Commit Graph

25 Commits

Author SHA1 Message Date
Daniel Golle cff3786bd5 scripts/mkits.sh: DT overlays don't need a loadaddr
DT overlays do not need relocation in order to be applied, so drop
defining the load address for dtbos.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-07-12 19:02:08 +01:00
David Bauer 2b133ab19c scripts: use sep-char for hash nodes
U-Boot with enabled secure-boot will not boot images with the
@-character used for hash node-names.

Use the existing separation character configurable for each device.

Signed-off-by: David Bauer <mail@david-bauer.net>
2023-07-08 20:04:45 +02:00
Daniel Golle 6b01d40bfe image: improve uImage.FIT device tree overlay support
Instead of generating full config nodes incl. kernel, generate minimal
config nodes for device tree overlays to be applied to the main config.
In this way, multiple device tree overlays can be applied more easily.
While at it change filenames to upstream style, ie. use dtso and dtbo
suffix for device tree overlays.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-06-05 11:36:32 +01:00
Felix Fietkau b8bf27e4cb scripts/mkits.sh: fix portability issue
BSD wc can output more whitespaces, which breaks the cut usage.
Replace the cut invocation with awk, which is more portable.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-11-09 20:43:41 +01:00
David Bauer a208f0a9be mkits: support definition of DTB loadaddr
Support defining a per-device loadaddress for the DTB. This is required
for devices which to not align the DTB from the bootloader correctly.

Signed-off-by: David Bauer <mail@david-bauer.net>
2022-11-08 12:16:36 +01:00
Daniel Golle e89c85249e scripts/mkits.sh: replace forgotten '-' with ${REFERENCE_CHAR}
Cosmetical change to improve style in mkits.sh.

Fixes: fd67908647 ("scripts: mkits.sh: Allow legacy @ mode for dts creation")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-03-24 00:46:45 +00:00
Damien Mascord fd67908647 scripts: mkits.sh: Allow legacy @ mode for dts creation
commit 5ec60cbe9d ("scripts: mkits.sh: replace @ with - in nodes")
broke support for Meraki MR32 and this patch makes the replacement
configurable allowing for specifying the @ or - or whatever character
that is desired to retain backwards compatibility with existing devices.

For example, this patch includes the fix for the Meraki MR32 in
target/linux/bcm53xx/image for meraki_mr32:

  DEVICE_DTS_DELIMITER := @
  DEVICE_DTS_CONFIG := config@1

Fixes: 5ec60cbe9d ("scripts: mkits.sh: replace @ with - in nodes")
Signed-off-by: Damien Mascord <tusker@tusker.org>
[Added tags, checkpatch.pl fixes, noted that this is for old stuff]
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2021-09-23 20:49:32 +02:00
Yonghyu Ban 7270d768da scripts/mkits.sh: Fix the hash algorithm paramter
The mkits.sh script help message states hash algorithm can be
specified using the -H command-line option, but it does not work
currently due to a bug in the script.

This patch fixes this problem by changing the option from -S to
-H and specify getopts parameter after it

Signed-off-by: Yonghyu Ban <yonghyu@empo.im>
2021-07-18 19:37:30 +01:00
Daniel Golle 4e6de4f093 scripts/mkits.sh: add support for adding DT overlay blobs to image
Allow adding multiple device tree overlay blobs to an image and
generate configurations for each of them.
This is useful on boards with modern U-Boot which allow e.g. user-
configurable peripherals ("shields") in that way.
Note that currently, each generated configuration adds exactly one
overlay on top of the base image, ie. adding multiple overlays at the
same time is not yet supported.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-03-17 17:41:24 +00:00
Robert Marko 5ec60cbe9d scripts: mkits.sh: replace @ with - in nodes
U-boot will reject the nodes with @ for the address since
commit:
79af75f777

This in turn will cause the failure to boot with OpenWrt
generated images.

So, to rectify that simply replace @ with -.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
(cover also newly added rootfs@1 and initrd@1 nodes)
Signed-off-by: Robert Marko <robert.marko@sartura.hr>
2021-03-05 15:45:33 +00:00
Daniel Golle 330bd380e8 image: allow building FIT and uImage with ramdisk
Instead of embedding the initrd cpio archive into the kernel, allow
for having an external ramdisk added to the FIT or uImage.
This is useful to overcome kernel size limitations present in many
stock bootloaders, as the ramdisk is then loaded seperately and doesn't
add to the kernel size. Hence we can have larger ramdisks to host ie.
installers with all binaries to flash included (or a web-based
firmware selector).
In terms of performance and total size the differences are neglectible.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-02-24 01:35:20 +00:00
Daniel Golle e6aac8d98f image: add support for building FIT image with filesystem
Allow for single (external-data) FIT image to hold kernel, dtb and
squashfs. In that way, the bootloader verifies the system integrity
including the rootfs, because what's the point of checking that the
hash of the kernel is correct if it won't boot in case of squashfs
being corrupted? Better allow bootloader to check everything needed
to make it at least up to failsafe mode. As a positive side effect
this change also makes the sysupgrade process on nand potentially
much easier as it is now.
In short: mkimage has a parameter '-E' which allows generating FIT
images with 'external' data rather than embedding the data into the
device-tree blob itself. In this way, the FIT structure itself remains
small and can be parsed easily (rather than having to page around
megabytes of image content). This patch makes use of that and adds
support for adding sub-images of type 'filesystem' which are used to
store the squashfs. Now U-Boot can verify the whole OS and the new
partition parsers added in the Linux kernel can detect the filesystem
sub-images, create partitions for them, and select the active rootfs
volume based on the configuration in FIT (passing configuration via
device tree could be implemented easily at a later stage).

This new FIT partition parser works for NOR flash (on top of mtdblock),
NAND flash (on top of ubiblock) as well as classic block devices
(ie. eMMC, SDcard, SATA, NVME, ...).
It could even be used to mount such FIT images via `losetup -P` on a
user PC if this patch gets included in Linux upstream one day ;)

Signed-off-by: John Crispin <john@phrozen.org>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-02-24 01:35:20 +00:00
Christian Lamparter fed1788689 scripts: mkits.sh make it possible to specify fdt@#
Some bootloaders are really keen on just one special
fdt in a multi-image fit image. This is a problem, because
currently this is fixed to "fdt@1".

This patch introduces a new device variable:
DEVICE_FDT_NUM that allows to specify the right
fdt number.

If the value is absent "1" will be chosen.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2020-09-25 19:32:33 +02:00
Adrian Schmutzler 52cdd6185e scripts/mkits.sh: fix use of printf
Due to a line break, printf was accidentally called with three
arguments instead of two, causing a different output than before.

Fix it by splitting the printf command into two lines.

Fixes: 907053193a ("scripts/mkits.sh: replace echo -e with printf")

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-07-11 18:46:53 +02:00
Petr Štetiar dec9ae6d9e scripts/mkits.sh: fix remaining shellcheck warning
Fixes following shellcheck warning:

 In scripts/mkits.sh line 19:
 		 "-k kernel [-D name -d dtb] -o its_file" "$(basename $0)"
                                                                       ^-- SC2086: Double quote to prevent globbing and word splitting.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
2020-07-11 14:42:32 +02:00
Rosen Penev 3d418dd51e scripts/mkits.sh: switch from bash to sh
This no longer needs bash.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-07-11 14:42:32 +02:00
Rosen Penev 7aefc85cab scripts/mkits.sh: fix improper string and array concatenation
Found with shellcheck.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-07-11 14:42:32 +02:00
Rosen Penev 765858f7ad scripts/mkits.sh: add missing quotes
Found with shellcheck.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-07-11 14:42:32 +02:00
Rosen Penev 907053193a scripts/mkits.sh: replace echo -e with printf
echo flags are not POSIX. printf does the same with added \n.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-07-11 14:42:32 +02:00
Rosen Penev 9a8ba44f9c scripts/mkits.sh: replace legacy backticks with $()
This replaces deprecated backticks by more versatile $(...) syntax.

Found with shellcheck.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
[adjust commit title and message]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2019-12-31 11:44:04 +01:00
Johann Neuhauser 205e0939f0 build: make device tree arg really optional in mkits.sh
If no device tree is given there is no node generated, but
the configuration does still include the name of the missing node.
This will result in a successful build fit image, but bootm does
throw a error message if we want to boot the bad configuration.

Signed-off-by: Johann Neuhauser <jneuhauser@dh-electronics.com>
2019-09-19 23:43:27 +02:00
Sven Eckelmann 1b773a46c2 build: Allow to change the FIT config section name
Some devices only boot when a special config is found in the image and
completely ignore the default entry during the selection. These devices can
now use the variable DEVICE_DTS_CONFIG in their device image definition.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2018-03-17 08:09:04 +01:00
Iblis Lin d9a0a8c78f scripts: avoid hard-coded paths in scripts
Signed-off-by: Iblis Lin <e196819@hotmail.com>
2016-04-28 16:43:28 +02:00
Felix Fietkau a37814faa7 build: make device-tree arg optional in mkits.sh
mkits.sh help currently shows dtb file as optional, but generates an
invalid its file when this option is unspecified.

We're fixing this problem by removing the use of the sed command and
just including variables instead.

Signed-off-by: Mathieu Olivari <mathieu@qca.qualcomm.com>

SVN-Revision: 45659
2015-05-10 11:46:45 +00:00
Luka Perkov acdb0ac35c build: move mkits.sh script to more common place
Signed-off-by: Luka Perkov <luka@openwrt.org>

SVN-Revision: 38430
2013-10-16 10:29:50 +00:00