Commit Graph

59202 Commits

Author SHA1 Message Date
Simon Glass
17a7421ff4 binman: Add a prefix before CBFS hex offsets
Add a 0x prefix to these errors to avoid confusion.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
513c53e445 binman: Add a few more features to the wishlist
Add mention of a few other desirable features that may be implemented in
the future.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
27145fd3a8 binman: Place Intel descriptor at image start
The Intel descriptor must always appear at the start of an (x86) image,
so it is supposed to position itself there always. However there is no
explicit test for this. Add one and fix a bug introduced by the recent
change to adjust Entry to read the node in a separate call.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
95a0f3c691 binman: Adjust fmap to ignore CBFS files
The FMAP is not intended to show the files inside a CBFS. The FMAP can be
used to locate the CBFS itself, but then the CBFS must be read to find out
what is in it.

Update the FMAP to work this way and add some debugging while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
89d66907b3 libfdt: Copy the struct region in fdt_resize()
At present this function appears to copy only the data before the struct
region and the data in the string region. It does not seem to copy the
struct region itself.

>From the arguments of this function it seems that it should support fdt
and buf being different. This patch attempts to fix this problem.

Upstream commit: c72fa77 libfdt: Copy the struct region in fdt_resize()

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
61ec04f9ed binman: Support shrinking a entry after packing
Sometimes an entry may shrink after it has already been packed. In that
case we must repack the items. Of course it is always possible to just
leave the entry at its original size and waste space at the end. This is
what binman does by default, since there is the possibility of the entry
changing size every time binman calculates its contents, thus causing a
loop.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
79d3c58d12 binman: Update the _testing entry to support shrinkage
Sometimes entries shrink after packing. As a start towards supporting
this, update the _testing entry to handle the test case.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
51014aabc2 binman: Allow updating entries that change size
So far we don't allow entries to change size when repacking. But this is
not very useful since it is common for entries to change size after an
updated binary is built, etc.

Add support for this, respecting the original offset/size/alignment
constraints of the image layout. For this to work the original image
must have been created with the 'allow-repack' property.

This does not support entry types with sub-entries such as files and
CBFS, but it does support sections.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
eba1f0cc94 binman: Add more tests for image header position
The positioning does not currently work correctly if at the end of an
image with no fixed size. Also if the header is in the middle of an image
it can cause a gap in the image since the header position is normally at
the image end, so entries after it are placed after the end of the image.

Fix these problems and add more tests to cover these cases.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
7400107e46 binman: Move Image.BuildImage() into a single function
Now that an Image is an Entry_section, there is no need for the separate
BuildSection() function. Drop it and add a bit of logging.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
96b6c506ca binman: Write the original input fdtmap to a file
When reading an image in, write its fdtmap to a file in the output
directory. This is useful for debugging. Update the 'ls' command to set up
the output directory; otherwise it will fail.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
4ab88b6f2f binman: Update documentation for image creation
There are a few more steps in the process now. Update the documentation to
reflect this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
12bb1a99c2 binman: Add info to allow safely repacking an image later
At present it is not possible to discover the contraints to repacking an
image (e.g. maximum section size) since this information is not preserved
from the original image description.

Add new 'orig-offset' and 'orig-size' properties to hold this. Add them to
the main device tree in the image.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
10f9d0066b binman: Support updating entries in an existing image
While it is useful and efficient to build images in a single pass from a
unified description, it is sometimes desirable to update the image later.

Add support for replace an existing file with one of the same size. This
avoids needing to repack the file. Support for more advanced updates will
come in future patches.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
a004f29464 binman: Tidy up _SetupDtb() to use its own temporary file
At present EnsureCompiled() uses an file from the 'output' directory (in
the tools module) when compiling the device tree. This is fine in most
cases, allowing useful inspection of the output files from binman.

However in functional tests, _SetupDtb() creates an output directory and
immediately removes it afterwards. This serves no benefit and just
confuses things, since the 'official' output directory is supposed to be
created and destroyed in control.Binman().

Add a new parameter for the optional temporary directory to use, and use a
separate temporary directory in _SetupDtb().

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
02fd463cfe binman: Allow the fdtmap to remain unchanged
When updating an existing image where the size of all entries remains the
same, we should not need to regenerate the fdtmap. Update the entry to
return the same fdtmap as was read from the image.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
6ccbfcdd96 binman: Add a constant for common entry properties
We use this same combination of properties several times in tests. Add a
constant for it to avoid typos, etc.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
c5ad04b721 binman: Add a function to obtain the image for an Entry
At present we have an 'image' property in the entry for this purpose, but
this is not necessary and seems error-prone in the presence of
inheritance. Add a function instead. The Entry_section class overrides
this with a special version, since top-level sections are in fact images,
since Image inherits Entry_section.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:06 -06:00
Simon Glass
c6bd6e235a binman: Adjust Entry to read the node in a separate call
At present the Entry constructor sets up the object and then immediately
reads its device-tree node to obtain its properties.

This breaks a convention that constructors should not do any processing.
A consequence is that we must pass all arguments to the constructor and
cannot have the node-reading proceed in a different way unless we pass
flags to that constructor. We already have a 'test' flag in a few cases,
and now need to control whether the 'orig_offset' and 'orig_size'
properties are set or not.

Adjust the code to require a separate call to ReadNode() after
construction. The Image class remains as it was.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:05 -06:00
Simon Glass
1411ac8d16 binman: Add an image name into the fdtmap
Since binman supports multiple images it is useful to know which one
created the image that has been read. Then it is possible to look up that
name in the 'master' device tree (containing the description of all
images).

Add a property for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:05 -06:00
Simon Glass
6ca0dcba5e binman: Store the entry in output_fdt_files
In some cases we want to access the Entry object for a particular device
tree. This allows us to read its contents or update it. Add this
information to output_fdt_files and provide a function to read it.

Also rename output_fdt_files since its name is no-longer descriptive.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:05 -06:00
Simon Glass
6a3b5b5411 binman: Allow state functions to fail to return data
At present these state functions raise an exception if they cannot find
what is requested. But in some cases the information is optional (e.g. an
fdtmap in a coming patch) so it is better to return gracefully.

Update these two functions to return None when the data cannot be found.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:05 -06:00
Simon Glass
d5079330f5 binman: Support loading entry data from a file
When modifying an image it is convenient to load the data from the file
into each entry so that it can be reprocessed. Add a new LoadData() method
to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:05 -06:00
Simon Glass
589d8f917e binman: Store image fdtmap when loading from a file
This data provides all the information about the position and size of each
entry. Store it for later use when loading an image. It can be reused as
is if the image is modified without changing offsets/sizes.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:05 -06:00
Simon Glass
e44bc831e2 dtoc: Update Fdt.GetNode() to handle the root node
This function currently fails if the root node is requested. Requesting
the root node is sometimes useful, so fix the bug.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:05 -06:00
Simon Glass
880e9ee650 dtoc: Update Fdt.FromData() to allow a name
It is confusing when something goes wrong with a device tree which was
created from data rather than a file, since there is no identifying
filename. Add an option to provide this. Use the filename as the name,
where available

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:05 -06:00
Simon Glass
d9dad10e3c binman: Show a helpful error when a DT property is missing
At present a Python exception is raised which does not show the node
information. Add a more helpful exception in this case.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:05 -06:00
Simon Glass
9f297b09c0 binman: Add a bit of logging in entries when packing
Use the new logging feature to log information about progress with
packing. This is useful to see how binman is figuring things out.

Also update elf.py to use the same feature.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:05 -06:00
Simon Glass
fd07336211 patman: Update tout to avoid open-coding the debug levels
Use the debug level constants instead of open-coding them in the file.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:05 -06:00
Simon Glass
f49462e547 binman: Drop state.fdt_set as this is not needed
We can iterate through the output files so don't need this global anymore.
Remove it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:05 -06:00
Simon Glass
77e4ef1bf4 binman: Simplify state.fdt_subset
At present this excludes the device tree passed in to binman since it
is always returned first by GetAllFdts(). However, this is easy to ensure
by adding a check in that function. Change this dict to includes all
device trees, and rename it to fdt_set.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:05 -06:00
Simon Glass
fb5e8b163e binman: Adjust state.fdt_files to be keyed by entry type
It makes more sense to use entry type as the key for this dictionary,
since the filename can in principle be anything. Make this change and also
rename fdt_files and add a comment to explain it better.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:05 -06:00
Simon Glass
4bdd30055c binman: Adjust GetFdt() to be keyed by etype
At present the FDTs are keyed by their default filename (not their actual
filename). It seems easier to key by the entry type, since this is always
the same for each FDT type.

To do this, add a new Entry method called GetFdtEtype(). This is necessary
since some entry types contain a device tree which are not the simple
three entry types 'u-boot-dtb', 'u-boot-spl' or 'u-boot-tpl'.

The code already returns a dict for GetFdt(). Update the value of that
dict to include the filename so that existing code can work.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:05 -06:00
Simon Glass
726e296129 binman: Rename state.GetFdt()
This function name conflicts with Fdt.Node.GetFdt() which has a different
purpose. Rename it to avoid confusion.

The new name suggests it is indexed by entry type rather than filename.
This will be tidied up in a future commit.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:05 -06:00
Simon Glass
4bdd115980 binman: Rename state.GetFdts()
This function name conflicts with Entry.GetFdts() which has a different
purpose. Rename it to avoid confusion. Also update a stale comment
relating to this function.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:05 -06:00
Simon Glass
a8adb6dfeb binman: Convert GetFdtSet() to use a dict
At present this function returns a set of device-tree filenames. It has no
way of returning the actual device-tree object. Change it to a dictionary
so that we can add this feature in a future patch.

Also drop fdt_set since it is no-longer used.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:05 -06:00
Simon Glass
a8573c4c8f binman: Move image/fdt code into PrepareImagesAndDtbs()
Further reduce the size of the main Binman() function by moving this setup
code into its own function.

Note that the 'images' value is accessed from other modules so must be made
a global.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:05 -06:00
Simon Glass
7b773167c0 binman: Use print() to print output
At present tout writes directly to stdout. This is not necessary and it
prevents tests from redirecting output. Change it to use print() for the
non-progress output.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:05 -06:00
Simon Glass
935461262e binman: Move GetFdtSet() into blob_dtb
At present we check the filename to see if an entry holds a device-tree
file. It is easier to use the base class designed for this purpose.

Move this method implementation into Entry_blob_dtb and update the default
one to return an empty set.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:05 -06:00
Simon Glass
b88e81c622 binman: Move image-processing code into a function
The Binman() function is very long. Split out the image code to make it
more manageable.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:05 -06:00
Simon Glass
1000096b06 dtoc: Return a non-zero exit code when tests fail
At present 'dtoc -t' return a success code even if some of the tests fail.
Fix this by checking the test result and setting the exit code. This
allows 'make qcheck' to function as expected.

Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-29 09:38:05 -06:00
Eric Perie
f043dc28e3 Add validation for icache/dcache arguments - arguments different from off/on/flush are currently silently ignored.
Signed-off-by: Eric Perie <eric.perie@yahoo.com>
2019-07-29 09:32:13 -04:00
Heinrich Schuchardt
a1b633df55 lib: uuid: alignment error in gen_rand_uuid()
Packed structures like struct uuid are not aligned. GCC 9.1 therefore
throws an error when trying to compile gen_rand_uuid().

lib/uuid.c: In function ‘gen_rand_uuid’:
lib/uuid.c:244:2: error: converting a packed ‘struct uuid’ pointer
(alignment 1) to a ‘unsigned int’ pointer (alignment 4) may result in
an unaligned pointer value [-Werror=address-of-packed-member]
  244 |  unsigned int *ptr = (unsigned int *)&uuid;
      |  ^~~~~~~~

Generate the uuid in a properly aligned buffer.

The byte order of a random number should not matter. Do not call
cpu_to_be32() to change the byte order.

Reported-by: Ramon Fried <rfried.dev@gmail.com>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-07-29 09:32:13 -04:00
Heiko Schocher
0c4e81e0eb rtc, rx8025: add DM support
add DM support for this RTC driver.

Signed-off-by: Heiko Schocher <hs@denx.de>
2019-07-29 09:32:12 -04:00
Heiko Schocher
f91fb7242a rtc, rx8025: fix Coding Style
fix Coding Style for this driver.

Signed-off-by: Heiko Schocher <hs@denx.de>
2019-07-29 09:32:12 -04:00
Heiko Schocher
a7e6d0c45a rtc: move RTC_RX8025 to Kconfig
move RTC_RX8025 to Kconfig and fixup board configs.

Signed-off-by: Heiko Schocher <hs@denx.de>
2019-07-29 09:32:11 -04:00
Fabien Parent
bb4c5d6055 board: mediatek: Add pumpkin board support
The pumpkin board is made by Gossamer Engineering and is using
a MediaTek SoC. The board currently comes in two available version:
MT8516 SoC and MT8167 SoC.
The board provides the following IOs: eMMC, NAND, SD card, USB type-A,
Ethernet, Wi-Fi, Bluetooth, Audio (jack out, 2 PDM port, 1 analog in),
serial over USB, and an expansion header.

Additionally there is a HDMI port, DSI port, and camera port only
on the MT8167 version of the board.

The board can be powered by battery and/or via a USB Type-C port and
is using a PMIC MT6392.

The eMMC and NAND are sharing pins and cannot be used together.

This commit is adding the basic boot support for the Pumpkin MT8516
board on the eMMC.

Signed-off-by: Fabien Parent <fparent@baylibre.com>
2019-07-29 09:32:11 -04:00
Fabien Parent
e66b202eb3 pinctrl: mediatek: fix warning
Fix the following warning when CONFIG_PINCONF=n:

drivers/pinctrl/mediatek/pinctrl-mtk-common.c:35:36:
warning: ‘mtk_drive’ defined but not used [-Wunused-const-variable=]
 static const struct mtk_drive_desc mtk_drive[] = {
                                    ^~~~~~~~~

Signed-off-by: Fabien Parent <fparent@baylibre.com>
2019-07-29 09:32:10 -04:00
Heiko Schocher
49b10cb492 gpio: fixes for gpio-hog support
recently added gpio hog patch was "in discussion"
state with Simon Glass. This patch now adds most
of comments from Simon Glass.

Signed-off-by: Heiko Schocher <hs@denx.de>
2019-07-29 09:32:10 -04:00
Keerthy
5917d0b877 doc: arch: sandbox: Replace all the instances of README.sandbox
commit 49116e6d23 ("doc: arch: Convert README.sandbox to reST")
Moves README.sandbox to doc/arch.
Replace all the existing instances to point to the right documentation
file.

Signed-off-by: Keerthy <j-keerthy@ti.com>
2019-07-29 09:32:09 -04:00