0
0
mirror of https://git.openwrt.org/openwrt/openwrt.git synced 2024-11-22 04:56:15 +00:00
openwrt/target/linux/at91/image/sama7.mk
Petr Štetiar 5c3679e39b at91: sama7: fix racy SD card image generation
We've few low spec (make -j3) build workers attached to the 22.03
buildbot instance which from time to time exhibit following build
failure during image generation:

 + dd bs=512 if=root.ext4 of=openwrt-22.03-snapshot-r20028-43d71ad93e-at91-sama7-microchip_sama7g5-ek-ext4-sdcard.img.gz.img seek=135168 conv=notrunc
 dd: failed to open 'root.ext4': No such file or directory

Thats likely due to the fact, that on buildbots we've
`TARGET_PER_DEVICE_ROOTFS=y` which produces differently named filesystem
image in the SD card image target dependency chain:

 make_ext4fs -L rootfs ... root.ext4+pkg=68b329da

and that hardcoded root.ext4 becomes available from other target in the
later stages. So lets fix this issue by using IMAGE_ROOTFS Make variable
which should contain proper path to the root filesystem image.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
2023-01-11 15:16:52 +01:00

58 lines
1.4 KiB
Makefile

define Device/default-nand
BLOCKSIZE := 128k
PAGESIZE := 2048
SUBPAGESIZE := 2048
MKUBIFS_OPTS := -m $$(PAGESIZE) -e 124KiB -c 2048
endef
define Build/at91-sdcard
$(if $(findstring ext4,$@), \
rm -f $@.boot
mkfs.fat -C $@.boot $(FAT32_BLOCKS)
mcopy -i $@.boot \
$(KDIR)/$(DEVICE_NAME)-fit-zImage.itb \
::$(DEVICE_NAME)-fit.itb
mcopy -i $@.boot \
$(BIN_DIR)/u-boot-$(DEVICE_DTS:at91-%=%)_mmc1/u-boot.bin \
::u-boot.bin
mcopy -i $@.boot \
$(BIN_DIR)/at91bootstrap-$(DEVICE_DTS:at91-%=%)sd_uboot/at91bootstrap.bin \
::BOOT.bin
$(CP) uboot-env.txt $@-uboot-env.txt
sed -i '2d;3d' $@-uboot-env.txt
sed -i '2i board='"$(DEVICE_NAME)"'' $@-uboot-env.txt
sed -i '3i board_name='"$(firstword $(SUPPORTED_DEVICES))"'' $@-uboot-env.txt
mkenvimage -s 0x4000 -o $@-uboot.env $@-uboot-env.txt
mcopy -i $@.boot $@-uboot.env ::uboot.env
./gen_at91_sdcard_img.sh \
$@.img \
$@.boot \
$(IMAGE_ROOTFS) \
$(AT91_SD_BOOT_PARTSIZE) \
$(CONFIG_TARGET_ROOTFS_PARTSIZE)
gzip -nc9 $@.img > $@
rm -f $@.img $@.boot $@-uboot.env $@-uboot-env.txt)
endef
define Device/microchip_sama7g5-ek
$(Device/evaluation-dtb)
DEVICE_VENDOR := Microchip
DEVICE_MODEL := SAMA7G5-EK
DEVICE_DTS := at91-sama7g5ek
SUPPORTED_DEVICES := microchip,sama7g5ek
KERNEL_SIZE := 6144k
KERNEL_LOADADDR := 0x62000000
$(Device/evaluation-sdimage)
endef
TARGET_DEVICES += microchip_sama7g5-ek