utils/check-package: add checks for genimage*.cfg files
Subsystems (5)
cover utils/check-package: add checks for genimage*.cfg files
Hello,
this series adds check-package support for the genimage*.cfg files, as Arnout requested[1], based on the "The genimage.cfg file" section of the manual.
Patch 1 adds the checks with their unit tests, and lists the existing files that do not comply in .checkpackageignore. Each of the following patches fixes a single board (or runtime test), and drops its entries from .checkpackageignore. At the end of the series no genimage*.cfg file is left there. Patches 2 to 46 have to be applied in order, since they all modify .checkpackageignore.
The generated images are not supposed to change. I've verified it by running genimage 19 with stub input files before and after the series:
the 43 disk images are the same, except for the random GUIDs and the related CRCs. The other 3 files (aspeed ast2500-evb and ast2600-evb, licheepi_nano) describe flash images, so there only the content of the files has been compared, ignoring white spaces and comments. No board has been boot tested.
Some notes:
- the GPT partitions lacking partition-type-uuid are set to L, since this is what genimage uses by default. This is not the most accurate type for bootloader, FAT and root partitions, but a better one would modify the images, so it can be done later board by board
- board/pc/genimage-efi.cfg now uses root-x86, because this is the shortcut of the GUID that was already there
- the shortcut table comes from genimage 19, while Buildroot has version 20
- genimage.cfg.in and genimage.cfg.template* are not checked, since they contain placeholders
[1]: https://lore.kernel.org/buildroot/[email protected]/
Best regards
Giulio Benetti
Giulio Benetti (46):
utils/check-package: add checks for genimage*.cfg files board/aarch64-efi: fix genimage-efi.cfg coding style board/amarula/vyasa: fix genimage.cfg coding style board/andes/ae350: fix genimage_sdcard.cfg coding style board/arm/fvp-ebbr: fix genimage.cfg coding style board/aspeed/ast2500-evb: fix genimage.cfg coding style board/aspeed/ast2600-evb: fix genimage.cfg coding style board/avnet/rzboard_v2l: fix style and set partition-type-uuid board/beagleboard/beagleplay: fix genimage.cfg coding style board/beagleboard/beaglev_fire: fix style and set partition-type-uuid board/bsh/imx8mn-bsh-smm-s2-pro: set partition-type-uuid in
genimage.cfg
board/canaan/k210-soc: fix genimage.cfg coding style board/compulab/iot-gate-imx8-ebbr: fix genimage.cfg coding style board/coolpi/coolpi-4b: fix style and set partition-type-uuid board/grinn/liteboard: fix genimage.cfg coding style board/khadas/vim3: fix genimage.cfg coding style board/kontron/bl-imx8mm: set partition-type-uuid in genimage.cfg board/kontron/smarc-sal28: set partition-type-uuid in genimage.cfg board/lego/ev3: fix genimage.cfg coding style board/loongarch64-efi: fix genimage-efi.cfg coding style board/mender/x86_64: fix genimage-efi.cfg coding style board/microchip/mpfs_icicle: fix style and set partition-type-uuid board/microchip/sama7g5ek: fix genimage.cfg coding style board/minnowboard: fix genimage.cfg coding style board/octavo/osd32mp1-brk: set partition-type-uuid in genimage.cfg board/octavo/osd32mp1-red: set partition-type-uuid in genimage.cfg board/olimex/stmp1_olinuxino: set partition-type-uuid in genimage.cfg board/orangepi/common: set partition-type-uuid in genimage.cfg board/orangepi/orangepi-5-plus: fix genimage.cfg coding style board/pc: fix genimage-efi.cfg coding style board/pine64/rockpro64-ebbr: fix genimage.cfg coding style board/pine64/rockpro64: fix style and set partition-type-uuid board/pine64/star64: fix style and set partition-type-uuid board/qemu/aarch64-ebbr: fix genimage.cfg coding style board/qemu/aarch64-sbsa: fix genimage.cfg coding style board/qemu/arm-ebbr: fix genimage.cfg coding style board/qemu/loongarch64-virt-efi: fix genimage.cfg coding style board/qemu/riscv64-virt-efi: fix genimage.cfg coding style board/radxa/rock5b: fix genimage.cfg coding style board/seeed/stm32mp157c-odyssey: set partition-type-uuid in
genimage.cfg
board/sifive/common: fix genimage_sdcard.cfg coding style board/sipeed/licheepi_nano: fix genimage.cfg coding style board/ti/am574x-idk: fix genimage.cfg coding style board/visionfive2: fix genimage.cfg coding style support/testing: test_grub: fix genimage-aarch64-efi.cfg coding style support/testing: test_xen: fix genimage.cfg coding style
board/aarch64-efi/genimage-efi.cfg | 1 + board/amarula/vyasa/genimage.cfg | 2 +- board/andes/ae350/genimage_sdcard.cfg | 1 + board/arm/fvp-ebbr/genimage.cfg | 2 +- board/aspeed/ast2500-evb/genimage.cfg | 3 +- board/aspeed/ast2600-evb/genimage.cfg | 1 + board/avnet/rzboard_v2l/genimage.cfg | 3 + board/beagleboard/beagleplay/genimage.cfg | 56 +- board/beagleboard/beaglev_fire/genimage.cfg | 8 +- board/bsh/imx8mn-bsh-smm-s2-pro/genimage.cfg | 1 + board/canaan/k210-soc/genimage.cfg | 1 + .../compulab/iot-gate-imx8-ebbr/genimage.cfg | 2 +- board/coolpi/coolpi-4b/genimage.cfg | 3 + board/grinn/liteboard/genimage.cfg | 4 +- board/khadas/vim3/genimage.cfg | 2 +- board/kontron/bl-imx8mm/genimage.cfg | 1 + board/kontron/smarc-sal28/genimage.cfg | 1 + board/lego/ev3/genimage.cfg | 3 +- board/loongarch64-efi/genimage-efi.cfg | 1 + board/mender/x86_64/genimage-efi.cfg | 6 +- board/microchip/mpfs_icicle/genimage.cfg | 7 +- board/microchip/sama7g5ek/genimage.cfg | 1 + board/minnowboard/genimage.cfg | 1 + board/octavo/osd32mp1-brk/genimage.cfg | 4 + board/octavo/osd32mp1-red/genimage.cfg | 4 + board/olimex/stmp1_olinuxino/genimage.cfg | 4 + board/orangepi/common/genimage.cfg | 1 + board/orangepi/orangepi-5-plus/genimage.cfg | 2 +- board/pc/genimage-efi.cfg | 2 +- board/pine64/rockpro64-ebbr/genimage.cfg | 4 +- board/pine64/rockpro64/genimage.cfg | 4 +- board/pine64/star64/genimage.cfg | 35 +- board/qemu/aarch64-ebbr/genimage.cfg | 2 +- board/qemu/aarch64-sbsa/genimage.cfg | 2 +- board/qemu/arm-ebbr/genimage.cfg | 2 +- board/qemu/loongarch64-virt-efi/genimage.cfg | 1 + board/qemu/riscv64-virt-efi/genimage.cfg | 2 +- board/radxa/rock5b/genimage.cfg | 2 +- board/seeed/stm32mp157c-odyssey/genimage.cfg | 4 + board/sifive/common/genimage_sdcard.cfg | 2 +- board/sipeed/licheepi_nano/genimage.cfg | 5 +- board/ti/am574x-idk/genimage.cfg | 2 +- board/visionfive2/genimage.cfg | 2 +- .../boot/test_grub/genimage-aarch64-efi.cfg | 4 +- .../package/test_xen/aarch64/genimage.cfg | 2 +- .../tests/package/test_xen/arm/genimage.cfg | 2 +- utils/check-package | 7 + utils/checkpackagelib/lib_genimage.py | 407 ++++++++++++ utils/checkpackagelib/test_lib_genimage.py | 623 ++++++++++++++++++ 49 files changed, 1163 insertions(+), 79 deletions(-) create mode 100644 utils/checkpackagelib/lib_genimage.py create mode 100644 utils/checkpackagelib/test_lib_genimage.py
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 1/46 utils/check-package: add checks for genimage*.cfg files
The coding style of the genimage.cfg files is described in the "The genimage.cfg file" section of the manual, but nothing enforces it. Add a library checking these rules:
- indentation with tabs, according to the nesting level
- position of the curly brackets
- empty line after a node, except for the last one
- one space before and after '='
- filename beginning with genimage
- notation of the offset and size options
- GB, MB, KB units in comments
- partition-type-uuid set for every partition of a GPT image, unquoted, using the genimage shortcut when there is one, and in lower-case otherwise
The table of shortcuts comes from genimage's image-hd.c.
Files generated from a template (genimage.cfg.in, genimage.cfg.template*) are not checked, since they contain placeholders.
Add the existing files that do not follow the rules to .checkpackageignore.
--- .checkpackageignore | 46 ++ utils/check-package | 7 + utils/checkpackagelib/lib_genimage.py | 407 ++++++++++++++ utils/checkpackagelib/test_lib_genimage.py | 623 +++++++++++++++++++++ 4 files changed, 1083 insertions(+) create mode 100644 utils/checkpackagelib/lib_genimage.py create mode 100644 utils/checkpackagelib/test_lib_genimage.py
.checkpackageignore +46 -0
@@ -1,48 +1,89 @@ +board/aarch64-efi/genimage-efi.cfg lib_genimage.EmptyLineAfterNode +board/amarula/vyasa/genimage.cfg lib_genimage.CommentUnits board/amarula/vyasa/post-build.sh Shellcheck +board/andes/ae350/genimage_sdcard.cfg lib_genimage.EmptyLineAfterNode board/arcturus/aarch64-ucls1012a/post-build.sh Shellcheck board/arcturus/aarch64-ucls1012a/post-image.sh Shellcheck +board/arm/fvp-ebbr/genimage.cfg lib_genimage.PartitionTypeUuidShortcut +board/aspeed/ast2500-evb/genimage.cfg lib_genimage.EmptyLineAfterNode lib_genimage.OptionAssignment +board/aspeed/ast2600-evb/genimage.cfg lib_genimage.EmptyLineAfterNode board/aspeed/common/post-image.sh Shellcheck board/asus/tinker/post-build.sh Shellcheck board/atmel/flasher.sh Shellcheck +board/avnet/rzboard_v2l/genimage.cfg lib_genimage.EmptyLineAfterNode lib_genimage.GptPartitionTypeUuid board/beagleboard/beaglebone-qt5/patches/linux/0001-keep-jtag-clock-alive-for-debugger.patch lib_patch.Upstream +board/beagleboard/beagleplay/genimage.cfg lib_genimage.Indent +board/beagleboard/beaglev_fire/genimage.cfg lib_genimage.EmptyLineAfterNode lib_genimage.GptPartitionTypeUuid lib_genimage.Indent lib_genimage.PartitionTypeUuidCase lib_genimage.PartitionTypeUuidShortcut board/boundarydevices/common/post-build.sh Shellcheck board/boundarydevices/common/post-image.sh Shellcheck board/broadcom/northstar/post-image.sh Shellcheck board/bsh/imx8mn-bsh-smm-s2-pro/flash.sh Shellcheck lib_shellscript.EmptyLastLine +board/bsh/imx8mn-bsh-smm-s2-pro/genimage.cfg lib_genimage.GptPartitionTypeUuid board/bsh/imx8mn-bsh-smm-s2-pro/post-build.sh Shellcheck board/bsh/imx8mn-bsh-smm-s2-pro/post-image.sh Shellcheck board/bsh/imx8mn-bsh-smm-s2/flash.sh Shellcheck lib_shellscript.EmptyLastLine board/bsh/imx8mn-bsh-smm-s2/post-build.sh Shellcheck +board/canaan/k210-soc/genimage.cfg lib_genimage.EmptyLineAfterNode board/canaan/k210-soc/post-build.sh Shellcheck board/chromebook/elm/sign.sh Shellcheck board/chromebook/mksd.sh Shellcheck board/ci20/patches/uboot/0001-mips-Remove-default-endiannes.patch lib_patch.Upstream +board/compulab/iot-gate-imx8-ebbr/genimage.cfg lib_genimage.PartitionTypeUuidCase +board/coolpi/coolpi-4b/genimage.cfg lib_genimage.EmptyLineAfterNode lib_genimage.GptPartitionTypeUuid board/freescale/common/imx/imx8-bootloader-prepare.sh Shellcheck board/freescale/common/mxs/post-image.sh Shellcheck board/friendlyarm/nanopi-r2s/post-build.sh Shellcheck +board/grinn/liteboard/genimage.cfg lib_genimage.CommentUnits board/hardkernel/odroidc2/post-image.sh Shellcheck board/hardkernel/odroidc2/rootfs_overlay/etc/init.d/S09modload Shellcheck lib_sysv.Variables +board/khadas/vim3/genimage.cfg lib_genimage.OptionAssignment +board/kontron/bl-imx8mm/genimage.cfg lib_genimage.GptPartitionTypeUuid board/kontron/bl-imx8mm/post-build.sh Shellcheck +board/kontron/smarc-sal28/genimage.cfg lib_genimage.GptPartitionTypeUuid board/kontron/smarc-sal28/post-build.sh Shellcheck +board/lego/ev3/genimage.cfg lib_genimage.CommentUnits lib_genimage.EmptyLineAfterNode board/lego/ev3/post-image.sh Shellcheck +board/loongarch64-efi/genimage-efi.cfg lib_genimage.EmptyLineAfterNode +board/mender/x86_64/genimage-efi.cfg lib_genimage.EmptyLineAfterNode lib_genimage.PartitionTypeUuidShortcut +board/microchip/mpfs_icicle/genimage.cfg lib_genimage.EmptyLineAfterNode lib_genimage.GptPartitionTypeUuid lib_genimage.Indent lib_genimage.PartitionTypeUuidCase +board/microchip/sama7g5ek/genimage.cfg lib_genimage.EmptyLineAfterNode +board/minnowboard/genimage.cfg lib_genimage.EmptyLineAfterNode board/minnowboard/post-build.sh Shellcheck board/nexbox/a95x/post-build.sh Shellcheck board/nexbox/a95x/post-image.sh Shellcheck +board/octavo/osd32mp1-brk/genimage.cfg lib_genimage.GptPartitionTypeUuid board/octavo/osd32mp1-brk/patches/uboot/0001-Add-OSD32MP1-BRK-device-tree-support.patch lib_patch.NumberedSubject lib_patch.Upstream board/octavo/osd32mp1-brk/patches/uboot/0002-Add-OSD32MP1-BRK-build-config.patch lib_patch.NumberedSubject lib_patch.Upstream +board/octavo/osd32mp1-red/genimage.cfg lib_genimage.GptPartitionTypeUuid board/octavo/osd32mp1-red/patches/uboot/0001-Add-OSD32MP1-RED-Device-Tree-support.patch lib_patch.NumberedSubject lib_patch.Upstream board/octavo/osd32mp1-red/patches/uboot/0002-configs-stm32mp15_trusted_defconfig-disable-environm.patch lib_patch.NumberedSubject lib_patch.Upstream +board/olimex/stmp1_olinuxino/genimage.cfg lib_genimage.GptPartitionTypeUuid board/olpc/post-build.sh Shellcheck +board/orangepi/common/genimage.cfg lib_genimage.GptPartitionTypeUuid board/orangepi/common/post-build.sh Shellcheck +board/orangepi/orangepi-5-plus/genimage.cfg lib_genimage.PartitionTypeUuidShortcut board/orangepi/orangepi-zero/patches/linux/0001-ARM-dts-orange-pi-zero-interrupt-triggering-xr819.patch lib_patch.Upstream board/orangepi/orangepi-zero/patches/linux/0002-ARM-dts-orange-pi-zero-enable-spi-nor.patch lib_patch.Upstream board/orangepi/orangepi-zero/patches/linux/0003-ARM-dts-orange-pi-zero-enable-spidev.patch lib_patch.Upstream board/orangepi/orangepi-zero/patches/linux/0004-ARM-dts-orange-pi-zero-enable-uart.patch lib_patch.Upstream +board/pc/genimage-efi.cfg lib_genimage.PartitionTypeUuidShortcut +board/pine64/rockpro64-ebbr/genimage.cfg lib_genimage.PartitionTypeUuidCase +board/pine64/rockpro64/genimage.cfg lib_genimage.GptPartitionTypeUuid lib_genimage.PartitionTypeUuidShortcut +board/pine64/star64/genimage.cfg lib_genimage.GptPartitionTypeUuid lib_genimage.Indent lib_genimage.PartitionTypeUuidCase +board/qemu/aarch64-ebbr/genimage.cfg lib_genimage.PartitionTypeUuidShortcut board/qemu/aarch64-sbsa/assemble-flash-images Shellcheck +board/qemu/aarch64-sbsa/genimage.cfg lib_genimage.PartitionTypeUuidShortcut +board/qemu/arm-ebbr/genimage.cfg lib_genimage.PartitionTypeUuidShortcut +board/qemu/loongarch64-virt-efi/genimage.cfg lib_genimage.EmptyLineAfterNode +board/qemu/riscv64-virt-efi/genimage.cfg lib_genimage.PartitionTypeUuidShortcut +board/radxa/rock5b/genimage.cfg lib_genimage.PartitionTypeUuidShortcut board/raspberrypi/post-build.sh Shellcheck board/raspberrypi/post-image.sh Shellcheck +board/seeed/stm32mp157c-odyssey/genimage.cfg lib_genimage.GptPartitionTypeUuid board/seeed/stm32mp157c-odyssey/patches/linux/0001-ARM-dts-stm32-fix-stm32mp157c-odyssey-card-detect.patch lib_patch.Upstream board/sheevaplug/patches/uboot/0001-Remove-redundant-YYLOC-global-declaration.patch lib_patch.Upstream +board/sifive/common/genimage_sdcard.cfg lib_genimage.PartitionTypeUuidShortcut +board/sipeed/licheepi_nano/genimage.cfg lib_genimage.CurlyBrackets lib_genimage.EmptyLastLine lib_genimage.EmptyLineAfterNode board/solidrun/clearfog/post-build.sh Shellcheck board/solidrun/macchiatobin/post-build-mainline.sh Shellcheck board/solidrun/macchiatobin/post-build.sh Shellcheck
@@ -52,7 +93,9 @@ board/stmicroelectronics/stm32f429-disco/flash.sh Shellcheck board/stmicroelectronics/stm32f469-disco/flash_sd.sh Shellcheck board/stmicroelectronics/stm32f469-disco/flash_xip.sh Shellcheck board/synopsys/axs10x/post-build.sh Shellcheck +board/ti/am574x-idk/genimage.cfg lib_genimage.Indent board/udoo/common/post-build.sh Shellcheck +board/visionfive2/genimage.cfg lib_genimage.PartitionTypeUuidShortcut boot/afboot-stm32/0003-Makefile-disable-stack-protector.patch lib_patch.Upstream boot/optee-os/3.13.0/0001-core-zlib-fix-build-warning-when-_LFS64_LARGEFILE-is.patch lib_patch.Upstream boot/syslinux/0001-bios-Fix-alignment-change-with-gcc-5.patch lib_patch.Upstream
@@ -980,6 +1023,9 @@ support/scripts/fix-configure-powerpc64.sh lib_shellscript.EmptyLastLine support/scripts/generate-gitlab-ci-yml Shellcheck support/scripts/mkmakefile Shellcheck lib_shellscript.ConsecutiveEmptyLines support/scripts/setlocalversion Shellcheck +support/testing/tests/boot/test_grub/genimage-aarch64-efi.cfg lib_genimage.PartitionTypeUuidShortcut support/testing/tests/core/post-build.sh Shellcheck support/testing/tests/package/test_opkg/post-build.sh Shellcheck +support/testing/tests/package/test_xen/aarch64/genimage.cfg lib_genimage.PartitionTypeUuidCase +support/testing/tests/package/test_xen/arm/genimage.cfg lib_genimage.PartitionTypeUuidCase support/testing/tests/utils/test_get_developers/0001-package-binutils-change-.mk.patch lib_patch.NumberedSubject lib_patch.Upstream
utils/check-package +7 -0
@@ -19,6 +19,7 @@ import sys import checkpackagelib.base import checkpackagelib.lib_config import checkpackagelib.lib_defconfig +import checkpackagelib.lib_genimage import checkpackagelib.lib_hash import checkpackagelib.lib_ignore import checkpackagelib.lib_mk
@@ -159,6 +160,10 @@ SYSV_INIT_SCRIPT_FILENAME = re.compile(r"/S\d\d[^/]+$") # in a br2-external tree. BR_DEFCONFIG_FILENAME = re.compile(r"^(.+/)?configs/[^/]+_defconfig$") +# Match any name containing genimage, so that the ones with a wrong prefix are +# reported. +GENIMAGE_CFG_FILENAME = re.compile(r"genimage[^/]*\.cfg$") + def get_lib_from_filename(fname): if flags.intree_only:
@@ -176,6 +181,8 @@ def get_lib_from_filename(fname): return checkpackagelib.lib_config if BR_DEFCONFIG_FILENAME.search(fname): return checkpackagelib.lib_defconfig + if GENIMAGE_CFG_FILENAME.search(fname): + return checkpackagelib.lib_genimage if fname.endswith(".hash"): return checkpackagelib.lib_hash if fname.endswith(".mk") or fname.endswith(".mk.in"):
utils/checkpackagelib/lib_genimage.py new file +407 -0
407 lines not on this page · raw message
utils/checkpackagelib/test_lib_genimage.py new file +623 -0
623 lines not on this page · raw message
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Hello!
Quoted 11 lines · Giulio Benetti
The coding style of the genimage.cfg files is described in the "The genimage.cfg file" section of the manual, but nothing enforces it. Add a library checking these rules:
- indentation with tabs, according to the nesting level
- position of the curly brackets
- empty line after a node, except for the last one
- one space before and after '='
- filename beginning with genimage
- notation of the offset and size options
- GB, MB, KB units in comments
Within genimage, ‘k’, ‘M’ and ‘G’ are binary units (powers of 1024 bytes). This can lead to some confusion, as HDD sizes are quoted with decimal prefixes (powers of 1000). Micro-SD cards used to be quoted with binary prefixes, but most (maybe all?) manufacturers have switched to decimal prefixes.
In order to avoid the confusion, it would be preferable to use the IEC prefixes in the comments: KiB, MiB and GiB. This would be consistent with the notation used by ‘dd’, where MiB = M = 1024^2 B, whereas MB = 10^6 B.
Regards,
Edgar Bonet.
Quoted 1,201 lines
- partition-type-uuid set for every partition of a GPT image, unquoted, using the genimage shortcut when there is one, and in lower-case otherwise
The table of shortcuts comes from genimage's
image-hd.c.Files generated from a template (genimage.cfg.in, genimage.cfg.template*) are not checked, since they contain placeholders.
Add the existing files that do not follow the rules to .checkpackageignore.
Assisted-by Claude Opus 5.5 <[email protected]>Signed-off-by Giulio Benetti <[email protected]>--- .checkpackageignore | 46 ++ utils/check-package | 7 + utils/checkpackagelib/lib_genimage.py | 407 ++++++++++++++ utils/checkpackagelib/test_lib_genimage.py | 623 +++++++++++++++++++++ 4 files changed, 1083 insertions(+) create mode 100644 utils/checkpackagelib/lib_genimage.py create mode 100644 utils/checkpackagelib/test_lib_genimage.py.checkpackageignore +46
-0@@ -1,48 +1,89 @@ +board/aarch64-efi/genimage-efi.cfg lib_genimage.EmptyLineAfterNode +board/amarula/vyasa/genimage.cfg lib_genimage.CommentUnits board/amarula/vyasa/post-build.sh Shellcheck +board/andes/ae350/genimage_sdcard.cfg lib_genimage.EmptyLineAfterNode board/arcturus/aarch64-ucls1012a/post-build.sh Shellcheck board/arcturus/aarch64-ucls1012a/post-image.sh Shellcheck +board/arm/fvp-ebbr/genimage.cfg lib_genimage.PartitionTypeUuidShortcut +board/aspeed/ast2500-evb/genimage.cfg lib_genimage.EmptyLineAfterNode lib_genimage.OptionAssignment +board/aspeed/ast2600-evb/genimage.cfg lib_genimage.EmptyLineAfterNode board/aspeed/common/post-image.sh Shellcheck board/asus/tinker/post-build.sh Shellcheck board/atmel/flasher.sh Shellcheck +board/avnet/rzboard_v2l/genimage.cfg lib_genimage.EmptyLineAfterNode lib_genimage.GptPartitionTypeUuid board/beagleboard/beaglebone-qt5/patches/linux/0001-keep-jtag-clock-alive-for-debugger.patch lib_patch.Upstream +board/beagleboard/beagleplay/genimage.cfg lib_genimage.Indent +board/beagleboard/beaglev_fire/genimage.cfg lib_genimage.EmptyLineAfterNode lib_genimage.GptPartitionTypeUuid lib_genimage.Indent lib_genimage.PartitionTypeUuidCase lib_genimage.PartitionTypeUuidShortcut board/boundarydevices/common/post-build.sh Shellcheck board/boundarydevices/common/post-image.sh Shellcheck board/broadcom/northstar/post-image.sh Shellcheck board/bsh/imx8mn-bsh-smm-s2-pro/flash.sh Shellcheck lib_shellscript.EmptyLastLine +board/bsh/imx8mn-bsh-smm-s2-pro/genimage.cfg lib_genimage.GptPartitionTypeUuid board/bsh/imx8mn-bsh-smm-s2-pro/post-build.sh Shellcheck board/bsh/imx8mn-bsh-smm-s2-pro/post-image.sh Shellcheck board/bsh/imx8mn-bsh-smm-s2/flash.sh Shellcheck lib_shellscript.EmptyLastLine board/bsh/imx8mn-bsh-smm-s2/post-build.sh Shellcheck +board/canaan/k210-soc/genimage.cfg lib_genimage.EmptyLineAfterNode board/canaan/k210-soc/post-build.sh Shellcheck board/chromebook/elm/sign.sh Shellcheck board/chromebook/mksd.sh Shellcheck board/ci20/patches/uboot/0001-mips-Remove-default-endiannes.patch lib_patch.Upstream +board/compulab/iot-gate-imx8-ebbr/genimage.cfg lib_genimage.PartitionTypeUuidCase +board/coolpi/coolpi-4b/genimage.cfg lib_genimage.EmptyLineAfterNode lib_genimage.GptPartitionTypeUuid board/freescale/common/imx/imx8-bootloader-prepare.sh Shellcheck board/freescale/common/mxs/post-image.sh Shellcheck board/friendlyarm/nanopi-r2s/post-build.sh Shellcheck +board/grinn/liteboard/genimage.cfg lib_genimage.CommentUnits board/hardkernel/odroidc2/post-image.sh Shellcheck board/hardkernel/odroidc2/rootfs_overlay/etc/init.d/S09modload Shellcheck lib_sysv.Variables +board/khadas/vim3/genimage.cfg lib_genimage.OptionAssignment +board/kontron/bl-imx8mm/genimage.cfg lib_genimage.GptPartitionTypeUuid board/kontron/bl-imx8mm/post-build.sh Shellcheck +board/kontron/smarc-sal28/genimage.cfg lib_genimage.GptPartitionTypeUuid board/kontron/smarc-sal28/post-build.sh Shellcheck +board/lego/ev3/genimage.cfg lib_genimage.CommentUnits lib_genimage.EmptyLineAfterNode board/lego/ev3/post-image.sh Shellcheck +board/loongarch64-efi/genimage-efi.cfg lib_genimage.EmptyLineAfterNode +board/mender/x86_64/genimage-efi.cfg lib_genimage.EmptyLineAfterNode lib_genimage.PartitionTypeUuidShortcut +board/microchip/mpfs_icicle/genimage.cfg lib_genimage.EmptyLineAfterNode lib_genimage.GptPartitionTypeUuid lib_genimage.Indent lib_genimage.PartitionTypeUuidCase +board/microchip/sama7g5ek/genimage.cfg lib_genimage.EmptyLineAfterNode +board/minnowboard/genimage.cfg lib_genimage.EmptyLineAfterNode board/minnowboard/post-build.sh Shellcheck board/nexbox/a95x/post-build.sh Shellcheck board/nexbox/a95x/post-image.sh Shellcheck +board/octavo/osd32mp1-brk/genimage.cfg lib_genimage.GptPartitionTypeUuid board/octavo/osd32mp1-brk/patches/uboot/0001-Add-OSD32MP1-BRK-device-tree-support.patch lib_patch.NumberedSubject lib_patch.Upstream board/octavo/osd32mp1-brk/patches/uboot/0002-Add-OSD32MP1-BRK-build-config.patch lib_patch.NumberedSubject lib_patch.Upstream +board/octavo/osd32mp1-red/genimage.cfg lib_genimage.GptPartitionTypeUuid board/octavo/osd32mp1-red/patches/uboot/0001-Add-OSD32MP1-RED-Device-Tree-support.patch lib_patch.NumberedSubject lib_patch.Upstream board/octavo/osd32mp1-red/patches/uboot/0002-configs-stm32mp15_trusted_defconfig-disable-environm.patch lib_patch.NumberedSubject lib_patch.Upstream +board/olimex/stmp1_olinuxino/genimage.cfg lib_genimage.GptPartitionTypeUuid board/olpc/post-build.sh Shellcheck +board/orangepi/common/genimage.cfg lib_genimage.GptPartitionTypeUuid board/orangepi/common/post-build.sh Shellcheck +board/orangepi/orangepi-5-plus/genimage.cfg lib_genimage.PartitionTypeUuidShortcut board/orangepi/orangepi-zero/patches/linux/0001-ARM-dts-orange-pi-zero-interrupt-triggering-xr819.patch lib_patch.Upstream board/orangepi/orangepi-zero/patches/linux/0002-ARM-dts-orange-pi-zero-enable-spi-nor.patch lib_patch.Upstream board/orangepi/orangepi-zero/patches/linux/0003-ARM-dts-orange-pi-zero-enable-spidev.patch lib_patch.Upstream board/orangepi/orangepi-zero/patches/linux/0004-ARM-dts-orange-pi-zero-enable-uart.patch lib_patch.Upstream +board/pc/genimage-efi.cfg lib_genimage.PartitionTypeUuidShortcut +board/pine64/rockpro64-ebbr/genimage.cfg lib_genimage.PartitionTypeUuidCase +board/pine64/rockpro64/genimage.cfg lib_genimage.GptPartitionTypeUuid lib_genimage.PartitionTypeUuidShortcut +board/pine64/star64/genimage.cfg lib_genimage.GptPartitionTypeUuid lib_genimage.Indent lib_genimage.PartitionTypeUuidCase +board/qemu/aarch64-ebbr/genimage.cfg lib_genimage.PartitionTypeUuidShortcut board/qemu/aarch64-sbsa/assemble-flash-images Shellcheck +board/qemu/aarch64-sbsa/genimage.cfg lib_genimage.PartitionTypeUuidShortcut +board/qemu/arm-ebbr/genimage.cfg lib_genimage.PartitionTypeUuidShortcut +board/qemu/loongarch64-virt-efi/genimage.cfg lib_genimage.EmptyLineAfterNode +board/qemu/riscv64-virt-efi/genimage.cfg lib_genimage.PartitionTypeUuidShortcut +board/radxa/rock5b/genimage.cfg lib_genimage.PartitionTypeUuidShortcut board/raspberrypi/post-build.sh Shellcheck board/raspberrypi/post-image.sh Shellcheck +board/seeed/stm32mp157c-odyssey/genimage.cfg lib_genimage.GptPartitionTypeUuid board/seeed/stm32mp157c-odyssey/patches/linux/0001-ARM-dts-stm32-fix-stm32mp157c-odyssey-card-detect.patch lib_patch.Upstream board/sheevaplug/patches/uboot/0001-Remove-redundant-YYLOC-global-declaration.patch lib_patch.Upstream +board/sifive/common/genimage_sdcard.cfg lib_genimage.PartitionTypeUuidShortcut +board/sipeed/licheepi_nano/genimage.cfg lib_genimage.CurlyBrackets lib_genimage.EmptyLastLine lib_genimage.EmptyLineAfterNode board/solidrun/clearfog/post-build.sh Shellcheck board/solidrun/macchiatobin/post-build-mainline.sh Shellcheck board/solidrun/macchiatobin/post-build.sh Shellcheck@@ -52,7 +93,9 @@ board/stmicroelectronics/stm32f429-disco/flash.sh Shellcheck board/stmicroelectronics/stm32f469-disco/flash_sd.sh Shellcheck board/stmicroelectronics/stm32f469-disco/flash_xip.sh Shellcheck board/synopsys/axs10x/post-build.sh Shellcheck +board/ti/am574x-idk/genimage.cfg lib_genimage.Indent board/udoo/common/post-build.sh Shellcheck +board/visionfive2/genimage.cfg lib_genimage.PartitionTypeUuidShortcut boot/afboot-stm32/0003-Makefile-disable-stack-protector.patch lib_patch.Upstream boot/optee-os/3.13.0/0001-core-zlib-fix-build-warning-when-_LFS64_LARGEFILE-is.patch lib_patch.Upstream boot/syslinux/0001-bios-Fix-alignment-change-with-gcc-5.patch lib_patch.Upstream@@ -980,6 +1023,9 @@ support/scripts/fix-configure-powerpc64.sh lib_shellscript.EmptyLastLine support/scripts/generate-gitlab-ci-yml Shellcheck support/scripts/mkmakefile Shellcheck lib_shellscript.ConsecutiveEmptyLines support/scripts/setlocalversion Shellcheck +support/testing/tests/boot/test_grub/genimage-aarch64-efi.cfg lib_genimage.PartitionTypeUuidShortcut support/testing/tests/core/post-build.sh Shellcheck support/testing/tests/package/test_opkg/post-build.sh Shellcheck +support/testing/tests/package/test_xen/aarch64/genimage.cfg lib_genimage.PartitionTypeUuidCase +support/testing/tests/package/test_xen/arm/genimage.cfg lib_genimage.PartitionTypeUuidCase support/testing/tests/utils/test_get_developers/0001-package-binutils-change-.mk.patch lib_patch.NumberedSubject lib_patch.Upstreamutils/check-package +7
-0@@ -19,6 +19,7 @@ import sys import checkpackagelib.base import checkpackagelib.lib_config import checkpackagelib.lib_defconfig +import checkpackagelib.lib_genimage import checkpackagelib.lib_hash import checkpackagelib.lib_ignore import checkpackagelib.lib_mk@@ -159,6 +160,10 @@ SYSV_INIT_SCRIPT_FILENAME = re.compile(r"/S\d\d[^/]+$") # in a br2-external tree. BR_DEFCONFIG_FILENAME = re.compile(r"^(.+/)?configs/[^/]+_defconfig$") +# Match any name containing genimage, so that the ones with a wrong prefix are +# reported. +GENIMAGE_CFG_FILENAME = re.compile(r"genimage[^/]*\.cfg$") + def get_lib_from_filename(fname): if flags.intree_only:@@ -176,6 +181,8 @@ def get_lib_from_filename(fname): return checkpackagelib.lib_config if BR_DEFCONFIG_FILENAME.search(fname): return checkpackagelib.lib_defconfig + if GENIMAGE_CFG_FILENAME.search(fname): + return checkpackagelib.lib_genimage if fname.endswith(".hash"): return checkpackagelib.lib_hash if fname.endswith(".mk") or fname.endswith(".mk.in"):utils/checkpackagelib/lib_genimage.py new file +407
-0@@ -0,0 +1,407 @@ +# See utils/checkpackagelib/readme.txt before editing this file. + +import os +import re + +from checkpackagelib.base import _CheckFunction +from checkpackagelib.lib import ConsecutiveEmptyLines # noqa: F401 +from checkpackagelib.lib import EmptyLastLine # noqa: F401 +from checkpackagelib.lib import NewlineAtEof # noqa: F401 +from checkpackagelib.lib import TrailingSpace # noqa: F401 +from checkpackagelib.lib import Utf8Characters # noqa: F401 +from checkpackagelib.tool import NotExecutable # noqa: F401 + +# used in more than one check +STRING_OR_COMMENT = re.compile(r"(\"[^\"]*\"|'[^']*')|(#|//).*") + + +def strip_comment(text): + return STRING_OR_COMMENT.sub(lambda m: m.group(1) or "", text).strip() + + +def strip_comment_and_strings(text): + return STRING_OR_COMMENT.sub(lambda m: '""' if m.group(1) else "", text).strip() + + +class _Structure(_CheckFunction): + """Keeps track of the curly brackets, to know where each line is located""" + BRACKET = re.compile(r"[{}]") + LIST = re.compile(r"=\s*$") + + def before(self): + # One entry per open curly bracket: the words of the node's name, or + # None for a list, e.g. 'files = {' + self.stack = [] + + def track(self, code): + """Update the stack, return the list of entries that were closed""" + closed = [] + start = 0 + for m in self.BRACKET.finditer(code): + if m.group() == "{": + name = code[start:m.start()] + self.stack.append(None if self.LIST.search(name) else name.split()) + elif self.stack: + closed.append(self.stack.pop()) + start = m.end() + return closed + + +class CommentUnits(_CheckFunction): + COMMENT = re.compile(r"(?:\"[^\"]*\"|'[^']*'|[^\"'#])*?(?:#|//)(.*)") + UNIT = re.compile(r"\b\d+ ?([kmg]b?)\b", re.IGNORECASE) + ALLOWED = ["GB", "MB", "KB"] + + def check_line(self, lineno, text): + comment = self.COMMENT.match(text) + if not comment: + return + for unit in self.UNIT.findall(comment.group(1)): + if unit not in self.ALLOWED: + return ["{}:{}: use GB, MB or KB in comments ({}#writing-genimage-cfg)" + .format(self.filename, lineno, self.url_to_manual), + text] + + +class CurlyBrackets(_Structure): + def check_line(self, lineno, text): + code = strip_comment_and_strings(text) + in_list = bool(self.stack) and self.stack[-1] is None + closed = self.track(code) + + if code.startswith("{"): + return ["{}:{}: open curly bracket must be on the same line as the name ({}#writing-genimage-cfg)" + .format(self.filename, lineno, self.url_to_manual), + text] + # lists can be on a single line + if any(entry is not None for entry in closed) and code != "}": + return ["{}:{}: closing curly bracket must be alone on its line ({}#writing-genimage-cfg)" + .format(self.filename, lineno, self.url_to_manual), + text] + opens_node = "{" in code and not in_list and "=" not in code.split("{")[0] + if opens_node and not code.endswith("{"): + return ["{}:{}: node content must start on a new line ({}#writing-genimage-cfg)" + .format(self.filename, lineno, self.url_to_manual), + text] + + +class EmptyLineAfterNode(_Structure): + def before(self): + super().before() + self.after_node = False + + def check_line(self, lineno, text): + code = strip_comment_and_strings(text) + missing = self.after_node and text.strip() != "" and not code.startswith("}") + closed = self.track(code) + self.after_node = bool(closed) and closed[-1] is not None + + if missing: + return ["{}:{}: missing empty line after the previous node ({}#writing-genimage-cfg)" + .format(self.filename, lineno, self.url_to_manual), + text] + + +class Filename(_CheckFunction): + def before(self): + if not os.path.basename(self.filename).startswith("genimage"): + return ["{}:0: filename must begin with genimage ({}#writing-genimage-cfg)" + .format(self.filename, self.url_to_manual)] + + +class GptPartitionTypeUuid(_Structure): + """Checks that each partition of a GPT image has a partition-type-uuid""" + OPTION = re.compile(r"^([a-z-]+)\s*=\s*[\"']?([^\"'\s]*)") + FALSE = ["false", "no", "off"] + + def before(self): + super().before() + self.gpt = False + self.partition = None + self.missing = [] + + def check_line(self, lineno, text): + code = strip_comment_and_strings(text) + closed = self.track(code) + node = self.stack[-1][0] if self.stack and self.stack[-1] else None + + if closed: + for entry in closed: + if not entry: + continue + if entry[0] == "partition" and self.partition: + if self.partition["needs-type"]: + self.missing.append(self.partition) + self.partition = None + elif entry[0] == "image": + gpt, missing = self.gpt, self.missing + self.gpt, self.missing = False, [] + if gpt and missing: + return ["{}:{}: GPT partition without partition-type-uuid: {} ({}#writing-genimage-cfg)" + .format(self.filename, missing[0]["lineno"], + ", ".join(p["name"] for p in missing), + self.url_to_manual), + missing[0]["text"]] + return + + if node == "partition" and code.endswith("{"): + self.partition = {"name": " ".join(strip_comment(text).rstrip("{").split()[1:]), + "lineno": lineno, "text": text, "needs-type": True} + return + + option = self.OPTION.search(strip_comment(text)) + if not option: + return + name, value = option.groups() + if node == "hdimage": + # 'gpt = true' is the deprecated form + if name == "partition-table-type": + self.gpt = value in ["gpt", "hybrid"] + elif name == "gpt": + self.gpt = value.lower() not in self.FALSE + elif node == "partition" and self.partition: + if name == "partition-type-uuid": + self.partition["needs-type"] = False + elif name == "in-partition-table" and value.lower() in self.FALSE: + self.partition["needs-type"] = False + + +class Indent(_Structure): + def check_line(self, lineno, text): + if text.strip() == "": + return + code = strip_comment_and_strings(text) + expected = len(self.stack) + if code.startswith("}"): + expected = max(0, expected - 1) + self.track(code) + + if text[:len(text) - len(text.lstrip())] != "\t" * expected: + return ["{}:{}: should be indented with {} tab(s) ({}#writing-genimage-cfg)" + .format(self.filename, lineno, expected, self.url_to_manual), + text] + + +class OptionAssignment(_CheckFunction): + ASSIGNMENT = re.compile(r"^[\w-]+(\s*)\+?=(\s*)(.*)$") + + def check_line(self, lineno, text): + m = self.ASSIGNMENT.search(strip_comment(text)) + if not m: + return + space_before, space_after, value = m.groups() + if space_before != " " or (value and space_after != " "): + return ["{}:{}: use one space before and after '=' ({}#writing-genimage-cfg)" + .format(self.filename, lineno, self.url_to_manual), + text] + + +class SizeNotation(_CheckFunction): + OPTION = re.compile(r"^(?:offset|size)\s*=\s*[\"']?(\d[^\"'\s]*)") + ALLOWED = re.compile(r"^(0x[0-9a-fA-F]+|\d+[GMK]?)$") + # genimage also accepts a percentage of the available space as size + PERCENTAGE = re.compile(r"^\d+%$") + + def check_line(self, lineno, text): + m = self.OPTION.search(strip_comment(text)) + if not m: + return + value = m.group(1) + if self.PERCENTAGE.match(value): + return + if not self.ALLOWED.match(value): + return ["{}:{}: use G, M, K, a 0x prefix or a byte count ({}#writing-genimage-cfg)" + .format(self.filename, lineno, self.url_to_manual), + text] + if value[-1] in "GMK": + return + count = int(value, 16) if value.startswith("0x") else int(value) + if count == 0 or count % 1024: + return + for suffix, unit in [("G", 1 << 30), ("M", 1 << 20), ("K", 1 << 10)]: + if count % unit == 0: + return ["{}:{}: use {}{} instead of {} ({}#writing-genimage-cfg)" + .format(self.filename, lineno, count // unit, suffix, value, self.url_to_manual), + text] + + +class _PartitionTypeUuid(_CheckFunction): + OPTION = re.compile(r"^partition-type-uuid\s*=\s*(\S+)") + GUID = re.compile(r"^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$", re.IGNORECASE) + # See gpt_partition_type_shortcuts in genimage's image-hd.c + SHORTCUTS = { + "0fc63daf-8483-4772-8e79-3d69d8477de4": "L", + "0657fd6d-a4ab-43c4-84e5-0933c84b4f4f": "S", + "933ac7e1-2eb4-4f13-b844-0e14e2aef915": "H", + "c12a7328-f81f-11d2-ba4b-00a0c93ec93b": "U", + "a19d880f-05fc-4d3b-a006-743f0f84911e": "R", + "e6d6d379-f507-44c2-a23c-238f2a3df928": "V", + "ebd0a0a2-b9e5-4433-87c0-68b6b72699c7": "F", + "4778ed65-bf42-45fa-9c5b-287a1dc4aab1": "barebox-state", + "6c3737f2-07f8-45d1-ad45-15d260aab24d": "barebox-env", + "3de21764-95bd-54bd-a5c3-4abe786f38a8": "u-boot-env", + "6523f8ae-3eb1-4e2a-a05a-18b695ae656f": "root-alpha", + "d27f46ed-2919-4cb8-bd25-9531f3c16534": "root-arc", + "69dad710-2ce4-4e3c-b16c-21a1d49abed3": "root-arm", + "b921b045-1df0-41c3-af44-4c6f280d3fae": "root-arm64", + "993d8d3d-f80e-4225-855a-9daf8ed7ea97": "root-ia64", + "77055800-792c-4f94-b39a-98c91b762bb6": "root-loongarch64", + "e9434544-6e2c-47cc-bae2-12d6deafb44c": "root-mips", + "d113af76-80ef-41b4-bdb6-0cff4d3d4a25": "root-mips64", + "37c58c8a-d913-4156-a25f-48b1b64e07f0": "root-mips-le", + "700bda43-7a34-4507-b179-eeb93d7a7ca3": "root-mips64-le", + "1aacdb3b-5444-4138-bd9e-e5c2239b2346": "root-parisc", + "1de3f1ef-fa98-47b5-8dcd-4a860a654d78": "root-ppc", + "912ade1d-a839-4913-8964-a10eee08fbd2": "root-ppc64", + "c31c45e6-3f39-412e-80fb-4809c4980599": "root-ppc64-le", + "60d5a7fe-8e7d-435c-b714-3dd8162144e1": "root-riscv32", + "72ec70a6-cf74-40e6-bd49-4bda08e8f224": "root-riscv64", + "08a7acea-624c-4a20-91e8-6e0fa67d23f9": "root-s390", + "5eead9a9-fe09-4a1e-a1d7-520d00531306": "root-s390x", + "c50cdd70-3862-4cc3-90e1-809a8c93ee2c": "root-tilegx", + "44479540-f297-41b2-9af7-d131d5f0458a": "root-x86", + "4f68bce3-e8cd-4db1-96e7-fbcaf984b709": "root-x86-64", + "e18cf08c-33ec-4c0d-8246-c6c6fb3da024": "usr-alpha", + "7978a683-6316-4922-bbee-38bff5a2fecc": "usr-arc", + "7d0359a3-02b3-4f0a-865c-654403e70625": "usr-arm", + "b0e01050-ee5f-4390-949a-9101b17104e9": "usr-arm64", + "4301d2a6-4e3b-4b2a-bb94-9e0b2c4225ea": "usr-ia64", + "e611c702-575c-4cbe-9a46-434fa0bf7e3f": "usr-loongarch64", + "773b2abc-2a99-4398-8bf5-03baac40d02b": "usr-mips", + "57e13958-7331-4365-8e6e-35eeee17c61b": "usr-mips64", + "0f4868e9-9952-4706-979f-3ed3a473e947": "usr-mips-le", + "c97c1f32-ba06-40b4-9f22-236061b08aa8": "usr-mips64-le", + "dc4a4480-6917-4262-a4ec-db9384949f25": "usr-parisc", + "7d14fec5-cc71-415d-9d6c-06bf0b3c3eaf": "usr-ppc", + "2c9739e2-f068-46b3-9fd0-01c5a9afbcca": "usr-ppc64", + "15bb03af-77e7-4d4a-b12b-c0d084f7491c": "usr-ppc64-le", + "b933fb22-5c3f-4f91-af90-e2bb0fa50702": "usr-riscv32", + "beaec34b-8442-439b-a40b-984381ed097d": "usr-riscv64", + "cd0f869b-d0fb-4ca0-b141-9ea87cc78d66": "usr-s390", + "8a4f5770-50aa-4ed3-874a-99b710db6fea": "usr-s390x", + "55497029-c7c1-44cc-aa39-815ed1558630": "usr-tilegx", + "75250d76-8cc6-458e-bd66-bd47cc81a812": "usr-x86", + "8484680c-9521-48c6-9c11-b0720656f69e": "usr-x86-64", + "fc56d9e9-e6e5-4c06-be32-e74407ce09a5": "root-alpha-verity", + "24b2d975-0f97-4521-afa1-cd531e421b8d": "root-arc-verity", + "7386cdf2-203c-47a9-a498-f2ecce45a2d6": "root-arm-verity", + "df3300ce-d69f-4c92-978c-9bfb0f38d820": "root-arm64-verity", + "86ed10d5-b607-45bb-8957-d350f23d0571": "root-ia64-verity", + "f3393b22-e9af-4613-a948-9d3bfbd0c535": "root-loongarch64-verity", + "7a430799-f711-4c7e-8e5b-1d685bd48607": "root-mips-verity", + "579536f8-6a33-4055-a95a-df2d5e2c42a8": "root-mips64-verity", + "d7d150d2-2a04-4a33-8f12-16651205ff7b": "root-mips-le-verity", + "16b417f8-3e06-4f57-8dd2-9b5232f41aa6": "root-mips64-le-verity", + "d212a430-fbc5-49f9-a983-a7feef2b8d0e": "root-parisc-verity", + "906bd944-4589-4aae-a4e4-dd983917446a": "root-ppc64-le-verity", + "9225a9a3-3c19-4d89-b4f6-eeff88f17631": "root-ppc64-verity", + "98cfe649-1588-46dc-b2f0-add147424925": "root-ppc-verity", + "ae0253be-1167-4007-ac68-43926c14c5de": "root-riscv32-verity", + "b6ed5582-440b-4209-b8da-5ff7c419ea3d": "root-riscv64-verity", + "7ac63b47-b25c-463b-8df8-b4a94e6c90e1": "root-s390-verity", + "b325bfbe-c7be-4ab8-8357-139e652d2f6b": "root-s390x-verity", + "966061ec-28e4-4b2e-b4a5-1f0a825a1d84": "root-tilegx-verity", + "2c7357ed-ebd2-46d9-aec1-23d437ec2bf5": "root-x86-64-verity", + "d13c5d3b-b5d1-422a-b29f-9454fdc89d76": "root-x86-verity", + "8cce0d25-c0d0-4a44-bd87-46331bf1df67": "usr-alpha-verity", + "fca0598c-d880-4591-8c16-4eda05c7347c": "usr-arc-verity", + "c215d751-7bcd-4649-be90-6627490a4c05": "usr-arm-verity", + "6e11a4e7-fbca-4ded-b9e9-e1a512bb664e": "usr-arm64-verity", + "6a491e03-3be7-4545-8e38-83320e0ea880": "usr-ia64-verity", + "f46b2c26-59ae-48f0-9106-c50ed47f673d": "usr-loongarch64-verity", + "6e5a1bc8-d223-49b7-bca8-37a5fcceb996": "usr-mips-verity", + "81cf9d90-7458-4df4-8dcf-c8a3a404f09b": "usr-mips64-verity", + "46b98d8d-b55c-4e8f-aab3-37fca7f80752": "usr-mips-le-verity", + "3c3d61fe-b5f3-414d-bb71-8739a694a4ef": "usr-mips64-le-verity", + "5843d618-ec37-48d7-9f12-cea8e08768b2": "usr-parisc-verity", + "ee2b9983-21e8-4153-86d9-b6901a54d1ce": "usr-ppc64-le-verity", + "bdb528a5-a259-475f-a87d-da53fa736a07": "usr-ppc64-verity", + "df765d00-270e-49e5-bc75-f47bb2118b09": "usr-ppc-verity", + "cb1ee4e3-8cd0-4136-a0a4-aa61a32e8730": "usr-riscv32-verity", + "8f1056be-9b05-47c4-81d6-be53128e5b54": "usr-riscv64-verity", + "b663c618-e7bc-4d6d-90aa-11b756bb1797": "usr-s390-verity", + "31741cc4-1a2a-4111-a581-e00b447d2d06": "usr-s390x-verity", + "2fb4bf56-07fa-42da-8132-6b139f2026ae": "usr-tilegx-verity", + "77ff5f63-e7b6-4633-acf4-1565b864c0e6": "usr-x86-64-verity", + "8f461b0d-14ee-4e81-9aa9-049b6fb97abd": "usr-x86-verity", + "d46495b7-a053-414f-80f7-700c99921ef8": "root-alpha-verity-sig", + "143a70ba-cbd3-4f06-919f-6c05683a78bc": "root-arc-verity-sig", + "42b0455f-eb11-491d-98d3-56145ba9d037": "root-arm-verity-sig", + "6db69de6-29f4-4758-a7a5-962190f00ce3": "root-arm64-verity-sig", + "e98b36ee-32ba-4882-9b12-0ce14655f46a": "root-ia64-verity-sig", + "5afb67eb-ecc8-4f85-ae8e-ac1e7c50e7d0": "root-loongarch64-verity-sig", + "bba210a2-9c5d-45ee-9e87-ff2ccbd002d0": "root-mips-verity-sig", + "43ce94d4-0f3d-4999-8250-b9deafd98e6e": "root-mips64-verity-sig", + "c919cc1f-4456-4eff-918c-f75e94525ca5": "root-mips-le-verity-sig", + "904e58ef-5c65-4a31-9c57-6af5fc7c5de7": "root-mips64-le-verity-sig", + "15de6170-65d3-431c-916e-b0dcd8393f25": "root-parisc-verity-sig", + "d4a236e7-e873-4c07-bf1d-bf6cf7f1c3c6": "root-ppc64-le-verity-sig", + "f5e2c20c-45b2-4ffa-bce9-2a60737e1aaf": "root-ppc64-verity-sig", + "1b31b5aa-add9-463a-b2ed-bd467fc857e7": "root-ppc-verity-sig", + "3a112a75-8729-4380-b4cf-764d79934448": "root-riscv32-verity-sig", + "efe0f087-ea8d-4469-821a-4c2a96a8386a": "root-riscv64-verity-sig", + "3482388e-4254-435a-a241-766a065f9960": "root-s390-verity-sig", + "c80187a5-73a3-491a-901a-017c3fa953e9": "root-s390x-verity-sig", + "b3671439-97b0-4a53-90f7-2d5a8f3ad47b": "root-tilegx-verity-sig", + "41092b05-9fc8-4523-994f-2def0408b176": "root-x86-64-verity-sig", + "5996fc05-109c-48de-808b-23fa0830b676": "root-x86-verity-sig", + "5c6e1c76-076a-457a-a0fe-f3b4cd21ce6e": "usr-alpha-verity-sig", + "94f9a9a1-9971-427a-a400-50cb297f0f35": "usr-arc-verity-sig", + "d7ff812f-37d1-4902-a810-d76ba57b975a": "usr-arm-verity-sig", + "c23ce4ff-44bd-4b00-b2d4-b41b3419e02a": "usr-arm64-verity-sig", + "8de58bc2-2a43-460d-b14e-a76e4a17b47f": "usr-ia64-verity-sig", + "b024f315-d330-444c-8461-44bbde524e99": "usr-loongarch64-verity-sig", + "97ae158d-f216-497b-8057-f7f905770f54": "usr-mips-verity-sig", + "05816ce2-dd40-4ac6-a61d-37d32dc1ba7d": "usr-mips64-verity-sig", + "3e23ca0b-a4bc-4b4e-8087-5ab6a26aa8a9": "usr-mips-le-verity-sig", + "f2c2c7ee-adcc-4351-b5c6-ee9816b66e16": "usr-mips64-le-verity-sig", + "450dd7d1-3224-45ec-9cf2-a43a346d71ee": "usr-parisc-verity-sig", + "c8bfbd1e-268e-4521-8bba-bf314c399557": "usr-ppc64-le-verity-sig", + "0b888863-d7f8-4d9e-9766-239fce4d58af": "usr-ppc64-verity-sig", + "7007891d-d371-4a80-86a4-5cb875b9302e": "usr-ppc-verity-sig", + "c3836a13-3137-45ba-b583-b16c50fe5eb4": "usr-riscv32-verity-sig", + "d2f9000a-7a18-453f-b5cd-4d32f77a7b32": "usr-riscv64-verity-sig", + "17440e4f-a8d0-467f-a46e-3912ae6ef2c5": "usr-s390-verity-sig", + "3f324816-667b-46ae-86ee-9b0c0c6c11b4": "usr-s390x-verity-sig", + "4ede75e2-6ccc-4cc8-b9c7-70334b087510": "usr-tilegx-verity-sig", + "e7bb33fb-06cf-4e81-8273-e543b413e2e2": "usr-x86-64-verity-sig", + "974a71c0-de41-43c3-be5d-5c5ccd1ad2c0": "usr-x86-verity-sig", + "bc13c2ff-59e6-4262-a352-b275fd6f7172": "xbootldr", + "3b8f8425-20e0-4f3b-907f-1a25a76f98e8": "srv", + "4d21b016-b534-45c2-a9fb-5c16e091fd2d": "var", + "7ec6f557-3bc5-4aca-b293-16ef5df639d1": "tmp", + "773f91ef-66d4-49b5-bd83-d683bf40ad16": "user-home", + } + + def get_value(self, text): + m = self.OPTION.search(strip_comment(text)) + return m.group(1) if m else "" + + +class PartitionTypeUuidCase(_PartitionTypeUuid): + def check_line(self, lineno, text): + value = self.get_value(text).strip("\"'") + if not self.GUID.match(value) or value.lower() in self.SHORTCUTS: + return + if value != value.lower(): + return ["{}:{}: partition-type-uuid must be in lower-case ({}#writing-genimage-cfg)" + .format(self.filename, lineno, self.url_to_manual), + text, + value.lower()] + + +class PartitionTypeUuidQuotes(_PartitionTypeUuid): + def check_line(self, lineno, text): + if self.get_value(text).startswith(("\"", "'")): + return ["{}:{}: partition-type-uuid must not be quoted ({}#writing-genimage-cfg)" + .format(self.filename, lineno, self.url_to_manual), + text] + + +class PartitionTypeUuidShortcut(_PartitionTypeUuid): + def check_line(self, lineno, text): + shortcut = self.SHORTCUTS.get(self.get_value(text).strip("\"'").lower()) + if shortcut: + return ["{}:{}: use the {} shortcut for partition-type-uuid ({}#writing-genimage-cfg)" + .format(self.filename, lineno, shortcut, self.url_to_manual), + text]utils/checkpackagelib/test_lib_genimage.py new file +613
-0@@ -0,0 +1,623 @@ +import pytest +import checkpackagelib.test_util as util +import checkpackagelib.lib_genimage as m + + +CommentUnits = [ + ('empty file', + 'any', + '', + []), + ('good', + 'any', + '# 1MB - 8KB, 2 GB\n', + []), + ('no comment', + 'any', + '\tsize = 30M\n', + []), + ('not a size', + 'any', + '# 1 kernel, 2 Macs, i.MX6\n', + []), + ('in a string', + 'any', + '\timage = "a#4M"\n', + []), + ('lower-case', + 'any', + '# 1 kB free\n', + [['any:1: use GB, MB or KB in comments (url#writing-genimage-cfg)', + '# 1 kB free\n']]), + ('no B', + 'any', + '\tsize = 1K # 16M\n', + [['any:1: use GB, MB or KB in comments (url#writing-genimage-cfg)', + '\tsize = 1K # 16M\n']]), + ('mixed', + 'any', + '# 1MB + 16mb\n', + [['any:1: use GB, MB or KB in comments (url#writing-genimage-cfg)', + '# 1MB + 16mb\n']]), + ] + + [email protected]('testname,filename,string,expected', CommentUnits) +def test_CommentUnits(testname, filename, string, expected): + warnings = util.check_file(m.CommentUnits, filename, string) + assert warnings == expected + + +CurlyBrackets = [ + ('empty file', + 'any', + '', + []), + ('good', + 'any', + 'image a {\n' + '\thdimage {\n' + '\t}\n' + '}\n', + []), + ('list', + 'any', + 'files = {\n' + '"a",\n' + '}\n', + []), + ('list on one line', + 'any', + 'holes = {"(440; 512)"}\n', + []), + ('list closed after last item', + 'any', + 'files = {\n' + '"a" }\n', + []), + ('brackets in string and comment', + 'any', + 'image = "}{" # }{\n', + []), + ('comment after brackets', + 'any', + 'image a { # x\n' + '} # y\n', + []), + ('open on next line', + 'any', + 'image a\n' + '{\n' + '}\n', + [['any:2: open curly bracket must be on the same line as the name (url#writing-genimage-cfg)', + '{\n']]), + ('empty node', + 'any', + 'flash {}\n', + [['any:1: closing curly bracket must be alone on its line (url#writing-genimage-cfg)', + 'flash {}\n']]), + ('close after option', + 'any', + 'image a {\n' + '\tsize = 1M }\n', + [['any:2: closing curly bracket must be alone on its line (url#writing-genimage-cfg)', + '\tsize = 1M }\n']]), + ('content after open', + 'any', + 'image a { size = 1M\n' + '}\n', + [['any:1: node content must start on a new line (url#writing-genimage-cfg)', + 'image a { size = 1M\n']]), + ] + + [email protected]('testname,filename,string,expected', CurlyBrackets) +def test_CurlyBrackets(testname, filename, string, expected): + warnings = util.check_file(m.CurlyBrackets, filename, string) + assert warnings == expected + + +EmptyLineAfterNode = [ + ('empty file', + 'any', + '', + []), + ('good', + 'any', + 'image a {\n' + '\tvfat {\n' + '\t}\n' + '\n' + '\tsize = 1M\n' + '}\n' + '\n' + 'image b {\n' + '}\n', + []), + ('last node', + 'any', + 'image a {\n' + '\tvfat {\n' + '\t}\n' + '}\n', + []), + ('list', + 'any', + 'vfat {\n' + '\tfiles = {\n' + '\t"a"\n' + '\t}\n' + '\tlabel = "x"\n' + '}\n', + []), + ('option', + 'any', + 'image a {\n' + '\tvfat {\n' + '\t}\n' + '\tsize = 1M\n' + '}\n', + [['any:4: missing empty line after the previous node (url#writing-genimage-cfg)', + '\tsize = 1M\n']]), + ('node', + 'any', + 'vfat {\n' + '\tfile a {\n' + '\t}\n' + '\tfile b {\n' + '\t}\n' + '}\n', + [['any:4: missing empty line after the previous node (url#writing-genimage-cfg)', + '\tfile b {\n']]), + ('comment', + 'any', + 'image a {\n' + '}\n' + '# x\n', + [['any:3: missing empty line after the previous node (url#writing-genimage-cfg)', + '# x\n']]), + ] + + [email protected]('testname,filename,string,expected', EmptyLineAfterNode) +def test_EmptyLineAfterNode(testname, filename, string, expected): + warnings = util.check_file(m.EmptyLineAfterNode, filename, string) + assert warnings == expected + + +Filename = [ + ('genimage.cfg', + 'board/x/genimage.cfg', + '', + []), + ('genimage-efi.cfg', + 'board/x/genimage-efi.cfg', + '', + []), + ('genimage_sdcard.cfg', + 'board/x/genimage_sdcard.cfg', + '', + []), + ('wrong prefix', + 'board/x/sdcard-genimage.cfg', + '', + [['board/x/sdcard-genimage.cfg:0: filename must begin with genimage (url#writing-genimage-cfg)']]), + ('only the directory', + 'genimage/a.cfg', + '', + [['genimage/a.cfg:0: filename must begin with genimage (url#writing-genimage-cfg)']]), + ] + + [email protected]('testname,filename,string,expected', Filename) +def test_Filename(testname, filename, string, expected): + warnings = util.check_file(m.Filename, filename, string) + assert warnings == expected + + +GptPartitionTypeUuid = [ + ('empty file', + 'any', + '', + []), + ('good', + 'any', + 'image a {\n' + '\thdimage {\n' + '\t\tpartition-table-type = "gpt"\n' + '\t}\n' + '\n' + '\tpartition b {\n' + '\t\tpartition-type-uuid = U\n' + '\t}\n' + '}\n', + []), + ('mbr', + 'any', + 'image a {\n' + '\thdimage {\n' + '\t}\n' + '\tpartition b {\n' + '\t\tpartition-type = 0xC\n' + '\t}\n' + '}\n', + []), + ('not in partition table', + 'any', + 'image a {\n' + '\thdimage {\n' + '\t\tpartition-table-type = "gpt"\n' + '\t}\n' + '\n' + '\tpartition b {\n' + '\t\tin-partition-table = "no"\n' + '\t}\n' + '}\n', + []), + ('gpt only in first image', + 'any', + 'image a {\n' + '\thdimage {\n' + '\t\tpartition-table-type = "gpt"\n' + '\t}\n' + '\n' + '}\n' + 'image a {\n' + '\thdimage {\n' + '\t}\n' + '\tpartition b {\n' + '\t}\n' + '}\n', + []), + ('missing', + 'any', + 'image a {\n' + '\thdimage {\n' + '\t\tpartition-table-type = "gpt"\n' + '\t}\n' + '\n' + '\tpartition b {\n' + '\t\timage = "x"\n' + '\t}\n' + '\tpartition c {\n' + '\t\tpartition-type-uuid = L\n' + '\t}\n' + '\tpartition d {\n' + '\t}\n' + '}\n', + [['any:6: GPT partition without partition-type-uuid: b, d (url#writing-genimage-cfg)', + '\tpartition b {\n']]), + ('hdimage last', + 'any', + 'image a {\n' + '\tpartition b {\n' + '\t}\n' + '\thdimage {\n' + '\t\tpartition-table-type = "gpt"\n' + '\t}\n' + '\n' + '}\n', + [['any:2: GPT partition without partition-type-uuid: b (url#writing-genimage-cfg)', + '\tpartition b {\n']]), + ('deprecated gpt option', + 'any', + 'image a {\n' + '\thdimage {\n' + '\t\tgpt = true\n' + '\t}\n' + '\tpartition b {\n' + '\t}\n' + '}\n', + [['any:5: GPT partition without partition-type-uuid: b (url#writing-genimage-cfg)', + '\tpartition b {\n']]), + ('explicitly in partition table', + 'any', + 'image a {\n' + '\thdimage {\n' + '\t\tpartition-table-type = "gpt"\n' + '\t}\n' + '\n' + '\tpartition b {\n' + '\t\tin-partition-table = true\n' + '\t}\n' + '}\n', + [['any:6: GPT partition without partition-type-uuid: b (url#writing-genimage-cfg)', + '\tpartition b {\n']]), + ] + + [email protected]('testname,filename,string,expected', GptPartitionTypeUuid) +def test_GptPartitionTypeUuid(testname, filename, string, expected): + warnings = util.check_file(m.GptPartitionTypeUuid, filename, string) + assert warnings == expected + + +Indent = [ + ('empty file', + 'any', + '', + []), + ('good', + 'any', + '# x\n' + 'image a {\n' + '\tvfat {\n' + '\t\tfiles = {\n' + '\t\t\t"a",\n' + '\t\t}\n' + '\t}\n' + '\n' + '\t# x\n' + '\tsize = 1M\n' + '}\n', + []), + ('spaces', + 'any', + 'image a {\n' + ' size = 1M\n' + '}\n', + [['any:2: should be indented with 1 tab(s) (url#writing-genimage-cfg)', + ' size = 1M\n']]), + ('tabs and space', + 'any', + 'image a {\n' + '\t size = 1M\n' + '}\n', + [['any:2: should be indented with 1 tab(s) (url#writing-genimage-cfg)', + '\t size = 1M\n']]), + ('too many', + 'any', + '\timage a {\n' + '}\n', + [['any:1: should be indented with 0 tab(s) (url#writing-genimage-cfg)', + '\timage a {\n']]), + ('closing', + 'any', + 'image a {\n' + '\tvfat {\n' + '}\n' + '}\n', + [['any:3: should be indented with 1 tab(s) (url#writing-genimage-cfg)', + '}\n']]), + ('comment', + 'any', + 'image a {\n' + '# x\n' + '}\n', + [['any:2: should be indented with 1 tab(s) (url#writing-genimage-cfg)', + '# x\n']]), + ('unbalanced', + 'any', + '}\n' + '}\n', + []), + ] + + [email protected]('testname,filename,string,expected', Indent) +def test_Indent(testname, filename, string, expected): + warnings = util.check_file(m.Indent, filename, string) + assert warnings == expected + + +OptionAssignment = [ + ('empty file', + 'any', + '', + []), + ('good', + 'any', + '\tsize = 1M\n' + '\tfiles = {\n', + []), + ('append', + 'any', + '\tfiles += {\n', + []), + ('equal in string', + 'any', + '\texec-pre = "a=b"\n', + []), + ('in comment', + 'any', + '# a=b\n', + []), + ('in list', + 'any', + '\t\t"a=b",\n', + []), + ('no spaces', + 'any', + '\timage="a"\n', + [["any:1: use one space before and after '=' (url#writing-genimage-cfg)", + '\timage="a"\n']]), + ('two spaces after', + 'any', + '\tsize = 1M\n', + [["any:1: use one space before and after '=' (url#writing-genimage-cfg)", + '\tsize = 1M\n']]), + ('tab before', + 'any', + '\tsize\t= 1M\n', + [["any:1: use one space before and after '=' (url#writing-genimage-cfg)", + '\tsize\t= 1M\n']]), + ('no space before', + 'any', + '\tfiles= {\n', + [["any:1: use one space before and after '=' (url#writing-genimage-cfg)", + '\tfiles= {\n']]), + ] + + [email protected]('testname,filename,string,expected', OptionAssignment) +def test_OptionAssignment(testname, filename, string, expected): + warnings = util.check_file(m.OptionAssignment, filename, string) + assert warnings == expected + + +PartitionTypeUuidCase = [ + ('empty file', + 'any', + '', + []), + ('lower-case', + 'any', + 'partition-type-uuid = 2e54b353-1271-4842-806f-e436d6af6985\n', + []), + ('shortcut', + 'any', + 'partition-type-uuid = U\n', + []), + ('has a shortcut', + 'any', + 'partition-type-uuid = 0FC63DAF-8483-4772-8E79-3D69D8477DE4\n', + []), + ('upper-case', + 'any', + 'partition-type-uuid = 2E54B353-1271-4842-806F-E436D6AF6985\n', + [['any:1: partition-type-uuid must be in lower-case (url#writing-genimage-cfg)', + 'partition-type-uuid = 2E54B353-1271-4842-806F-E436D6AF6985\n', + '2e54b353-1271-4842-806f-e436d6af6985']]), + ] + + [email protected]('testname,filename,string,expected', PartitionTypeUuidCase) +def test_PartitionTypeUuidCase(testname, filename, string, expected): + warnings = util.check_file(m.PartitionTypeUuidCase, filename, string) + assert warnings == expected + + +PartitionTypeUuidQuotes = [ + ('empty file', + 'any', + '', + []), + ('good', + 'any', + 'partition-type-uuid = U\n', + []), + ('other option', + 'any', + 'partition-uuid = "U"\n', + []), + ('quoted', + 'any', + 'partition-type-uuid = "U"\n', + [['any:1: partition-type-uuid must not be quoted (url#writing-genimage-cfg)', + 'partition-type-uuid = "U"\n']]), + ] + + [email protected]('testname,filename,string,expected', PartitionTypeUuidQuotes) +def test_PartitionTypeUuidQuotes(testname, filename, string, expected): + warnings = util.check_file(m.PartitionTypeUuidQuotes, filename, string) + assert warnings == expected + + +PartitionTypeUuidShortcut = [ + ('empty file', + 'any', + '', + []), + ('shortcut', + 'any', + 'partition-type-uuid = U\n', + []), + ('no shortcut', + 'any', + 'partition-type-uuid = 2e54b353-1271-4842-806f-e436d6af6985\n', + []), + ('placeholder', + 'any', + 'partition-type-uuid = %UUID%\n', + []), + ('letter', + 'any', + 'partition-type-uuid = c12a7328-f81f-11d2-ba4b-00a0c93ec93b\n', + [['any:1: use the U shortcut for partition-type-uuid (url#writing-genimage-cfg)', + 'partition-type-uuid = c12a7328-f81f-11d2-ba4b-00a0c93ec93b\n']]), + ('upper-case', + 'any', + 'partition-type-uuid = 0FC63DAF-8483-4772-8E79-3D69D8477DE4\n', + [['any:1: use the L shortcut for partition-type-uuid (url#writing-genimage-cfg)', + 'partition-type-uuid = 0FC63DAF-8483-4772-8E79-3D69D8477DE4\n']]), + ('root', + 'any', + 'partition-type-uuid = b921b045-1df0-41c3-af44-4c6f280d3fae\n', + [['any:1: use the root-arm64 shortcut for partition-type-uuid (url#writing-genimage-cfg)', + 'partition-type-uuid = b921b045-1df0-41c3-af44-4c6f280d3fae\n']]), + ] + + [email protected]('testname,filename,string,expected', PartitionTypeUuidShortcut) +def test_PartitionTypeUuidShortcut(testname, filename, string, expected): + warnings = util.check_file(m.PartitionTypeUuidShortcut, filename, string) + assert warnings == expected + + +SizeNotation = [ + ('empty file', + 'any', + '', + []), + ('suffixes', + 'any', + 'size = 1G\n' + 'offset = 1M\n' + 'size = 1K # x\n', + []), + ('zero', + 'any', + 'offset = 0\n', + []), + ('hexadecimal', + 'any', + 'offset = 0x201\n', + []), + ('byte count', + 'any', + 'offset = 512\n', + []), + ('percentage', + 'any', + 'size = 50%\n', + []), + ('placeholder', + 'any', + 'offset = %IMXOFFSET%\n', + []), + ('other option', + 'any', + 'pebsize = 65536\n', + []), + ('quoted', + 'any', + 'size = "1M"\n', + []), + ('lower-case', + 'any', + 'size = 1k\n', + [['any:1: use G, M, K, a 0x prefix or a byte count (url#writing-genimage-cfg)', + 'size = 1k\n']]), + ('unit', + 'any', + 'size = 1MB\n', + [['any:1: use G, M, K, a 0x prefix or a byte count (url#writing-genimage-cfg)', + 'size = 1MB\n']]), + ('useless byte count', + 'any', + 'offset = 1024\n', + [['any:1: use 1K instead of 1024 (url#writing-genimage-cfg)', + 'offset = 1024\n']]), + ('useless hexadecimal', + 'any',
utils/checkpackagelib/test_lib_genimage.py line 623
Quoted 10 lines
utils/checkpackagelib/test_lib_genimage.py new file +10
-0+ 'offset = 0x100000\n', + [['any:1: use 1M instead of 0x100000 (url#writing-genimage-cfg)', + 'offset = 0x100000\n']]), + ] + + [email protected]('testname,filename,string,expected', SizeNotation) +def test_SizeNotation(testname, filename, string, expected): + warnings = util.check_file(m.SizeNotation, filename, string) + assert warnings == expected
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Hi Edgar,
Quoted 15 lines · Edgar Bonet
Hello!
Quoted 11 lines · Giulio Benetti
The coding style of the genimage.cfg files is described in the "The genimage.cfg file" section of the manual, but nothing enforces it. Add a library checking these rules:
- indentation with tabs, according to the nesting level
- position of the curly brackets
- empty line after a node, except for the last one
- one space before and after '='
- filename beginning with genimage
- notation of the offset and size options
- GB, MB, KB units in comments
Quoted 5 lines
Within genimage, ‘k’, ‘M’ and ‘G’ are binary units (powers of 1024 bytes). This can lead to some confusion, as HDD sizes are quoted with decimal prefixes (powers of 1000). Micro-SD cards used to be quoted with binary prefixes, but most (maybe all?) manufacturers have switched to decimal prefixes.
you're right,
Quoted 4 lines
In order to avoid the confusion, it would be preferable to use the IEC prefixes in the comments: KiB, MiB and GiB. This would be consistent with the notation used by ‘dd’, where MiB = M = 1024^2 B, whereas MB = 10^6 B.
thanks for pointing. And yes that would be preferable but I need to add
IEC support to genimage and wait for my patch to be accepted before checking against those prefixes. So I think this is a different but useful thing.
I'm creating the patch right now.
Best regards
Giulio
Quoted 1,207 lines
Regards,
Edgar Bonet.
Quoted 1,203 lines
- partition-type-uuid set for every partition of a GPT image, unquoted, using the genimage shortcut when there is one, and in lower-case otherwise
The table of shortcuts comes from genimage's
image-hd.c.Files generated from a template (genimage.cfg.in, genimage.cfg.template*) are not checked, since they contain placeholders.
Add the existing files that do not follow the rules to .checkpackageignore.
Assisted-by Claude Opus 5.5 <[email protected]>Signed-off-by Giulio Benetti <[email protected]>--- .checkpackageignore | 46 ++ utils/check-package | 7 + utils/checkpackagelib/lib_genimage.py | 407 ++++++++++++++ utils/checkpackagelib/test_lib_genimage.py | 623 +++++++++++++++++++++ 4 files changed, 1083 insertions(+)create mode 100644
utils/checkpackagelib/lib_genimage.pycreate mode 100644utils/checkpackagelib/test_lib_genimage.py.checkpackageignore +46
-0@@ -1,48 +1,89 @@ +board/aarch64-efi/genimage-efi.cfg lib_genimage.EmptyLineAfterNode +board/amarula/vyasa/genimage.cfg lib_genimage.CommentUnits board/amarula/vyasa/post-build.sh Shellcheck +board/andes/ae350/genimage_sdcard.cfg lib_genimage.EmptyLineAfterNode board/arcturus/aarch64-ucls1012a/post-build.sh Shellcheck board/arcturus/aarch64-ucls1012a/post-image.sh Shellcheck +board/arm/fvp-ebbr/genimage.cfg lib_genimage.PartitionTypeUuidShortcut +board/aspeed/ast2500-evb/genimage.cfg lib_genimage.EmptyLineAfterNode lib_genimage.OptionAssignment +board/aspeed/ast2600-evb/genimage.cfg lib_genimage.EmptyLineAfterNode board/aspeed/common/post-image.sh Shellcheck board/asus/tinker/post-build.sh Shellcheck board/atmel/flasher.sh Shellcheck +board/avnet/rzboard_v2l/genimage.cfg lib_genimage.EmptyLineAfterNode lib_genimage.GptPartitionTypeUuid board/beagleboard/beaglebone-qt5/patches/linux/0001-keep-jtag-clock-alive-for-debugger.patch lib_patch.Upstream +board/beagleboard/beagleplay/genimage.cfg lib_genimage.Indent +board/beagleboard/beaglev_fire/genimage.cfg lib_genimage.EmptyLineAfterNode lib_genimage.GptPartitionTypeUuid lib_genimage.Indent lib_genimage.PartitionTypeUuidCase lib_genimage.PartitionTypeUuidShortcut board/boundarydevices/common/post-build.sh Shellcheck board/boundarydevices/common/post-image.sh Shellcheck board/broadcom/northstar/post-image.sh Shellcheck board/bsh/imx8mn-bsh-smm-s2-pro/flash.sh Shellcheck lib_shellscript.EmptyLastLine +board/bsh/imx8mn-bsh-smm-s2-pro/genimage.cfg lib_genimage.GptPartitionTypeUuid board/bsh/imx8mn-bsh-smm-s2-pro/post-build.sh Shellcheck board/bsh/imx8mn-bsh-smm-s2-pro/post-image.sh Shellcheck board/bsh/imx8mn-bsh-smm-s2/flash.sh Shellcheck lib_shellscript.EmptyLastLine board/bsh/imx8mn-bsh-smm-s2/post-build.sh Shellcheck +board/canaan/k210-soc/genimage.cfg lib_genimage.EmptyLineAfterNode board/canaan/k210-soc/post-build.sh Shellcheck board/chromebook/elm/sign.sh Shellcheck board/chromebook/mksd.sh Shellcheck board/ci20/patches/uboot/0001-mips-Remove-default-endiannes.patch lib_patch.Upstream +board/compulab/iot-gate-imx8-ebbr/genimage.cfg lib_genimage.PartitionTypeUuidCase +board/coolpi/coolpi-4b/genimage.cfg lib_genimage.EmptyLineAfterNode lib_genimage.GptPartitionTypeUuid board/freescale/common/imx/imx8-bootloader-prepare.sh Shellcheck board/freescale/common/mxs/post-image.sh Shellcheck board/friendlyarm/nanopi-r2s/post-build.sh Shellcheck +board/grinn/liteboard/genimage.cfg lib_genimage.CommentUnits board/hardkernel/odroidc2/post-image.sh Shellcheck board/hardkernel/odroidc2/rootfs_overlay/etc/init.d/S09modload Shellcheck lib_sysv.Variables +board/khadas/vim3/genimage.cfg lib_genimage.OptionAssignment +board/kontron/bl-imx8mm/genimage.cfg lib_genimage.GptPartitionTypeUuid board/kontron/bl-imx8mm/post-build.sh Shellcheck +board/kontron/smarc-sal28/genimage.cfg lib_genimage.GptPartitionTypeUuid board/kontron/smarc-sal28/post-build.sh Shellcheck +board/lego/ev3/genimage.cfg lib_genimage.CommentUnits lib_genimage.EmptyLineAfterNode board/lego/ev3/post-image.sh Shellcheck +board/loongarch64-efi/genimage-efi.cfg lib_genimage.EmptyLineAfterNode +board/mender/x86_64/genimage-efi.cfg lib_genimage.EmptyLineAfterNode lib_genimage.PartitionTypeUuidShortcut +board/microchip/mpfs_icicle/genimage.cfg lib_genimage.EmptyLineAfterNode lib_genimage.GptPartitionTypeUuid lib_genimage.Indent lib_genimage.PartitionTypeUuidCase +board/microchip/sama7g5ek/genimage.cfg lib_genimage.EmptyLineAfterNode +board/minnowboard/genimage.cfg lib_genimage.EmptyLineAfterNode board/minnowboard/post-build.sh Shellcheck board/nexbox/a95x/post-build.sh Shellcheck board/nexbox/a95x/post-image.sh Shellcheck +board/octavo/osd32mp1-brk/genimage.cfg lib_genimage.GptPartitionTypeUuid board/octavo/osd32mp1-brk/patches/uboot/0001-Add-OSD32MP1-BRK-device-tree-support.patch lib_patch.NumberedSubject lib_patch.Upstream board/octavo/osd32mp1-brk/patches/uboot/0002-Add-OSD32MP1-BRK-build-config.patch lib_patch.NumberedSubject lib_patch.Upstream +board/octavo/osd32mp1-red/genimage.cfg lib_genimage.GptPartitionTypeUuid board/octavo/osd32mp1-red/patches/uboot/0001-Add-OSD32MP1-RED-Device-Tree-support.patch lib_patch.NumberedSubject lib_patch.Upstream board/octavo/osd32mp1-red/patches/uboot/0002-configs-stm32mp15_trusted_defconfig-disable-environm.patch lib_patch.NumberedSubject lib_patch.Upstream +board/olimex/stmp1_olinuxino/genimage.cfg lib_genimage.GptPartitionTypeUuid board/olpc/post-build.sh Shellcheck +board/orangepi/common/genimage.cfg lib_genimage.GptPartitionTypeUuid board/orangepi/common/post-build.sh Shellcheck +board/orangepi/orangepi-5-plus/genimage.cfg lib_genimage.PartitionTypeUuidShortcut board/orangepi/orangepi-zero/patches/linux/0001-ARM-dts-orange-pi-zero-interrupt-triggering-xr819.patch lib_patch.Upstream board/orangepi/orangepi-zero/patches/linux/0002-ARM-dts-orange-pi-zero-enable-spi-nor.patch lib_patch.Upstream board/orangepi/orangepi-zero/patches/linux/0003-ARM-dts-orange-pi-zero-enable-spidev.patch lib_patch.Upstream board/orangepi/orangepi-zero/patches/linux/0004-ARM-dts-orange-pi-zero-enable-uart.patch lib_patch.Upstream +board/pc/genimage-efi.cfg lib_genimage.PartitionTypeUuidShortcut +board/pine64/rockpro64-ebbr/genimage.cfg lib_genimage.PartitionTypeUuidCase +board/pine64/rockpro64/genimage.cfg lib_genimage.GptPartitionTypeUuid lib_genimage.PartitionTypeUuidShortcut +board/pine64/star64/genimage.cfg lib_genimage.GptPartitionTypeUuid lib_genimage.Indent lib_genimage.PartitionTypeUuidCase +board/qemu/aarch64-ebbr/genimage.cfg lib_genimage.PartitionTypeUuidShortcut board/qemu/aarch64-sbsa/assemble-flash-images Shellcheck +board/qemu/aarch64-sbsa/genimage.cfg lib_genimage.PartitionTypeUuidShortcut +board/qemu/arm-ebbr/genimage.cfg lib_genimage.PartitionTypeUuidShortcut +board/qemu/loongarch64-virt-efi/genimage.cfg lib_genimage.EmptyLineAfterNode +board/qemu/riscv64-virt-efi/genimage.cfg lib_genimage.PartitionTypeUuidShortcut +board/radxa/rock5b/genimage.cfg lib_genimage.PartitionTypeUuidShortcut board/raspberrypi/post-build.sh Shellcheck board/raspberrypi/post-image.sh Shellcheck +board/seeed/stm32mp157c-odyssey/genimage.cfg lib_genimage.GptPartitionTypeUuid board/seeed/stm32mp157c-odyssey/patches/linux/0001-ARM-dts-stm32-fix-stm32mp157c-odyssey-card-detect.patch lib_patch.Upstream board/sheevaplug/patches/uboot/0001-Remove-redundant-YYLOC-global-declaration.patch lib_patch.Upstream +board/sifive/common/genimage_sdcard.cfg lib_genimage.PartitionTypeUuidShortcut +board/sipeed/licheepi_nano/genimage.cfg lib_genimage.CurlyBrackets lib_genimage.EmptyLastLine lib_genimage.EmptyLineAfterNode board/solidrun/clearfog/post-build.sh Shellcheck board/solidrun/macchiatobin/post-build-mainline.sh Shellcheck board/solidrun/macchiatobin/post-build.sh Shellcheck@@ -52,7 +93,9 @@ board/stmicroelectronics/stm32f429-disco/flash.sh Shellcheck board/stmicroelectronics/stm32f469-disco/flash_sd.sh Shellcheck board/stmicroelectronics/stm32f469-disco/flash_xip.sh Shellcheck board/synopsys/axs10x/post-build.sh Shellcheck +board/ti/am574x-idk/genimage.cfg lib_genimage.Indent board/udoo/common/post-build.sh Shellcheck +board/visionfive2/genimage.cfg lib_genimage.PartitionTypeUuidShortcut boot/afboot-stm32/0003-Makefile-disable-stack-protector.patch lib_patch.Upstream boot/optee-os/3.13.0/0001-core-zlib-fix-build-warning-when-_LFS64_LARGEFILE-is.patch lib_patch.Upstream boot/syslinux/0001-bios-Fix-alignment-change-with-gcc-5.patch lib_patch.Upstream@@ -980,6 +1023,9 @@ support/scripts/fix-configure-powerpc64.sh lib_shellscript.EmptyLastLine support/scripts/generate-gitlab-ci-yml Shellcheck support/scripts/mkmakefile Shellcheck lib_shellscript.ConsecutiveEmptyLines support/scripts/setlocalversion Shellcheck +support/testing/tests/boot/test_grub/genimage-aarch64-efi.cfg lib_genimage.PartitionTypeUuidShortcut support/testing/tests/core/post-build.sh Shellcheck support/testing/tests/package/test_opkg/post-build.sh Shellcheck +support/testing/tests/package/test_xen/aarch64/genimage.cfg lib_genimage.PartitionTypeUuidCase +support/testing/tests/package/test_xen/arm/genimage.cfg lib_genimage.PartitionTypeUuidCase support/testing/tests/utils/test_get_developers/0001-package-binutils-change-.mk.patch lib_patch.NumberedSubject lib_patch.Upstreamutils/check-package +7
-0@@ -19,6 +19,7 @@ import sys import checkpackagelib.base import checkpackagelib.lib_config import checkpackagelib.lib_defconfig +import checkpackagelib.lib_genimage import checkpackagelib.lib_hash import checkpackagelib.lib_ignore import checkpackagelib.lib_mk@@ -159,6 +160,10 @@ SYSV_INIT_SCRIPT_FILENAME = re.compile(r"/S\d\d[^/]+$") # in a br2-external tree. BR_DEFCONFIG_FILENAME = re.compile(r"^(.+/)?configs/[^/]+_defconfig$") +# Match any name containing genimage, so that the ones with a wrong prefix are +# reported. +GENIMAGE_CFG_FILENAME = re.compile(r"genimage[^/]*\.cfg$") + def get_lib_from_filename(fname): if flags.intree_only:@@ -176,6 +181,8 @@ def get_lib_from_filename(fname): return checkpackagelib.lib_config if BR_DEFCONFIG_FILENAME.search(fname): return checkpackagelib.lib_defconfig + if GENIMAGE_CFG_FILENAME.search(fname): + return checkpackagelib.lib_genimage if fname.endswith(".hash"): return checkpackagelib.lib_hash if fname.endswith(".mk") or fname.endswith(".mk.in"):utils/checkpackagelib/lib_genimage.py new file +407
-0@@ -0,0 +1,407 @@ +# See utils/checkpackagelib/readme.txt before editing this file. + +import os +import re + +from checkpackagelib.base import _CheckFunction +from checkpackagelib.lib import ConsecutiveEmptyLines # noqa: F401 +from checkpackagelib.lib import EmptyLastLine # noqa: F401 +from checkpackagelib.lib import NewlineAtEof # noqa: F401 +from checkpackagelib.lib import TrailingSpace # noqa: F401 +from checkpackagelib.lib import Utf8Characters # noqa: F401 +from checkpackagelib.tool import NotExecutable # noqa: F401 + +# used in more than one check +STRING_OR_COMMENT = re.compile(r"(\"[^\"]*\"|'[^']*')|(#|//).*") + + +def strip_comment(text): + return STRING_OR_COMMENT.sub(lambda m: m.group(1) or "", text).strip() + + +def strip_comment_and_strings(text): + return STRING_OR_COMMENT.sub(lambda m: '""' if m.group(1) else "", text).strip() + + +class _Structure(_CheckFunction): + """Keeps track of the curly brackets, to know where each line is located""" + BRACKET = re.compile(r"[{}]") + LIST = re.compile(r"=\s*$") + + def before(self): + # One entry per open curly bracket: the words of the node's name, or + # None for a list, e.g. 'files = {' + self.stack = [] + + def track(self, code): + """Update the stack, return the list of entries that were closed""" + closed = [] + start = 0 + for m in self.BRACKET.finditer(code): + if m.group() == "{": + name = code[start:m.start()] + self.stack.append(None if self.LIST.search(name) else name.split()) + elif self.stack: + closed.append(self.stack.pop()) + start = m.end() + return closed + + +class CommentUnits(_CheckFunction): + COMMENT = re.compile(r"(?:\"[^\"]*\"|'[^']*'|[^\"'#])*?(?:#|//)(.*)") + UNIT = re.compile(r"\b\d+ ?([kmg]b?)\b", re.IGNORECASE) + ALLOWED = ["GB", "MB", "KB"] + + def check_line(self, lineno, text): + comment = self.COMMENT.match(text) + if not comment: + return + for unit in self.UNIT.findall(comment.group(1)): + if unit not in self.ALLOWED: + return ["{}:{}: use GB, MB or KB in comments ({}#writing-genimage-cfg)" + .format(self.filename, lineno, self.url_to_manual), + text] + + +class CurlyBrackets(_Structure): + def check_line(self, lineno, text): + code = strip_comment_and_strings(text) + in_list = bool(self.stack) and self.stack[-1] is None + closed = self.track(code) + + if code.startswith("{"): + return ["{}:{}: open curly bracket must be on the same line as the name ({}#writing-genimage-cfg)" + .format(self.filename, lineno, self.url_to_manual), + text] + # lists can be on a single line + if any(entry is not None for entry in closed) and code != "}": + return ["{}:{}: closing curly bracket must be alone on its line ({}#writing-genimage-cfg)" + .format(self.filename, lineno, self.url_to_manual), + text] + opens_node = "{" in code and not in_list and "=" not in code.split("{")[0] + if opens_node and not code.endswith("{"): + return ["{}:{}: node content must start on a new line ({}#writing-genimage-cfg)" + .format(self.filename, lineno, self.url_to_manual), + text] + + +class EmptyLineAfterNode(_Structure): + def before(self): + super().before() + self.after_node = False + + def check_line(self, lineno, text): + code = strip_comment_and_strings(text) + missing = self.after_node and text.strip() != "" and not code.startswith("}") + closed = self.track(code) + self.after_node = bool(closed) and closed[-1] is not None + + if missing: + return ["{}:{}: missing empty line after the previous node ({}#writing-genimage-cfg)" + .format(self.filename, lineno, self.url_to_manual), + text] + + +class Filename(_CheckFunction): + def before(self): + if not os.path.basename(self.filename).startswith("genimage"): + return ["{}:0: filename must begin with genimage ({}#writing-genimage-cfg)" + .format(self.filename, self.url_to_manual)] + + +class GptPartitionTypeUuid(_Structure): + """Checks that each partition of a GPT image has a partition-type-uuid""" + OPTION = re.compile(r"^([a-z-]+)\s*=\s*[\"']?([^\"'\s]*)") + FALSE = ["false", "no", "off"] + + def before(self): + super().before() + self.gpt = False + self.partition = None + self.missing = [] + + def check_line(self, lineno, text): + code = strip_comment_and_strings(text) + closed = self.track(code) + node = self.stack[-1][0] if self.stack and self.stack[-1] else None + + if closed: + for entry in closed: + if not entry: + continue + if entry[0] == "partition" and self.partition: + if self.partition["needs-type"]: + self.missing.append(self.partition) + self.partition = None + elif entry[0] == "image": + gpt, missing = self.gpt, self.missing + self.gpt, self.missing = False, [] + if gpt and missing: + return ["{}:{}: GPT partition without partition-type-uuid: {} ({}#writing-genimage-cfg)" + .format(self.filename, missing[0]["lineno"], + ", ".join(p["name"] for p in missing), + self.url_to_manual), + missing[0]["text"]] + return + + if node == "partition" and code.endswith("{"): + self.partition = {"name": " ".join(strip_comment(text).rstrip("{").split()[1:]), + "lineno": lineno, "text": text, "needs-type": True} + return + + option = self.OPTION.search(strip_comment(text)) + if not option: + return + name, value = option.groups() + if node == "hdimage": + # 'gpt = true' is the deprecated form + if name == "partition-table-type": + self.gpt = value in ["gpt", "hybrid"] + elif name == "gpt": + self.gpt = value.lower() not in self.FALSE + elif node == "partition" and self.partition: + if name == "partition-type-uuid": + self.partition["needs-type"] = False + elif name == "in-partition-table" and value.lower() in self.FALSE: + self.partition["needs-type"] = False + + +class Indent(_Structure): + def check_line(self, lineno, text): + if text.strip() == "": + return + code = strip_comment_and_strings(text) + expected = len(self.stack) + if code.startswith("}"): + expected = max(0, expected - 1) + self.track(code) + + if text[:len(text) - len(text.lstrip())] != "\t" * expected: + return ["{}:{}: should be indented with {} tab(s) ({}#writing-genimage-cfg)" + .format(self.filename, lineno, expected, self.url_to_manual), + text] + + +class OptionAssignment(_CheckFunction): + ASSIGNMENT = re.compile(r"^[\w-]+(\s*)\+?=(\s*)(.*)$") + + def check_line(self, lineno, text): + m = self.ASSIGNMENT.search(strip_comment(text)) + if not m: + return + space_before, space_after, value = m.groups() + if space_before != " " or (value and space_after != " "): + return ["{}:{}: use one space before and after '=' ({}#writing-genimage-cfg)" + .format(self.filename, lineno, self.url_to_manual), + text] + + +class SizeNotation(_CheckFunction): + OPTION = re.compile(r"^(?:offset|size)\s*=\s*[\"']?(\d[^\"'\s]*)") + ALLOWED = re.compile(r"^(0x[0-9a-fA-F]+|\d+[GMK]?)$") + # genimage also accepts a percentage of the available space as size + PERCENTAGE = re.compile(r"^\d+%$") + + def check_line(self, lineno, text): + m = self.OPTION.search(strip_comment(text)) + if not m: + return + value = m.group(1) + if self.PERCENTAGE.match(value): + return + if not self.ALLOWED.match(value): + return ["{}:{}: use G, M, K, a 0x prefix or a byte count ({}#writing-genimage-cfg)" + .format(self.filename, lineno, self.url_to_manual), + text] + if value[-1] in "GMK": + return + count = int(value, 16) if value.startswith("0x") else int(value) + if count == 0 or count % 1024: + return + for suffix, unit in [("G", 1 << 30), ("M", 1 << 20), ("K", 1 << 10)]: + if count % unit == 0: + return ["{}:{}: use {}{} instead of {} ({}#writing-genimage-cfg)" + .format(self.filename, lineno, count // unit, suffix, value, self.url_to_manual), + text] + + +class _PartitionTypeUuid(_CheckFunction): + OPTION = re.compile(r"^partition-type-uuid\s*=\s*(\S+)") + GUID = re.compile(r"^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$", re.IGNORECASE) + # See gpt_partition_type_shortcuts in genimage's image-hd.c + SHORTCUTS = { + "0fc63daf-8483-4772-8e79-3d69d8477de4": "L", + "0657fd6d-a4ab-43c4-84e5-0933c84b4f4f": "S", + "933ac7e1-2eb4-4f13-b844-0e14e2aef915": "H", + "c12a7328-f81f-11d2-ba4b-00a0c93ec93b": "U", + "a19d880f-05fc-4d3b-a006-743f0f84911e": "R", + "e6d6d379-f507-44c2-a23c-238f2a3df928": "V", + "ebd0a0a2-b9e5-4433-87c0-68b6b72699c7": "F", + "4778ed65-bf42-45fa-9c5b-287a1dc4aab1": "barebox-state", + "6c3737f2-07f8-45d1-ad45-15d260aab24d": "barebox-env", + "3de21764-95bd-54bd-a5c3-4abe786f38a8": "u-boot-env", + "6523f8ae-3eb1-4e2a-a05a-18b695ae656f": "root-alpha", + "d27f46ed-2919-4cb8-bd25-9531f3c16534": "root-arc", + "69dad710-2ce4-4e3c-b16c-21a1d49abed3": "root-arm", + "b921b045-1df0-41c3-af44-4c6f280d3fae": "root-arm64", + "993d8d3d-f80e-4225-855a-9daf8ed7ea97": "root-ia64", + "77055800-792c-4f94-b39a-98c91b762bb6": "root-loongarch64", + "e9434544-6e2c-47cc-bae2-12d6deafb44c": "root-mips", + "d113af76-80ef-41b4-bdb6-0cff4d3d4a25": "root-mips64", + "37c58c8a-d913-4156-a25f-48b1b64e07f0": "root-mips-le", + "700bda43-7a34-4507-b179-eeb93d7a7ca3": "root-mips64-le", + "1aacdb3b-5444-4138-bd9e-e5c2239b2346": "root-parisc", + "1de3f1ef-fa98-47b5-8dcd-4a860a654d78": "root-ppc", + "912ade1d-a839-4913-8964-a10eee08fbd2": "root-ppc64", + "c31c45e6-3f39-412e-80fb-4809c4980599": "root-ppc64-le", + "60d5a7fe-8e7d-435c-b714-3dd8162144e1": "root-riscv32", + "72ec70a6-cf74-40e6-bd49-4bda08e8f224": "root-riscv64", + "08a7acea-624c-4a20-91e8-6e0fa67d23f9": "root-s390", + "5eead9a9-fe09-4a1e-a1d7-520d00531306": "root-s390x", + "c50cdd70-3862-4cc3-90e1-809a8c93ee2c": "root-tilegx", + "44479540-f297-41b2-9af7-d131d5f0458a": "root-x86", + "4f68bce3-e8cd-4db1-96e7-fbcaf984b709": "root-x86-64", + "e18cf08c-33ec-4c0d-8246-c6c6fb3da024": "usr-alpha", + "7978a683-6316-4922-bbee-38bff5a2fecc": "usr-arc", + "7d0359a3-02b3-4f0a-865c-654403e70625": "usr-arm", + "b0e01050-ee5f-4390-949a-9101b17104e9": "usr-arm64", + "4301d2a6-4e3b-4b2a-bb94-9e0b2c4225ea": "usr-ia64", + "e611c702-575c-4cbe-9a46-434fa0bf7e3f": "usr-loongarch64", + "773b2abc-2a99-4398-8bf5-03baac40d02b": "usr-mips", + "57e13958-7331-4365-8e6e-35eeee17c61b": "usr-mips64", + "0f4868e9-9952-4706-979f-3ed3a473e947": "usr-mips-le", + "c97c1f32-ba06-40b4-9f22-236061b08aa8": "usr-mips64-le", + "dc4a4480-6917-4262-a4ec-db9384949f25": "usr-parisc", + "7d14fec5-cc71-415d-9d6c-06bf0b3c3eaf": "usr-ppc", + "2c9739e2-f068-46b3-9fd0-01c5a9afbcca": "usr-ppc64", + "15bb03af-77e7-4d4a-b12b-c0d084f7491c": "usr-ppc64-le", + "b933fb22-5c3f-4f91-af90-e2bb0fa50702": "usr-riscv32", + "beaec34b-8442-439b-a40b-984381ed097d": "usr-riscv64", + "cd0f869b-d0fb-4ca0-b141-9ea87cc78d66": "usr-s390", + "8a4f5770-50aa-4ed3-874a-99b710db6fea": "usr-s390x", + "55497029-c7c1-44cc-aa39-815ed1558630": "usr-tilegx", + "75250d76-8cc6-458e-bd66-bd47cc81a812": "usr-x86", + "8484680c-9521-48c6-9c11-b0720656f69e": "usr-x86-64", + "fc56d9e9-e6e5-4c06-be32-e74407ce09a5": "root-alpha-verity", + "24b2d975-0f97-4521-afa1-cd531e421b8d": "root-arc-verity", + "7386cdf2-203c-47a9-a498-f2ecce45a2d6": "root-arm-verity", + "df3300ce-d69f-4c92-978c-9bfb0f38d820": "root-arm64-verity", + "86ed10d5-b607-45bb-8957-d350f23d0571": "root-ia64-verity", + "f3393b22-e9af-4613-a948-9d3bfbd0c535": "root-loongarch64-verity", + "7a430799-f711-4c7e-8e5b-1d685bd48607": "root-mips-verity", + "579536f8-6a33-4055-a95a-df2d5e2c42a8": "root-mips64-verity", + "d7d150d2-2a04-4a33-8f12-16651205ff7b": "root-mips-le-verity", + "16b417f8-3e06-4f57-8dd2-9b5232f41aa6": "root-mips64-le-verity", + "d212a430-fbc5-49f9-a983-a7feef2b8d0e": "root-parisc-verity", + "906bd944-4589-4aae-a4e4-dd983917446a": "root-ppc64-le-verity", + "9225a9a3-3c19-4d89-b4f6-eeff88f17631": "root-ppc64-verity", + "98cfe649-1588-46dc-b2f0-add147424925": "root-ppc-verity", + "ae0253be-1167-4007-ac68-43926c14c5de": "root-riscv32-verity", + "b6ed5582-440b-4209-b8da-5ff7c419ea3d": "root-riscv64-verity", + "7ac63b47-b25c-463b-8df8-b4a94e6c90e1": "root-s390-verity", + "b325bfbe-c7be-4ab8-8357-139e652d2f6b": "root-s390x-verity", + "966061ec-28e4-4b2e-b4a5-1f0a825a1d84": "root-tilegx-verity", + "2c7357ed-ebd2-46d9-aec1-23d437ec2bf5": "root-x86-64-verity", + "d13c5d3b-b5d1-422a-b29f-9454fdc89d76": "root-x86-verity", + "8cce0d25-c0d0-4a44-bd87-46331bf1df67": "usr-alpha-verity", + "fca0598c-d880-4591-8c16-4eda05c7347c": "usr-arc-verity", + "c215d751-7bcd-4649-be90-6627490a4c05": "usr-arm-verity", + "6e11a4e7-fbca-4ded-b9e9-e1a512bb664e": "usr-arm64-verity", + "6a491e03-3be7-4545-8e38-83320e0ea880": "usr-ia64-verity", + "f46b2c26-59ae-48f0-9106-c50ed47f673d": "usr-loongarch64-verity", + "6e5a1bc8-d223-49b7-bca8-37a5fcceb996": "usr-mips-verity", + "81cf9d90-7458-4df4-8dcf-c8a3a404f09b": "usr-mips64-verity", + "46b98d8d-b55c-4e8f-aab3-37fca7f80752": "usr-mips-le-verity", + "3c3d61fe-b5f3-414d-bb71-8739a694a4ef": "usr-mips64-le-verity", + "5843d618-ec37-48d7-9f12-cea8e08768b2": "usr-parisc-verity", + "ee2b9983-21e8-4153-86d9-b6901a54d1ce": "usr-ppc64-le-verity", + "bdb528a5-a259-475f-a87d-da53fa736a07": "usr-ppc64-verity", + "df765d00-270e-49e5-bc75-f47bb2118b09": "usr-ppc-verity", + "cb1ee4e3-8cd0-4136-a0a4-aa61a32e8730": "usr-riscv32-verity", + "8f1056be-9b05-47c4-81d6-be53128e5b54": "usr-riscv64-verity", + "b663c618-e7bc-4d6d-90aa-11b756bb1797": "usr-s390-verity", + "31741cc4-1a2a-4111-a581-e00b447d2d06": "usr-s390x-verity", + "2fb4bf56-07fa-42da-8132-6b139f2026ae": "usr-tilegx-verity", + "77ff5f63-e7b6-4633-acf4-1565b864c0e6": "usr-x86-64-verity", + "8f461b0d-14ee-4e81-9aa9-049b6fb97abd": "usr-x86-verity", + "d46495b7-a053-414f-80f7-700c99921ef8": "root-alpha-verity-sig", + "143a70ba-cbd3-4f06-919f-6c05683a78bc": "root-arc-verity-sig", + "42b0455f-eb11-491d-98d3-56145ba9d037": "root-arm-verity-sig", + "6db69de6-29f4-4758-a7a5-962190f00ce3": "root-arm64-verity-sig", + "e98b36ee-32ba-4882-9b12-0ce14655f46a": "root-ia64-verity-sig", + "5afb67eb-ecc8-4f85-ae8e-ac1e7c50e7d0": "root-loongarch64-verity-sig", + "bba210a2-9c5d-45ee-9e87-ff2ccbd002d0": "root-mips-verity-sig", + "43ce94d4-0f3d-4999-8250-b9deafd98e6e": "root-mips64-verity-sig", + "c919cc1f-4456-4eff-918c-f75e94525ca5": "root-mips-le-verity-sig", + "904e58ef-5c65-4a31-9c57-6af5fc7c5de7": "root-mips64-le-verity-sig", + "15de6170-65d3-431c-916e-b0dcd8393f25": "root-parisc-verity-sig", + "d4a236e7-e873-4c07-bf1d-bf6cf7f1c3c6": "root-ppc64-le-verity-sig", + "f5e2c20c-45b2-4ffa-bce9-2a60737e1aaf": "root-ppc64-verity-sig", + "1b31b5aa-add9-463a-b2ed-bd467fc857e7": "root-ppc-verity-sig", + "3a112a75-8729-4380-b4cf-764d79934448": "root-riscv32-verity-sig", + "efe0f087-ea8d-4469-821a-4c2a96a8386a": "root-riscv64-verity-sig", + "3482388e-4254-435a-a241-766a065f9960": "root-s390-verity-sig", + "c80187a5-73a3-491a-901a-017c3fa953e9": "root-s390x-verity-sig", + "b3671439-97b0-4a53-90f7-2d5a8f3ad47b": "root-tilegx-verity-sig", + "41092b05-9fc8-4523-994f-2def0408b176": "root-x86-64-verity-sig", + "5996fc05-109c-48de-808b-23fa0830b676": "root-x86-verity-sig", + "5c6e1c76-076a-457a-a0fe-f3b4cd21ce6e": "usr-alpha-verity-sig", + "94f9a9a1-9971-427a-a400-50cb297f0f35": "usr-arc-verity-sig", + "d7ff812f-37d1-4902-a810-d76ba57b975a": "usr-arm-verity-sig", + "c23ce4ff-44bd-4b00-b2d4-b41b3419e02a": "usr-arm64-verity-sig", + "8de58bc2-2a43-460d-b14e-a76e4a17b47f": "usr-ia64-verity-sig", + "b024f315-d330-444c-8461-44bbde524e99": "usr-loongarch64-verity-sig", + "97ae158d-f216-497b-8057-f7f905770f54": "usr-mips-verity-sig", + "05816ce2-dd40-4ac6-a61d-37d32dc1ba7d": "usr-mips64-verity-sig", + "3e23ca0b-a4bc-4b4e-8087-5ab6a26aa8a9": "usr-mips-le-verity-sig", + "f2c2c7ee-adcc-4351-b5c6-ee9816b66e16": "usr-mips64-le-verity-sig", + "450dd7d1-3224-45ec-9cf2-a43a346d71ee": "usr-parisc-verity-sig", + "c8bfbd1e-268e-4521-8bba-bf314c399557": "usr-ppc64-le-verity-sig", + "0b888863-d7f8-4d9e-9766-239fce4d58af": "usr-ppc64-verity-sig", + "7007891d-d371-4a80-86a4-5cb875b9302e": "usr-ppc-verity-sig", + "c3836a13-3137-45ba-b583-b16c50fe5eb4": "usr-riscv32-verity-sig", + "d2f9000a-7a18-453f-b5cd-4d32f77a7b32": "usr-riscv64-verity-sig", + "17440e4f-a8d0-467f-a46e-3912ae6ef2c5": "usr-s390-verity-sig", + "3f324816-667b-46ae-86ee-9b0c0c6c11b4": "usr-s390x-verity-sig", + "4ede75e2-6ccc-4cc8-b9c7-70334b087510": "usr-tilegx-verity-sig", + "e7bb33fb-06cf-4e81-8273-e543b413e2e2": "usr-x86-64-verity-sig", + "974a71c0-de41-43c3-be5d-5c5ccd1ad2c0": "usr-x86-verity-sig", + "bc13c2ff-59e6-4262-a352-b275fd6f7172": "xbootldr", + "3b8f8425-20e0-4f3b-907f-1a25a76f98e8": "srv", + "4d21b016-b534-45c2-a9fb-5c16e091fd2d": "var", + "7ec6f557-3bc5-4aca-b293-16ef5df639d1": "tmp", + "773f91ef-66d4-49b5-bd83-d683bf40ad16": "user-home", + } + + def get_value(self, text): + m = self.OPTION.search(strip_comment(text)) + return m.group(1) if m else "" + + +class PartitionTypeUuidCase(_PartitionTypeUuid): + def check_line(self, lineno, text): + value = self.get_value(text).strip("\"'") + if not self.GUID.match(value) or value.lower() in self.SHORTCUTS: + return + if value != value.lower(): + return ["{}:{}: partition-type-uuid must be in lower-case ({}#writing-genimage-cfg)" + .format(self.filename, lineno, self.url_to_manual), + text, + value.lower()] + + +class PartitionTypeUuidQuotes(_PartitionTypeUuid): + def check_line(self, lineno, text): + if self.get_value(text).startswith(("\"", "'")): + return ["{}:{}: partition-type-uuid must not be quoted ({}#writing-genimage-cfg)" + .format(self.filename, lineno, self.url_to_manual), + text] + + +class PartitionTypeUuidShortcut(_PartitionTypeUuid): + def check_line(self, lineno, text): + shortcut = self.SHORTCUTS.get(self.get_value(text).strip("\"'").lower()) + if shortcut: + return ["{}:{}: use the {} shortcut for partition-type-uuid ({}#writing-genimage-cfg)" + .format(self.filename, lineno, shortcut, self.url_to_manual), + text]utils/checkpackagelib/test_lib_genimage.py new file +615
-0@@ -0,0 +1,623 @@ +import pytest +import checkpackagelib.test_util as util +import checkpackagelib.lib_genimage as m + + +CommentUnits = [ + ('empty file', + 'any', + '', + []), + ('good', + 'any', + '# 1MB - 8KB, 2 GB\n', + []), + ('no comment', + 'any', + '\tsize = 30M\n', + []), + ('not a size', + 'any', + '# 1 kernel, 2 Macs, i.MX6\n', + []), + ('in a string', + 'any', + '\timage = "a#4M"\n', + []), + ('lower-case', + 'any', + '# 1 kB free\n', + [['any:1: use GB, MB or KB in comments (url#writing-genimage-cfg)', + '# 1 kB free\n']]), + ('no B', + 'any', + '\tsize = 1K # 16M\n', + [['any:1: use GB, MB or KB in comments (url#writing-genimage-cfg)', + '\tsize = 1K # 16M\n']]), + ('mixed', + 'any', + '# 1MB + 16mb\n', + [['any:1: use GB, MB or KB in comments (url#writing-genimage-cfg)', + '# 1MB + 16mb\n']]), + ] + + [email protected]('testname,filename,string,expected', CommentUnits) +def test_CommentUnits(testname, filename, string, expected): + warnings = util.check_file(m.CommentUnits, filename, string) + assert warnings == expected + + +CurlyBrackets = [ + ('empty file', + 'any', + '', + []), + ('good', + 'any', + 'image a {\n' + '\thdimage {\n' + '\t}\n' + '}\n', + []), + ('list', + 'any', + 'files = {\n' + '"a",\n' + '}\n', + []), + ('list on one line', + 'any', + 'holes = {"(440; 512)"}\n', + []), + ('list closed after last item', + 'any', + 'files = {\n' + '"a" }\n', + []), + ('brackets in string and comment', + 'any', + 'image = "}{" # }{\n', + []), + ('comment after brackets', + 'any', + 'image a { # x\n' + '} # y\n', + []), + ('open on next line', + 'any', + 'image a\n' + '{\n' + '}\n', + [['any:2: open curly bracket must be on the same line as the name (url#writing-genimage-cfg)', + '{\n']]), + ('empty node', + 'any', + 'flash {}\n', + [['any:1: closing curly bracket must be alone on its line (url#writing-genimage-cfg)', + 'flash {}\n']]), + ('close after option', + 'any', + 'image a {\n' + '\tsize = 1M }\n', + [['any:2: closing curly bracket must be alone on its line (url#writing-genimage-cfg)', + '\tsize = 1M }\n']]), + ('content after open', + 'any', + 'image a { size = 1M\n' + '}\n', + [['any:1: node content must start on a new line (url#writing-genimage-cfg)', + 'image a { size = 1M\n']]), + ] + + [email protected]('testname,filename,string,expected', CurlyBrackets) +def test_CurlyBrackets(testname, filename, string, expected): + warnings = util.check_file(m.CurlyBrackets, filename, string) + assert warnings == expected + + +EmptyLineAfterNode = [ + ('empty file', + 'any', + '', + []), + ('good', + 'any', + 'image a {\n' + '\tvfat {\n' + '\t}\n' + '\n' + '\tsize = 1M\n' + '}\n' + '\n' + 'image b {\n' + '}\n', + []), + ('last node', + 'any', + 'image a {\n' + '\tvfat {\n' + '\t}\n' + '}\n', + []), + ('list', + 'any', + 'vfat {\n' + '\tfiles = {\n' + '\t"a"\n' + '\t}\n' + '\tlabel = "x"\n' + '}\n', + []), + ('option', + 'any', + 'image a {\n' + '\tvfat {\n' + '\t}\n' + '\tsize = 1M\n' + '}\n', + [['any:4: missing empty line after the previous node (url#writing-genimage-cfg)', + '\tsize = 1M\n']]), + ('node', + 'any', + 'vfat {\n' + '\tfile a {\n' + '\t}\n' + '\tfile b {\n' + '\t}\n' + '}\n', + [['any:4: missing empty line after the previous node (url#writing-genimage-cfg)', + '\tfile b {\n']]), + ('comment', + 'any', + 'image a {\n' + '}\n' + '# x\n', + [['any:3: missing empty line after the previous node (url#writing-genimage-cfg)', + '# x\n']]), + ] + + [email protected]('testname,filename,string,expected', EmptyLineAfterNode) +def test_EmptyLineAfterNode(testname, filename, string, expected): + warnings = util.check_file(m.EmptyLineAfterNode, filename, string) + assert warnings == expected + + +Filename = [ + ('genimage.cfg', + 'board/x/genimage.cfg', + '', + []), + ('genimage-efi.cfg', + 'board/x/genimage-efi.cfg', + '', + []), + ('genimage_sdcard.cfg', + 'board/x/genimage_sdcard.cfg', + '', + []), + ('wrong prefix', + 'board/x/sdcard-genimage.cfg', + '', + [['board/x/sdcard-genimage.cfg:0: filename must begin with genimage (url#writing-genimage-cfg)']]), + ('only the directory', + 'genimage/a.cfg', + '', + [['genimage/a.cfg:0: filename must begin with genimage (url#writing-genimage-cfg)']]), + ] + + [email protected]('testname,filename,string,expected', Filename) +def test_Filename(testname, filename, string, expected): + warnings = util.check_file(m.Filename, filename, string) + assert warnings == expected + + +GptPartitionTypeUuid = [ + ('empty file', + 'any', + '', + []), + ('good', + 'any', + 'image a {\n' + '\thdimage {\n' + '\t\tpartition-table-type = "gpt"\n' + '\t}\n' + '\n' + '\tpartition b {\n' + '\t\tpartition-type-uuid = U\n' + '\t}\n' + '}\n', + []), + ('mbr', + 'any', + 'image a {\n' + '\thdimage {\n' + '\t}\n' + '\tpartition b {\n' + '\t\tpartition-type = 0xC\n' + '\t}\n' + '}\n', + []), + ('not in partition table', + 'any', + 'image a {\n' + '\thdimage {\n' + '\t\tpartition-table-type = "gpt"\n' + '\t}\n' + '\n' + '\tpartition b {\n' + '\t\tin-partition-table = "no"\n' + '\t}\n' + '}\n', + []), + ('gpt only in first image', + 'any', + 'image a {\n' + '\thdimage {\n' + '\t\tpartition-table-type = "gpt"\n' + '\t}\n' + '\n' + '}\n' + 'image a {\n' + '\thdimage {\n' + '\t}\n' + '\tpartition b {\n' + '\t}\n' + '}\n', + []), + ('missing', + 'any', + 'image a {\n' + '\thdimage {\n' + '\t\tpartition-table-type = "gpt"\n' + '\t}\n' + '\n' + '\tpartition b {\n' + '\t\timage = "x"\n' + '\t}\n' + '\tpartition c {\n' + '\t\tpartition-type-uuid = L\n' + '\t}\n' + '\tpartition d {\n' + '\t}\n' + '}\n', + [['any:6: GPT partition without partition-type-uuid: b, d (url#writing-genimage-cfg)', + '\tpartition b {\n']]), + ('hdimage last', + 'any', + 'image a {\n' + '\tpartition b {\n' + '\t}\n' + '\thdimage {\n' + '\t\tpartition-table-type = "gpt"\n' + '\t}\n' + '\n' + '}\n', + [['any:2: GPT partition without partition-type-uuid: b (url#writing-genimage-cfg)', + '\tpartition b {\n']]), + ('deprecated gpt option', + 'any', + 'image a {\n' + '\thdimage {\n' + '\t\tgpt = true\n' + '\t}\n' + '\tpartition b {\n' + '\t}\n' + '}\n', + [['any:5: GPT partition without partition-type-uuid: b (url#writing-genimage-cfg)', + '\tpartition b {\n']]), + ('explicitly in partition table', + 'any', + 'image a {\n' + '\thdimage {\n' + '\t\tpartition-table-type = "gpt"\n' + '\t}\n' + '\n' + '\tpartition b {\n' + '\t\tin-partition-table = true\n' + '\t}\n' + '}\n', + [['any:6: GPT partition without partition-type-uuid: b (url#writing-genimage-cfg)', + '\tpartition b {\n']]), + ] + + [email protected]('testname,filename,string,expected', GptPartitionTypeUuid) +def test_GptPartitionTypeUuid(testname, filename, string, expected): + warnings = util.check_file(m.GptPartitionTypeUuid, filename, string) + assert warnings == expected + + +Indent = [ + ('empty file', + 'any', + '', + []), + ('good', + 'any', + '# x\n' + 'image a {\n' + '\tvfat {\n' + '\t\tfiles = {\n' + '\t\t\t"a",\n' + '\t\t}\n' + '\t}\n' + '\n' + '\t# x\n' + '\tsize = 1M\n' + '}\n', + []), + ('spaces', + 'any', + 'image a {\n' + ' size = 1M\n' + '}\n', + [['any:2: should be indented with 1 tab(s) (url#writing-genimage-cfg)', + ' size = 1M\n']]), + ('tabs and space', + 'any', + 'image a {\n' + '\t size = 1M\n' + '}\n', + [['any:2: should be indented with 1 tab(s) (url#writing-genimage-cfg)', + '\t size = 1M\n']]), + ('too many', + 'any', + '\timage a {\n' + '}\n', + [['any:1: should be indented with 0 tab(s) (url#writing-genimage-cfg)', + '\timage a {\n']]), + ('closing', + 'any', + 'image a {\n' + '\tvfat {\n' + '}\n' + '}\n', + [['any:3: should be indented with 1 tab(s) (url#writing-genimage-cfg)', + '}\n']]), + ('comment', + 'any', + 'image a {\n' + '# x\n' + '}\n', + [['any:2: should be indented with 1 tab(s) (url#writing-genimage-cfg)', + '# x\n']]), + ('unbalanced', + 'any', + '}\n' + '}\n', + []), + ] + + [email protected]('testname,filename,string,expected', Indent) +def test_Indent(testname, filename, string, expected): + warnings = util.check_file(m.Indent, filename, string) + assert warnings == expected + + +OptionAssignment = [ + ('empty file', + 'any', + '', + []), + ('good', + 'any', + '\tsize = 1M\n' + '\tfiles = {\n', + []), + ('append', + 'any', + '\tfiles += {\n', + []), + ('equal in string', + 'any', + '\texec-pre = "a=b"\n', + []), + ('in comment', + 'any', + '# a=b\n', + []), + ('in list', + 'any', + '\t\t"a=b",\n', + []), + ('no spaces', + 'any', + '\timage="a"\n', + [["any:1: use one space before and after '=' (url#writing-genimage-cfg)", + '\timage="a"\n']]), + ('two spaces after', + 'any', + '\tsize = 1M\n', + [["any:1: use one space before and after '=' (url#writing-genimage-cfg)", + '\tsize = 1M\n']]), + ('tab before', + 'any', + '\tsize\t= 1M\n', + [["any:1: use one space before and after '=' (url#writing-genimage-cfg)", + '\tsize\t= 1M\n']]), + ('no space before', + 'any', + '\tfiles= {\n', + [["any:1: use one space before and after '=' (url#writing-genimage-cfg)", + '\tfiles= {\n']]), + ] + + [email protected]('testname,filename,string,expected', OptionAssignment) +def test_OptionAssignment(testname, filename, string, expected): + warnings = util.check_file(m.OptionAssignment, filename, string) + assert warnings == expected + + +PartitionTypeUuidCase = [ + ('empty file', + 'any', + '', + []), + ('lower-case', + 'any', + 'partition-type-uuid = 2e54b353-1271-4842-806f-e436d6af6985\n', + []), + ('shortcut', + 'any', + 'partition-type-uuid = U\n', + []), + ('has a shortcut', + 'any', + 'partition-type-uuid = 0FC63DAF-8483-4772-8E79-3D69D8477DE4\n', + []), + ('upper-case', + 'any', + 'partition-type-uuid = 2E54B353-1271-4842-806F-E436D6AF6985\n', + [['any:1: partition-type-uuid must be in lower-case (url#writing-genimage-cfg)', + 'partition-type-uuid = 2E54B353-1271-4842-806F-E436D6AF6985\n', + '2e54b353-1271-4842-806f-e436d6af6985']]), + ] + + [email protected]('testname,filename,string,expected', PartitionTypeUuidCase) +def test_PartitionTypeUuidCase(testname, filename, string, expected): + warnings = util.check_file(m.PartitionTypeUuidCase, filename, string) + assert warnings == expected + + +PartitionTypeUuidQuotes = [ + ('empty file', + 'any', + '', + []), + ('good', + 'any', + 'partition-type-uuid = U\n', + []), + ('other option', + 'any', + 'partition-uuid = "U"\n', + []), + ('quoted', + 'any', + 'partition-type-uuid = "U"\n', + [['any:1: partition-type-uuid must not be quoted (url#writing-genimage-cfg)', + 'partition-type-uuid = "U"\n']]), + ] + + [email protected]('testname,filename,string,expected', PartitionTypeUuidQuotes) +def test_PartitionTypeUuidQuotes(testname, filename, string, expected): + warnings = util.check_file(m.PartitionTypeUuidQuotes, filename, string) + assert warnings == expected + + +PartitionTypeUuidShortcut = [ + ('empty file', + 'any', + '', + []), + ('shortcut', + 'any', + 'partition-type-uuid = U\n', + []), + ('no shortcut', + 'any', + 'partition-type-uuid = 2e54b353-1271-4842-806f-e436d6af6985\n', + []), + ('placeholder', + 'any', + 'partition-type-uuid = %UUID%\n', + []), + ('letter', + 'any', + 'partition-type-uuid = c12a7328-f81f-11d2-ba4b-00a0c93ec93b\n', + [['any:1: use the U shortcut for partition-type-uuid (url#writing-genimage-cfg)', + 'partition-type-uuid = c12a7328-f81f-11d2-ba4b-00a0c93ec93b\n']]), + ('upper-case', + 'any', + 'partition-type-uuid = 0FC63DAF-8483-4772-8E79-3D69D8477DE4\n', + [['any:1: use the L shortcut for partition-type-uuid (url#writing-genimage-cfg)', + 'partition-type-uuid = 0FC63DAF-8483-4772-8E79-3D69D8477DE4\n']]), + ('root', + 'any', + 'partition-type-uuid = b921b045-1df0-41c3-af44-4c6f280d3fae\n', + [['any:1: use the root-arm64 shortcut for partition-type-uuid (url#writing-genimage-cfg)', + 'partition-type-uuid = b921b045-1df0-41c3-af44-4c6f280d3fae\n']]), + ] + + [email protected]('testname,filename,string,expected', PartitionTypeUuidShortcut) +def test_PartitionTypeUuidShortcut(testname, filename, string, expected): + warnings = util.check_file(m.PartitionTypeUuidShortcut, filename, string) + assert warnings == expected + + +SizeNotation = [ + ('empty file', + 'any', + '', + []), + ('suffixes', + 'any', + 'size = 1G\n' + 'offset = 1M\n' + 'size = 1K # x\n', + []), + ('zero', + 'any', + 'offset = 0\n', + []), + ('hexadecimal', + 'any', + 'offset = 0x201\n', + []), + ('byte count', + 'any', + 'offset = 512\n', + []), + ('percentage', + 'any', + 'size = 50%\n', + []), + ('placeholder', + 'any', + 'offset = %IMXOFFSET%\n', + []), + ('other option', + 'any', + 'pebsize = 65536\n', + []), + ('quoted', + 'any', + 'size = "1M"\n', + []), + ('lower-case', + 'any', + 'size = 1k\n', + [['any:1: use G, M, K, a 0x prefix or a byte count (url#writing-genimage-cfg)', + 'size = 1k\n']]), + ('unit', + 'any', + 'size = 1MB\n', + [['any:1: use G, M, K, a 0x prefix or a byte count (url#writing-genimage-cfg)', + 'size = 1MB\n']]), + ('useless byte count', + 'any', + 'offset = 1024\n', + [['any:1: use 1K instead of 1024 (url#writing-genimage-cfg)', + 'offset = 1024\n']]), + ('useless hexadecimal', + 'any', + 'offset = 0x100000\n', + [['any:1: use 1M instead of 0x100000 (url#writing-genimage-cfg)',
Quoted 9 lines
utils/checkpackagelib/test_lib_genimage.py line 623
Quoted 8 lines
utils/checkpackagelib/test_lib_genimage.py new file +8
-0+ 'offset = 0x100000\n']]), + ] + + [email protected]('testname,filename,string,expected', SizeNotation) +def test_SizeNotation(testname, filename, string, expected): + warnings = util.check_file(m.SizeNotation, filename, string) + assert warnings == expected
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 26 lines · Giulio Benetti
Hi Edgar,
Quoted 15 lines · Edgar Bonet
Hello!
Quoted 11 lines · Giulio Benetti
The coding style of the genimage.cfg files is described in the "The genimage.cfg file" section of the manual, but nothing enforces it. Add a library checking these rules:
- indentation with tabs, according to the nesting level
- position of the curly brackets
- empty line after a node, except for the last one
- one space before and after '='
- filename beginning with genimage
- notation of the offset and size options
- GB, MB, KB units in commentsQuoted 5 lines
Within genimage, ‘k’, ‘M’ and ‘G’ are binary units (powers of 1024 bytes). This can lead to some confusion, as HDD sizes are quoted with decimal prefixes (powers of 1000). Micro-SD cards used to be quoted with binary prefixes, but most (maybe all?) manufacturers have switched to decimal prefixes.
you're right,
Quoted 8 lines
Quoted 4 lines
In order to avoid the confusion, it would be preferable to use the IEC prefixes in the comments: KiB, MiB and GiB. This would be consistent with the notation used by ‘dd’, where MiB = M = 1024^2 B, whereas MB = 10^6 B.
thanks for pointing. And yes that would be preferable but I need to add
IEC support to genimage and wait for my patch to be accepted before checking against those prefixes. So I think this is a different but useful thing.
I think there is no need to wait.
See what happened with ‘dd’:
• at some point, ‘dd’ used ‘K’, ‘M’ and ‘G’ as binary suffixes (or ‘units’, they are not prefixes: you would write ‘bs=1M’)
• when it introduced IEC support, it kept the original meaning of ‘K’, ‘M’ and ‘G’, for the sake of compatibility, while introducing the decimal units ‘kB’, ‘MB’ and ‘GB’, and the binary units ‘KiB’, ‘MiB’ and ‘GiB’.
Hence it introduced the convention:
• MB = 10^6 bytes
• M = MiB = 2^20 bytes
I believe I have seen this convention used in other tools, although I do not remember where. But it seems to me like this convention is spreading.
So far, genimage is consistent with this convention, save for the case of ‘k’: ‘k’, ‘M’ and ‘G’ are used as binary units. No need to change this. Your patch replaces ‘M’ with ‘MB’ in the comments, which clashes with this convention (as ‘M’ stands for 2^20 bytes in this context). I propose using the IEC units in the comments, thus writing
size = 16M # 16 MiB
This would disambiguate the ‘M’ while being consistent with both IEC and the ‘dd’ convention.
Regards,
Edgar.
Quoted 1,221 lines
I'm creating the patch right now.
Best regards
GiulioQuoted 1,205 lines
Regards,
Edgar Bonet.
Quoted 1,201 lines
- partition-type-uuid set for every partition of a GPT image, unquoted, using the genimage shortcut when there is one, and in lower-case otherwise
The table of shortcuts comes from genimage's
image-hd.c.Files generated from a template (genimage.cfg.in, genimage.cfg.template*) are not checked, since they contain placeholders.
Add the existing files that do not follow the rules to .checkpackageignore.
Assisted-by Claude Opus 5.5 <[email protected]>Signed-off-by Giulio Benetti <[email protected]>---
.checkpackageignore | 46 ++ utils/check-package | 7 + utils/checkpackagelib/lib_genimage.py | 407 ++++++++++++++utils/checkpackagelib/test_lib_genimage.py| 623 +++++++++++++++++++++4 files changed, 1083 insertions(+)create mode 100644
utils/checkpackagelib/lib_genimage.pycreate mode 100644utils/checkpackagelib/test_lib_genimage.py.checkpackageignore +2
-0@@ -1,48 +1,89 @@ +board/aarch64-efi/genimage-efi.cfg lib_genimage.EmptyLineAfterNode +board/amarula/vyasa/genimage.cfg lib_genimage.CommentUnits
board/amarula/vyasa/post-build.shShellcheck +board/andes/ae350/genimage_sdcard.cfg lib_genimage.EmptyLineAfterNodeboard/arcturus/aarch64-ucls1012a/post-build.shShellcheckboard/arcturus/aarch64-ucls1012a/post-image.shShellcheck.checkpackageignore +3
-0+board/arm/fvp-ebbr/genimage.cfg lib_genimage.PartitionTypeUuidShortcut +board/aspeed/ast2500-evb/genimage.cfg lib_genimage.EmptyLineAfterNode lib_genimage.OptionAssignment +board/aspeed/ast2600-evb/genimage.cfg lib_genimage.EmptyLineAfterNode
board/aspeed/common/post-image.shShellcheck
board/asus/tinker/post-build.shShellcheck
board/atmel/flasher.shShellcheck
+board/avnet/rzboard_v2l/genimage.cfg lib_genimage.EmptyLineAfterNode lib_genimage.GptPartitionTypeUuidboard/beagleboard/beaglebone-qt5/patches/linux/0001-keep-jtag-clock-alive-for-debugger.patchlib_patch.Upstream.checkpackageignore +2
-0+board/beagleboard/beagleplay/genimage.cfg lib_genimage.Indent +board/beagleboard/beaglev_fire/genimage.cfg lib_genimage.EmptyLineAfterNode lib_genimage.GptPartitionTypeUuid lib_genimage.Indent lib_genimage.PartitionTypeUuidCase lib_genimage.PartitionTypeUuidShortcut
board/boundarydevices/common/post-build.shShellcheckboard/boundarydevices/common/post-image.shShellcheckboard/broadcom/northstar/post-image.shShellcheckboard/bsh/imx8mn-bsh-smm-s2-pro/flash.shShellcheck lib_shellscript.EmptyLastLine +board/bsh/imx8mn-bsh-smm-s2-pro/genimage.cfg lib_genimage.GptPartitionTypeUuidboard/bsh/imx8mn-bsh-smm-s2-pro/post-build.shShellcheckboard/bsh/imx8mn-bsh-smm-s2-pro/post-image.shShellcheckboard/bsh/imx8mn-bsh-smm-s2/flash.shShellcheck lib_shellscript.EmptyLastLineboard/bsh/imx8mn-bsh-smm-s2/post-build.shShellcheck +board/canaan/k210-soc/genimage.cfg lib_genimage.EmptyLineAfterNodeboard/canaan/k210-soc/post-build.shShellcheckboard/chromebook/elm/sign.shShellcheck
board/chromebook/mksd.shShellcheckboard/ci20/patches/uboot/0001-mips-Remove-default-endiannes.patchlib_patch.Upstream.checkpackageignore +2
-0+board/compulab/iot-gate-imx8-ebbr/genimage.cfg lib_genimage.PartitionTypeUuidCase +board/coolpi/coolpi-4b/genimage.cfg lib_genimage.EmptyLineAfterNode lib_genimage.GptPartitionTypeUuid
board/freescale/common/imx/imx8-bootloader-prepare.shShellcheckboard/freescale/common/mxs/post-image.shShellcheckboard/friendlyarm/nanopi-r2s/post-build.shShellcheck +board/grinn/liteboard/genimage.cfg lib_genimage.CommentUnitsboard/hardkernel/odroidc2/post-image.shShellcheck board/hardkernel/odroidc2/rootfs_overlay/etc/init.d/S09modload Shellcheck lib_sysv.Variables.checkpackageignore +2
-0+board/khadas/vim3/genimage.cfg lib_genimage.OptionAssignment +board/kontron/bl-imx8mm/genimage.cfg lib_genimage.GptPartitionTypeUuid
board/kontron/bl-imx8mm/post-build.shShellcheck +board/kontron/smarc-sal28/genimage.cfg lib_genimage.GptPartitionTypeUuidboard/kontron/smarc-sal28/post-build.shShellcheck +board/lego/ev3/genimage.cfg lib_genimage.CommentUnits lib_genimage.EmptyLineAfterNodeboard/lego/ev3/post-image.shShellcheck.checkpackageignore +5
-0+board/loongarch64-efi/genimage-efi.cfg lib_genimage.EmptyLineAfterNode +board/mender/x86_64/genimage-efi.cfg lib_genimage.EmptyLineAfterNode lib_genimage.PartitionTypeUuidShortcut +board/microchip/mpfs_icicle/genimage.cfg lib_genimage.EmptyLineAfterNode lib_genimage.GptPartitionTypeUuid lib_genimage.Indent lib_genimage.PartitionTypeUuidCase +board/microchip/sama7g5ek/genimage.cfg lib_genimage.EmptyLineAfterNode +board/minnowboard/genimage.cfg lib_genimage.EmptyLineAfterNode
board/minnowboard/post-build.shShellcheck
board/nexbox/a95x/post-build.shShellcheck
board/nexbox/a95x/post-image.shShellcheck
+board/octavo/osd32mp1-brk/genimage.cfg lib_genimage.GptPartitionTypeUuidboard/octavo/osd32mp1-brk/patches/uboot/0001-Add-OSD32MP1-BRK-device-tree-support.patchlib_patch.NumberedSubject lib_patch.Upstreamboard/octavo/osd32mp1-brk/patches/uboot/0002-Add-OSD32MP1-BRK-build-config.patchlib_patch.NumberedSubject lib_patch.Upstream +board/octavo/osd32mp1-red/genimage.cfg lib_genimage.GptPartitionTypeUuidboard/octavo/osd32mp1-red/patches/uboot/0001-Add-OSD32MP1-RED-Device-Tree-support.patchlib_patch.NumberedSubject lib_patch.Upstreamboard/octavo/osd32mp1-red/patches/uboot/0002-configs-stm32mp15_trusted_defconfig-disable-environm.patchlib_patch.NumberedSubject lib_patch.Upstream +board/olimex/stmp1_olinuxino/genimage.cfg lib_genimage.GptPartitionTypeUuid
board/olpc/post-build.shShellcheck
+board/orangepi/common/genimage.cfg lib_genimage.GptPartitionTypeUuid
board/orangepi/common/post-build.shShellcheck
+board/orangepi/orangepi-5-plus/genimage.cfg lib_genimage.PartitionTypeUuidShortcutboard/orangepi/orangepi-zero/patches/linux/0001-ARM-dts-orange-pi-zero-interrupt-triggering-xr819.patchlib_patch.Upstreamboard/orangepi/orangepi-zero/patches/linux/0002-ARM-dts-orange-pi-zero-enable-spi-nor.patchlib_patch.Upstreamboard/orangepi/orangepi-zero/patches/linux/0003-ARM-dts-orange-pi-zero-enable-spidev.patchlib_patch.Upstreamboard/orangepi/orangepi-zero/patches/linux/0004-ARM-dts-orange-pi-zero-enable-uart.patchlib_patch.Upstream.checkpackageignore +5
-0+board/pc/genimage-efi.cfg lib_genimage.PartitionTypeUuidShortcut +board/pine64/rockpro64-ebbr/genimage.cfg lib_genimage.PartitionTypeUuidCase +board/pine64/rockpro64/genimage.cfg lib_genimage.GptPartitionTypeUuid lib_genimage.PartitionTypeUuidShortcut +board/pine64/star64/genimage.cfg lib_genimage.GptPartitionTypeUuid lib_genimage.Indent lib_genimage.PartitionTypeUuidCase +board/qemu/aarch64-ebbr/genimage.cfg lib_genimage.PartitionTypeUuidShortcutboard/qemu/aarch64-sbsa/assemble-flash-images Shellcheck
.checkpackageignore +5
-0+board/qemu/aarch64-sbsa/genimage.cfg lib_genimage.PartitionTypeUuidShortcut +board/qemu/arm-ebbr/genimage.cfg lib_genimage.PartitionTypeUuidShortcut +board/qemu/loongarch64-virt-efi/genimage.cfg lib_genimage.EmptyLineAfterNode +board/qemu/riscv64-virt-efi/genimage.cfg lib_genimage.PartitionTypeUuidShortcut +board/radxa/rock5b/genimage.cfg lib_genimage.PartitionTypeUuidShortcut
board/raspberrypi/post-build.shShellcheck
board/raspberrypi/post-image.shShellcheck
+board/seeed/stm32mp157c-odyssey/genimage.cfg lib_genimage.GptPartitionTypeUuidboard/seeed/stm32mp157c-odyssey/patches/linux/0001-ARM-dts-stm32-fix-stm32mp157c-odyssey-card-detect.patchlib_patch.Upstreamboard/sheevaplug/patches/uboot/0001-Remove-redundant-YYLOC-global-declaration.patchlib_patch.Upstream.checkpackageignore +2
-0+board/sifive/common/genimage_sdcard.cfg lib_genimage.PartitionTypeUuidShortcut +board/sipeed/licheepi_nano/genimage.cfg lib_genimage.CurlyBrackets lib_genimage.EmptyLastLine lib_genimage.EmptyLineAfterNode
board/solidrun/clearfog/post-build.shShellcheckboard/solidrun/macchiatobin/post-build-mainline.shShellcheckboard/solidrun/macchiatobin/post-build.shShellcheck.checkpackageignore +0
-0@@ -52,7 +93,9 @@ board/stmicroelectronics/stm32f429-disco/flash.sh Shellcheck
board/stmicroelectronics/stm32f469-disco/flash_sd.shShellcheckboard/stmicroelectronics/stm32f469-disco/flash_xip.shShellcheckboard/synopsys/axs10x/post-build.shShellcheck
+board/ti/am574x-idk/genimage.cfg lib_genimage.Indent
board/udoo/common/post-build.shShellcheck
+board/visionfive2/genimage.cfg lib_genimage.PartitionTypeUuidShortcutboot/afboot-stm32/0003-Makefile-disable-stack-protector.patchlib_patch.Upstreamboot/optee-os/3.13.0/0001-core-zlib-fix-build-warning-when-_LFS64_LARGEFILE-is.patchlib_patch.Upstreamboot/syslinux/0001-bios-Fix-alignment-change-with-gcc-5.patchlib_patch.Upstream.checkpackageignore +0
-0@@ -980,6 +1023,9 @@ support/scripts/fix-configure-powerpc64.sh lib_shellscript.EmptyLastLinesupport/scripts/generate-gitlab-ci-yml Shellcheck
support/scripts/mkmakefile Shellcheck lib_shellscript.ConsecutiveEmptyLines support/scripts/setlocalversion Shellcheck +support/testing/tests/boot/test_grub/genimage-aarch64-efi.cfg lib_genimage.PartitionTypeUuidShortcutsupport/testing/tests/core/post-build.shShellchecksupport/testing/tests/package/test_opkg/post-build.shShellcheck.checkpackageignore +2
-0+support/testing/tests/package/test_xen/aarch64/genimage.cfg lib_genimage.PartitionTypeUuidCase +support/testing/tests/package/test_xen/arm/genimage.cfg lib_genimage.PartitionTypeUuidCase
support/testing/tests/utils/test_get_developers/0001-package-binutils-change-.mk.patchlib_patch.NumberedSubject lib_patch.Upstreamutils/check-package +0
-0@@ -19,6 +19,7 @@ import sysimport checkpackagelib.base
import checkpackagelib.lib_config
import checkpackagelib.lib_defconfig
+import checkpackagelib.lib_genimage
import checkpackagelib.lib_hash
import checkpackagelib.lib_ignore
import checkpackagelib.lib_mkutils/check-package +0
-0@@ -159,6 +160,10 @@ SYSV_INIT_SCRIPT_FILENAME = re.compile(r"/S\d\d[^/]+$") # in a br2-external tree. BR_DEFCONFIG_FILENAME = re.compile(r"^(.+/)?configs/[^/]+_defconfig$")+# Match any name containing genimage, so that the ones with a wrong prefix are
utils/check-package +3
-0+# reported. +GENIMAGE_CFG_FILENAME = re.compile(r"genimage[^/]*\.cfg$") +def
get_lib_from_filename(fname):
if flags.intree_only:utils/check-package +0
-0@@ -176,6 +181,8 @@ def get_lib_from_filename(fname):return checkpackagelib.lib_config
ifBR_DEFCONFIG_FILENAME.search(fname):
return checkpackagelib.lib_defconfig
+ ifGENIMAGE_CFG_FILENAME.search(fname):
+ return checkpackagelib.lib_genimage
iffname.endswith(".hash"):
return checkpackagelib.lib_hash
iffname.endswith(".mk")orfname.endswith(".mk.in"):utils/checkpackagelib/lib_genimage.py new file +407
-0@@ -0,0 +1,407 @@ +# See utils/checkpackagelib/readme.txt before editing this file. + +import os +import re + +from checkpackagelib.base import _CheckFunction +from checkpackagelib.lib import ConsecutiveEmptyLines # noqa: F401 +from checkpackagelib.lib import EmptyLastLine # noqa: F401 +from checkpackagelib.lib import NewlineAtEof # noqa: F401 +from checkpackagelib.lib import TrailingSpace # noqa: F401 +from checkpackagelib.lib import Utf8Characters # noqa: F401 +from checkpackagelib.tool import NotExecutable # noqa: F401 + +# used in more than one check +STRING_OR_COMMENT = re.compile(r"(\"[^\"]*\"|'[^']*')|(#|//).*") + + +def strip_comment(text): + return STRING_OR_COMMENT.sub(lambda m: m.group(1) or "", text).strip() + + +def strip_comment_and_strings(text): + return STRING_OR_COMMENT.sub(lambda m: '""' if m.group(1) else "", text).strip() + + +class _Structure(_CheckFunction): + """Keeps track of the curly brackets, to know where each line is located""" + BRACKET = re.compile(r"[{}]") + LIST = re.compile(r"=\s*$") + + def before(self): + # One entry per open curly bracket: the words of the node's name, or + # None for a list, e.g. 'files = {' + self.stack = [] + + def track(self, code): + """Update the stack, return the list of entries that were closed""" + closed = [] + start = 0 + for m in self.BRACKET.finditer(code): + if m.group() == "{": + name = code[start:m.start()] + self.stack.append(None if self.LIST.search(name) else name.split()) + elif self.stack: + closed.append(self.stack.pop()) + start = m.end() + return closed + + +class CommentUnits(_CheckFunction): + COMMENT = re.compile(r"(?:\"[^\"]*\"|'[^']*'|[^\"'#])*?(?:#|//)(.*)") + UNIT = re.compile(r"\b\d+ ?([kmg]b?)\b", re.IGNORECASE) + ALLOWED = ["GB", "MB", "KB"] + + def check_line(self, lineno, text): + comment = self.COMMENT.match(text) + if not comment: + return + for unit in self.UNIT.findall(comment.group(1)): + if unit not in self.ALLOWED: + return ["{}:{}: use GB, MB or KB in comments ({}#writing-genimage-cfg)" + .format(self.filename, lineno, self.url_to_manual), + text] + + +class CurlyBrackets(_Structure): + def check_line(self, lineno, text): + code = strip_comment_and_strings(text) + in_list = bool(self.stack) and self.stack[-1] is None + closed = self.track(code) + + if code.startswith("{"): + return ["{}:{}: open curly bracket must be on the same line as the name ({}#writing-genimage-cfg)" + .format(self.filename, lineno, self.url_to_manual), + text] + # lists can be on a single line + if any(entry is not None for entry in closed) and code != "}": + return ["{}:{}: closing curly bracket must be alone on its line ({}#writing-genimage-cfg)" + .format(self.filename, lineno, self.url_to_manual), + text] + opens_node = "{" in code and not in_list and "=" not in code.split("{")[0] + if opens_node and not code.endswith("{"): + return ["{}:{}: node content must start on a new line ({}#writing-genimage-cfg)" + .format(self.filename, lineno, self.url_to_manual), + text] + + +class EmptyLineAfterNode(_Structure): + def before(self): + super().before() + self.after_node = False + + def check_line(self, lineno, text): + code = strip_comment_and_strings(text) + missing = self.after_node and text.strip() != "" and not code.startswith("}") + closed = self.track(code) + self.after_node = bool(closed) and closed[-1] is not None + + if missing: + return ["{}:{}: missing empty line after the previous node ({}#writing-genimage-cfg)" + .format(self.filename, lineno, self.url_to_manual), + text] + + +class Filename(_CheckFunction): + def before(self): + if not os.path.basename(self.filename).startswith("genimage"): + return ["{}:0: filename must begin with genimage ({}#writing-genimage-cfg)" + .format(self.filename, self.url_to_manual)] + + +class GptPartitionTypeUuid(_Structure): + """Checks that each partition of a GPT image has a partition-type-uuid""" + OPTION = re.compile(r"^([a-z-]+)\s*=\s*[\"']?([^\"'\s]*)") + FALSE = ["false", "no", "off"] + + def before(self): + super().before() + self.gpt = False + self.partition = None + self.missing = [] + + def check_line(self, lineno, text): + code = strip_comment_and_strings(text) + closed = self.track(code) + node = self.stack[-1][0] if self.stack and self.stack[-1] else None + + if closed: + for entry in closed: + if not entry: + continue + if entry[0] == "partition" and self.partition: + if self.partition["needs-type"]: + self.missing.append(self.partition) + self.partition = None + elif entry[0] == "image": + gpt, missing = self.gpt, self.missing + self.gpt, self.missing = False, [] + if gpt and missing: + return ["{}:{}: GPT partition without partition-type-uuid: {} ({}#writing-genimage-cfg)" + .format(self.filename, missing[0]["lineno"], + ", ".join(p["name"] for p in missing), + self.url_to_manual), + missing[0]["text"]] + return + + if node == "partition" and code.endswith("{"): + self.partition = {"name": " ".join(strip_comment(text).rstrip("{").split()[1:]), + "lineno": lineno, "text": text, "needs-type": True} + return + + option = self.OPTION.search(strip_comment(text)) + if not option: + return + name, value = option.groups() + if node == "hdimage": + # 'gpt = true' is the deprecated form + if name == "partition-table-type": + self.gpt = value in ["gpt", "hybrid"] + elif name == "gpt": + self.gpt = value.lower() not in self.FALSE + elif node == "partition" and self.partition: + if name == "partition-type-uuid": + self.partition["needs-type"] = False + elif name == "in-partition-table" and value.lower() in self.FALSE: + self.partition["needs-type"] = False + + +class Indent(_Structure): + def check_line(self, lineno, text): + if text.strip() == "": + return + code = strip_comment_and_strings(text) + expected = len(self.stack) + if code.startswith("}"): + expected = max(0, expected - 1) + self.track(code) + + if text[:len(text) - len(text.lstrip())] != "\t" * expected: + return ["{}:{}: should be indented with {} tab(s) ({}#writing-genimage-cfg)" + .format(self.filename, lineno, expected, self.url_to_manual), + text] + + +class OptionAssignment(_CheckFunction): + ASSIGNMENT = re.compile(r"^[\w-]+(\s*)\+?=(\s*)(.*)$") + + def check_line(self, lineno, text): + m = self.ASSIGNMENT.search(strip_comment(text)) + if not m: + return + space_before, space_after, value = m.groups() + if space_before != " " or (value and space_after != " "): + return ["{}:{}: use one space before and after '=' ({}#writing-genimage-cfg)" + .format(self.filename, lineno, self.url_to_manual), + text] + + +class SizeNotation(_CheckFunction): + OPTION = re.compile(r"^(?:offset|size)\s*=\s*[\"']?(\d[^\"'\s]*)") + ALLOWED = re.compile(r"^(0x[0-9a-fA-F]+|\d+[GMK]?)$") + # genimage also accepts a percentage of the available space as size + PERCENTAGE = re.compile(r"^\d+%$") + + def check_line(self, lineno, text): + m = self.OPTION.search(strip_comment(text)) + if not m: + return + value = m.group(1) + if self.PERCENTAGE.match(value): + return + if not self.ALLOWED.match(value): + return ["{}:{}: use G, M, K, a 0x prefix or a byte count ({}#writing-genimage-cfg)" + .format(self.filename, lineno, self.url_to_manual), + text] + if value[-1] in "GMK": + return + count = int(value, 16) if value.startswith("0x") else int(value) + if count == 0 or count % 1024: + return + for suffix, unit in [("G", 1 << 30), ("M", 1 << 20), ("K", 1 << 10)]: + if count % unit == 0: + return ["{}:{}: use {}{} instead of {} ({}#writing-genimage-cfg)" + .format(self.filename, lineno, count // unit, suffix, value, self.url_to_manual), + text] + + +class _PartitionTypeUuid(_CheckFunction): + OPTION = re.compile(r"^partition-type-uuid\s*=\s*(\S+)") + GUID = re.compile(r"^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$", re.IGNORECASE) + # See gpt_partition_type_shortcuts in genimage's image-hd.c + SHORTCUTS = { + "0fc63daf-8483-4772-8e79-3d69d8477de4": "L", + "0657fd6d-a4ab-43c4-84e5-0933c84b4f4f": "S", + "933ac7e1-2eb4-4f13-b844-0e14e2aef915": "H", + "c12a7328-f81f-11d2-ba4b-00a0c93ec93b": "U", + "a19d880f-05fc-4d3b-a006-743f0f84911e": "R", + "e6d6d379-f507-44c2-a23c-238f2a3df928": "V", + "ebd0a0a2-b9e5-4433-87c0-68b6b72699c7": "F", + "4778ed65-bf42-45fa-9c5b-287a1dc4aab1": "barebox-state", + "6c3737f2-07f8-45d1-ad45-15d260aab24d": "barebox-env", + "3de21764-95bd-54bd-a5c3-4abe786f38a8": "u-boot-env", + "6523f8ae-3eb1-4e2a-a05a-18b695ae656f": "root-alpha", + "d27f46ed-2919-4cb8-bd25-9531f3c16534": "root-arc", + "69dad710-2ce4-4e3c-b16c-21a1d49abed3": "root-arm", + "b921b045-1df0-41c3-af44-4c6f280d3fae": "root-arm64", + "993d8d3d-f80e-4225-855a-9daf8ed7ea97": "root-ia64", + "77055800-792c-4f94-b39a-98c91b762bb6": "root-loongarch64", + "e9434544-6e2c-47cc-bae2-12d6deafb44c": "root-mips", + "d113af76-80ef-41b4-bdb6-0cff4d3d4a25": "root-mips64", + "37c58c8a-d913-4156-a25f-48b1b64e07f0": "root-mips-le", + "700bda43-7a34-4507-b179-eeb93d7a7ca3": "root-mips64-le", + "1aacdb3b-5444-4138-bd9e-e5c2239b2346": "root-parisc", + "1de3f1ef-fa98-47b5-8dcd-4a860a654d78": "root-ppc", + "912ade1d-a839-4913-8964-a10eee08fbd2": "root-ppc64", + "c31c45e6-3f39-412e-80fb-4809c4980599": "root-ppc64-le", + "60d5a7fe-8e7d-435c-b714-3dd8162144e1": "root-riscv32", + "72ec70a6-cf74-40e6-bd49-4bda08e8f224": "root-riscv64", + "08a7acea-624c-4a20-91e8-6e0fa67d23f9": "root-s390", + "5eead9a9-fe09-4a1e-a1d7-520d00531306": "root-s390x", + "c50cdd70-3862-4cc3-90e1-809a8c93ee2c": "root-tilegx", + "44479540-f297-41b2-9af7-d131d5f0458a": "root-x86", + "4f68bce3-e8cd-4db1-96e7-fbcaf984b709": "root-x86-64", + "e18cf08c-33ec-4c0d-8246-c6c6fb3da024": "usr-alpha", + "7978a683-6316-4922-bbee-38bff5a2fecc": "usr-arc", + "7d0359a3-02b3-4f0a-865c-654403e70625": "usr-arm", + "b0e01050-ee5f-4390-949a-9101b17104e9": "usr-arm64", + "4301d2a6-4e3b-4b2a-bb94-9e0b2c4225ea": "usr-ia64", + "e611c702-575c-4cbe-9a46-434fa0bf7e3f": "usr-loongarch64", + "773b2abc-2a99-4398-8bf5-03baac40d02b": "usr-mips", + "57e13958-7331-4365-8e6e-35eeee17c61b": "usr-mips64", + "0f4868e9-9952-4706-979f-3ed3a473e947": "usr-mips-le", + "c97c1f32-ba06-40b4-9f22-236061b08aa8": "usr-mips64-le", + "dc4a4480-6917-4262-a4ec-db9384949f25": "usr-parisc", + "7d14fec5-cc71-415d-9d6c-06bf0b3c3eaf": "usr-ppc", + "2c9739e2-f068-46b3-9fd0-01c5a9afbcca": "usr-ppc64", + "15bb03af-77e7-4d4a-b12b-c0d084f7491c": "usr-ppc64-le", + "b933fb22-5c3f-4f91-af90-e2bb0fa50702": "usr-riscv32", + "beaec34b-8442-439b-a40b-984381ed097d": "usr-riscv64", + "cd0f869b-d0fb-4ca0-b141-9ea87cc78d66": "usr-s390", + "8a4f5770-50aa-4ed3-874a-99b710db6fea": "usr-s390x", + "55497029-c7c1-44cc-aa39-815ed1558630": "usr-tilegx", + "75250d76-8cc6-458e-bd66-bd47cc81a812": "usr-x86", + "8484680c-9521-48c6-9c11-b0720656f69e": "usr-x86-64", + "fc56d9e9-e6e5-4c06-be32-e74407ce09a5": "root-alpha-verity", + "24b2d975-0f97-4521-afa1-cd531e421b8d": "root-arc-verity", + "7386cdf2-203c-47a9-a498-f2ecce45a2d6": "root-arm-verity", + "df3300ce-d69f-4c92-978c-9bfb0f38d820": "root-arm64-verity", + "86ed10d5-b607-45bb-8957-d350f23d0571": "root-ia64-verity", + "f3393b22-e9af-4613-a948-9d3bfbd0c535": "root-loongarch64-verity", + "7a430799-f711-4c7e-8e5b-1d685bd48607": "root-mips-verity", + "579536f8-6a33-4055-a95a-df2d5e2c42a8": "root-mips64-verity", + "d7d150d2-2a04-4a33-8f12-16651205ff7b": "root-mips-le-verity", + "16b417f8-3e06-4f57-8dd2-9b5232f41aa6": "root-mips64-le-verity", + "d212a430-fbc5-49f9-a983-a7feef2b8d0e": "root-parisc-verity", + "906bd944-4589-4aae-a4e4-dd983917446a": "root-ppc64-le-verity", + "9225a9a3-3c19-4d89-b4f6-eeff88f17631": "root-ppc64-verity", + "98cfe649-1588-46dc-b2f0-add147424925": "root-ppc-verity", + "ae0253be-1167-4007-ac68-43926c14c5de": "root-riscv32-verity", + "b6ed5582-440b-4209-b8da-5ff7c419ea3d": "root-riscv64-verity", + "7ac63b47-b25c-463b-8df8-b4a94e6c90e1": "root-s390-verity", + "b325bfbe-c7be-4ab8-8357-139e652d2f6b": "root-s390x-verity", + "966061ec-28e4-4b2e-b4a5-1f0a825a1d84": "root-tilegx-verity", + "2c7357ed-ebd2-46d9-aec1-23d437ec2bf5": "root-x86-64-verity", + "d13c5d3b-b5d1-422a-b29f-9454fdc89d76": "root-x86-verity", + "8cce0d25-c0d0-4a44-bd87-46331bf1df67": "usr-alpha-verity", + "fca0598c-d880-4591-8c16-4eda05c7347c": "usr-arc-verity", + "c215d751-7bcd-4649-be90-6627490a4c05": "usr-arm-verity", + "6e11a4e7-fbca-4ded-b9e9-e1a512bb664e": "usr-arm64-verity", + "6a491e03-3be7-4545-8e38-83320e0ea880": "usr-ia64-verity", + "f46b2c26-59ae-48f0-9106-c50ed47f673d": "usr-loongarch64-verity", + "6e5a1bc8-d223-49b7-bca8-37a5fcceb996": "usr-mips-verity", + "81cf9d90-7458-4df4-8dcf-c8a3a404f09b": "usr-mips64-verity", + "46b98d8d-b55c-4e8f-aab3-37fca7f80752": "usr-mips-le-verity", + "3c3d61fe-b5f3-414d-bb71-8739a694a4ef": "usr-mips64-le-verity", + "5843d618-ec37-48d7-9f12-cea8e08768b2": "usr-parisc-verity", + "ee2b9983-21e8-4153-86d9-b6901a54d1ce": "usr-ppc64-le-verity", + "bdb528a5-a259-475f-a87d-da53fa736a07": "usr-ppc64-verity", + "df765d00-270e-49e5-bc75-f47bb2118b09": "usr-ppc-verity", + "cb1ee4e3-8cd0-4136-a0a4-aa61a32e8730": "usr-riscv32-verity", + "8f1056be-9b05-47c4-81d6-be53128e5b54": "usr-riscv64-verity", + "b663c618-e7bc-4d6d-90aa-11b756bb1797": "usr-s390-verity", + "31741cc4-1a2a-4111-a581-e00b447d2d06": "usr-s390x-verity", + "2fb4bf56-07fa-42da-8132-6b139f2026ae": "usr-tilegx-verity", + "77ff5f63-e7b6-4633-acf4-1565b864c0e6": "usr-x86-64-verity", + "8f461b0d-14ee-4e81-9aa9-049b6fb97abd": "usr-x86-verity", + "d46495b7-a053-414f-80f7-700c99921ef8": "root-alpha-verity-sig", + "143a70ba-cbd3-4f06-919f-6c05683a78bc": "root-arc-verity-sig", + "42b0455f-eb11-491d-98d3-56145ba9d037": "root-arm-verity-sig", + "6db69de6-29f4-4758-a7a5-962190f00ce3": "root-arm64-verity-sig", + "e98b36ee-32ba-4882-9b12-0ce14655f46a": "root-ia64-verity-sig", + "5afb67eb-ecc8-4f85-ae8e-ac1e7c50e7d0": "root-loongarch64-verity-sig", + "bba210a2-9c5d-45ee-9e87-ff2ccbd002d0": "root-mips-verity-sig", + "43ce94d4-0f3d-4999-8250-b9deafd98e6e": "root-mips64-verity-sig", + "c919cc1f-4456-4eff-918c-f75e94525ca5": "root-mips-le-verity-sig", + "904e58ef-5c65-4a31-9c57-6af5fc7c5de7": "root-mips64-le-verity-sig", + "15de6170-65d3-431c-916e-b0dcd8393f25": "root-parisc-verity-sig", + "d4a236e7-e873-4c07-bf1d-bf6cf7f1c3c6": "root-ppc64-le-verity-sig", + "f5e2c20c-45b2-4ffa-bce9-2a60737e1aaf": "root-ppc64-verity-sig", + "1b31b5aa-add9-463a-b2ed-bd467fc857e7": "root-ppc-verity-sig", + "3a112a75-8729-4380-b4cf-764d79934448": "root-riscv32-verity-sig", + "efe0f087-ea8d-4469-821a-4c2a96a8386a": "root-riscv64-verity-sig", + "3482388e-4254-435a-a241-766a065f9960": "root-s390-verity-sig", + "c80187a5-73a3-491a-901a-017c3fa953e9": "root-s390x-verity-sig", + "b3671439-97b0-4a53-90f7-2d5a8f3ad47b": "root-tilegx-verity-sig", + "41092b05-9fc8-4523-994f-2def0408b176": "root-x86-64-verity-sig", + "5996fc05-109c-48de-808b-23fa0830b676": "root-x86-verity-sig", + "5c6e1c76-076a-457a-a0fe-f3b4cd21ce6e": "usr-alpha-verity-sig", + "94f9a9a1-9971-427a-a400-50cb297f0f35": "usr-arc-verity-sig", + "d7ff812f-37d1-4902-a810-d76ba57b975a": "usr-arm-verity-sig", + "c23ce4ff-44bd-4b00-b2d4-b41b3419e02a": "usr-arm64-verity-sig", + "8de58bc2-2a43-460d-b14e-a76e4a17b47f": "usr-ia64-verity-sig", + "b024f315-d330-444c-8461-44bbde524e99": "usr-loongarch64-verity-sig", + "97ae158d-f216-497b-8057-f7f905770f54": "usr-mips-verity-sig", + "05816ce2-dd40-4ac6-a61d-37d32dc1ba7d": "usr-mips64-verity-sig", + "3e23ca0b-a4bc-4b4e-8087-5ab6a26aa8a9": "usr-mips-le-verity-sig", + "f2c2c7ee-adcc-4351-b5c6-ee9816b66e16": "usr-mips64-le-verity-sig", + "450dd7d1-3224-45ec-9cf2-a43a346d71ee": "usr-parisc-verity-sig", + "c8bfbd1e-268e-4521-8bba-bf314c399557": "usr-ppc64-le-verity-sig", + "0b888863-d7f8-4d9e-9766-239fce4d58af": "usr-ppc64-verity-sig", + "7007891d-d371-4a80-86a4-5cb875b9302e": "usr-ppc-verity-sig", + "c3836a13-3137-45ba-b583-b16c50fe5eb4": "usr-riscv32-verity-sig", + "d2f9000a-7a18-453f-b5cd-4d32f77a7b32": "usr-riscv64-verity-sig", + "17440e4f-a8d0-467f-a46e-3912ae6ef2c5": "usr-s390-verity-sig", + "3f324816-667b-46ae-86ee-9b0c0c6c11b4": "usr-s390x-verity-sig", + "4ede75e2-6ccc-4cc8-b9c7-70334b087510": "usr-tilegx-verity-sig", + "e7bb33fb-06cf-4e81-8273-e543b413e2e2": "usr-x86-64-verity-sig", + "974a71c0-de41-43c3-be5d-5c5ccd1ad2c0": "usr-x86-verity-sig", + "bc13c2ff-59e6-4262-a352-b275fd6f7172": "xbootldr", + "3b8f8425-20e0-4f3b-907f-1a25a76f98e8": "srv", + "4d21b016-b534-45c2-a9fb-5c16e091fd2d": "var", + "7ec6f557-3bc5-4aca-b293-16ef5df639d1": "tmp", + "773f91ef-66d4-49b5-bd83-d683bf40ad16": "user-home", + } + + def get_value(self, text): + m = self.OPTION.search(strip_comment(text)) + return m.group(1) if m else "" + + +class PartitionTypeUuidCase(_PartitionTypeUuid): + def check_line(self, lineno, text): + value = self.get_value(text).strip("\"'") + if not self.GUID.match(value) or value.lower() in self.SHORTCUTS: + return + if value != value.lower(): + return ["{}:{}: partition-type-uuid must be in lower-case ({}#writing-genimage-cfg)" + .format(self.filename, lineno, self.url_to_manual), + text, + value.lower()] + + +class PartitionTypeUuidQuotes(_PartitionTypeUuid): + def check_line(self, lineno, text): + if self.get_value(text).startswith(("\"", "'")): + return ["{}:{}: partition-type-uuid must not be quoted ({}#writing-genimage-cfg)" + .format(self.filename, lineno, self.url_to_manual), + text] + + +class PartitionTypeUuidShortcut(_PartitionTypeUuid): + def check_line(self, lineno, text): + shortcut = self.SHORTCUTS.get(self.get_value(text).strip("\"'").lower()) + if shortcut: + return ["{}:{}: use the {} shortcut for partition-type-uuid ({}#writing-genimage-cfg)" + .format(self.filename, lineno, shortcut, self.url_to_manual), + text]utils/checkpackagelib/test_lib_genimage.py new file +615
-0@@ -0,0 +1,623 @@ +import pytest +import checkpackagelib.test_util as util +import checkpackagelib.lib_genimage as m + + +CommentUnits = [ + ('empty file', + 'any', + '', + []), + ('good', + 'any', + '# 1MB - 8KB, 2 GB\n', + []), + ('no comment', + 'any', + '\tsize = 30M\n', + []), + ('not a size', + 'any', + '# 1 kernel, 2 Macs, i.MX6\n', + []), + ('in a string', + 'any', + '\timage = "a#4M"\n', + []), + ('lower-case', + 'any', + '# 1 kB free\n', + [['any:1: use GB, MB or KB in comments (url#writing-genimage-cfg)', + '# 1 kB free\n']]), + ('no B', + 'any', + '\tsize = 1K # 16M\n', + [['any:1: use GB, MB or KB in comments (url#writing-genimage-cfg)', + '\tsize = 1K # 16M\n']]), + ('mixed', + 'any', + '# 1MB + 16mb\n', + [['any:1: use GB, MB or KB in comments (url#writing-genimage-cfg)', + '# 1MB + 16mb\n']]), + ] + + [email protected]('testname,filename,string,expected', CommentUnits) +def test_CommentUnits(testname, filename, string, expected): + warnings = util.check_file(m.CommentUnits, filename, string) + assert warnings == expected + + +CurlyBrackets = [ + ('empty file', + 'any', + '', + []), + ('good', + 'any', + 'image a {\n' + '\thdimage {\n' + '\t}\n' + '}\n', + []), + ('list', + 'any', + 'files = {\n' + '"a",\n' + '}\n', + []), + ('list on one line', + 'any', + 'holes = {"(440; 512)"}\n', + []), + ('list closed after last item', + 'any', + 'files = {\n' + '"a" }\n', + []), + ('brackets in string and comment', + 'any', + 'image = "}{" # }{\n', + []), + ('comment after brackets', + 'any', + 'image a { # x\n' + '} # y\n', + []), + ('open on next line', + 'any', + 'image a\n' + '{\n' + '}\n', + [['any:2: open curly bracket must be on the same line as the name (url#writing-genimage-cfg)', + '{\n']]), + ('empty node', + 'any', + 'flash {}\n', + [['any:1: closing curly bracket must be alone on its line (url#writing-genimage-cfg)', + 'flash {}\n']]), + ('close after option', + 'any', + 'image a {\n' + '\tsize = 1M }\n', + [['any:2: closing curly bracket must be alone on its line (url#writing-genimage-cfg)', + '\tsize = 1M }\n']]), + ('content after open', + 'any', + 'image a { size = 1M\n' + '}\n', + [['any:1: node content must start on a new line (url#writing-genimage-cfg)', + 'image a { size = 1M\n']]), + ] + + [email protected]('testname,filename,string,expected', CurlyBrackets) +def test_CurlyBrackets(testname, filename, string, expected): + warnings = util.check_file(m.CurlyBrackets, filename, string) + assert warnings == expected + + +EmptyLineAfterNode = [ + ('empty file', + 'any', + '', + []), + ('good', + 'any', + 'image a {\n' + '\tvfat {\n' + '\t}\n' + '\n' + '\tsize = 1M\n' + '}\n' + '\n' + 'image b {\n' + '}\n', + []), + ('last node', + 'any', + 'image a {\n' + '\tvfat {\n' + '\t}\n' + '}\n', + []), + ('list', + 'any', + 'vfat {\n' + '\tfiles = {\n' + '\t"a"\n' + '\t}\n' + '\tlabel = "x"\n' + '}\n', + []), + ('option', + 'any', + 'image a {\n' + '\tvfat {\n' + '\t}\n' + '\tsize = 1M\n' + '}\n', + [['any:4: missing empty line after the previous node (url#writing-genimage-cfg)', + '\tsize = 1M\n']]), + ('node', + 'any', + 'vfat {\n' + '\tfile a {\n' + '\t}\n' + '\tfile b {\n' + '\t}\n' + '}\n', + [['any:4: missing empty line after the previous node (url#writing-genimage-cfg)', + '\tfile b {\n']]), + ('comment', + 'any', + 'image a {\n' + '}\n' + '# x\n', + [['any:3: missing empty line after the previous node (url#writing-genimage-cfg)', + '# x\n']]), + ] + + [email protected]('testname,filename,string,expected', EmptyLineAfterNode) +def test_EmptyLineAfterNode(testname, filename, string, expected): + warnings = util.check_file(m.EmptyLineAfterNode, filename, string) + assert warnings == expected + + +Filename = [ + ('genimage.cfg', + 'board/x/genimage.cfg', + '', + []), + ('genimage-efi.cfg', + 'board/x/genimage-efi.cfg', + '', + []), + ('genimage_sdcard.cfg', + 'board/x/genimage_sdcard.cfg', + '', + []), + ('wrong prefix', + 'board/x/sdcard-genimage.cfg', + '', + [['board/x/sdcard-genimage.cfg:0: filename must begin with genimage (url#writing-genimage-cfg)']]), + ('only the directory', + 'genimage/a.cfg', + '', + [['genimage/a.cfg:0: filename must begin with genimage (url#writing-genimage-cfg)']]), + ] + + [email protected]('testname,filename,string,expected', Filename) +def test_Filename(testname, filename, string, expected): + warnings = util.check_file(m.Filename, filename, string) + assert warnings == expected + + +GptPartitionTypeUuid = [ + ('empty file', + 'any', + '', + []), + ('good', + 'any', + 'image a {\n' + '\thdimage {\n' + '\t\tpartition-table-type = "gpt"\n' + '\t}\n' + '\n' + '\tpartition b {\n' + '\t\tpartition-type-uuid = U\n' + '\t}\n' + '}\n', + []), + ('mbr', + 'any', + 'image a {\n' + '\thdimage {\n' + '\t}\n' + '\tpartition b {\n' + '\t\tpartition-type = 0xC\n' + '\t}\n' + '}\n', + []), + ('not in partition table', + 'any', + 'image a {\n' + '\thdimage {\n' + '\t\tpartition-table-type = "gpt"\n' + '\t}\n' + '\n' + '\tpartition b {\n' + '\t\tin-partition-table = "no"\n' + '\t}\n' + '}\n', + []), + ('gpt only in first image', + 'any', + 'image a {\n' + '\thdimage {\n' + '\t\tpartition-table-type = "gpt"\n' + '\t}\n' + '\n' + '}\n' + 'image a {\n' + '\thdimage {\n' + '\t}\n' + '\tpartition b {\n' + '\t}\n' + '}\n', + []), + ('missing', + 'any', + 'image a {\n' + '\thdimage {\n' + '\t\tpartition-table-type = "gpt"\n' + '\t}\n' + '\n' + '\tpartition b {\n' + '\t\timage = "x"\n' + '\t}\n' + '\tpartition c {\n' + '\t\tpartition-type-uuid = L\n' + '\t}\n' + '\tpartition d {\n' + '\t}\n' + '}\n', + [['any:6: GPT partition without partition-type-uuid: b, d (url#writing-genimage-cfg)', + '\tpartition b {\n']]), + ('hdimage last', + 'any', + 'image a {\n' + '\tpartition b {\n' + '\t}\n' + '\thdimage {\n' + '\t\tpartition-table-type = "gpt"\n' + '\t}\n' + '\n' + '}\n', + [['any:2: GPT partition without partition-type-uuid: b (url#writing-genimage-cfg)', + '\tpartition b {\n']]), + ('deprecated gpt option', + 'any', + 'image a {\n' + '\thdimage {\n' + '\t\tgpt = true\n' + '\t}\n' + '\tpartition b {\n' + '\t}\n' + '}\n', + [['any:5: GPT partition without partition-type-uuid: b (url#writing-genimage-cfg)', + '\tpartition b {\n']]), + ('explicitly in partition table', + 'any', + 'image a {\n' + '\thdimage {\n' + '\t\tpartition-table-type = "gpt"\n' + '\t}\n' + '\n' + '\tpartition b {\n' + '\t\tin-partition-table = true\n' + '\t}\n' + '}\n', + [['any:6: GPT partition without partition-type-uuid: b (url#writing-genimage-cfg)', + '\tpartition b {\n']]), + ] + + [email protected]('testname,filename,string,expected', GptPartitionTypeUuid) +def test_GptPartitionTypeUuid(testname, filename, string, expected): + warnings = util.check_file(m.GptPartitionTypeUuid, filename, string) + assert warnings == expected + + +Indent = [ + ('empty file', + 'any', + '', + []), + ('good', + 'any', + '# x\n' + 'image a {\n' + '\tvfat {\n' + '\t\tfiles = {\n' + '\t\t\t"a",\n' + '\t\t}\n' + '\t}\n' + '\n' + '\t# x\n' + '\tsize = 1M\n' + '}\n', + []), + ('spaces', + 'any', + 'image a {\n' + ' size = 1M\n' + '}\n', + [['any:2: should be indented with 1 tab(s) (url#writing-genimage-cfg)', + ' size = 1M\n']]), + ('tabs and space', + 'any', + 'image a {\n' + '\t size = 1M\n' + '}\n', + [['any:2: should be indented with 1 tab(s) (url#writing-genimage-cfg)', + '\t size = 1M\n']]), + ('too many', + 'any', + '\timage a {\n' + '}\n', + [['any:1: should be indented with 0 tab(s) (url#writing-genimage-cfg)', + '\timage a {\n']]), + ('closing', + 'any', + 'image a {\n' + '\tvfat {\n' + '}\n' + '}\n', + [['any:3: should be indented with 1 tab(s) (url#writing-genimage-cfg)', + '}\n']]), + ('comment', + 'any', + 'image a {\n' + '# x\n' + '}\n', + [['any:2: should be indented with 1 tab(s) (url#writing-genimage-cfg)', + '# x\n']]), + ('unbalanced', + 'any', + '}\n' + '}\n', + []), + ] + + [email protected]('testname,filename,string,expected', Indent) +def test_Indent(testname, filename, string, expected): + warnings = util.check_file(m.Indent, filename, string) + assert warnings == expected + + +OptionAssignment = [ + ('empty file', + 'any', + '', + []), + ('good', + 'any', + '\tsize = 1M\n' + '\tfiles = {\n', + []), + ('append', + 'any', + '\tfiles += {\n', + []), + ('equal in string', + 'any', + '\texec-pre = "a=b"\n', + []), + ('in comment', + 'any', + '# a=b\n', + []), + ('in list', + 'any', + '\t\t"a=b",\n', + []), + ('no spaces', + 'any', + '\timage="a"\n', + [["any:1: use one space before and after '=' (url#writing-genimage-cfg)", + '\timage="a"\n']]), + ('two spaces after', + 'any', + '\tsize = 1M\n', + [["any:1: use one space before and after '=' (url#writing-genimage-cfg)", + '\tsize = 1M\n']]), + ('tab before', + 'any', + '\tsize\t= 1M\n', + [["any:1: use one space before and after '=' (url#writing-genimage-cfg)", + '\tsize\t= 1M\n']]), + ('no space before', + 'any', + '\tfiles= {\n', + [["any:1: use one space before and after '=' (url#writing-genimage-cfg)", + '\tfiles= {\n']]), + ] + + [email protected]('testname,filename,string,expected', OptionAssignment) +def test_OptionAssignment(testname, filename, string, expected): + warnings = util.check_file(m.OptionAssignment, filename, string) + assert warnings == expected + + +PartitionTypeUuidCase = [ + ('empty file', + 'any', + '', + []), + ('lower-case', + 'any', + 'partition-type-uuid = 2e54b353-1271-4842-806f-e436d6af6985\n', + []), + ('shortcut', + 'any', + 'partition-type-uuid = U\n', + []), + ('has a shortcut', + 'any', + 'partition-type-uuid = 0FC63DAF-8483-4772-8E79-3D69D8477DE4\n', + []), + ('upper-case', + 'any', + 'partition-type-uuid = 2E54B353-1271-4842-806F-E436D6AF6985\n', + [['any:1: partition-type-uuid must be in lower-case (url#writing-genimage-cfg)', + 'partition-type-uuid = 2E54B353-1271-4842-806F-E436D6AF6985\n', + '2e54b353-1271-4842-806f-e436d6af6985']]), + ] + + [email protected]('testname,filename,string,expected', PartitionTypeUuidCase) +def test_PartitionTypeUuidCase(testname, filename, string, expected): + warnings = util.check_file(m.PartitionTypeUuidCase, filename, string) + assert warnings == expected + + +PartitionTypeUuidQuotes = [ + ('empty file', + 'any', + '', + []), + ('good', + 'any', + 'partition-type-uuid = U\n', + []), + ('other option', + 'any', + 'partition-uuid = "U"\n', + []), + ('quoted', + 'any', + 'partition-type-uuid = "U"\n', + [['any:1: partition-type-uuid must not be quoted (url#writing-genimage-cfg)', + 'partition-type-uuid = "U"\n']]), + ] + + [email protected]('testname,filename,string,expected', PartitionTypeUuidQuotes) +def test_PartitionTypeUuidQuotes(testname, filename, string, expected): + warnings = util.check_file(m.PartitionTypeUuidQuotes, filename, string) + assert warnings == expected + + +PartitionTypeUuidShortcut = [ + ('empty file', + 'any', + '', + []), + ('shortcut', + 'any', + 'partition-type-uuid = U\n', + []), + ('no shortcut', + 'any', + 'partition-type-uuid = 2e54b353-1271-4842-806f-e436d6af6985\n', + []), + ('placeholder', + 'any', + 'partition-type-uuid = %UUID%\n', + []), + ('letter', + 'any', + 'partition-type-uuid = c12a7328-f81f-11d2-ba4b-00a0c93ec93b\n', + [['any:1: use the U shortcut for partition-type-uuid (url#writing-genimage-cfg)', + 'partition-type-uuid = c12a7328-f81f-11d2-ba4b-00a0c93ec93b\n']]), + ('upper-case', + 'any', + 'partition-type-uuid = 0FC63DAF-8483-4772-8E79-3D69D8477DE4\n', + [['any:1: use the L shortcut for partition-type-uuid (url#writing-genimage-cfg)', + 'partition-type-uuid = 0FC63DAF-8483-4772-8E79-3D69D8477DE4\n']]), + ('root', + 'any', + 'partition-type-uuid = b921b045-1df0-41c3-af44-4c6f280d3fae\n', + [['any:1: use the root-arm64 shortcut for partition-type-uuid (url#writing-genimage-cfg)', + 'partition-type-uuid = b921b045-1df0-41c3-af44-4c6f280d3fae\n']]), + ] + + [email protected]('testname,filename,string,expected', PartitionTypeUuidShortcut) +def test_PartitionTypeUuidShortcut(testname, filename, string, expected): + warnings = util.check_file(m.PartitionTypeUuidShortcut, filename, string) + assert warnings == expected + + +SizeNotation = [ + ('empty file', + 'any', + '', + []), + ('suffixes', + 'any', + 'size = 1G\n' + 'offset = 1M\n' + 'size = 1K # x\n', + []), + ('zero', + 'any', + 'offset = 0\n', + []), + ('hexadecimal', + 'any', + 'offset = 0x201\n', + []), + ('byte count', + 'any', + 'offset = 512\n', + []), + ('percentage', + 'any', + 'size = 50%\n', + []), + ('placeholder', + 'any', + 'offset = %IMXOFFSET%\n', + []), + ('other option', + 'any', + 'pebsize = 65536\n', + []), + ('quoted', + 'any', + 'size = "1M"\n', + []), + ('lower-case', + 'any', + 'size = 1k\n', + [['any:1: use G, M, K, a 0x prefix or a byte count (url#writing-genimage-cfg)', + 'size = 1k\n']]), + ('unit', + 'any', + 'size = 1MB\n', + [['any:1: use G, M, K, a 0x prefix or a byte count (url#writing-genimage-cfg)', + 'size = 1MB\n']]), + ('useless byte count', + 'any', + 'offset = 1024\n', + [['any:1: use 1K instead of 1024 (url#writing-genimage-cfg)', + 'offset = 1024\n']]), + ('useless hexadecimal', + 'any', + 'offset = 0x100000\n', + [['any:1: use 1M instead of 0x100000 (url#writing-genimage-cfg)',Quoted 9 lines
utils/checkpackagelib/test_lib_genimage.py line 623
Quoted 8 lines
utils/checkpackagelib/test_lib_genimage.py new file +8
-0+ 'offset = 0x100000\n']]), + ] + + [email protected]('testname,filename,string,expected', SizeNotation) +def test_SizeNotation(testname, filename, string, expected): + warnings = util.check_file(m.SizeNotation, filename, string) + assert warnings == expected
Quoted 4 lines
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 63 lines · Edgar Bonet
Quoted 26 lines · Giulio Benetti
Hi Edgar,
Quoted 15 lines · Edgar Bonet
Hello!
Quoted 11 lines · Giulio Benetti
The coding style of the genimage.cfg files is described in the "The genimage.cfg file" section of the manual, but nothing enforces it. Add a library checking these rules:
- indentation with tabs, according to the nesting level
- position of the curly brackets
- empty line after a node, except for the last one
- one space before and after '='
- filename beginning with genimage
- notation of the offset and size options
- GB, MB, KB units in commentsQuoted 5 lines
Within genimage, ‘k’, ‘M’ and ‘G’ are binary units (powers of 1024 bytes). This can lead to some confusion, as HDD sizes are quoted with decimal prefixes (powers of 1000). Micro-SD cards used to be quoted with binary prefixes, but most (maybe all?) manufacturers have switched to decimal prefixes.
you're right,
Quoted 8 lines
Quoted 4 lines
In order to avoid the confusion, it would be preferable to use the IEC prefixes in the comments: KiB, MiB and GiB. This would be consistent with the notation used by ‘dd’, where MiB = M = 1024^2 B, whereas MB = 10^6 B.
thanks for pointing. And yes that would be preferable but I need to add
IEC support to genimage and wait for my patch to be accepted before checking against those prefixes. So I think this is a different but useful thing.I think there is no need to wait.
See what happened with ‘dd’:
• at some point, ‘dd’ used ‘K’, ‘M’ and ‘G’ as binary suffixes (or ‘units’, they are not prefixes: you would write ‘bs=1M’)
• when it introduced IEC support, it kept the original meaning of ‘K’, ‘M’ and ‘G’, for the sake of compatibility, while introducing the decimal units ‘kB’, ‘MB’ and ‘GB’, and the binary units ‘KiB’, ‘MiB’ and ‘GiB’.
Hence it introduced the convention:
• MB = 10^6 bytes
• M = MiB = 2^20 bytesI believe I have seen this convention used in other tools, although I do not remember where. But it seems to me like this convention is spreading.
So far, genimage is consistent with this convention, save for the case of ‘k’: ‘k’, ‘M’ and ‘G’ are used as binary units. No need to change this. Your patch replaces ‘M’ with ‘MB’ in the comments, which clashes with this convention (as ‘M’ stands for 2^20 bytes in this context). I propose using the IEC units in the comments, thus writing
Quoted 4 lines
size = 16M # 16 MiBThis would disambiguate the ‘M’ while being consistent with both IEC and the ‘dd’ convention.
Sure thing. It's only I prefer to send 2 different patchsets:
1. this one to add linter and fixes found by linter
2. a second one bumping to genimage with IEC support or addin a local patch pending upstream for genimage and one patch per .cfg file that rename every memory notation entry into IEC standard
I'm already working on genimage patch to add IEC notation support, check here:
https://github.com/Benetti-Engineering/genimage/commits/iec-suffix/
Giulio
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 75 lines · Giulio Benetti
Quoted 63 lines · Edgar Bonet
Quoted 26 lines · Giulio Benetti
Hi Edgar,
Quoted 15 lines · Edgar Bonet
Hello!
Quoted 11 lines · Giulio Benetti
The coding style of the genimage.cfg files is described in the "The genimage.cfg file" section of the manual, but nothing enforces it. Add a library checking these rules:
- indentation with tabs, according to the nesting level
- position of the curly brackets
- empty line after a node, except for the last one
- one space before and after '='
- filename beginning with genimage
- notation of the offset and size options
- GB, MB, KB units in commentsQuoted 5 lines
Within genimage, ‘k’, ‘M’ and ‘G’ are binary units (powers of 1024 bytes). This can lead to some confusion, as HDD sizes are quoted with decimal prefixes (powers of 1000). Micro-SD cards used to be quoted with binary prefixes, but most (maybe all?) manufacturers have switched to decimal prefixes.
you're right,
Quoted 8 lines
Quoted 4 lines
In order to avoid the confusion, it would be preferable to use the IEC prefixes in the comments: KiB, MiB and GiB. This would be consistent with the notation used by ‘dd’, where MiB = M = 1024^2 B, whereas MB = 10^6 B.
thanks for pointing. And yes that would be preferable but I need to add
IEC support to genimage and wait for my patch to be accepted before checking against those prefixes. So I think this is a different but useful thing.I think there is no need to wait.
See what happened with ‘dd’:
• at some point, ‘dd’ used ‘K’, ‘M’ and ‘G’ as binary suffixes (or ‘units’, they are not prefixes: you would write ‘bs=1M’)
• when it introduced IEC support, it kept the original meaning of ‘K’, ‘M’ and ‘G’, for the sake of compatibility, while introducing the decimal units ‘kB’, ‘MB’ and ‘GB’, and the binary units ‘KiB’, ‘MiB’ and ‘GiB’.
Hence it introduced the convention:
• MB = 10^6 bytes
• M = MiB = 2^20 bytesI believe I have seen this convention used in other tools, although I do not remember where. But it seems to me like this convention is spreading.
So far, genimage is consistent with this convention, save for the case of ‘k’: ‘k’, ‘M’ and ‘G’ are used as binary units. No need to change this. Your patch replaces ‘M’ with ‘MB’ in the comments, which clashes with this convention (as ‘M’ stands for 2^20 bytes in this context). I propose using the IEC units in the comments, thus writing
Quoted 4 lines
size = 16M # 16 MiB
This would disambiguate the ‘M’ while being consistent with both IEC and the ‘dd’ convention.
Sure thing. It's only I prefer to send 2 different patchsets:
1. this one to add linter and fixes found by linter
2. a second one bumping to genimage with IEC support or addin a local patch pending upstream for genimage and one patch per .cfg file that rename every memory notation entry into IEC standard
Quoted 4 lines
I'm already working on genimage patch to add IEC notation support, check here:
https://github.com/Benetti-Engineering/genimage/commits/iec-suffix/Giulio
I've added support for IEC/SI styles to genimage and to Buildroot Linter as well and fixed all the .cfg files.
If anyone is interested in V2, since it's 81 patch "long", it can be found here:
https://github.com/Benetti-Engineering/buildroot/tree/genimage-iec
Giulio
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 368 lines
The coding style of the genimage.cfg files is described in the "The genimage.cfg file" section of the manual, but nothing enforces it. Add a library checking these rules:
- indentation with tabs, according to the nesting level
- position of the curly brackets
- empty line after a node, except for the last one
- one space before and after '='
- filename beginning with genimage
- notation of the offset and size options
- GB, MB, KB units in comments
- partition-type-uuid set for every partition of a GPT image, unquoted, using the genimage shortcut when there is one, and in lower-case otherwiseThe table of shortcuts comes from genimage's
image-hd.c.Files generated from a template (genimage.cfg.in, genimage.cfg.template*) are not checked, since they contain placeholders.
Add the existing files that do not follow the rules to .checkpackageignore.
Assisted-by Claude Opus 5.5 <[email protected]>Signed-off-by Giulio Benetti <[email protected]>.checkpackageignore +46
-0@@ -1,48 +1,89 @@ +board/aarch64-efi/genimage-efi.cfg lib_genimage.EmptyLineAfterNode +board/amarula/vyasa/genimage.cfg lib_genimage.CommentUnits board/amarula/vyasa/post-build.sh Shellcheck +board/andes/ae350/genimage_sdcard.cfg lib_genimage.EmptyLineAfterNode board/arcturus/aarch64-ucls1012a/post-build.sh Shellcheck board/arcturus/aarch64-ucls1012a/post-image.sh Shellcheck +board/arm/fvp-ebbr/genimage.cfg lib_genimage.PartitionTypeUuidShortcut +board/aspeed/ast2500-evb/genimage.cfg lib_genimage.EmptyLineAfterNode lib_genimage.OptionAssignment +board/aspeed/ast2600-evb/genimage.cfg lib_genimage.EmptyLineAfterNode board/aspeed/common/post-image.sh Shellcheck board/asus/tinker/post-build.sh Shellcheck board/atmel/flasher.sh Shellcheck +board/avnet/rzboard_v2l/genimage.cfg lib_genimage.EmptyLineAfterNode lib_genimage.GptPartitionTypeUuid board/beagleboard/beaglebone-qt5/patches/linux/0001-keep-jtag-clock-alive-for-debugger.patch lib_patch.Upstream +board/beagleboard/beagleplay/genimage.cfg lib_genimage.Indent +board/beagleboard/beaglev_fire/genimage.cfg lib_genimage.EmptyLineAfterNode lib_genimage.GptPartitionTypeUuid lib_genimage.Indent lib_genimage.PartitionTypeUuidCase lib_genimage.PartitionTypeUuidShortcut board/boundarydevices/common/post-build.sh Shellcheck board/boundarydevices/common/post-image.sh Shellcheck board/broadcom/northstar/post-image.sh Shellcheck board/bsh/imx8mn-bsh-smm-s2-pro/flash.sh Shellcheck lib_shellscript.EmptyLastLine +board/bsh/imx8mn-bsh-smm-s2-pro/genimage.cfg lib_genimage.GptPartitionTypeUuid board/bsh/imx8mn-bsh-smm-s2-pro/post-build.sh Shellcheck board/bsh/imx8mn-bsh-smm-s2-pro/post-image.sh Shellcheck board/bsh/imx8mn-bsh-smm-s2/flash.sh Shellcheck lib_shellscript.EmptyLastLine board/bsh/imx8mn-bsh-smm-s2/post-build.sh Shellcheck +board/canaan/k210-soc/genimage.cfg lib_genimage.EmptyLineAfterNode board/canaan/k210-soc/post-build.sh Shellcheck board/chromebook/elm/sign.sh Shellcheck board/chromebook/mksd.sh Shellcheck board/ci20/patches/uboot/0001-mips-Remove-default-endiannes.patch lib_patch.Upstream +board/compulab/iot-gate-imx8-ebbr/genimage.cfg lib_genimage.PartitionTypeUuidCase +board/coolpi/coolpi-4b/genimage.cfg lib_genimage.EmptyLineAfterNode lib_genimage.GptPartitionTypeUuid board/freescale/common/imx/imx8-bootloader-prepare.sh Shellcheck board/freescale/common/mxs/post-image.sh Shellcheck board/friendlyarm/nanopi-r2s/post-build.sh Shellcheck +board/grinn/liteboard/genimage.cfg lib_genimage.CommentUnits board/hardkernel/odroidc2/post-image.sh Shellcheck board/hardkernel/odroidc2/rootfs_overlay/etc/init.d/S09modload Shellcheck lib_sysv.Variables +board/khadas/vim3/genimage.cfg lib_genimage.OptionAssignment +board/kontron/bl-imx8mm/genimage.cfg lib_genimage.GptPartitionTypeUuid board/kontron/bl-imx8mm/post-build.sh Shellcheck +board/kontron/smarc-sal28/genimage.cfg lib_genimage.GptPartitionTypeUuid board/kontron/smarc-sal28/post-build.sh Shellcheck +board/lego/ev3/genimage.cfg lib_genimage.CommentUnits lib_genimage.EmptyLineAfterNode board/lego/ev3/post-image.sh Shellcheck +board/loongarch64-efi/genimage-efi.cfg lib_genimage.EmptyLineAfterNode +board/mender/x86_64/genimage-efi.cfg lib_genimage.EmptyLineAfterNode lib_genimage.PartitionTypeUuidShortcut +board/microchip/mpfs_icicle/genimage.cfg lib_genimage.EmptyLineAfterNode lib_genimage.GptPartitionTypeUuid lib_genimage.Indent lib_genimage.PartitionTypeUuidCase +board/microchip/sama7g5ek/genimage.cfg lib_genimage.EmptyLineAfterNode +board/minnowboard/genimage.cfg lib_genimage.EmptyLineAfterNode board/minnowboard/post-build.sh Shellcheck board/nexbox/a95x/post-build.sh Shellcheck board/nexbox/a95x/post-image.sh Shellcheck +board/octavo/osd32mp1-brk/genimage.cfg lib_genimage.GptPartitionTypeUuid board/octavo/osd32mp1-brk/patches/uboot/0001-Add-OSD32MP1-BRK-device-tree-support.patch lib_patch.NumberedSubject lib_patch.Upstream board/octavo/osd32mp1-brk/patches/uboot/0002-Add-OSD32MP1-BRK-build-config.patch lib_patch.NumberedSubject lib_patch.Upstream +board/octavo/osd32mp1-red/genimage.cfg lib_genimage.GptPartitionTypeUuid board/octavo/osd32mp1-red/patches/uboot/0001-Add-OSD32MP1-RED-Device-Tree-support.patch lib_patch.NumberedSubject lib_patch.Upstream board/octavo/osd32mp1-red/patches/uboot/0002-configs-stm32mp15_trusted_defconfig-disable-environm.patch lib_patch.NumberedSubject lib_patch.Upstream +board/olimex/stmp1_olinuxino/genimage.cfg lib_genimage.GptPartitionTypeUuid board/olpc/post-build.sh Shellcheck +board/orangepi/common/genimage.cfg lib_genimage.GptPartitionTypeUuid board/orangepi/common/post-build.sh Shellcheck +board/orangepi/orangepi-5-plus/genimage.cfg lib_genimage.PartitionTypeUuidShortcut board/orangepi/orangepi-zero/patches/linux/0001-ARM-dts-orange-pi-zero-interrupt-triggering-xr819.patch lib_patch.Upstream board/orangepi/orangepi-zero/patches/linux/0002-ARM-dts-orange-pi-zero-enable-spi-nor.patch lib_patch.Upstream board/orangepi/orangepi-zero/patches/linux/0003-ARM-dts-orange-pi-zero-enable-spidev.patch lib_patch.Upstream board/orangepi/orangepi-zero/patches/linux/0004-ARM-dts-orange-pi-zero-enable-uart.patch lib_patch.Upstream +board/pc/genimage-efi.cfg lib_genimage.PartitionTypeUuidShortcut +board/pine64/rockpro64-ebbr/genimage.cfg lib_genimage.PartitionTypeUuidCase +board/pine64/rockpro64/genimage.cfg lib_genimage.GptPartitionTypeUuid lib_genimage.PartitionTypeUuidShortcut +board/pine64/star64/genimage.cfg lib_genimage.GptPartitionTypeUuid lib_genimage.Indent lib_genimage.PartitionTypeUuidCase +board/qemu/aarch64-ebbr/genimage.cfg lib_genimage.PartitionTypeUuidShortcut board/qemu/aarch64-sbsa/assemble-flash-images Shellcheck +board/qemu/aarch64-sbsa/genimage.cfg lib_genimage.PartitionTypeUuidShortcut +board/qemu/arm-ebbr/genimage.cfg lib_genimage.PartitionTypeUuidShortcut +board/qemu/loongarch64-virt-efi/genimage.cfg lib_genimage.EmptyLineAfterNode +board/qemu/riscv64-virt-efi/genimage.cfg lib_genimage.PartitionTypeUuidShortcut +board/radxa/rock5b/genimage.cfg lib_genimage.PartitionTypeUuidShortcut board/raspberrypi/post-build.sh Shellcheck board/raspberrypi/post-image.sh Shellcheck +board/seeed/stm32mp157c-odyssey/genimage.cfg lib_genimage.GptPartitionTypeUuid board/seeed/stm32mp157c-odyssey/patches/linux/0001-ARM-dts-stm32-fix-stm32mp157c-odyssey-card-detect.patch lib_patch.Upstream board/sheevaplug/patches/uboot/0001-Remove-redundant-YYLOC-global-declaration.patch lib_patch.Upstream +board/sifive/common/genimage_sdcard.cfg lib_genimage.PartitionTypeUuidShortcut +board/sipeed/licheepi_nano/genimage.cfg lib_genimage.CurlyBrackets lib_genimage.EmptyLastLine lib_genimage.EmptyLineAfterNode board/solidrun/clearfog/post-build.sh Shellcheck board/solidrun/macchiatobin/post-build-mainline.sh Shellcheck board/solidrun/macchiatobin/post-build.sh Shellcheck@@ -52,7 +93,9 @@ board/stmicroelectronics/stm32f429-disco/flash.sh Shellcheck board/stmicroelectronics/stm32f469-disco/flash_sd.sh Shellcheck board/stmicroelectronics/stm32f469-disco/flash_xip.sh Shellcheck board/synopsys/axs10x/post-build.sh Shellcheck +board/ti/am574x-idk/genimage.cfg lib_genimage.Indent board/udoo/common/post-build.sh Shellcheck +board/visionfive2/genimage.cfg lib_genimage.PartitionTypeUuidShortcut boot/afboot-stm32/0003-Makefile-disable-stack-protector.patch lib_patch.Upstream boot/optee-os/3.13.0/0001-core-zlib-fix-build-warning-when-_LFS64_LARGEFILE-is.patch lib_patch.Upstream boot/syslinux/0001-bios-Fix-alignment-change-with-gcc-5.patch lib_patch.Upstream@@ -982,6 +1025,9 @@ support/scripts/fix-configure-powerpc64.sh lib_shellscript.EmptyLastLine support/scripts/generate-gitlab-ci-yml Shellcheck support/scripts/mkmakefile Shellcheck lib_shellscript.ConsecutiveEmptyLines support/scripts/setlocalversion Shellcheck +support/testing/tests/boot/test_grub/genimage-aarch64-efi.cfg lib_genimage.PartitionTypeUuidShortcut support/testing/tests/core/post-build.sh Shellcheck support/testing/tests/package/test_opkg/post-build.sh Shellcheck +support/testing/tests/package/test_xen/aarch64/genimage.cfg lib_genimage.PartitionTypeUuidCase +support/testing/tests/package/test_xen/arm/genimage.cfg lib_genimage.PartitionTypeUuidCase support/testing/tests/utils/test_get_developers/0001-package-binutils-change-.mk.patch lib_patch.NumberedSubject lib_patch.Upstreamutils/check-package +7
-0@@ -19,6 +19,7 @@ import sys import checkpackagelib.base import checkpackagelib.lib_config import checkpackagelib.lib_defconfig +import checkpackagelib.lib_genimage import checkpackagelib.lib_hash import checkpackagelib.lib_ignore import checkpackagelib.lib_mk@@ -159,6 +160,10 @@ SYSV_INIT_SCRIPT_FILENAME = re.compile(r"/S\d\d[^/]+$") # in a br2-external tree. BR_DEFCONFIG_FILENAME = re.compile(r"^(.+/)?configs/[^/]+_defconfig$") +# Match any name containing genimage, so that the ones with a wrong prefix are +# reported. +GENIMAGE_CFG_FILENAME = re.compile(r"genimage[^/]*\.cfg$") + def get_lib_from_filename(fname): if flags.intree_only:@@ -176,6 +181,8 @@ def get_lib_from_filename(fname): return checkpackagelib.lib_config if BR_DEFCONFIG_FILENAME.search(fname): return checkpackagelib.lib_defconfig + if GENIMAGE_CFG_FILENAME.search(fname): + return checkpackagelib.lib_genimage if fname.endswith(".hash"): return checkpackagelib.lib_hash if fname.endswith(".mk") or fname.endswith(".mk.in"):utils/checkpackagelib/lib_genimage.py new file +190
-0@@ -0,0 +1,407 @@ +# See utils/checkpackagelib/readme.txt before editing this file. + +import os +import re + +from checkpackagelib.base import _CheckFunction +from checkpackagelib.lib import ConsecutiveEmptyLines # noqa: F401 +from checkpackagelib.lib import EmptyLastLine # noqa: F401 +from checkpackagelib.lib import NewlineAtEof # noqa: F401 +from checkpackagelib.lib import TrailingSpace # noqa: F401 +from checkpackagelib.lib import Utf8Characters # noqa: F401 +from checkpackagelib.tool import NotExecutable # noqa: F401 + +# used in more than one check +STRING_OR_COMMENT = re.compile(r"(\"[^\"]*\"|'[^']*')|(#|//).*") + + +def strip_comment(text): + return STRING_OR_COMMENT.sub(lambda m: m.group(1) or "", text).strip() + + +def strip_comment_and_strings(text): + return STRING_OR_COMMENT.sub(lambda m: '""' if m.group(1) else "", text).strip() + + +class _Structure(_CheckFunction): + """Keeps track of the curly brackets, to know where each line is located""" + BRACKET = re.compile(r"[{}]") + LIST = re.compile(r"=\s*$") + + def before(self): + # One entry per open curly bracket: the words of the node's name, or + # None for a list, e.g. 'files = {' + self.stack = [] + + def track(self, code): + """Update the stack, return the list of entries that were closed""" + closed = [] + start = 0 + for m in self.BRACKET.finditer(code): + if m.group() == "{": + name = code[start:m.start()] + self.stack.append(None if self.LIST.search(name) else name.split()) + elif self.stack: + closed.append(self.stack.pop()) + start = m.end() + return closed + + +class CommentUnits(_CheckFunction): + COMMENT = re.compile(r"(?:\"[^\"]*\"|'[^']*'|[^\"'#])*?(?:#|//)(.*)") + UNIT = re.compile(r"\b\d+ ?([kmg]b?)\b", re.IGNORECASE) + ALLOWED = ["GB", "MB", "KB"] + + def check_line(self, lineno, text): + comment = self.COMMENT.match(text) + if not comment: + return + for unit in self.UNIT.findall(comment.group(1)): + if unit not in self.ALLOWED: + return ["{}:{}: use GB, MB or KB in comments ({}#writing-genimage-cfg)" + .format(self.filename, lineno, self.url_to_manual), + text] + + +class CurlyBrackets(_Structure): + def check_line(self, lineno, text): + code = strip_comment_and_strings(text) + in_list = bool(self.stack) and self.stack[-1] is None + closed = self.track(code) + + if code.startswith("{"): + return ["{}:{}: open curly bracket must be on the same line as the name ({}#writing-genimage-cfg)" + .format(self.filename, lineno, self.url_to_manual), + text] + # lists can be on a single line + if any(entry is not None for entry in closed) and code != "}": + return ["{}:{}: closing curly bracket must be alone on its line ({}#writing-genimage-cfg)" + .format(self.filename, lineno, self.url_to_manual), + text] + opens_node = "{" in code and not in_list and "=" not in code.split("{")[0] + if opens_node and not code.endswith("{"): + return ["{}:{}: node content must start on a new line ({}#writing-genimage-cfg)" + .format(self.filename, lineno, self.url_to_manual), + text] + + +class EmptyLineAfterNode(_Structure): + def before(self): + super().before() + self.after_node = False + + def check_line(self, lineno, text): + code = strip_comment_and_strings(text) + missing = self.after_node and text.strip() != "" and not code.startswith("}") + closed = self.track(code) + self.after_node = bool(closed) and closed[-1] is not None + + if missing: + return ["{}:{}: missing empty line after the previous node ({}#writing-genimage-cfg)" + .format(self.filename, lineno, self.url_to_manual), + text] + + +class Filename(_CheckFunction): + def before(self): + if not os.path.basename(self.filename).startswith("genimage"): + return ["{}:0: filename must begin with genimage ({}#writing-genimage-cfg)" + .format(self.filename, self.url_to_manual)] + + +class GptPartitionTypeUuid(_Structure): + """Checks that each partition of a GPT image has a partition-type-uuid""" + OPTION = re.compile(r"^([a-z-]+)\s*=\s*[\"']?([^\"'\s]*)") + FALSE = ["false", "no", "off"] + + def before(self): + super().before() + self.gpt = False + self.partition = None + self.missing = [] + + def check_line(self, lineno, text): + code = strip_comment_and_strings(text) + closed = self.track(code) + node = self.stack[-1][0] if self.stack and self.stack[-1] else None + + if closed: + for entry in closed: + if not entry: + continue + if entry[0] == "partition" and self.partition: + if self.partition["needs-type"]: + self.missing.append(self.partition) + self.partition = None + elif entry[0] == "image": + gpt, missing = self.gpt, self.missing + self.gpt, self.missing = False, [] + if gpt and missing: + return ["{}:{}: GPT partition without partition-type-uuid: {} ({}#writing-genimage-cfg)" + .format(self.filename, missing[0]["lineno"], + ", ".join(p["name"] for p in missing), + self.url_to_manual), + missing[0]["text"]] + return + + if node == "partition" and code.endswith("{"): + self.partition = {"name": " ".join(strip_comment(text).rstrip("{").split()[1:]), + "lineno": lineno, "text": text, "needs-type": True} + return + + option = self.OPTION.search(strip_comment(text)) + if not option: + return + name, value = option.groups() + if node == "hdimage": + # 'gpt = true' is the deprecated form + if name == "partition-table-type": + self.gpt = value in ["gpt", "hybrid"] + elif name == "gpt": + self.gpt = value.lower() not in self.FALSE + elif node == "partition" and self.partition: + if name == "partition-type-uuid": + self.partition["needs-type"] = False + elif name == "in-partition-table" and value.lower() in self.FALSE: + self.partition["needs-type"] = False + + +class Indent(_Structure): + def check_line(self, lineno, text): + if text.strip() == "": + return + code = strip_comment_and_strings(text) + expected = len(self.stack) + if code.startswith("}"): + expected = max(0, expected - 1) + self.track(code) + + if text[:len(text) - len(text.lstrip())] != "\t" * expected: + return ["{}:{}: should be indented with {} tab(s) ({}#writing-genimage-cfg)" + .format(self.filename, lineno, expected, self.url_to_manual), + text] + + +class OptionAssignment(_CheckFunction): + ASSIGNMENT = re.compile(r"^[\w-]+(\s*)\+?=(\s*)(.*)$") + + def check_line(self, lineno, text): + m = self.ASSIGNMENT.search(strip_comment(text)) + if not m:
utils/checkpackagelib/lib_genimage.py line 200
Quoted 10 lines
utils/checkpackagelib/lib_genimage.py new file +10
-0+ return + space_before, space_after, value = m.groups() + if space_before != " " or (value and space_after != " "): + return ["{}:{}: use one space before and after '=' ({}#writing-genimage-cfg)" + .format(self.filename, lineno, self.url_to_manual), + text] + + +class SizeNotation(_CheckFunction): + OPTION = re.compile(r"^(?:offset|size)\s*=\s*[\"']?(\d[^\"'\s]*)")
Would it be worth also checking other size fields in the flash section, e.g. pebsize, numpebs?
https://github.com/pengutronix/genimage#the-flash-section
Just a suggestion, could do it in a separate patch.
Signature · 5 lines
Fengwei Tan <[email protected]> _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 2/46 board/aarch64-efi: fix genimage-efi.cfg coding style
In reply to Giulio BenettiFix the check-package warnings:
- add the missing empty lines after nodes
The generated image is not modified.
Drop the corresponding entry from .checkpackageignore.
--- .checkpackageignore | 1 - board/aarch64-efi/genimage-efi.cfg | 1 + 2 files changed, 1 insertion(+), 1 deletion(-)
.checkpackageignore +0 -1
@@ -1,4 +1,3 @@ -board/aarch64-efi/genimage-efi.cfg lib_genimage.EmptyLineAfterNode board/amarula/vyasa/genimage.cfg lib_genimage.CommentUnits board/amarula/vyasa/post-build.sh Shellcheck board/andes/ae350/genimage_sdcard.cfg lib_genimage.EmptyLineAfterNode
board/aarch64-efi/genimage-efi.cfg +1 -0
@@ -3,6 +3,7 @@ image efi-part.vfat { file EFI { image = "efi-part/EFI" } + file Image { image = "Image" }
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 3/46 board/amarula/vyasa: fix genimage.cfg coding style
In reply to Giulio BenettiFix the check-package warnings:
- use KB and MB in comments
The generated image is not modified.
Drop the corresponding entry from .checkpackageignore.
--- .checkpackageignore | 1 - board/amarula/vyasa/genimage.cfg | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-)
.checkpackageignore +0 -1
@@ -1,4 +1,3 @@ -board/amarula/vyasa/genimage.cfg lib_genimage.CommentUnits board/amarula/vyasa/post-build.sh Shellcheck board/andes/ae350/genimage_sdcard.cfg lib_genimage.EmptyLineAfterNode board/arcturus/aarch64-ucls1012a/post-build.sh Shellcheck
board/amarula/vyasa/genimage.cfg +1 -1
@@ -12,7 +12,7 @@ image sdcard.img { in-partition-table = "no" image = "u-boot-dtb.img" offset = 8M - size = 30M # falcon mode: args @ 16M args, uImage @ 17M + size = 30M # falcon mode: args @ 16MB args, uImage @ 17MB } partition rootfs {
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH 03/46] board/amarula/vyasa: fix genimage.cfg coding style
Hi Giulio
Quoted 30 lines · Giulio Benetti
Fix the check-package warnings:
- use KB and MB in comments
The generated image is not modified.
Drop the corresponding entry from .checkpackageignore.
Assisted-by Claude Opus 5.5 <[email protected]>Signed-off-by Giulio Benetti <[email protected]>--- .checkpackageignore | 1 - board/amarula/vyasa/genimage.cfg | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-).checkpackageignore +0
-1@@ -1,4 +1,3 @@ -board/amarula/vyasa/genimage.cfg lib_genimage.CommentUnits board/amarula/vyasa/post-build.sh Shellcheck board/andes/ae350/genimage_sdcard.cfg lib_genimage.EmptyLineAfterNode board/arcturus/aarch64-ucls1012a/post-build.sh Shellcheckboard/amarula/vyasa/genimage.cfg +0
-0
board/amarula/vyasa/genimage.cfg image sdcard.img { · line 15
Quoted 5 lines
board/amarula/vyasa/genimage.cfg +1
-1@@ -12,7 +12,7 @@ image sdcard.img { in-partition-table = "no" image = "u-boot-dtb.img" offset = 8M - size = 30M # falcon mode: args @ 16M args, uImage @ 17M + size = 30M # falcon mode: args @ 16MB args, uImage @ 17MB
Michael
Quoted 6 lines
board/amarula/vyasa/genimage.cfg +0
-1} partition rootfs { --2.47.3
Signature · 15 lines
Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 [email protected] __________________________________ Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 [email protected] www.amarulasolutions.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 4/46 board/andes/ae350: fix genimage_sdcard.cfg coding style
In reply to Giulio BenettiFix the check-package warnings:
- add the missing empty lines after nodes
The generated image is not modified.
Drop the corresponding entry from .checkpackageignore.
--- .checkpackageignore | 1 - board/andes/ae350/genimage_sdcard.cfg | 1 + 2 files changed, 1 insertion(+), 1 deletion(-)
.checkpackageignore +0 -1
@@ -1,5 +1,4 @@ board/amarula/vyasa/post-build.sh Shellcheck -board/andes/ae350/genimage_sdcard.cfg lib_genimage.EmptyLineAfterNode board/arcturus/aarch64-ucls1012a/post-build.sh Shellcheck board/arcturus/aarch64-ucls1012a/post-image.sh Shellcheck board/arm/fvp-ebbr/genimage.cfg lib_genimage.PartitionTypeUuidShortcut
board/andes/ae350/genimage_sdcard.cfg +1 -0
@@ -6,6 +6,7 @@ image boot.vfat { "ae350_ax45mp.dtb", } } + size = 2M }
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 5/46 board/arm/fvp-ebbr: fix genimage.cfg coding style
In reply to Giulio BenettiFix the check-package warnings:
- use the genimage shortcuts for partition-type-uuid
The generated image is not modified.
Drop the corresponding entry from .checkpackageignore.
--- .checkpackageignore | 1 - board/arm/fvp-ebbr/genimage.cfg | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-)
.checkpackageignore +0 -1
@@ -1,7 +1,6 @@ board/amarula/vyasa/post-build.sh Shellcheck board/arcturus/aarch64-ucls1012a/post-build.sh Shellcheck board/arcturus/aarch64-ucls1012a/post-image.sh Shellcheck -board/arm/fvp-ebbr/genimage.cfg lib_genimage.PartitionTypeUuidShortcut board/aspeed/ast2500-evb/genimage.cfg lib_genimage.EmptyLineAfterNode lib_genimage.OptionAssignment board/aspeed/ast2600-evb/genimage.cfg lib_genimage.EmptyLineAfterNode board/aspeed/common/post-image.sh Shellcheck
board/arm/fvp-ebbr/genimage.cfg +1 -1
@@ -25,7 +25,7 @@ image disk.img { } partition root { - partition-type-uuid = b921b045-1df0-41c3-af44-4c6f280d3fae + partition-type-uuid = root-arm64 image = "rootfs.ext2" } }
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 6/46 board/aspeed/ast2500-evb: fix genimage.cfg coding style
In reply to Giulio BenettiFix the check-package warnings:
- add the missing empty lines after nodes
- use one space before and after '='
The generated image is not modified.
Drop the corresponding entry from .checkpackageignore.
--- .checkpackageignore | 1 - board/aspeed/ast2500-evb/genimage.cfg | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-)
.checkpackageignore +0 -1
@@ -1,7 +1,6 @@ board/amarula/vyasa/post-build.sh Shellcheck board/arcturus/aarch64-ucls1012a/post-build.sh Shellcheck board/arcturus/aarch64-ucls1012a/post-image.sh Shellcheck -board/aspeed/ast2500-evb/genimage.cfg lib_genimage.EmptyLineAfterNode lib_genimage.OptionAssignment board/aspeed/ast2600-evb/genimage.cfg lib_genimage.EmptyLineAfterNode board/aspeed/common/post-image.sh Shellcheck board/asus/tinker/post-build.sh Shellcheck
board/aspeed/ast2500-evb/genimage.cfg +2 -1
@@ -14,6 +14,7 @@ flash nor-32M-256 { image flash.img { flash { } + flashtype = "nor-32M-256" partition uboot {
@@ -35,6 +36,6 @@ image flash.img { partition spare { offset = 7512K - size = 25256K + size = 25256K } }
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 7/46 board/aspeed/ast2600-evb: fix genimage.cfg coding style
In reply to Giulio BenettiFix the check-package warnings:
- add the missing empty lines after nodes
The generated image is not modified.
Drop the corresponding entry from .checkpackageignore.
--- .checkpackageignore | 1 - board/aspeed/ast2600-evb/genimage.cfg | 1 + 2 files changed, 1 insertion(+), 1 deletion(-)
.checkpackageignore +0 -1
@@ -1,7 +1,6 @@ board/amarula/vyasa/post-build.sh Shellcheck board/arcturus/aarch64-ucls1012a/post-build.sh Shellcheck board/arcturus/aarch64-ucls1012a/post-image.sh Shellcheck -board/aspeed/ast2600-evb/genimage.cfg lib_genimage.EmptyLineAfterNode board/aspeed/common/post-image.sh Shellcheck board/asus/tinker/post-build.sh Shellcheck board/atmel/flasher.sh Shellcheck
board/aspeed/ast2600-evb/genimage.cfg +1 -0
@@ -14,6 +14,7 @@ flash nor-64M-256 { image flash.img { flash { } + flashtype = "nor-64M-256" partition uboot {
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 8/46 board/avnet/rzboard_v2l: fix style and set partition-type-uuid
In reply to Giulio BenettiFix the check-package warnings:
- add the missing empty lines after nodes
- set partition-type-uuid for every GPT partition
The partition-type-uuid that was missing is set to L, which is what genimage uses by default.
The generated image is not modified.
Drop the corresponding entry from .checkpackageignore.
--- .checkpackageignore | 1 - board/avnet/rzboard_v2l/genimage.cfg | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-)
.checkpackageignore +0 -1
@@ -4,7 +4,6 @@ board/arcturus/aarch64-ucls1012a/post-image.sh Shellcheck board/aspeed/common/post-image.sh Shellcheck board/asus/tinker/post-build.sh Shellcheck board/atmel/flasher.sh Shellcheck -board/avnet/rzboard_v2l/genimage.cfg lib_genimage.EmptyLineAfterNode lib_genimage.GptPartitionTypeUuid board/beagleboard/beaglebone-qt5/patches/linux/0001-keep-jtag-clock-alive-for-debugger.patch lib_patch.Upstream board/beagleboard/beagleplay/genimage.cfg lib_genimage.Indent board/beagleboard/beaglev_fire/genimage.cfg lib_genimage.EmptyLineAfterNode lib_genimage.GptPartitionTypeUuid lib_genimage.Indent lib_genimage.PartitionTypeUuidCase lib_genimage.PartitionTypeUuidShortcut
board/avnet/rzboard_v2l/genimage.cfg +3 -0
@@ -8,6 +8,7 @@ image boot.vfat { "uEnv.txt" } } + size = 24M }
@@ -20,10 +21,12 @@ image sdcard.img { partition-type = "0xC" bootable = "true" image = "boot.vfat" + partition-type-uuid = L } partition rootfs { partition-type = 0x83 image = "rootfs.ext2" + partition-type-uuid = L } }
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 9/46 board/beagleboard/beagleplay: fix genimage.cfg coding style
In reply to Giulio BenettiFix the check-package warnings:
- indent with tabs
The generated image is not modified.
Drop the corresponding entry from .checkpackageignore.
--- .checkpackageignore | 1 - board/beagleboard/beagleplay/genimage.cfg | 56 +++++++++++------------ 2 files changed, 28 insertions(+), 29 deletions(-)
.checkpackageignore +0 -1
@@ -5,7 +5,6 @@ board/aspeed/common/post-image.sh Shellcheck board/asus/tinker/post-build.sh Shellcheck board/atmel/flasher.sh Shellcheck board/beagleboard/beaglebone-qt5/patches/linux/0001-keep-jtag-clock-alive-for-debugger.patch lib_patch.Upstream -board/beagleboard/beagleplay/genimage.cfg lib_genimage.Indent board/beagleboard/beaglev_fire/genimage.cfg lib_genimage.EmptyLineAfterNode lib_genimage.GptPartitionTypeUuid lib_genimage.Indent lib_genimage.PartitionTypeUuidCase lib_genimage.PartitionTypeUuidShortcut board/boundarydevices/common/post-build.sh Shellcheck board/boundarydevices/common/post-image.sh Shellcheck
board/beagleboard/beagleplay/genimage.cfg +28 -28
67 lines not on this page · raw message
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 10/46 board/beagleboard/beaglev_fire: fix style and set partition-type-uuid
In reply to Giulio BenettiFix the check-package warnings:
- indent with tabs
- add the missing empty lines after nodes
- use the genimage shortcuts for partition-type-uuid
- use lower-case GUIDs for partition-type-uuid
- set partition-type-uuid for every GPT partition
The partition-type-uuid that was missing is set to L, which is what genimage uses by default.
The generated image is not modified.
Drop the corresponding entry from .checkpackageignore.
--- .checkpackageignore | 1 - board/beagleboard/beaglev_fire/genimage.cfg | 8 +++++--- 2 files changed, 5 insertions(+), 4 deletions(-)
.checkpackageignore +0 -1
@@ -5,7 +5,6 @@ board/aspeed/common/post-image.sh Shellcheck board/asus/tinker/post-build.sh Shellcheck board/atmel/flasher.sh Shellcheck board/beagleboard/beaglebone-qt5/patches/linux/0001-keep-jtag-clock-alive-for-debugger.patch lib_patch.Upstream -board/beagleboard/beaglev_fire/genimage.cfg lib_genimage.EmptyLineAfterNode lib_genimage.GptPartitionTypeUuid lib_genimage.Indent lib_genimage.PartitionTypeUuidCase lib_genimage.PartitionTypeUuidShortcut board/boundarydevices/common/post-build.sh Shellcheck board/boundarydevices/common/post-image.sh Shellcheck board/broadcom/northstar/post-image.sh Shellcheck
board/beagleboard/beaglev_fire/genimage.cfg +5 -3
@@ -3,13 +3,14 @@ image boot.vfat { vfat { files = { - "beaglev_fire.itb", + "beaglev_fire.itb", } file boot.scr { image = "boot.scr" } } + size = 60M }
@@ -19,17 +20,18 @@ image sdcard.img { } partition uboot { - partition-type-uuid = 21686148-6449-6E6F-744E-656564454649 + partition-type-uuid = 21686148-6449-6e6f-744e-656564454649 image = "payload.bin" } partition kernel { - partition-type-uuid = 0FC63DAF-8483-4772-8E79-3D69D8477DE4 + partition-type-uuid = L bootable = "true" image = "boot.vfat" } partition root { image = "rootfs.ext4" + partition-type-uuid = L } }
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 11/46 board/bsh/imx8mn-bsh-smm-s2-pro: set partition-type-uuid in genimage.cfg
In reply to Giulio BenettiFix the check-package warnings:
- set partition-type-uuid for every GPT partition
The partition-type-uuid that was missing is set to L, which is what genimage uses by default.
The generated image is not modified.
Drop the corresponding entry from .checkpackageignore.
--- .checkpackageignore | 1 - board/bsh/imx8mn-bsh-smm-s2-pro/genimage.cfg | 1 + 2 files changed, 1 insertion(+), 1 deletion(-)
.checkpackageignore +0 -1
@@ -9,7 +9,6 @@ board/boundarydevices/common/post-build.sh Shellcheck board/boundarydevices/common/post-image.sh Shellcheck board/broadcom/northstar/post-image.sh Shellcheck board/bsh/imx8mn-bsh-smm-s2-pro/flash.sh Shellcheck lib_shellscript.EmptyLastLine -board/bsh/imx8mn-bsh-smm-s2-pro/genimage.cfg lib_genimage.GptPartitionTypeUuid board/bsh/imx8mn-bsh-smm-s2-pro/post-build.sh Shellcheck board/bsh/imx8mn-bsh-smm-s2-pro/post-image.sh Shellcheck board/bsh/imx8mn-bsh-smm-s2/flash.sh Shellcheck lib_shellscript.EmptyLastLine
board/bsh/imx8mn-bsh-smm-s2-pro/genimage.cfg +1 -0
@@ -12,6 +12,7 @@ image sdcard.img { partition rootfs { offset = 8M image = "rootfs.ext4" + partition-type-uuid = L partition-uuid = %PARTUUID% } }
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 12/46 board/canaan/k210-soc: fix genimage.cfg coding style
In reply to Giulio BenettiFix the check-package warnings:
- add the missing empty lines after nodes
The generated image is not modified.
Drop the corresponding entry from .checkpackageignore.
--- .checkpackageignore | 1 - board/canaan/k210-soc/genimage.cfg | 1 + 2 files changed, 1 insertion(+), 1 deletion(-)
.checkpackageignore +0 -1
@@ -13,7 +13,6 @@ board/bsh/imx8mn-bsh-smm-s2-pro/post-build.sh Shellcheck board/bsh/imx8mn-bsh-smm-s2-pro/post-image.sh Shellcheck board/bsh/imx8mn-bsh-smm-s2/flash.sh Shellcheck lib_shellscript.EmptyLastLine board/bsh/imx8mn-bsh-smm-s2/post-build.sh Shellcheck -board/canaan/k210-soc/genimage.cfg lib_genimage.EmptyLineAfterNode board/canaan/k210-soc/post-build.sh Shellcheck board/chromebook/elm/sign.sh Shellcheck board/chromebook/mksd.sh Shellcheck
board/canaan/k210-soc/genimage.cfg +1 -0
@@ -8,6 +8,7 @@ image boot.vfat { image = "k210.dtb" } } + size = 4M }
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 13/46 board/compulab/iot-gate-imx8-ebbr: fix genimage.cfg coding style
In reply to Giulio BenettiFix the check-package warnings:
- use lower-case GUIDs for partition-type-uuid
The generated image is not modified.
Drop the corresponding entry from .checkpackageignore.
--- .checkpackageignore | 1 - board/compulab/iot-gate-imx8-ebbr/genimage.cfg | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-)
.checkpackageignore +0 -1
@@ -17,7 +17,6 @@ board/canaan/k210-soc/post-build.sh Shellcheck board/chromebook/elm/sign.sh Shellcheck board/chromebook/mksd.sh Shellcheck board/ci20/patches/uboot/0001-mips-Remove-default-endiannes.patch lib_patch.Upstream -board/compulab/iot-gate-imx8-ebbr/genimage.cfg lib_genimage.PartitionTypeUuidCase board/coolpi/coolpi-4b/genimage.cfg lib_genimage.EmptyLineAfterNode lib_genimage.GptPartitionTypeUuid board/freescale/common/imx/imx8-bootloader-prepare.sh Shellcheck board/freescale/common/mxs/post-image.sh Shellcheck
board/compulab/iot-gate-imx8-ebbr/genimage.cfg +1 -1
@@ -28,7 +28,7 @@ image disk.img { partition firmware { image = "flash.bin" # Linux reserved - partition-type-uuid = 8DA63339-0007-60C0-C436-083AC8230908 + partition-type-uuid = 8da63339-0007-60c0-c436-083ac8230908 offset = 33K }
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 14/46 board/coolpi/coolpi-4b: fix style and set partition-type-uuid
In reply to Giulio BenettiFix the check-package warnings:
- add the missing empty lines after nodes
- set partition-type-uuid for every GPT partition
The partition-type-uuid that was missing is set to L, which is what genimage uses by default.
The generated image is not modified.
Drop the corresponding entry from .checkpackageignore.
--- .checkpackageignore | 1 - board/coolpi/coolpi-4b/genimage.cfg | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-)
.checkpackageignore +0 -1
@@ -17,7 +17,6 @@ board/canaan/k210-soc/post-build.sh Shellcheck board/chromebook/elm/sign.sh Shellcheck board/chromebook/mksd.sh Shellcheck board/ci20/patches/uboot/0001-mips-Remove-default-endiannes.patch lib_patch.Upstream -board/coolpi/coolpi-4b/genimage.cfg lib_genimage.EmptyLineAfterNode lib_genimage.GptPartitionTypeUuid board/freescale/common/imx/imx8-bootloader-prepare.sh Shellcheck board/freescale/common/mxs/post-image.sh Shellcheck board/friendlyarm/nanopi-r2s/post-build.sh Shellcheck
board/coolpi/coolpi-4b/genimage.cfg +3 -0
@@ -8,6 +8,7 @@ image boot.vfat { "extlinux" } } + size = 32M }
@@ -26,10 +27,12 @@ image sdcard.img { partition-type = "0xC" bootable = "true" image = "boot.vfat" + partition-type-uuid = L } partition rootfs { partition-type = 0x83 image = "rootfs.ext2" + partition-type-uuid = L } }
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 15/46 board/grinn/liteboard: fix genimage.cfg coding style
In reply to Giulio BenettiFix the check-package warnings:
- use KB and MB in comments
The generated image is not modified.
Drop the corresponding entry from .checkpackageignore.
--- .checkpackageignore | 1 - board/grinn/liteboard/genimage.cfg | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-)
.checkpackageignore +0 -1
@@ -20,7 +20,6 @@ board/ci20/patches/uboot/0001-mips-Remove-default-endiannes.patch lib_patch.Upst board/freescale/common/imx/imx8-bootloader-prepare.sh Shellcheck board/freescale/common/mxs/post-image.sh Shellcheck board/friendlyarm/nanopi-r2s/post-build.sh Shellcheck -board/grinn/liteboard/genimage.cfg lib_genimage.CommentUnits board/hardkernel/odroidc2/post-image.sh Shellcheck board/hardkernel/odroidc2/rootfs_overlay/etc/init.d/S09modload Shellcheck lib_sysv.Variables board/khadas/vim3/genimage.cfg lib_genimage.OptionAssignment
board/grinn/liteboard/genimage.cfg +2 -2
@@ -1,9 +1,9 @@ # Minimal microSD card image for Grinn's liteBoard # # We mimic the .sdcard Freescale's image format for i.MX6UL: -# * the microSD card must have 1 kB free space at the beginning, +# * the microSD card must have 1 KB free space at the beginning, # * SPL is dumped as is, -# * U-Boot is dumped at 69K offset, as configured in SPL +# * U-Boot is dumped at 69KB offset, as configured in SPL # * a FAT partition at offset 8 MB is containing zImage and dtbs, # * a single root filesystem partition is required (Ext4 in this case). #
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 16/46 board/khadas/vim3: fix genimage.cfg coding style
In reply to Giulio BenettiFix the check-package warnings:
- use one space before and after '='
The generated image is not modified.
Drop the corresponding entry from .checkpackageignore.
--- .checkpackageignore | 1 - board/khadas/vim3/genimage.cfg | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-)
.checkpackageignore +0 -1
@@ -22,7 +22,6 @@ board/freescale/common/mxs/post-image.sh Shellcheck board/friendlyarm/nanopi-r2s/post-build.sh Shellcheck board/hardkernel/odroidc2/post-image.sh Shellcheck board/hardkernel/odroidc2/rootfs_overlay/etc/init.d/S09modload Shellcheck lib_sysv.Variables -board/khadas/vim3/genimage.cfg lib_genimage.OptionAssignment board/kontron/bl-imx8mm/genimage.cfg lib_genimage.GptPartitionTypeUuid board/kontron/bl-imx8mm/post-build.sh Shellcheck board/kontron/smarc-sal28/genimage.cfg lib_genimage.GptPartitionTypeUuid
board/khadas/vim3/genimage.cfg +1 -1
@@ -19,7 +19,7 @@ image sdcard.img { partition boot { partition-type = 0xC bootable = "true" - image="boot.vfat" + image = "boot.vfat" size = 64M offset = 2M }
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 17/46 board/kontron/bl-imx8mm: set partition-type-uuid in genimage.cfg
In reply to Giulio BenettiFix the check-package warnings:
- set partition-type-uuid for every GPT partition
The partition-type-uuid that was missing is set to L, which is what genimage uses by default.
The generated image is not modified.
Drop the corresponding entry from .checkpackageignore.
--- .checkpackageignore | 1 - board/kontron/bl-imx8mm/genimage.cfg | 1 + 2 files changed, 1 insertion(+), 1 deletion(-)
.checkpackageignore +0 -1
@@ -22,7 +22,6 @@ board/freescale/common/mxs/post-image.sh Shellcheck board/friendlyarm/nanopi-r2s/post-build.sh Shellcheck board/hardkernel/odroidc2/post-image.sh Shellcheck board/hardkernel/odroidc2/rootfs_overlay/etc/init.d/S09modload Shellcheck lib_sysv.Variables -board/kontron/bl-imx8mm/genimage.cfg lib_genimage.GptPartitionTypeUuid board/kontron/bl-imx8mm/post-build.sh Shellcheck board/kontron/smarc-sal28/genimage.cfg lib_genimage.GptPartitionTypeUuid board/kontron/smarc-sal28/post-build.sh Shellcheck
board/kontron/bl-imx8mm/genimage.cfg +1 -0
@@ -12,6 +12,7 @@ image sdcard.img { partition rootfs { image = "rootfs.ext4" + partition-type-uuid = L offset = 8M partition-uuid = %PARTUUID% }
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 18/46 board/kontron/smarc-sal28: set partition-type-uuid in genimage.cfg
In reply to Giulio BenettiFix the check-package warnings:
- set partition-type-uuid for every GPT partition
The partition-type-uuid that was missing is set to L, which is what genimage uses by default.
The generated image is not modified.
Drop the corresponding entry from .checkpackageignore.
--- .checkpackageignore | 1 - board/kontron/smarc-sal28/genimage.cfg | 1 + 2 files changed, 1 insertion(+), 1 deletion(-)
.checkpackageignore +0 -1
@@ -23,7 +23,6 @@ board/friendlyarm/nanopi-r2s/post-build.sh Shellcheck board/hardkernel/odroidc2/post-image.sh Shellcheck board/hardkernel/odroidc2/rootfs_overlay/etc/init.d/S09modload Shellcheck lib_sysv.Variables board/kontron/bl-imx8mm/post-build.sh Shellcheck -board/kontron/smarc-sal28/genimage.cfg lib_genimage.GptPartitionTypeUuid board/kontron/smarc-sal28/post-build.sh Shellcheck board/lego/ev3/genimage.cfg lib_genimage.CommentUnits lib_genimage.EmptyLineAfterNode board/lego/ev3/post-image.sh Shellcheck
board/kontron/smarc-sal28/genimage.cfg +1 -0
@@ -19,6 +19,7 @@ image sdcard-emmc.img { partition rootfs { offset = 4M image = rootfs.ext4 + partition-type-uuid = L partition-uuid = %PARTUUID% } }
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 19/46 board/lego/ev3: fix genimage.cfg coding style
In reply to Giulio BenettiFix the check-package warnings:
- add the missing empty lines after nodes
- use KB and MB in comments
The generated image is not modified.
Drop the corresponding entry from .checkpackageignore.
--- .checkpackageignore | 1 - board/lego/ev3/genimage.cfg | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-)
.checkpackageignore +0 -1
@@ -24,7 +24,6 @@ board/hardkernel/odroidc2/post-image.sh Shellcheck board/hardkernel/odroidc2/rootfs_overlay/etc/init.d/S09modload Shellcheck lib_sysv.Variables board/kontron/bl-imx8mm/post-build.sh Shellcheck board/kontron/smarc-sal28/post-build.sh Shellcheck -board/lego/ev3/genimage.cfg lib_genimage.CommentUnits lib_genimage.EmptyLineAfterNode board/lego/ev3/post-image.sh Shellcheck board/loongarch64-efi/genimage-efi.cfg lib_genimage.EmptyLineAfterNode board/mender/x86_64/genimage-efi.cfg lib_genimage.EmptyLineAfterNode lib_genimage.PartitionTypeUuidShortcut
board/lego/ev3/genimage.cfg +2 -1
@@ -13,6 +13,7 @@ flash nor-16M-256 { image flash.bin { flash { } + flashtype = "nor-16M-256" partition uboot {
@@ -34,7 +35,7 @@ image flash.bin { partition rootfs { image = "rootfs.squashfs" - offset = 4416K # 4M + 320KB + offset = 4416K # 4MB + 320KB size = 10M } }
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 20/46 board/loongarch64-efi: fix genimage-efi.cfg coding style
In reply to Giulio BenettiFix the check-package warnings:
- add the missing empty lines after nodes
The generated image is not modified.
Drop the corresponding entry from .checkpackageignore.
--- .checkpackageignore | 1 - board/loongarch64-efi/genimage-efi.cfg | 1 + 2 files changed, 1 insertion(+), 1 deletion(-)
.checkpackageignore +0 -1
@@ -25,7 +25,6 @@ board/hardkernel/odroidc2/rootfs_overlay/etc/init.d/S09modload Shellcheck lib_sy board/kontron/bl-imx8mm/post-build.sh Shellcheck board/kontron/smarc-sal28/post-build.sh Shellcheck board/lego/ev3/post-image.sh Shellcheck -board/loongarch64-efi/genimage-efi.cfg lib_genimage.EmptyLineAfterNode board/mender/x86_64/genimage-efi.cfg lib_genimage.EmptyLineAfterNode lib_genimage.PartitionTypeUuidShortcut board/microchip/mpfs_icicle/genimage.cfg lib_genimage.EmptyLineAfterNode lib_genimage.GptPartitionTypeUuid lib_genimage.Indent lib_genimage.PartitionTypeUuidCase board/microchip/sama7g5ek/genimage.cfg lib_genimage.EmptyLineAfterNode
board/loongarch64-efi/genimage-efi.cfg +1 -0
@@ -3,6 +3,7 @@ image efi-part.vfat { file EFI { image = "efi-part/EFI" } + file vmlinux.efi { image = "vmlinux.efi" }
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 21/46 board/mender/x86_64: fix genimage-efi.cfg coding style
In reply to Giulio BenettiFix the check-package warnings:
- add the missing empty lines after nodes
- use the genimage shortcuts for partition-type-uuid
The generated image is not modified.
Drop the corresponding entry from .checkpackageignore.
--- .checkpackageignore | 1 - board/mender/x86_64/genimage-efi.cfg | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-)
.checkpackageignore +0 -1
@@ -25,7 +25,6 @@ board/hardkernel/odroidc2/rootfs_overlay/etc/init.d/S09modload Shellcheck lib_sy board/kontron/bl-imx8mm/post-build.sh Shellcheck board/kontron/smarc-sal28/post-build.sh Shellcheck board/lego/ev3/post-image.sh Shellcheck -board/mender/x86_64/genimage-efi.cfg lib_genimage.EmptyLineAfterNode lib_genimage.PartitionTypeUuidShortcut board/microchip/mpfs_icicle/genimage.cfg lib_genimage.EmptyLineAfterNode lib_genimage.GptPartitionTypeUuid lib_genimage.Indent lib_genimage.PartitionTypeUuidCase board/microchip/sama7g5ek/genimage.cfg lib_genimage.EmptyLineAfterNode board/minnowboard/genimage.cfg lib_genimage.EmptyLineAfterNode
board/mender/x86_64/genimage-efi.cfg +4 -2
@@ -3,9 +3,11 @@ image efi-part.vfat { file EFI { image = "efi-part/EFI" } + file grub-mender-grubenv { image = "efi-part/grub-mender-grubenv" } + file bzImage { image = "bzImage" }
@@ -27,12 +29,12 @@ image disk.img { } partition roota { - partition-type-uuid = 4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709 + partition-type-uuid = root-x86-64 image = "rootfs.ext2" } partition rootb { - partition-type-uuid = 4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709 + partition-type-uuid = root-x86-64 image = "rootfs.ext2" }
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 22/46 board/microchip/mpfs_icicle: fix style and set partition-type-uuid
In reply to Giulio BenettiFix the check-package warnings:
- indent with tabs
- add the missing empty lines after nodes
- use lower-case GUIDs for partition-type-uuid
- set partition-type-uuid for every GPT partition
The partition-type-uuid that was missing is set to L, which is what genimage uses by default.
The generated image is not modified.
Drop the corresponding entry from .checkpackageignore.
--- .checkpackageignore | 1 - board/microchip/mpfs_icicle/genimage.cfg | 7 +++++-- 2 files changed, 5 insertions(+), 3 deletions(-)
.checkpackageignore +0 -1
@@ -25,7 +25,6 @@ board/hardkernel/odroidc2/rootfs_overlay/etc/init.d/S09modload Shellcheck lib_sy board/kontron/bl-imx8mm/post-build.sh Shellcheck board/kontron/smarc-sal28/post-build.sh Shellcheck board/lego/ev3/post-image.sh Shellcheck -board/microchip/mpfs_icicle/genimage.cfg lib_genimage.EmptyLineAfterNode lib_genimage.GptPartitionTypeUuid lib_genimage.Indent lib_genimage.PartitionTypeUuidCase board/microchip/sama7g5ek/genimage.cfg lib_genimage.EmptyLineAfterNode board/minnowboard/genimage.cfg lib_genimage.EmptyLineAfterNode board/minnowboard/post-build.sh Shellcheck
board/microchip/mpfs_icicle/genimage.cfg +5 -2
@@ -3,13 +3,14 @@ image boot.vfat { vfat { files = { - "mpfs_icicle.itb", + "mpfs_icicle.itb", } file boot.scr { image = "boot.scr" } } + size = 60M }
@@ -19,16 +20,18 @@ image sdcard.img { } partition uboot { - partition-type-uuid = 21686148-6449-6E6F-744E-656564454649 + partition-type-uuid = 21686148-6449-6e6f-744e-656564454649 image = "payload.bin" } partition kernel { bootable = "true" image = "boot.vfat" + partition-type-uuid = L } partition root { image = "rootfs.ext4" + partition-type-uuid = L } }
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 23/46 board/microchip/sama7g5ek: fix genimage.cfg coding style
In reply to Giulio BenettiFix the check-package warnings:
- add the missing empty lines after nodes
The generated image is not modified.
Drop the corresponding entry from .checkpackageignore.
--- .checkpackageignore | 1 - board/microchip/sama7g5ek/genimage.cfg | 1 + 2 files changed, 1 insertion(+), 1 deletion(-)
.checkpackageignore +0 -1
@@ -25,7 +25,6 @@ board/hardkernel/odroidc2/rootfs_overlay/etc/init.d/S09modload Shellcheck lib_sy board/kontron/bl-imx8mm/post-build.sh Shellcheck board/kontron/smarc-sal28/post-build.sh Shellcheck board/lego/ev3/post-image.sh Shellcheck -board/microchip/sama7g5ek/genimage.cfg lib_genimage.EmptyLineAfterNode board/minnowboard/genimage.cfg lib_genimage.EmptyLineAfterNode board/minnowboard/post-build.sh Shellcheck board/nexbox/a95x/post-build.sh Shellcheck
board/microchip/sama7g5ek/genimage.cfg +1 -0
@@ -9,6 +9,7 @@ image boot.vfat { "u-boot.bin" } } + size = 16M }
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 24/46 board/minnowboard: fix genimage.cfg coding style
In reply to Giulio BenettiFix the check-package warnings:
- add the missing empty lines after nodes
The generated image is not modified.
Drop the corresponding entry from .checkpackageignore.
--- .checkpackageignore | 1 - board/minnowboard/genimage.cfg | 1 + 2 files changed, 1 insertion(+), 1 deletion(-)
.checkpackageignore +0 -1
@@ -25,7 +25,6 @@ board/hardkernel/odroidc2/rootfs_overlay/etc/init.d/S09modload Shellcheck lib_sy board/kontron/bl-imx8mm/post-build.sh Shellcheck board/kontron/smarc-sal28/post-build.sh Shellcheck board/lego/ev3/post-image.sh Shellcheck -board/minnowboard/genimage.cfg lib_genimage.EmptyLineAfterNode board/minnowboard/post-build.sh Shellcheck board/nexbox/a95x/post-build.sh Shellcheck board/nexbox/a95x/post-image.sh Shellcheck
board/minnowboard/genimage.cfg +1 -0
@@ -4,6 +4,7 @@ image efi-part.vfat { file EFI { image = "efi-part/EFI" } + file bzImage { image = "bzImage" }
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 25/46 board/octavo/osd32mp1-brk: set partition-type-uuid in genimage.cfg
In reply to Giulio BenettiFix the check-package warnings:
- set partition-type-uuid for every GPT partition
The partition-type-uuid that was missing is set to L, which is what genimage uses by default.
The generated image is not modified.
Drop the corresponding entry from .checkpackageignore.
--- .checkpackageignore | 1 - board/octavo/osd32mp1-brk/genimage.cfg | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-)
.checkpackageignore +0 -1
@@ -28,7 +28,6 @@ board/lego/ev3/post-image.sh Shellcheck board/minnowboard/post-build.sh Shellcheck board/nexbox/a95x/post-build.sh Shellcheck board/nexbox/a95x/post-image.sh Shellcheck -board/octavo/osd32mp1-brk/genimage.cfg lib_genimage.GptPartitionTypeUuid board/octavo/osd32mp1-brk/patches/uboot/0001-Add-OSD32MP1-BRK-device-tree-support.patch lib_patch.NumberedSubject lib_patch.Upstream board/octavo/osd32mp1-brk/patches/uboot/0002-Add-OSD32MP1-BRK-build-config.patch lib_patch.NumberedSubject lib_patch.Upstream board/octavo/osd32mp1-red/genimage.cfg lib_genimage.GptPartitionTypeUuid
board/octavo/osd32mp1-brk/genimage.cfg +4 -0
@@ -5,19 +5,23 @@ image sdcard.img { partition fsbl1 { image = "tf-a-stm32mp157c-osd32mp1-brk.stm32" + partition-type-uuid = L } partition fsbl2 { image = "tf-a-stm32mp157c-osd32mp1-brk.stm32" + partition-type-uuid = L } partition fip { image = "fip.bin" + partition-type-uuid = L size = 2M } partition rootfs { image = "rootfs.ext4" + partition-type-uuid = L bootable = "yes" } }
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 26/46 board/octavo/osd32mp1-red: set partition-type-uuid in genimage.cfg
In reply to Giulio BenettiFix the check-package warnings:
- set partition-type-uuid for every GPT partition
The partition-type-uuid that was missing is set to L, which is what genimage uses by default.
The generated image is not modified.
Drop the corresponding entry from .checkpackageignore.
--- .checkpackageignore | 1 - board/octavo/osd32mp1-red/genimage.cfg | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-)
.checkpackageignore +0 -1
@@ -30,7 +30,6 @@ board/nexbox/a95x/post-build.sh Shellcheck board/nexbox/a95x/post-image.sh Shellcheck board/octavo/osd32mp1-brk/patches/uboot/0001-Add-OSD32MP1-BRK-device-tree-support.patch lib_patch.NumberedSubject lib_patch.Upstream board/octavo/osd32mp1-brk/patches/uboot/0002-Add-OSD32MP1-BRK-build-config.patch lib_patch.NumberedSubject lib_patch.Upstream -board/octavo/osd32mp1-red/genimage.cfg lib_genimage.GptPartitionTypeUuid board/octavo/osd32mp1-red/patches/uboot/0001-Add-OSD32MP1-RED-Device-Tree-support.patch lib_patch.NumberedSubject lib_patch.Upstream board/octavo/osd32mp1-red/patches/uboot/0002-configs-stm32mp15_trusted_defconfig-disable-environm.patch lib_patch.NumberedSubject lib_patch.Upstream board/olimex/stmp1_olinuxino/genimage.cfg lib_genimage.GptPartitionTypeUuid
board/octavo/osd32mp1-red/genimage.cfg +4 -0
@@ -5,19 +5,23 @@ image sdcard.img { partition fsbl1 { image = "tf-a-stm32mp157c-osd32mp1-red.stm32" + partition-type-uuid = L } partition fsbl2 { image = "tf-a-stm32mp157c-osd32mp1-red.stm32" + partition-type-uuid = L } partition fip { image = "fip.bin" + partition-type-uuid = L size = 2M } partition rootfs { image = "rootfs.ext4" + partition-type-uuid = L bootable = "yes" } }
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 27/46 board/olimex/stmp1_olinuxino: set partition-type-uuid in genimage.cfg
In reply to Giulio BenettiFix the check-package warnings:
- set partition-type-uuid for every GPT partition
The partition-type-uuid that was missing is set to L, which is what genimage uses by default.
The generated image is not modified.
Drop the corresponding entry from .checkpackageignore.
--- .checkpackageignore | 1 - board/olimex/stmp1_olinuxino/genimage.cfg | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-)
.checkpackageignore +0 -1
@@ -32,7 +32,6 @@ board/octavo/osd32mp1-brk/patches/uboot/0001-Add-OSD32MP1-BRK-device-tree-suppor board/octavo/osd32mp1-brk/patches/uboot/0002-Add-OSD32MP1-BRK-build-config.patch lib_patch.NumberedSubject lib_patch.Upstream board/octavo/osd32mp1-red/patches/uboot/0001-Add-OSD32MP1-RED-Device-Tree-support.patch lib_patch.NumberedSubject lib_patch.Upstream board/octavo/osd32mp1-red/patches/uboot/0002-configs-stm32mp15_trusted_defconfig-disable-environm.patch lib_patch.NumberedSubject lib_patch.Upstream -board/olimex/stmp1_olinuxino/genimage.cfg lib_genimage.GptPartitionTypeUuid board/olpc/post-build.sh Shellcheck board/orangepi/common/genimage.cfg lib_genimage.GptPartitionTypeUuid board/orangepi/common/post-build.sh Shellcheck
board/olimex/stmp1_olinuxino/genimage.cfg +4 -0
@@ -5,21 +5,25 @@ image sdcard.img { partition fsbl1 { image = "u-boot-spl.stm32" + partition-type-uuid = L size = 256K } partition fsbl2 { image = "u-boot-spl.stm32" + partition-type-uuid = L size = 256K } partition ssbl { image = "u-boot.img" + partition-type-uuid = L size = 2M } partition rootfs { image = "rootfs.ext4" + partition-type-uuid = L bootable = "yes" } }
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 28/46 board/orangepi/common: set partition-type-uuid in genimage.cfg
In reply to Giulio BenettiFix the check-package warnings:
- set partition-type-uuid for every GPT partition
The partition-type-uuid that was missing is set to L, which is what genimage uses by default.
The generated image is not modified.
Drop the corresponding entry from .checkpackageignore.
--- .checkpackageignore | 1 - board/orangepi/common/genimage.cfg | 1 + 2 files changed, 1 insertion(+), 1 deletion(-)
.checkpackageignore +0 -1
@@ -33,7 +33,6 @@ board/octavo/osd32mp1-brk/patches/uboot/0002-Add-OSD32MP1-BRK-build-config.patch board/octavo/osd32mp1-red/patches/uboot/0001-Add-OSD32MP1-RED-Device-Tree-support.patch lib_patch.NumberedSubject lib_patch.Upstream board/octavo/osd32mp1-red/patches/uboot/0002-configs-stm32mp15_trusted_defconfig-disable-environm.patch lib_patch.NumberedSubject lib_patch.Upstream board/olpc/post-build.sh Shellcheck -board/orangepi/common/genimage.cfg lib_genimage.GptPartitionTypeUuid board/orangepi/common/post-build.sh Shellcheck board/orangepi/orangepi-5-plus/genimage.cfg lib_genimage.PartitionTypeUuidShortcut board/orangepi/orangepi-zero/patches/linux/0001-ARM-dts-orange-pi-zero-interrupt-triggering-xr819.patch lib_patch.Upstream
board/orangepi/common/genimage.cfg +1 -0
@@ -15,6 +15,7 @@ image sdcard.img { partition rootfs { offset = 1M image = "rootfs.ext4" + partition-type-uuid = L partition-uuid = %PARTUUID% } }
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 29/46 board/orangepi/orangepi-5-plus: fix genimage.cfg coding style
In reply to Giulio BenettiFix the check-package warnings:
- use the genimage shortcuts for partition-type-uuid
The generated image is not modified.
Drop the corresponding entry from .checkpackageignore.
--- .checkpackageignore | 1 - board/orangepi/orangepi-5-plus/genimage.cfg | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-)
.checkpackageignore +0 -1
@@ -34,7 +34,6 @@ board/octavo/osd32mp1-red/patches/uboot/0001-Add-OSD32MP1-RED-Device-Tree-suppor board/octavo/osd32mp1-red/patches/uboot/0002-configs-stm32mp15_trusted_defconfig-disable-environm.patch lib_patch.NumberedSubject lib_patch.Upstream board/olpc/post-build.sh Shellcheck board/orangepi/common/post-build.sh Shellcheck -board/orangepi/orangepi-5-plus/genimage.cfg lib_genimage.PartitionTypeUuidShortcut board/orangepi/orangepi-zero/patches/linux/0001-ARM-dts-orange-pi-zero-interrupt-triggering-xr819.patch lib_patch.Upstream board/orangepi/orangepi-zero/patches/linux/0002-ARM-dts-orange-pi-zero-enable-spi-nor.patch lib_patch.Upstream board/orangepi/orangepi-zero/patches/linux/0003-ARM-dts-orange-pi-zero-enable-spidev.patch lib_patch.Upstream
board/orangepi/orangepi-5-plus/genimage.cfg +1 -1
@@ -10,7 +10,7 @@ image sdcard.img { } partition uboot-env { - partition-type-uuid = 3de21764-95bd-54bd-a5c3-4abe786f38a8 + partition-type-uuid = u-boot-env offset = 16M size = 64K }
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 30/46 board/pc: fix genimage-efi.cfg coding style
In reply to Giulio BenettiFix the check-package warnings:
- use the genimage shortcuts for partition-type-uuid
The generated image is not modified.
Drop the corresponding entry from .checkpackageignore.
--- .checkpackageignore | 1 - board/pc/genimage-efi.cfg | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-)
.checkpackageignore +0 -1
@@ -38,7 +38,6 @@ board/orangepi/orangepi-zero/patches/linux/0001-ARM-dts-orange-pi-zero-interrupt board/orangepi/orangepi-zero/patches/linux/0002-ARM-dts-orange-pi-zero-enable-spi-nor.patch lib_patch.Upstream board/orangepi/orangepi-zero/patches/linux/0003-ARM-dts-orange-pi-zero-enable-spidev.patch lib_patch.Upstream board/orangepi/orangepi-zero/patches/linux/0004-ARM-dts-orange-pi-zero-enable-uart.patch lib_patch.Upstream -board/pc/genimage-efi.cfg lib_genimage.PartitionTypeUuidShortcut board/pine64/rockpro64-ebbr/genimage.cfg lib_genimage.PartitionTypeUuidCase board/pine64/rockpro64/genimage.cfg lib_genimage.GptPartitionTypeUuid lib_genimage.PartitionTypeUuidShortcut board/pine64/star64/genimage.cfg lib_genimage.GptPartitionTypeUuid lib_genimage.Indent lib_genimage.PartitionTypeUuidCase
board/pc/genimage-efi.cfg +1 -1
@@ -25,7 +25,7 @@ image disk.img { } partition root { - partition-type-uuid = 44479540-f297-41b2-9af7-d131d5f0458a + partition-type-uuid = root-x86 partition-uuid = UUID_TMP image = "rootfs.ext2" }
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 31/46 board/pine64/rockpro64-ebbr: fix genimage.cfg coding style
In reply to Giulio BenettiFix the check-package warnings:
- use lower-case GUIDs for partition-type-uuid
The generated image is not modified.
Drop the corresponding entry from .checkpackageignore.
--- .checkpackageignore | 1 - board/pine64/rockpro64-ebbr/genimage.cfg | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-)
.checkpackageignore +0 -1
@@ -38,7 +38,6 @@ board/orangepi/orangepi-zero/patches/linux/0001-ARM-dts-orange-pi-zero-interrupt board/orangepi/orangepi-zero/patches/linux/0002-ARM-dts-orange-pi-zero-enable-spi-nor.patch lib_patch.Upstream board/orangepi/orangepi-zero/patches/linux/0003-ARM-dts-orange-pi-zero-enable-spidev.patch lib_patch.Upstream board/orangepi/orangepi-zero/patches/linux/0004-ARM-dts-orange-pi-zero-enable-uart.patch lib_patch.Upstream -board/pine64/rockpro64-ebbr/genimage.cfg lib_genimage.PartitionTypeUuidCase board/pine64/rockpro64/genimage.cfg lib_genimage.GptPartitionTypeUuid lib_genimage.PartitionTypeUuidShortcut board/pine64/star64/genimage.cfg lib_genimage.GptPartitionTypeUuid lib_genimage.Indent lib_genimage.PartitionTypeUuidCase board/qemu/aarch64-ebbr/genimage.cfg lib_genimage.PartitionTypeUuidShortcut
board/pine64/rockpro64-ebbr/genimage.cfg +2 -2
@@ -19,13 +19,13 @@ image disk.img { partition loader1 { image = "idbloader.img" - partition-type-uuid = 8DA63339-0007-60C0-C436-083AC8230908 + partition-type-uuid = 8da63339-0007-60c0-c436-083ac8230908 offset = 32K } partition loader2 { image = "u-boot.itb" - partition-type-uuid = 8DA63339-0007-60C0-C436-083AC8230908 + partition-type-uuid = 8da63339-0007-60c0-c436-083ac8230908 offset = 8M }
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 32/46 board/pine64/rockpro64: fix style and set partition-type-uuid
In reply to Giulio BenettiFix the check-package warnings:
- use the genimage shortcuts for partition-type-uuid
- set partition-type-uuid for every GPT partition
The partition-type-uuid that was missing is set to L, which is what genimage uses by default.
The generated image is not modified.
Drop the corresponding entry from .checkpackageignore.
--- .checkpackageignore | 1 - board/pine64/rockpro64/genimage.cfg | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-)
.checkpackageignore +0 -1
@@ -38,7 +38,6 @@ board/orangepi/orangepi-zero/patches/linux/0001-ARM-dts-orange-pi-zero-interrupt board/orangepi/orangepi-zero/patches/linux/0002-ARM-dts-orange-pi-zero-enable-spi-nor.patch lib_patch.Upstream board/orangepi/orangepi-zero/patches/linux/0003-ARM-dts-orange-pi-zero-enable-spidev.patch lib_patch.Upstream board/orangepi/orangepi-zero/patches/linux/0004-ARM-dts-orange-pi-zero-enable-uart.patch lib_patch.Upstream -board/pine64/rockpro64/genimage.cfg lib_genimage.GptPartitionTypeUuid lib_genimage.PartitionTypeUuidShortcut board/pine64/star64/genimage.cfg lib_genimage.GptPartitionTypeUuid lib_genimage.Indent lib_genimage.PartitionTypeUuidCase board/qemu/aarch64-ebbr/genimage.cfg lib_genimage.PartitionTypeUuidShortcut board/qemu/aarch64-sbsa/assemble-flash-images Shellcheck
board/pine64/rockpro64/genimage.cfg +3 -1
@@ -17,11 +17,13 @@ image sdcard.img { partition loader1 { image = "idbloader.img" + partition-type-uuid = L offset = 32K } partition loader2 { image = "u-boot.itb" + partition-type-uuid = L offset = 8M }
@@ -33,7 +35,7 @@ image sdcard.img { } partition rootfs { - partition-type-uuid = b921b045-1df0-41c3-af44-4c6f280d3fae + partition-type-uuid = root-arm64 image = "rootfs.ext4" } }
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 33/46 board/pine64/star64: fix style and set partition-type-uuid
In reply to Giulio BenettiFix the check-package warnings:
- indent with tabs
- use lower-case GUIDs for partition-type-uuid
- set partition-type-uuid for every GPT partition
The partition-type-uuid that was missing is set to L, which is what genimage uses by default.
The generated image is not modified.
Drop the corresponding entry from .checkpackageignore.
--- .checkpackageignore | 1 - board/pine64/star64/genimage.cfg | 35 ++++++++++++++++---------------- 2 files changed, 18 insertions(+), 18 deletions(-)
.checkpackageignore +0 -1
@@ -38,7 +38,6 @@ board/orangepi/orangepi-zero/patches/linux/0001-ARM-dts-orange-pi-zero-interrupt board/orangepi/orangepi-zero/patches/linux/0002-ARM-dts-orange-pi-zero-enable-spi-nor.patch lib_patch.Upstream board/orangepi/orangepi-zero/patches/linux/0003-ARM-dts-orange-pi-zero-enable-spidev.patch lib_patch.Upstream board/orangepi/orangepi-zero/patches/linux/0004-ARM-dts-orange-pi-zero-enable-uart.patch lib_patch.Upstream -board/pine64/star64/genimage.cfg lib_genimage.GptPartitionTypeUuid lib_genimage.Indent lib_genimage.PartitionTypeUuidCase board/qemu/aarch64-ebbr/genimage.cfg lib_genimage.PartitionTypeUuidShortcut board/qemu/aarch64-sbsa/assemble-flash-images Shellcheck board/qemu/aarch64-sbsa/genimage.cfg lib_genimage.PartitionTypeUuidShortcut
board/pine64/star64/genimage.cfg +18 -17
@@ -1,24 +1,25 @@ # SD card image for the Pine64 Star64 board image sdcard.img { - hdimage { - partition-table-type = "gpt" - } + hdimage { + partition-table-type = "gpt" + } - partition spl { - image = "u-boot-spl.bin.normal.out" - partition-type-uuid = 2E54B353-1271-4842-806F-E436D6AF6985 - offset = 2M - } + partition spl { + image = "u-boot-spl.bin.normal.out" + partition-type-uuid = 2e54b353-1271-4842-806f-e436d6af6985 + offset = 2M + } - partition uboot { - image = "u-boot.itb" - partition-type-uuid = xbootldr - offset = 4M - } + partition uboot { + image = "u-boot.itb" + partition-type-uuid = xbootldr + offset = 4M + } - partition rootfs { - image = "rootfs.ext4" - bootable = true - } + partition rootfs { + image = "rootfs.ext4" + partition-type-uuid = L + bootable = true + } }
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 34/46 board/qemu/aarch64-ebbr: fix genimage.cfg coding style
In reply to Giulio BenettiFix the check-package warnings:
- use the genimage shortcuts for partition-type-uuid
The generated image is not modified.
Drop the corresponding entry from .checkpackageignore.
--- .checkpackageignore | 1 - board/qemu/aarch64-ebbr/genimage.cfg | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-)
.checkpackageignore +0 -1
@@ -38,7 +38,6 @@ board/orangepi/orangepi-zero/patches/linux/0001-ARM-dts-orange-pi-zero-interrupt board/orangepi/orangepi-zero/patches/linux/0002-ARM-dts-orange-pi-zero-enable-spi-nor.patch lib_patch.Upstream board/orangepi/orangepi-zero/patches/linux/0003-ARM-dts-orange-pi-zero-enable-spidev.patch lib_patch.Upstream board/orangepi/orangepi-zero/patches/linux/0004-ARM-dts-orange-pi-zero-enable-uart.patch lib_patch.Upstream -board/qemu/aarch64-ebbr/genimage.cfg lib_genimage.PartitionTypeUuidShortcut board/qemu/aarch64-sbsa/assemble-flash-images Shellcheck board/qemu/aarch64-sbsa/genimage.cfg lib_genimage.PartitionTypeUuidShortcut board/qemu/arm-ebbr/genimage.cfg lib_genimage.PartitionTypeUuidShortcut
board/qemu/aarch64-ebbr/genimage.cfg +1 -1
@@ -25,7 +25,7 @@ image disk.img { } partition root { - partition-type-uuid = b921b045-1df0-41c3-af44-4c6f280d3fae + partition-type-uuid = root-arm64 image = "rootfs.ext2" } }
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 35/46 board/qemu/aarch64-sbsa: fix genimage.cfg coding style
In reply to Giulio BenettiFix the check-package warnings:
- use the genimage shortcuts for partition-type-uuid
The generated image is not modified.
Drop the corresponding entry from .checkpackageignore.
--- .checkpackageignore | 1 - board/qemu/aarch64-sbsa/genimage.cfg | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-)
.checkpackageignore +0 -1
@@ -39,7 +39,6 @@ board/orangepi/orangepi-zero/patches/linux/0002-ARM-dts-orange-pi-zero-enable-sp board/orangepi/orangepi-zero/patches/linux/0003-ARM-dts-orange-pi-zero-enable-spidev.patch lib_patch.Upstream board/orangepi/orangepi-zero/patches/linux/0004-ARM-dts-orange-pi-zero-enable-uart.patch lib_patch.Upstream board/qemu/aarch64-sbsa/assemble-flash-images Shellcheck -board/qemu/aarch64-sbsa/genimage.cfg lib_genimage.PartitionTypeUuidShortcut board/qemu/arm-ebbr/genimage.cfg lib_genimage.PartitionTypeUuidShortcut board/qemu/loongarch64-virt-efi/genimage.cfg lib_genimage.EmptyLineAfterNode board/qemu/riscv64-virt-efi/genimage.cfg lib_genimage.PartitionTypeUuidShortcut
board/qemu/aarch64-sbsa/genimage.cfg +1 -1
@@ -25,7 +25,7 @@ image disk.img { } partition root { - partition-type-uuid = b921b045-1df0-41c3-af44-4c6f280d3fae + partition-type-uuid = root-arm64 image = "rootfs.ext2" } }
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 36/46 board/qemu/arm-ebbr: fix genimage.cfg coding style
In reply to Giulio BenettiFix the check-package warnings:
- use the genimage shortcuts for partition-type-uuid
The generated image is not modified.
Drop the corresponding entry from .checkpackageignore.
--- .checkpackageignore | 1 - board/qemu/arm-ebbr/genimage.cfg | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-)
.checkpackageignore +0 -1
@@ -39,7 +39,6 @@ board/orangepi/orangepi-zero/patches/linux/0002-ARM-dts-orange-pi-zero-enable-sp board/orangepi/orangepi-zero/patches/linux/0003-ARM-dts-orange-pi-zero-enable-spidev.patch lib_patch.Upstream board/orangepi/orangepi-zero/patches/linux/0004-ARM-dts-orange-pi-zero-enable-uart.patch lib_patch.Upstream board/qemu/aarch64-sbsa/assemble-flash-images Shellcheck -board/qemu/arm-ebbr/genimage.cfg lib_genimage.PartitionTypeUuidShortcut board/qemu/loongarch64-virt-efi/genimage.cfg lib_genimage.EmptyLineAfterNode board/qemu/riscv64-virt-efi/genimage.cfg lib_genimage.PartitionTypeUuidShortcut board/radxa/rock5b/genimage.cfg lib_genimage.PartitionTypeUuidShortcut
board/qemu/arm-ebbr/genimage.cfg +1 -1
@@ -25,7 +25,7 @@ image disk.img { } partition root { - partition-type-uuid = 69dad710-2ce4-4e3c-b16c-21a1d49abed3 + partition-type-uuid = root-arm image = "rootfs.ext2" } }
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 37/46 board/qemu/loongarch64-virt-efi: fix genimage.cfg coding style
In reply to Giulio BenettiFix the check-package warnings:
- add the missing empty lines after nodes
The generated image is not modified.
Drop the corresponding entry from .checkpackageignore.
--- .checkpackageignore | 1 - board/qemu/loongarch64-virt-efi/genimage.cfg | 1 + 2 files changed, 1 insertion(+), 1 deletion(-)
.checkpackageignore +0 -1
@@ -39,7 +39,6 @@ board/orangepi/orangepi-zero/patches/linux/0002-ARM-dts-orange-pi-zero-enable-sp board/orangepi/orangepi-zero/patches/linux/0003-ARM-dts-orange-pi-zero-enable-spidev.patch lib_patch.Upstream board/orangepi/orangepi-zero/patches/linux/0004-ARM-dts-orange-pi-zero-enable-uart.patch lib_patch.Upstream board/qemu/aarch64-sbsa/assemble-flash-images Shellcheck -board/qemu/loongarch64-virt-efi/genimage.cfg lib_genimage.EmptyLineAfterNode board/qemu/riscv64-virt-efi/genimage.cfg lib_genimage.PartitionTypeUuidShortcut board/radxa/rock5b/genimage.cfg lib_genimage.PartitionTypeUuidShortcut board/raspberrypi/post-build.sh Shellcheck
board/qemu/loongarch64-virt-efi/genimage.cfg +1 -0
@@ -3,6 +3,7 @@ image efi-part.vfat { file EFI { image = "efi-part/EFI" } + file vmlinux.efi { image = "vmlinux.efi" }
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 38/46 board/qemu/riscv64-virt-efi: fix genimage.cfg coding style
In reply to Giulio BenettiFix the check-package warnings:
- use the genimage shortcuts for partition-type-uuid
The generated image is not modified.
Drop the corresponding entry from .checkpackageignore.
--- .checkpackageignore | 1 - board/qemu/riscv64-virt-efi/genimage.cfg | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-)
.checkpackageignore +0 -1
@@ -39,7 +39,6 @@ board/orangepi/orangepi-zero/patches/linux/0002-ARM-dts-orange-pi-zero-enable-sp board/orangepi/orangepi-zero/patches/linux/0003-ARM-dts-orange-pi-zero-enable-spidev.patch lib_patch.Upstream board/orangepi/orangepi-zero/patches/linux/0004-ARM-dts-orange-pi-zero-enable-uart.patch lib_patch.Upstream board/qemu/aarch64-sbsa/assemble-flash-images Shellcheck -board/qemu/riscv64-virt-efi/genimage.cfg lib_genimage.PartitionTypeUuidShortcut board/radxa/rock5b/genimage.cfg lib_genimage.PartitionTypeUuidShortcut board/raspberrypi/post-build.sh Shellcheck board/raspberrypi/post-image.sh Shellcheck
board/qemu/riscv64-virt-efi/genimage.cfg +1 -1
@@ -28,7 +28,7 @@ image disk.img { # For partition-type-uuid value, see: # https://uapi-group.org/specifications/specs/discoverable_partitions_specification/ # SD_GPT_ROOT_RISCV64 - partition-type-uuid = 72ec70a6-cf74-40e6-bd49-4bda08e8f224 + partition-type-uuid = root-riscv64 image = "rootfs.ext2" } }
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 39/46 board/radxa/rock5b: fix genimage.cfg coding style
In reply to Giulio BenettiFix the check-package warnings:
- use the genimage shortcuts for partition-type-uuid
The generated image is not modified.
Drop the corresponding entry from .checkpackageignore.
--- .checkpackageignore | 1 - board/radxa/rock5b/genimage.cfg | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-)
.checkpackageignore +0 -1
@@ -39,7 +39,6 @@ board/orangepi/orangepi-zero/patches/linux/0002-ARM-dts-orange-pi-zero-enable-sp board/orangepi/orangepi-zero/patches/linux/0003-ARM-dts-orange-pi-zero-enable-spidev.patch lib_patch.Upstream board/orangepi/orangepi-zero/patches/linux/0004-ARM-dts-orange-pi-zero-enable-uart.patch lib_patch.Upstream board/qemu/aarch64-sbsa/assemble-flash-images Shellcheck -board/radxa/rock5b/genimage.cfg lib_genimage.PartitionTypeUuidShortcut board/raspberrypi/post-build.sh Shellcheck board/raspberrypi/post-image.sh Shellcheck board/seeed/stm32mp157c-odyssey/genimage.cfg lib_genimage.GptPartitionTypeUuid
board/radxa/rock5b/genimage.cfg +1 -1
@@ -12,7 +12,7 @@ image sdcard.img { } partition uboot-env { - partition-type-uuid = 3de21764-95bd-54bd-a5c3-4abe786f38a8 + partition-type-uuid = u-boot-env offset = 16M size = 64K }
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 40/46 board/seeed/stm32mp157c-odyssey: set partition-type-uuid in genimage.cfg
In reply to Giulio BenettiFix the check-package warnings:
- set partition-type-uuid for every GPT partition
The partition-type-uuid that was missing is set to L, which is what genimage uses by default.
The generated image is not modified.
Drop the corresponding entry from .checkpackageignore.
--- .checkpackageignore | 1 - board/seeed/stm32mp157c-odyssey/genimage.cfg | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-)
.checkpackageignore +0 -1
@@ -41,7 +41,6 @@ board/orangepi/orangepi-zero/patches/linux/0004-ARM-dts-orange-pi-zero-enable-ua board/qemu/aarch64-sbsa/assemble-flash-images Shellcheck board/raspberrypi/post-build.sh Shellcheck board/raspberrypi/post-image.sh Shellcheck -board/seeed/stm32mp157c-odyssey/genimage.cfg lib_genimage.GptPartitionTypeUuid board/seeed/stm32mp157c-odyssey/patches/linux/0001-ARM-dts-stm32-fix-stm32mp157c-odyssey-card-detect.patch lib_patch.Upstream board/sheevaplug/patches/uboot/0001-Remove-redundant-YYLOC-global-declaration.patch lib_patch.Upstream board/sifive/common/genimage_sdcard.cfg lib_genimage.PartitionTypeUuidShortcut
board/seeed/stm32mp157c-odyssey/genimage.cfg +4 -0
@@ -5,18 +5,22 @@ image sdcard.img { partition fsbl1 { image = "tf-a-stm32mp157c-odyssey.stm32" + partition-type-uuid = L } partition fsbl2 { image = "tf-a-stm32mp157c-odyssey.stm32" + partition-type-uuid = L } partition ssbl { image = "u-boot.stm32" + partition-type-uuid = L } partition rootfs { image = "rootfs.ext4" + partition-type-uuid = L bootable = "yes" } }
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 41/46 board/sifive/common: fix genimage_sdcard.cfg coding style
In reply to Giulio BenettiFix the check-package warnings:
- use the genimage shortcuts for partition-type-uuid
The generated image is not modified.
Drop the corresponding entry from .checkpackageignore.
--- .checkpackageignore | 1 - board/sifive/common/genimage_sdcard.cfg | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-)
.checkpackageignore +0 -1
@@ -43,7 +43,6 @@ board/raspberrypi/post-build.sh Shellcheck board/raspberrypi/post-image.sh Shellcheck board/seeed/stm32mp157c-odyssey/patches/linux/0001-ARM-dts-stm32-fix-stm32mp157c-odyssey-card-detect.patch lib_patch.Upstream board/sheevaplug/patches/uboot/0001-Remove-redundant-YYLOC-global-declaration.patch lib_patch.Upstream -board/sifive/common/genimage_sdcard.cfg lib_genimage.PartitionTypeUuidShortcut board/sipeed/licheepi_nano/genimage.cfg lib_genimage.CurlyBrackets lib_genimage.EmptyLastLine lib_genimage.EmptyLineAfterNode board/solidrun/clearfog/post-build.sh Shellcheck board/solidrun/macchiatobin/post-build-mainline.sh Shellcheck
board/sifive/common/genimage_sdcard.cfg +1 -1
@@ -18,7 +18,7 @@ image sdcard.img { partition rootfs { image = "rootfs.ext4" offset = 4076K - partition-type-uuid = 0fc63daf-8483-4772-8e79-3d69d8477de4 + partition-type-uuid = L bootable = true } }
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 42/46 board/sipeed/licheepi_nano: fix genimage.cfg coding style
In reply to Giulio BenettiFix the check-package warnings:
- add the missing empty lines after nodes
- put the closing curly bracket on its own line
- remove the empty line at end of file
The generated image is not modified.
Drop the corresponding entry from .checkpackageignore.
--- .checkpackageignore | 1 - board/sipeed/licheepi_nano/genimage.cfg | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-)
.checkpackageignore +0 -1
@@ -43,7 +43,6 @@ board/raspberrypi/post-build.sh Shellcheck board/raspberrypi/post-image.sh Shellcheck board/seeed/stm32mp157c-odyssey/patches/linux/0001-ARM-dts-stm32-fix-stm32mp157c-odyssey-card-detect.patch lib_patch.Upstream board/sheevaplug/patches/uboot/0001-Remove-redundant-YYLOC-global-declaration.patch lib_patch.Upstream -board/sipeed/licheepi_nano/genimage.cfg lib_genimage.CurlyBrackets lib_genimage.EmptyLastLine lib_genimage.EmptyLineAfterNode board/solidrun/clearfog/post-build.sh Shellcheck board/solidrun/macchiatobin/post-build-mainline.sh Shellcheck board/solidrun/macchiatobin/post-build.sh Shellcheck
board/sipeed/licheepi_nano/genimage.cfg +3 -2
@@ -7,7 +7,9 @@ flash w25q128 { } image flash.bin { - flash {} + flash { + } + flashtype = w25q128 partition uboot {
@@ -30,4 +32,3 @@ image flash.bin { size = 0 } } -
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH 42/46] board/sipeed/licheepi_nano: fix genimage.cfg coding style
Quoted 9 lines · Giulio Benetti
Fix the check-package warnings:
- add the missing empty lines after nodes
- put the closing curly bracket on its own line
- remove the empty line at end of fileThe generated image is not modified.
[...]
Signature · 5 lines
Fengwei Tan <[email protected]> _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 43/46 board/ti/am574x-idk: fix genimage.cfg coding style
In reply to Giulio BenettiFix the check-package warnings:
- indent with tabs
The generated image is not modified.
Drop the corresponding entry from .checkpackageignore.
--- .checkpackageignore | 1 - board/ti/am574x-idk/genimage.cfg | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-)
.checkpackageignore +0 -1
@@ -52,7 +52,6 @@ board/stmicroelectronics/stm32f429-disco/flash.sh Shellcheck board/stmicroelectronics/stm32f469-disco/flash_sd.sh Shellcheck board/stmicroelectronics/stm32f469-disco/flash_xip.sh Shellcheck board/synopsys/axs10x/post-build.sh Shellcheck -board/ti/am574x-idk/genimage.cfg lib_genimage.Indent board/udoo/common/post-build.sh Shellcheck board/visionfive2/genimage.cfg lib_genimage.PartitionTypeUuidShortcut boot/afboot-stm32/0003-Makefile-disable-stack-protector.patch lib_patch.Upstream
board/ti/am574x-idk/genimage.cfg +1 -1
@@ -21,7 +21,7 @@ image sdcard.img { partition u-boot { partition-type = 0xC bootable = "true" - image = "boot.vfat" + image = "boot.vfat" } partition rootfs {
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 44/46 board/visionfive2: fix genimage.cfg coding style
In reply to Giulio BenettiFix the check-package warnings:
- use the genimage shortcuts for partition-type-uuid
The generated image is not modified.
Drop the corresponding entry from .checkpackageignore.
--- .checkpackageignore | 1 - board/visionfive2/genimage.cfg | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-)
.checkpackageignore +0 -1
@@ -53,7 +53,6 @@ board/stmicroelectronics/stm32f469-disco/flash_sd.sh Shellcheck board/stmicroelectronics/stm32f469-disco/flash_xip.sh Shellcheck board/synopsys/axs10x/post-build.sh Shellcheck board/udoo/common/post-build.sh Shellcheck -board/visionfive2/genimage.cfg lib_genimage.PartitionTypeUuidShortcut boot/afboot-stm32/0003-Makefile-disable-stack-protector.patch lib_patch.Upstream boot/optee-os/3.13.0/0001-core-zlib-fix-build-warning-when-_LFS64_LARGEFILE-is.patch lib_patch.Upstream boot/syslinux/0001-bios-Fix-alignment-change-with-gcc-5.patch lib_patch.Upstream
board/visionfive2/genimage.cfg +1 -1
@@ -6,7 +6,7 @@ image sdcard.img { } partition rootfs { - partition-type-uuid = 0FC63DAF-8483-4772-8E79-3D69D8477DE4 + partition-type-uuid = L bootable = true image = "rootfs.ext4" }
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH 44/46] board/visionfive2: fix genimage.cfg coding style
Quoted 9 lines · Giulio Benetti
Fix the check-package warnings:
- use the genimage shortcuts for partition-type-uuid
The generated image is not modified.
Drop the corresponding entry from .checkpackageignore.
[...]
Signature · 5 lines
Fengwei Tan <[email protected]> _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 45/46 support/testing: test_grub: fix genimage-aarch64-efi.cfg coding style
In reply to Giulio BenettiFix the check-package warnings:
- use the genimage shortcuts for partition-type-uuid
The generated image is not modified.
Drop the corresponding entry from .checkpackageignore.
--- .checkpackageignore | 1 - support/testing/tests/boot/test_grub/genimage-aarch64-efi.cfg | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-)
.checkpackageignore +0 -1
@@ -980,7 +980,6 @@ support/scripts/fix-configure-powerpc64.sh lib_shellscript.EmptyLastLine support/scripts/generate-gitlab-ci-yml Shellcheck support/scripts/mkmakefile Shellcheck lib_shellscript.ConsecutiveEmptyLines support/scripts/setlocalversion Shellcheck -support/testing/tests/boot/test_grub/genimage-aarch64-efi.cfg lib_genimage.PartitionTypeUuidShortcut support/testing/tests/core/post-build.sh Shellcheck support/testing/tests/package/test_opkg/post-build.sh Shellcheck support/testing/tests/package/test_xen/aarch64/genimage.cfg lib_genimage.PartitionTypeUuidCase
support/testing/tests/boot/test_grub/genimage-aarch64-efi.cfg +2 -2
@@ -19,13 +19,13 @@ image disk.img { partition boot { image = "efi-part.vfat" - partition-type-uuid = c12a7328-f81f-11d2-ba4b-00a0c93ec93b + partition-type-uuid = U offset = 32K bootable = true } partition root { - partition-type-uuid = 44479540-f297-41b2-9af7-d131d5f0458a + partition-type-uuid = root-x86 partition-uuid = UUID_TMP image = "rootfs.ext2" }
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 46/46 support/testing: test_xen: fix genimage.cfg coding style
In reply to Giulio BenettiFix the check-package warnings:
- use lower-case GUIDs for partition-type-uuid
The generated images are not modified.
Drop the corresponding entries from .checkpackageignore.
--- .checkpackageignore | 2 -- support/testing/tests/package/test_xen/aarch64/genimage.cfg | 2 +- support/testing/tests/package/test_xen/arm/genimage.cfg | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-)
.checkpackageignore +0 -2
@@ -982,6 +982,4 @@ support/scripts/mkmakefile Shellcheck lib_shellscript.ConsecutiveEmptyLines support/scripts/setlocalversion Shellcheck support/testing/tests/core/post-build.sh Shellcheck support/testing/tests/package/test_opkg/post-build.sh Shellcheck -support/testing/tests/package/test_xen/aarch64/genimage.cfg lib_genimage.PartitionTypeUuidCase -support/testing/tests/package/test_xen/arm/genimage.cfg lib_genimage.PartitionTypeUuidCase support/testing/tests/utils/test_get_developers/0001-package-binutils-change-.mk.patch lib_patch.NumberedSubject lib_patch.Upstream
support/testing/tests/package/test_xen/aarch64/genimage.cfg +1 -1
@@ -35,7 +35,7 @@ image disk.img { partition guest { # Linux reserved - partition-type-uuid = 8DA63339-0007-60C0-C436-083AC8230908 + partition-type-uuid = 8da63339-0007-60c0-c436-083ac8230908 image = "rootfs.ext2" } }
support/testing/tests/package/test_xen/arm/genimage.cfg +1 -1
@@ -29,7 +29,7 @@ image disk.img { partition guest { # Linux reserved - partition-type-uuid = 8DA63339-0007-60C0-C436-083AC8230908 + partition-type-uuid = 8da63339-0007-60c0-c436-083ac8230908 image = "rootfs.ext2" } }
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot