# $NetBSD: armv7.conf,v 1.12.4.1 2017/07/18 19:13:07 snj Exp $ # ARMv7 customization script used by mkimage # board=armv7 console=fb resize=true . ${DIR}/conf/evbarm.conf kernels_beagle="BEAGLEBOARD BEAGLEBONE" kernels_awin="BPI CUBIEBOARD CUBIETRUCK" kernels_rpi="RPI2" kernels_amlogic="ODROID-C1" kernels_tegra="TEGRA" kernels_sunxi="SUNXI" make_label() { make_label_evbarm } make_fstab() { make_fstab_evbarm } customize() { customize_evbarm cat >> "${mnt}/etc/rc.conf" << EOF mdnsd=YES wscons=YES devpubd=YES EOF } populate_beagle() { bboard_kernelimg=netbsd-BEAGLEBOARD.ub bboard_loadaddr=81000000 bbone_kernelimg=netbsd-BEAGLEBONE.ub bbone_loadaddr=82000000 # Create a uEnv.txt to auto boot the correct kernel cat >> "${mnt}/boot/uEnv.txt" << EOF loaduimage=if test \$board = am335x; then fatload mmc 0 ${bbone_loadaddr} ${bbone_kernelimg}; bootm ${bbone_loadaddr} root=ld0a; else fatload mmc 0 ${bboard_loadaddr} ${bboard_kernelimg}; bootm ${bboard_loadaddr} root=ld0a; fi 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() { firmwaredir="${src}/external/broadcom/rpi-firmware/dist" firmwarefiles="LICENCE.broadcom bootcode.bin fixup.dat fixup_cd.dat start.elf start_cd.elf" # RPI2 kernel needs to be installed as kernel7.img if [ -f "${mnt}/boot/netbsd-RPI2.bin" ]; then echo "${bar} renaming netbsd-RPI2.bin to kernel7.img ${bar}" mv "${mnt}/boot/netbsd-RPI2.bin" "${mnt}/boot/kernel7.img" cat > "${mnt}/boot/cmdline.txt" << EOF root=ld0a console=${console} #fb=1280x1024 # to select a mode, otherwise try EDID #fb=disable # to disable fb completely EOF echo "${bar} installing firmware files ${bar}" (cd "${mnt}/boot" && for f in ${firmwarefiles}; do echo " $f" cp "${firmwaredir}/${f}" . done ) fi # # If arm_freq is specified in config.txt, set CPU frequency # to match at boot time. # cp ${release}/etc/rc.local ${mnt}/etc/rc.local cat >> ${mnt}/etc/rc.local << EOF if /sbin/sysctl -q machdep.cpu.frequency.max; then cpufreq_max=\$(/sbin/sysctl -n machdep.cpu.frequency.max) cpufreq_cur=\$(/sbin/sysctl -n machdep.cpu.frequency.current) if [ ! "\$cpufreq_max" = "\$cpufreq_cur" ]; then /sbin/sysctl -w machdep.cpu.frequency.target=\$cpufreq_max fi fi EOF echo "./etc/rc.local type=file uname=root gname=wheel mode=0644" \ >> "$tmp/selected_sets" } populate_amlogic() { odroidc1_kernelimg=netbsd-ODROID-C1.ub # Create a boot.ini for Amlogic U-Boot cat >> "${mnt}/boot/boot.ini" << EOF ODROIDC-UBOOT-CONFIG setenv bootargs "root=ld0a awge0.mac-address=\${ethaddr} console=${console}" setenv bootcmd "fatload mmc 0:1 0x21000000 ${odroidc1_kernelimg}; bootm 0x21000000" run bootcmd EOF } 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() { echo "${bar} looking for kernels in ${kernel} ${bar}" kernels="" # .ub kernels for k in $kernels_beagle $kernels_awin $kernels_sunxi $kernels_amlogic $kernels_tegra; do f="${kernel}/netbsd-${k}.ub.gz" test -f "${f}" && kernels="${kernels} ${f}" done # .bin kernels for k in $kernels_rpi; do f="${kernel}/netbsd-${k}.bin.gz" test -f "${f}" && kernels="${kernels} ${f}" done # .dtb files for k in $kernels_sunxi $kernels_tegra; do test -d "${KERNOBJDIR}/${k}" && \ dtbs="$(${MAKE} -C ${KERNOBJDIR}/${k} -v DTB)" || \ dtbs= for dtb in $dtbs; do f="${kernel}/${dtb}.gz" test -f "${f}" && kernels="${kernels} ${f}" done done # install kernels to /boot partition for k in ${kernels}; do tgt="$(basename ${k} | sed 's/\.gz$//')" echo "${bar} installing ${k} to /boot/${tgt} ${bar}" case "${k}" in *.gz) ${GZIP_CMD} -dc "${k}" > "${mnt}/boot/${tgt}" ;; *) cp "${k}" "${mnt}/boot/${tgt}" ;; esac done # board specific configuration populate_beagle populate_awin populate_rpi populate_amlogic populate_tegra populate_sunxi }