Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/distrib/utils/embedded Fallback to non-EFI boot script if EF...



details:   https://anonhg.NetBSD.org/src/rev/47282b6d7730
branches:  trunk
changeset: 457811:47282b6d7730
user:      rin <rin%NetBSD.org@localhost>
date:      Sun Jul 21 16:05:24 2019 +0000

description:
Fallback to non-EFI boot script if EFI bootloader is absent.

Note that we do not currently build EFI bootloader for earmv7hf-eb,
as it requires little-endian version of toolchain.

diffstat:

 distrib/utils/embedded/conf/armv7.conf             |  10 ++-
 distrib/utils/embedded/files/armv7_boot_nonefi.cmd |  61 ++++++++++++++++++++++
 2 files changed, 68 insertions(+), 3 deletions(-)

diffs (100 lines):

diff -r 3b5be42f33bc -r 47282b6d7730 distrib/utils/embedded/conf/armv7.conf
--- a/distrib/utils/embedded/conf/armv7.conf    Sun Jul 21 15:57:23 2019 +0000
+++ b/distrib/utils/embedded/conf/armv7.conf    Sun Jul 21 16:05:24 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: armv7.conf,v 1.34 2019/05/18 07:33:10 skrll Exp $
+# $NetBSD: armv7.conf,v 1.35 2019/07/21 16:05:24 rin Exp $
 # ARMv7 customization script used by mkimage
 #
 board=armv7
@@ -30,8 +30,8 @@
 }
 
 populate_common() {
-       # Install EFI bootloader
        if [ -f "${release}/usr/mdec/bootarm.efi" ]; then
+               # Install EFI bootloader
                mkdir -p "${mnt}/boot/EFI/BOOT"
                cp "${release}/usr/mdec/bootarm.efi" "${mnt}/boot/EFI/BOOT/bootarm.efi"
 
@@ -39,10 +39,14 @@
                ${GZIP_CMD} -dc ${kernel}/netbsd-${kernels_generic}.gz > "${mnt}/netbsd"
                echo "./netbsd type=file uname=root gname=wheel mode=0755" \
                    >> "$tmp/selected_sets"
+
+               cp ${DIR}/files/armv7_boot.cmd ${mnt}/boot/boot.cmd
+       else
+               # Fallback to non-EFI boot command
+               cp ${DIR}/files/armv7_boot_nonefi.cmd ${mnt}/boot/boot.cmd
        fi
 
        # Install boot script
-       cp ${DIR}/files/armv7_boot.cmd ${mnt}/boot/boot.cmd
        "${MKUBOOTIMAGE}" -A arm -C none -O netbsd -T script -a 0 -n "NetBSD/armv7 boot" "${mnt}/boot/boot.cmd" "${mnt}/boot/boot.scr"
 }
 
diff -r 3b5be42f33bc -r 47282b6d7730 distrib/utils/embedded/files/armv7_boot_nonefi.cmd
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/distrib/utils/embedded/files/armv7_boot_nonefi.cmd        Sun Jul 21 16:05:24 2019 +0000
@@ -0,0 +1,61 @@
+if test "${board}" = "am335x" ; then
+       setenv kernel netbsd.ub
+       setenv mmcpart 0:1
+       setenv bootargs root=wd0a
+fi
+if test "${board}" = "de0-nano-soc" ; then
+       setenv kernel netbsd.ub
+       setenv bootargs 'root=wd0a'
+       setenv mmcpart 0:1
+       setenv use_fdt 1
+fi
+if test "${soc}" = "exynos" ; then
+       setenv kernel netbsd.ub
+       setenv bootargs 'root=wd0a'
+       setenv mmcpart 2:1
+       setenv use_fdt 1
+fi
+if test "${soc}" = "sunxi" ; then
+       setenv kernel netbsd.ub
+       setenv bootargs 'root=wd0a'
+       setenv mmcpart 0:1
+       setenv use_fdt 1
+fi
+if test "${soc}" = "tegra" ; then
+       setenv kernel netbsd.ub
+       setenv bootargs root=wd0a
+       setenv mmcpart 1:1
+       setenv use_fdt 1
+fi
+if test "${soc}" = "tegra124" ; then
+       setenv kernel netbsd.ub
+       setenv bootargs root=wd0a
+       setenv mmcpart 1:1
+       setenv use_fdt 1
+fi
+if test "${soc}" = "tegra210" ; then
+       setenv kernel netbsd.ub
+       setenv bootargs root=wd0a
+       setenv mmcpart 1:1
+       setenv use_fdt 1
+       setenv fdtfile ${soc}-${board}.dtb
+       # enable PCIe
+       pci enum
+fi
+
+if test "${kernel}" = "" ; then
+       echo '>>>'
+       echo '>>> Target device is not supported by this script.'
+       echo '>>>'
+       exit
+fi
+
+if test "${use_fdt}" = "1" ; then
+       fatload mmc ${mmcpart} ${kernel_addr_r} ${kernel}
+       fatload mmc ${mmcpart} ${fdt_addr_r} ${fdtfile}
+       fdt addr ${fdt_addr_r}
+       bootm ${kernel_addr_r} - ${fdt_addr_r}
+else
+       fatload mmc ${mmcpart} ${kernel_addr_r} ${kernel}
+       bootm ${kernel_addr_r} ${bootargs}
+fi



Home | Main Index | Thread Index | Old Index