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 <[email protected]>
define Build/boot-scr
- sed -e 's#@ROOT@#$(SIGNATURE)#g' \
+ sed \
+ -e 's#@ROOT@#$(SIGNATURE)#g' \
+ -e 's#@DTB@#$(firstword $(DEVICE_DTS))#g' \
endef
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
+++ /dev/null
-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}
+++ /dev/null
-# 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}
+++ /dev/null
-# 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}
+++ /dev/null
-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}
--- /dev/null
+# 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} ${kernel_addr_r} zImage
+bootz ${kernel_addr_r} - ${fdt_addr_r}
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
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
--- /dev/null
+setenv bootargs "root=PARTUUID=@ROOT@-02 rw rootwait"
+
+if test -n "${console}"; then
+ setenv bootargs "${bootargs} ${console}"
+fi
+
+load mmc 0:1 ${kernel_addr} Image
+
+booti ${kernel_addr} - ${fdt_addr}
+++ /dev/null
-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}