Module Name: src Committed By: jmcneill Date: Sat Oct 7 23:40:00 UTC 2017
Modified Files: src/distrib/utils/embedded/conf: armv7.conf Added Files: src/distrib/utils/embedded/files: armv7_boot.cmd Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/distrib/utils/embedded/conf/armv7.conf cvs rdiff -u -r0 -r1.1 src/distrib/utils/embedded/files/armv7_boot.cmd Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/distrib/utils/embedded/conf/armv7.conf diff -u src/distrib/utils/embedded/conf/armv7.conf:1.16 src/distrib/utils/embedded/conf/armv7.conf:1.17 --- src/distrib/utils/embedded/conf/armv7.conf:1.16 Mon Jul 31 16:34:22 2017 +++ src/distrib/utils/embedded/conf/armv7.conf Sat Oct 7 23:40:00 2017 @@ -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 @@ devpubd=YES 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 @@ EOF } 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_sunxi() { } 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() { populate_amlogic populate_tegra populate_sunxi + + # common configuration + populate_common } Added files: Index: src/distrib/utils/embedded/files/armv7_boot.cmd diff -u /dev/null src/distrib/utils/embedded/files/armv7_boot.cmd:1.1 --- /dev/null Sat Oct 7 23:40:00 2017 +++ src/distrib/utils/embedded/files/armv7_boot.cmd Sat Oct 7 23:40:00 2017 @@ -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