From fb005d688ea2955df89279d75499fca26e2f6f00 Mon Sep 17 00:00:00 2001 From: Tomasz Maciej Nowak Date: Sat, 11 May 2019 19:37:30 +0200 Subject: mvebu: image: introduce BOOT_SCRIPT variable All of U-Boot scripts repeat the same pattern with only Device Tree blob name changing for respective device. Therefore create generic scripts which will be altered on demad by image build process, and create BOOT_SCRIPT variable which can be added to device recipe and will allow referencing the same script by many device recipes. This will allow to slim down the ammount of files in buildroot tree and avoid needlessly incrementing amount of boot scripts if new devices will be added. Signed-off-by: Tomasz Maciej Nowak --- target/linux/mvebu/image/Makefile | 10 +++++--- target/linux/mvebu/image/armada-3720-db.bootscript | 10 -------- .../image/armada-388-clearfog-base.bootscript | 27 ---------------------- .../mvebu/image/armada-388-clearfog-pro.bootscript | 27 ---------------------- .../mvebu/image/armada-macchiatobin.bootscript | 10 -------- target/linux/mvebu/image/clearfog.bootscript | 23 ++++++++++++++++++ target/linux/mvebu/image/cortex-a9.mk | 4 +++- target/linux/mvebu/image/generic-arm64.bootscript | 10 ++++++++ .../mvebu/image/globalscale-espressobin.bootscript | 10 -------- 9 files changed, 43 insertions(+), 88 deletions(-) delete mode 100644 target/linux/mvebu/image/armada-3720-db.bootscript delete mode 100644 target/linux/mvebu/image/armada-388-clearfog-base.bootscript delete mode 100644 target/linux/mvebu/image/armada-388-clearfog-pro.bootscript delete mode 100644 target/linux/mvebu/image/armada-macchiatobin.bootscript create mode 100644 target/linux/mvebu/image/clearfog.bootscript create mode 100644 target/linux/mvebu/image/generic-arm64.bootscript delete mode 100644 target/linux/mvebu/image/globalscale-espressobin.bootscript (limited to 'target/linux/mvebu/image') diff --git a/target/linux/mvebu/image/Makefile b/target/linux/mvebu/image/Makefile index 5f4ab89716..95d4d5a79b 100644 --- a/target/linux/mvebu/image/Makefile +++ b/target/linux/mvebu/image/Makefile @@ -17,8 +17,10 @@ SIGNATURE:=$(shell printf "%.8s" $(SOURCE_DATE_EPOCH)) define Build/boot-scr rm -f $@-boot.scr - sed -e 's#@ROOT@#$(SIGNATURE)#g' \ - $(DEVICE_NAME).bootscript > $@-new.bootscript + sed \ + -e 's#@ROOT@#$(SIGNATURE)#g' \ + -e 's#@DTB@#$(firstword $(DEVICE_DTS))#g' \ + $(BOOT_SCRIPT).bootscript > $@-new.bootscript mkimage -A arm -O linux -T script -C none -a 0 -e 0 -d $@-new.bootscript $@-boot.scr endef @@ -80,10 +82,12 @@ define Device/Default KERNEL := kernel-bin | append-dtb | uImage none SUPPORTED_DEVICES = $$(DEVICE_DTS) UBOOT := + BOOT_SCRIPT := endef -DEVICE_VARS += UBOOT +DEVICE_VARS += BOOT_SCRIPT UBOOT define Device/Default-arm64 + BOOT_SCRIPT := generic-arm64 DTS_DIR := $(DTS_DIR)/marvell IMAGES := sdcard.img.gz IMAGE/sdcard.img.gz := boot-scr | boot-img-ext4 | sdcard-img-ext4 | gzip | append-metadata diff --git a/target/linux/mvebu/image/armada-3720-db.bootscript b/target/linux/mvebu/image/armada-3720-db.bootscript deleted file mode 100644 index 65e39a1af5..0000000000 --- a/target/linux/mvebu/image/armada-3720-db.bootscript +++ /dev/null @@ -1,10 +0,0 @@ -setenv bootargs "root=PARTUUID=@ROOT@-02 rw rootwait" - -if test -n "${console}"; then - setenv bootargs "${bootargs} ${console}" -fi - -load mmc 0:1 ${fdt_addr} armada-3720-db.dtb -load mmc 0:1 ${kernel_addr} Image - -booti ${kernel_addr} - ${fdt_addr} diff --git a/target/linux/mvebu/image/armada-388-clearfog-base.bootscript b/target/linux/mvebu/image/armada-388-clearfog-base.bootscript deleted file mode 100644 index 1755203dc5..0000000000 --- a/target/linux/mvebu/image/armada-388-clearfog-base.bootscript +++ /dev/null @@ -1,27 +0,0 @@ -# Standard Boot-Script -# use only well-known variable names provided by U-Boot Distro boot -# This script assumes that there is a boot partition, -# and that the root partition is always the next one. - -# Override DeviceTree for Clearfog Base -# removed once U-Boot is able to detect the board variant. -setenv fdtfile armada-388-clearfog-base.dtb - -# rootfs is always on the next partition -setexpr openwrt_rootpart ${distro_bootpart} + 1 - -# figure out partition uuid to pass to the kernel as root= -part uuid ${devtype} ${devnum}:${openwrt_rootpart} uuid - -# generate bootargs (rootfs) -setenv bootargs ${bootargs} root=PARTUUID=${uuid} rootfstype=auto rootwait - -# add console= option to bootargs, if any -if test -n "${console}"; then - setenv bootargs ${bootargs} console=${console} -fi - -echo "Booting Linux with ${bootargs}" -load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${fdtfile} -load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} zImage -bootz ${kernel_addr_r} - ${fdt_addr_r} diff --git a/target/linux/mvebu/image/armada-388-clearfog-pro.bootscript b/target/linux/mvebu/image/armada-388-clearfog-pro.bootscript deleted file mode 100644 index 99aa145858..0000000000 --- a/target/linux/mvebu/image/armada-388-clearfog-pro.bootscript +++ /dev/null @@ -1,27 +0,0 @@ -# Standard Boot-Script -# use only well-known variable names provided by U-Boot Distro boot -# This script assumes that there is a boot partition, -# and that the root partition is always the next one. - -# Override DeviceTree for Clearfog Pro -# removed once U-Boot has been updated to the new name. -setenv fdtfile armada-388-clearfog-pro.dtb - -# rootfs is always on the next partition -setexpr openwrt_rootpart ${distro_bootpart} + 1 - -# figure out partition uuid to pass to the kernel as root= -part uuid ${devtype} ${devnum}:${openwrt_rootpart} uuid - -# generate bootargs (rootfs) -setenv bootargs ${bootargs} root=PARTUUID=${uuid} rootfstype=auto rootwait - -# add console= option to bootargs, if any -if test -n "${console}"; then - setenv bootargs ${bootargs} console=${console} -fi - -echo "Booting Linux with ${bootargs}" -load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${fdtfile} -load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} zImage -bootz ${kernel_addr_r} - ${fdt_addr_r} diff --git a/target/linux/mvebu/image/armada-macchiatobin.bootscript b/target/linux/mvebu/image/armada-macchiatobin.bootscript deleted file mode 100644 index ae9fdca92d..0000000000 --- a/target/linux/mvebu/image/armada-macchiatobin.bootscript +++ /dev/null @@ -1,10 +0,0 @@ -setenv bootargs "root=PARTUUID=@ROOT@-02 rw rootwait" - -if test -n "${console}"; then - setenv bootargs "${bootargs} ${console}" -fi - -load mmc 1:1 ${fdt_addr} armada-8040-mcbin.dtb -load mmc 1:1 ${kernel_addr} Image - -booti ${kernel_addr} - ${fdt_addr} diff --git a/target/linux/mvebu/image/clearfog.bootscript b/target/linux/mvebu/image/clearfog.bootscript new file mode 100644 index 0000000000..20ba76f0da --- /dev/null +++ b/target/linux/mvebu/image/clearfog.bootscript @@ -0,0 +1,23 @@ +# Standard Boot-Script +# use only well-known variable names provided by U-Boot Distro boot +# This script assumes that there is a boot partition, +# and that the root partition is always the next one. + +# rootfs is always on the next partition +setexpr openwrt_rootpart ${distro_bootpart} + 1 + +# figure out partition uuid to pass to the kernel as root= +part uuid ${devtype} ${devnum}:${openwrt_rootpart} uuid + +# generate bootargs (rootfs) +setenv bootargs ${bootargs} root=PARTUUID=${uuid} rootfstype=auto rootwait + +# add console= option to bootargs, if any +if test -n "${console}"; then + setenv bootargs ${bootargs} console=${console} +fi + +echo "Booting Linux with ${bootargs}" +load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} @DTB@.dtb +load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} zImage +bootz ${kernel_addr_r} - ${fdt_addr_r} diff --git a/target/linux/mvebu/image/cortex-a9.mk b/target/linux/mvebu/image/cortex-a9.mk index 66cf54f9c5..8e9ef41fb6 100644 --- a/target/linux/mvebu/image/cortex-a9.mk +++ b/target/linux/mvebu/image/cortex-a9.mk @@ -132,6 +132,7 @@ define Device/armada-388-clearfog-pro DEVICE_DTS := armada-388-clearfog-pro armada-388-clearfog-base SUPPORTED_DEVICES := armada-388-clearfog-pro armada-388-clearfog UBOOT := clearfog-u-boot-spl.kwb + BOOT_SCRIPT := clearfog endef TARGET_DEVICES += armada-388-clearfog-pro @@ -142,8 +143,9 @@ define Device/armada-388-clearfog-base DEVICE_PACKAGES := mkf2fs e2fsprogs partx-utils IMAGES := sdcard.img.gz IMAGE/sdcard.img.gz := boot-scr | boot-img-ext4 | sdcard-img-ext4 | gzip | append-metadata - DEVICE_DTS := armada-388-clearfog-pro armada-388-clearfog-base + DEVICE_DTS := armada-388-clearfog-base armada-388-clearfog-pro UBOOT := clearfog-u-boot-spl.kwb + BOOT_SCRIPT := clearfog endef TARGET_DEVICES += armada-388-clearfog-base diff --git a/target/linux/mvebu/image/generic-arm64.bootscript b/target/linux/mvebu/image/generic-arm64.bootscript new file mode 100644 index 0000000000..f395590f84 --- /dev/null +++ b/target/linux/mvebu/image/generic-arm64.bootscript @@ -0,0 +1,10 @@ +setenv bootargs "root=PARTUUID=@ROOT@-02 rw rootwait" + +if test -n "${console}"; then + setenv bootargs "${bootargs} ${console}" +fi + +load mmc 0:1 ${fdt_addr} @DTB@.dtb +load mmc 0:1 ${kernel_addr} Image + +booti ${kernel_addr} - ${fdt_addr} diff --git a/target/linux/mvebu/image/globalscale-espressobin.bootscript b/target/linux/mvebu/image/globalscale-espressobin.bootscript deleted file mode 100644 index 0d03ac8513..0000000000 --- a/target/linux/mvebu/image/globalscale-espressobin.bootscript +++ /dev/null @@ -1,10 +0,0 @@ -setenv bootargs "root=PARTUUID=@ROOT@-02 rw rootwait" - -if test -n "${console}"; then - setenv bootargs "${bootargs} ${console}" -fi - -load mmc 0:1 ${fdt_addr} armada-3720-espressobin.dtb -load mmc 0:1 ${kernel_addr} Image - -booti ${kernel_addr} - ${fdt_addr} -- cgit v1.2.3