From a82d17717e951f7c38c40264e47f0941914b486b Mon Sep 17 00:00:00 2001 From: Jens Rehsack Date: Mon, 22 Jun 2020 16:48:34 +0200 Subject: [PATCH] u-boot-script-qoriq: introduce QorIQ u-boot-script Introduce a script which is able to be used for any QorIQ boot situation (with some adoption) to favour distro_boot over fallback sd_boot or alike hacked by NXP. Signed-off-by: Jens Rehsack --- .../u-boot/u-boot-script-qoriq/boot.cmd.in | 12 +++++ .../u-boot/u-boot-script-qoriq_2019.10.bb | 54 +++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 recipes-bsp/u-boot/u-boot-script-qoriq/boot.cmd.in create mode 100644 recipes-bsp/u-boot/u-boot-script-qoriq_2019.10.bb diff --git a/recipes-bsp/u-boot/u-boot-script-qoriq/boot.cmd.in b/recipes-bsp/u-boot/u-boot-script-qoriq/boot.cmd.in new file mode 100644 index 0000000..d42efaf --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-script-qoriq/boot.cmd.in @@ -0,0 +1,12 @@ +setenv kernel @KERNEL_IMAGETYPE@ +setenv fdt_file @KERNEL_DEVICETREE@ +setenv rootfs_mmc0 setenv rootfs /dev/mmcblk0p2 +setenv rootfs_mmc1 setenv rootfs /dev/mmcblk1p2 +setenv rootfs_nvme0 setenv rootfs /dev/nvme0n1p2 +setenv rootfs_scsi0 setenv rootfs /dev/sda2 +setenv rootfs_usb0 setenv rootfs /dev/sda2 +setenv rootfs_dhcp setenv rootfs /dev/root +run rootfs_${target} +setenv new_bootargs setenv bootargs console=ttyAMA0,115200 earlycon=pl011,mmio32,0x21c0000 root=${rootfs} default_hugepagesz=1024m hugepagesz=1024m hugepages=2 pci=pcie_bus_perf +run new_bootargs +${bootfstype}load ${devtype} ${devnum}:1 ${kernel_addr_r} /${kernel}; ${bootfstype}load ${devtype} ${devnum}:1 ${fdt_addr_r} /${fdt_file}; @KERNEL_BOOTCMD@ ${kernel_addr_r} - ${fdt_addr_r} diff --git a/recipes-bsp/u-boot/u-boot-script-qoriq_2019.10.bb b/recipes-bsp/u-boot/u-boot-script-qoriq_2019.10.bb new file mode 100644 index 0000000..eadd683 --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-script-qoriq_2019.10.bb @@ -0,0 +1,54 @@ +DESCRIPTION = "Boot script for launching images with U-Boot distro boot" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +INHIBIT_DEFAULT_DEPS = "1" +DEPENDS = "u-boot-mkimage-native" + +SRC_URI = "\ + file://boot.cmd.in \ +" + +KERNEL_BOOTCMD ?= "booti" + +inherit deploy + +do_configure[noexec] = "1" + +do_compile() { + kernel_devicetree_spc="" + kernel_devicetree_tmp="" + for kdt in ${KERNEL_DEVICETREE} + do + kernel_devicetree_tmp="${kernel_devicetree_tmp}${kernel_devicetree_spc}$(basename ${kdt})" + kernel_devicetree_spc=" " + done + kernel_devicetree="${kernel_devicetree_tmp}" + sed -e 's/@KERNEL_BOOTCMD[@]/${KERNEL_BOOTCMD}/' -e "s,@KERNEL_IMAGETYPE[@],${KERNEL_IMAGETYPE},g" \ + -e "s,@KERNEL_DEVICETREE[@],${kernel_devicetree},g" \ + "${WORKDIR}/boot.cmd.in" > ${B}/boot.cmd + target_arch="${TARGET_ARCH}" + test "${TARGET_ARCH}" = "aarch64" && target_arch="arm64" + mkimage -A ${target_arch} -T script -C none -n "Distro boot script" -d ${B}/boot.cmd ${B}/boot.scr +} + +do_install() { + install -Dm 0644 ${B}/boot.scr ${D}/boot/boot.scr +} + +do_deploy() { + install -Dm 0644 ${D}/boot/boot.scr ${DEPLOYDIR}/boot.scr-${MACHINE}-${PV}-${PR} + cd ${DEPLOYDIR} + rm -f boot.scr-${MACHINE} + ln -sf boot.scr-${MACHINE}-${PV}-${PR} boot.scr-${MACHINE} +} + +addtask deploy after do_install before do_build + +PROVIDES += "u-boot-default-script" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +COMPATIBLE_MACHINE = "(qoriq)" + +FILES_${PN} = "/boot"