Source-Changes-HG archive

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

[src/trunk]: src/distrib/utils/embedded Install a boot.scr on armv7.img that ...



details:   https://anonhg.NetBSD.org/src/rev/19c0907c0253
branches:  trunk
changeset: 826982:19c0907c0253
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sat Oct 07 23:40:00 2017 +0000

description:
Install a boot.scr on armv7.img that detects the running board and selects
the correct kernel and boot protocol. Should work on tegra, sunxi, and
am335x boards for now.

diffstat:

 distrib/utils/embedded/conf/armv7.conf      |  29 ++++++++++--------------
 distrib/utils/embedded/files/armv7_boot.cmd |  34 +++++++++++++++++++++++++++++
 2 files changed, 46 insertions(+), 17 deletions(-)

diffs (100 lines):

diff -r a8a253e04716 -r 19c0907c0253 distrib/utils/embedded/conf/armv7.conf
--- a/distrib/utils/embedded/conf/armv7.conf    Sat Oct 07 21:53:16 2017 +0000
+++ b/distrib/utils/embedded/conf/armv7.conf    Sat Oct 07 23:40:00 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: armv7.conf,v 1.16 2017/07/31 16:34:22 jmcneill Exp $
+# $NetBSD: armv7.conf,v 1.17 2017/10/07 23:40:00 jmcneill Exp $
 # ARMv7 customization script used by mkimage
 #
 board=armv7
@@ -31,6 +31,12 @@
 EOF
 }
 
+populate_common() {
+       # 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"
+}
+
 populate_beagle() {
        bboard_kernelimg=netbsd-BEAGLEBOARD.ub
        bboard_loadaddr=81000000
@@ -44,10 +50,7 @@
 }
 
 populate_awin() {
-       cat >> "${mnt}/boot/uEnv.txt" << EOF
-bootargs=root=ld0a console=${console}
-uenvcmd=mmc dev 0; mmc rescan; if test \$fdtfile = sun7i-a20-cubieboard2.dtb; then setenv kernel netbsd-CUBIEBOARD.ub; elif test \$fdtfile = sun7i-a20-cubietruck.dtb; then setenv kernel 
netbsd-CUBIETRUCK.ub; elif test \$fdtfile = sun6i-a31-hummingbird.dtb; then setenv kernel netbsd-HUMMINGBIRD_A31.ub; elif test \$fdtfile = sun7i-a20-bananapi.dtb; then setenv kernel netbsd-BPI.ub; 
fi; fatload mmc 0:1 82000000 \$kernel; bootm 82000000
-EOF
+       :
 }
 
 populate_rpi() {
@@ -117,18 +120,7 @@
 }
 
 populate_tegra() {
-       tegra_kernelimg=netbsd-TEGRA.ub
-       tegra_loadaddr=0x90000000
-
-       # Create a boot.scr for Tegra U-Boot
-       cat > "${mnt}/boot/boot-TEGRA.txt" << EOF
-setenv bootargs root=ld0a
-fatload mmc 1:1 ${tegra_loadaddr} ${tegra_kernelimg}
-fatload mmc 1:1 \${fdt_addr_r} tegra124-\${board}.dtb
-fdt addr \${fdt_addr_r}
-bootm ${tegra_loadaddr} - \${fdt_addr_r}
-EOF
-       "${MKUBOOTIMAGE}" -A arm -C none -O netbsd -T script -a 0 -n "NetBSD/tegra boot" "${mnt}/boot/boot-TEGRA.txt" "${mnt}/boot/boot.scr"
+       :
 }
 
 populate() {
@@ -176,4 +168,7 @@
        populate_amlogic
        populate_tegra
        populate_sunxi
+
+       # common configuration
+       populate_common
 }
diff -r a8a253e04716 -r 19c0907c0253 distrib/utils/embedded/files/armv7_boot.cmd
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/distrib/utils/embedded/files/armv7_boot.cmd       Sat Oct 07 23:40:00 2017 +0000
@@ -0,0 +1,34 @@
+if test "${soc}" = "sunxi" ; then
+       setenv kernel netbsd-SUNXI.ub
+       setenv bootargs root=ld0a
+       setenv mmcpart 0:1
+       setenv use_fdt 1
+fi
+if test "${soc}" = "tegra" ; then
+       setenv kernel netbsd-TEGRA.ub
+       setenv bootargs root=ld1a
+       setenv mmcpart 1:1
+       setenv use_fdt 1
+fi
+if test "${board}" = "am335x" ; then
+       setenv kernel netbsd-BEAGLEBONE.ub
+       setenv mmcpart 0:1
+       setenv bootargs root=ld0a
+fi
+
+if test "${kernel}" = "" ; then
+       echo '>>>'
+       echo '>>> Target device is not supported by this script.'
+       echo '>>>'
+       exit
+fi
+
+if test "1" -eq ${use_fdt} ; 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