summaryrefslogtreecommitdiffstats
path: root/tools
Commit message (Collapse)AuthorAgeFilesLines
* dtoc: Drop use of DECL() macrosSimon Glass2021-03-222-36/+36
| | | | | | | | We can use extern instead, so let's drop these macros. It adds one more thing to learn about and doesn't make the code any clearer. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Generate device instancesSimon Glass2021-03-222-15/+480
| | | | | | | | | | | | | Add support for generating a file containing udevice instances. This avoids the need to create these at run time. Update a test uclass to include a 'per_device_plat_auto' member, to increase test coverage. Add another tab to the driver_info output so it lines up nicely like the device-instance output. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Generate uclass devicesSimon Glass2021-03-222-13/+244
| | | | | | | | | | Add support for generating a file containing uclass instances. This avoids the need to create these at run time. Update a test uclass to include a 'priv_auto' member, to increase test coverage. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Generate a summary in the dt-plat.c fileSimon Glass2021-03-222-35/+169
| | | | | | | | | Add a summary to the top of the generated code, to make it easier to see what the file contains. Also add a tab to .plat so that its value lines up with the others. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Tidy up the list of supported phandle propertiesSimon Glass2021-03-221-7/+21
| | | | | | | | | | | For now dtoc only supports a hard-coded list of phandle properties, to avoid any situation where it makes a mistake in its determination. Make this into a constant dict, recording both the phandle property name and the associated #cells property in the target node. This makes it easier to find and modify. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Don't generate platform data with instantiationSimon Glass2021-03-222-13/+75
| | | | | | | | | | | This file is not used when instantiating devices. Update dtoc to skip generating its contents and just add a comment instead. Also it is useful to see the driver name and parent for each device. Update the file to show that information, to avoid updating the same tests twice. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Add support for decl fileSimon Glass2021-03-222-7/+120
| | | | | | | Add an option to generate the declaration file, which declares all drivers and uclasses, so references can be used in the code. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Add an option for device instantiationSimon Glass2021-03-223-22/+36
| | | | | | | Add an option to instantiate devices at build time. For now this just parses the option and sets up a few parameters. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Support processing the root nodeSimon Glass2021-03-224-20/+59
| | | | | | | | | | | The device for the root node is normally bound by driver model on init. With devices being instantiated at build time, we must handle the root device also. Add support for processing the root node, which may not have a compatible string. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Set up the uclasses that are usedSimon Glass2021-03-224-18/+119
| | | | | | | | | | | | | | | | We only care about uclasses that are actually used. This is determined by the drivers that use them. Check all the used drivers and build a list of 'valid' uclasses. Also add references to the uclasses so we can generate C code that uses them. Attach a uclass to each valid driver. For the tests, now that we have uclasses we must create an explicit test for the case where a node does not have one. This should only happen if the source code does not build, or the source-code scanning fails to find it. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Assign a sequence number to each nodeSimon Glass2021-03-222-15/+46
| | | | | | | | | | | | Now that we have the alias information we can assign a sequence number to each device in the uclass. Store this in the node associated with each device. This requires renaming the sandbox test drivers to have the right name. Note that test coverage is broken with this patch, but fixed in the next one. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Detect drivers only at the start of start of lineSimon Glass2021-03-221-2/+2
| | | | | | | | | If a driver declaration is included in a comment, dtoc currently gets confused. Update the parser to only consider declarations that begin at the start of a line. Since multi-line comments begin with an asterisk, this avoids the problem. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Read aliases for uclassesSimon Glass2021-03-227-3/+345
| | | | | | | Scan the aliases in the device tree to establish the number of devices within each uclass, and the sequence number of each. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Warn of duplicate driversSimon Glass2021-03-222-1/+122
| | | | | | | | If drivers have the same name then we cannot distinguish them. This only matters if the driver is actually used by dtoc, but in that case, issue a warning. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Process driver aliases along with driversSimon Glass2021-03-222-11/+9
| | | | | | | | | | | | | | Instead of using a separate step for this processing, handle it while scanning its associated driver. This allows us to drop the code coverage exception in this case. Note that only files containing drivers are scanned by dtoc, so aliases declared in a file that doesn't hold a driver will not be noticed. It would be confusing to put them anywhere other than in the driver that they relate to, but update the documentation to say this explicitly, just in case. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Support headers needed for driversSimon Glass2021-03-222-0/+11
| | | | | | | | | | | | | | Typically dtoc can detect the header file needed for a driver by looking for the structs that it uses. For example, if a driver as a .priv_auto that uses 'struct serial_priv', then dtoc can search header files for the definition of that struct and use the file. In some cases, enums are used in drivers, typically with the .data field of struct udevice_id. Since dtoc does not support searching for these, add a way to tell dtoc which header to use. This works as a macro included in the driver definition. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Support tracking the phase of U-BootSimon Glass2021-03-225-12/+31
| | | | | | | | | | | | | | | | | | | | U-Boot operates in several phases, typically TPL, SPL and U-Boot proper. The latter does not use dtoc. In some rare cases different drivers are used for two phases. For example, in TPL it may not be necessary to use the full PCI subsystem, so a simple driver can be used instead. This works in the build system simply by compiling in one driver or the other (e.g. PCI driver + uclass for SPL; simple_bus for TPL). But dtoc has no way of knowing which code is compiled in for which phase, since it does not inspect Makefiles or dependency graphs. So to make this work for dtoc, we need to be able to explicitly mark drivers with their phase. This is done by adding an empty macro to the driver. Add support for this in dtoc. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Track nodes which are actually usedSimon Glass2021-03-224-4/+37
| | | | | | | Mark all nodes that are actually used, so we can perform extra checks on them. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Process nodes to set up required propertiesSimon Glass2021-03-223-0/+124
| | | | | | | | | Add logic to assign property values to nodes as required by dtoc. The references allow nodes to refer to each other in C code. The macros used by dtoc are not yet defined in driver model. They will be added along with the actual driver model implementation. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Make use of node propertiesSimon Glass2021-03-221-26/+19
| | | | | | | Now that we have these available, use them instead of recalculating things each time. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Add some extra properties to nodesSimon Glass2021-03-221-0/+37
| | | | | | | | | It is convenient to attach drivers, etc. to nodes so that we can use the Node object as the main data structure in this module. Add a function which adds the new properties, along with documentation. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Rename sandbox_i2c_test and sandbox_pmic_testSimon Glass2021-03-222-8/+8
| | | | | | | These have '_test' suffixes which are not present on the drivers in the source code. Drop the suffixes to avoid a mismatch when scanning. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Move test files into a test/ directorySimon Glass2021-03-2223-12/+24
| | | | | | | | | | It is confusing to have the test files in the same places as the implementation. Move them into a separate directory. Add a helper function for test_dtoc, to avoid repeating the same path. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Support scanning of structs in header filesSimon Glass2021-03-222-3/+128
| | | | | | | | | | | | | | | | | Drivers can have private / platform data contained in structs and these struct definitions are generally kept in header files. In order to generate build-time devices, dtoc needs to generate code that declares the data contained in those structs. This generated code must include the relevant header file, to avoid a build error. We need a way for dtoc to scan header files for struct definitions. Then, when it wants to generate code that uses a struct, it can make sure it includes the correct header file, first. Add a parser for struct information, similar to drivers. Keep a dict of the structs that were found. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Support scanning of uclassesSimon Glass2021-03-222-0/+177
| | | | | | | | | | | Uclasses can have per-device private / platform data so dtoc needs to scan these drivers. This allows it to find out the size of this data so it can be allocated a build time. Add a parser for uclass information, similar to drivers. Keep a dict of the uclasses that were found. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Collect priv/plat struct info from driversSimon Glass2021-03-222-2/+55
| | | | | | | | | | | | In order to output variables to hold the priv/plat information used by each device, dtoc needs to know the struct for each. With this, it can declare this at build time: u8 xxx_priv [sizeof(struct <name>)]; Collect the various struct names from the drivers. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Ignore unwanted files when scanning for driversSimon Glass2021-03-222-1/+9
| | | | | | | | We should ignore anything in the .git directory or any of the build-sandbox, etc. directories created by 'make check'. These can confuse dtoc. Update the code to ignore these. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Save scan information across test runsSimon Glass2021-03-223-10/+43
| | | | | | | | | | | | | | | At present most of the tests scan the U-Boot source tree as part of their run. This information does not change across tests, so we can save time by remembering it. Add a way to set up this information and use it for each test, taking a copy first, so as not to mess up the original. This reduces the run time from about 1.6 seconds to 1.5 seconds on my machine. For code coverage (which cannot run in parallel), it reduces from 33 seconds to 5. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Scan drivers for available informationSimon Glass2021-03-222-14/+311
| | | | | | | | | At present we simply record the name of a driver parsed from its implementation file. We also need to get the uclass and a few other things so we can instantiate devices at build time. Add support for collecting this information. This requires parsing each driver file. Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Use less for help file, if availableNicolas Boichat2021-03-221-0/+3
| | | | | | | It's convenient to be able to scroll up in `patman -H`. Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* tools: fdtgrep: Use unsigned chars for arraysSamuel Dionne-Riel2021-03-221-1/+1
| | | | | | | | Otherwise, values over 127 end up prefixed with ffffff. Signed-off-by: Samuel Dionne-Riel <samuel@dionne-riel.com> Cc: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* patman: Quieten down the alias checkingSimon Glass2021-03-224-32/+31
| | | | | | | | | | | | When a tag is used in a patch subject (e.g. "tag: rest of message") and it cannot be found as an alias, patman currently reports a fatal error, unless -t is provided, in which case it reports a warning. Experience suggest that the fatal error is not very useful. Instead, default to reporting a warning, with -t tell patman to ignore it altogether. Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Update documentation to match new usageSimon Glass2021-03-221-7/+7
| | | | | | | With the subcommands some of the documentation examples are no-longer correct. Fix all of them, so it is consistent. Signed-off-by: Simon Glass <sjg@chromium.org>
* tools: mtk_image: add an option to set device header offsetWeijie Gao2021-03-201-3/+47
| | | | | | | | This patch adds an option which allows setting the device header offset. This is useful if this tool is used to generate ATF BL2 image of mt7622 for SD cards. Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
* Merge tag 'v2021.04-rc4' into nextTom Rini2021-03-159-36/+76
|\ | | | | | | Prepare v2021.04-rc4
| * arm: mvebu: a38x: Remove dead code ARMADA_39XPali Rohár2021-03-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | Config option ARMADA_39X is never set so remove all dead code hidden under ifdef CONFIG_ARMADA_39X blocks. Also remove useless checks for CONFIG_ARMADA_38X define as this macro is always defined for a38x code path. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de>
| * buildman: Support single-threaded operationSimon Glass2021-03-046-30/+68
| | | | | | | | | | | | | | | | | | | | At present even if only a single thread is in use, buildman still uses threading. For some debugging it is helpful to do everything in the main process. Allow -T0 to support this. Signed-off-by: Simon Glass <sjg@chromium.org>
| * fix patman --limit-cc optionBernhard Kirchen2021-03-031-1/+1
| | | | | | | | | | | | | | | | | | patman's --limit-cc option parses its argument to an integer and uses that to trim the list of CC recipients to a particular maximum. but that only works if the cc variable is a list, which it is not. Signed-off-by: Bernhard Kirchen <bernhard.kirchen@mbconnectline.com> Reviewed-by: Simon Glass <sjg@chromium.org>
| * Merge tag 'u-boot-imx-20210303' of ↵Tom Rini2021-03-031-3/+5
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://gitlab.denx.de/u-boot/custodians/u-boot-imx i.MX for 2021.04 ---------------- - new boards: - i.MX8MN Beacon EmbeddedWorks (2GB) - Gateworks Venice imx8mm - convert to DM: - imx53-qsb, mx53loco, mx51evk, mx23-evk - Fixes : - Network : FEC ethernet quirks - DH dh-imx6 CI: https://source.denx.de/u-boot/custodians/u-boot-imx/-/pipelines/6597
| | * tools: imx8mimage: Restore the original __ALIGN_MASK() macroFabio Estevam2021-03-011-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since commit c738adb8dbbf ("tool: Move ALIGN_MASK to header as common MACRO") the i.MX8MQ EVK board no longer boots. The reason is that imx8mimage.c used a custom __ALIGN_MASK() macro, so restore the original macro to fix the boot and rename it accordingly. Reported-by: Lukas Rusak <lorusak@gmail.com> Signed-off-by: Fabio Estevam <festevam@gmail.com> Tested-by: Ye Li <ye.li@nxp.com>
* | | binman: Indicate how to make binman verboseSimon Glass2021-03-021-1/+3
|/ / | | | | | | | | | | | | | | Add notes about how to make binman produce verbose logging when building. Add a comment on how to do this. Signed-off-by: Simon Glass <sjg@chromium.org>
* / tools/mkeficapsule.c: fix DEBUG buildKlaus Heinrich Kiwi2021-02-261-1/+1
|/ | | | | | | | | | | | | Fix a missing comma sign (,) from a printf(), that is only reachable if DEBUG is defined, in which case the build fails with: tools/mkeficapsule.c:266:36: error: expected ‘)’ before ‘bin’ 266 | printf("\tbin: %s\n\ttype: %pUl\n" bin, guid); | ^~~~ | ) Signed-off-by: Klaus Heinrich Kiwi <klaus@linux.vnet.ibm.com> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* image: Adjust the workings of fit_check_format()Simon Glass2021-02-153-2/+5
| | | | | | | | | | | | | | | | | At present this function does not accept a size for the FIT. This means that it must be read from the FIT itself, introducing potential security risk. Update the function to include a size parameter, which can be invalid, in which case fit_check_format() calculates it. For now no callers pass the size, but this can be updated later. Also adjust the return value to an error code so that all the different types of problems can be distinguished by the user. Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Bruce Monroe <bruce.monroe@intel.com> Reported-by: Arie Haenel <arie.haenel@intel.com> Reported-by: Julien Lenoir <julien.lenoir@intel.com>
* buildman: 'Thread' object has no attribute 'isAlive'Heinrich Schuchardt2021-02-141-1/+1
| | | | | | | | | | | The isAlive() method was deprecated in Python 3.8 and has been removed in Python 3.9. See https://bugs.python.org/issue37804. Use is_alive() instead. Since Python 2.6 is_alive() has been a synonym for isAlive(). So there should be no problems for users using elder Python 3 versions. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
* tools/fit_check_sign.c: Update usage function.Ilies CHERGUI2021-02-011-2/+3
| | | | | | | Add "-c" option to set the configuration name when checking the FIT image signature. Signed-off-by: Ilies CHERGUI <ilies.chergui@gmail.com>
* Merge tag 'dm-pull-30jan21' of ↵Tom Rini2021-01-3124-36/+393
|\ | | | | | | | | | | | | | | | | https://gitlab.denx.de/u-boot/custodians/u-boot-dm tpm fixes for coral binman fixes support for symbols in sub-sections support for additional cros_ec commands various minor fixes / tweaks
| * binman: Allow for skip_at_start when reading entriesSimon Glass2021-01-303-4/+48
| | | | | | | | | | | | | | The offset of an entry needs to be adjusted by its skip-at-start value. This is currently missing when reading entry data. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Support alignment of filesSimon Glass2021-01-307-1/+53
| | | | | | | | | | | | | | | | When packing files it is sometimes useful to align the start of each file, e.g. if the flash driver can only access 32-bit-aligned data. Provides a new property to support this. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Allow vblock to include devicetree blobsSimon Glass2021-01-305-10/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | | At present if a devicetree blob is included in a vblock it does not deal with updates. This is because the vblock is created once at the start and does not have a method to update itself later, after all the entry contents are finalised. Fix this by adjusting how the vblock is created. Also simplify Image.ProcessEntryContents() since it effectively duplicates the code in Section.ProcessContents(). Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Support reading an image with entry argsSimon Glass2021-01-305-4/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Normally when an entry is created, any entry arguments it has are required to be provided, so it can actually generate its contents correctly. However when an existing image is read, Entry objects are created for each of the entries in the image. This happens as part of the process of reading the image into binman. In this case we don't need the entry arguments, since we do not intend to regenerate the entries, or at least not unless requested. So there is no sense in reporting an error for missing entry arguments. Add a new property for the Image to handle this case. Update the error reporting to be conditional on this property. Signed-off-by: Simon Glass <sjg@chromium.org>