CVS commit: src/distrib/utils/embedded/files
Module Name:src Committed By: rhialto Date: Tue Jul 20 19:31:23 UTC 2021 Modified Files: src/distrib/utils/embedded/files: ec2_init Log Message: Extract just the random bits to feed to /dev/urandom. This makes no difference in the randomness of the pool, but it improves on the estimation (if any) of how many random bits were obtained. Also make the ftp -q time out a bit longer since I got some time outs. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/distrib/utils/embedded/files/ec2_init 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/files/ec2_init diff -u src/distrib/utils/embedded/files/ec2_init:1.3 src/distrib/utils/embedded/files/ec2_init:1.4 --- src/distrib/utils/embedded/files/ec2_init:1.3 Thu Jul 15 19:03:17 2021 +++ src/distrib/utils/embedded/files/ec2_init Tue Jul 20 19:31:23 2021 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: ec2_init,v 1.3 2021/07/15 19:03:17 rhialto Exp $ +# $NetBSD: ec2_init,v 1.4 2021/07/20 19:31:23 rhialto Exp $ # # PROVIDE: ec2_init # REQUIRE: NETWORKING @@ -28,6 +28,11 @@ ec2_newuser() useradd -g users -G wheel,operator -m "${EC2_USER}" } +extract_random_seed() +{ + sed -n -e '/random_seed/s/.*"random_seed": *"\([A-Za-z0-9+/=]*\)".*/\1/p' +} + ec2_init() { ( @@ -38,7 +43,7 @@ ec2_init() try=0 while [ $((try++)) -lt 20 ] do - HOSTNAME=$(ftp -o - -q 1 "${METADATA_URL}${HOSTNAME_URL}") + HOSTNAME=$(ftp -o - -q 2 "${METADATA_URL}${HOSTNAME_URL}") if [ -n "$HOSTNAME" ]; then echo "Setting EC2 hostname: ${HOSTNAME}" echo "$HOSTNAME" > /etc/myname @@ -53,7 +58,7 @@ ec2_init() id "${EC2_USER}" >/dev/null 2>&1 || ec2_newuser # fetch the public key from Amazon Web Services - EC2_SSH_KEY=$(ftp -o - -q 1 "${METADATA_URL}${SSH_KEY_URL}") + EC2_SSH_KEY=$(ftp -o - -q 2 "${METADATA_URL}${SSH_KEY_URL}") if [ -n "$EC2_SSH_KEY" ]; then # A key pair is associated with this instance, add it @@ -71,10 +76,11 @@ ec2_init() fi fi - # May contain a "random_seed". Everything else doesn't matter. - OS_METADATA="$(ftp -o - -q 1 ${OS_METADATA_URL})" + # May contain a "random_seed". + OS_METADATA="$(ftp -o - -q 2 ${OS_METADATA_URL})" if echo "$OS_METADATA" | grep -q random_seed; then - echo "$OS_METADATA" >> /dev/urandom + echo "$OS_METADATA" | extract_random_seed | + base64 -di >> /dev/urandom fi ) }
CVS commit: src/distrib/utils/embedded/files
Module Name:src Committed By: rhialto Date: Thu Jul 15 19:03:17 UTC 2021 Modified Files: src/distrib/utils/embedded/files: ec2_init Log Message: Add some OpenStack support. I found that in the cloud I tried, by the time this script runs, there is no default route in effect yet. That takes some 5 to 10 seconds longer. So I added a retry loop, and to make that easier, changed the order of queries. To make sure it doesn't wait ~forever for a non-existent service I added the -q 1 option to ftp invocations. I also added OpenStack-specific metadata which contains a different random_seed of 512 bytes every time it is requested. See https://github.com/openstack/nova/blob/master/nova/api/metadata/base.py#L355 It may not be trusted data but only in the strictest sense of the word. The data can only be observed by people with access to the cloud's overlay network for the particular VM. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/distrib/utils/embedded/files/ec2_init 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/files/ec2_init diff -u src/distrib/utils/embedded/files/ec2_init:1.2 src/distrib/utils/embedded/files/ec2_init:1.3 --- src/distrib/utils/embedded/files/ec2_init:1.2 Thu Jul 1 18:05:45 2021 +++ src/distrib/utils/embedded/files/ec2_init Thu Jul 15 19:03:17 2021 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: ec2_init,v 1.2 2021/07/01 18:05:45 jmcneill Exp $ +# $NetBSD: ec2_init,v 1.3 2021/07/15 19:03:17 rhialto Exp $ # # PROVIDE: ec2_init # REQUIRE: NETWORKING @@ -20,6 +20,8 @@ HOSTNAME_URL="hostname" SSH_KEY_FILE="/home/${EC2_USER}/.ssh/authorized_keys" +OS_METADATA_URL="http://169.254.169.254/openstack/latest/meta_data.json"; + ec2_newuser() { echo "Creating EC2 user account ${EC2_USER}" @@ -31,11 +33,27 @@ ec2_init() ( umask 022 + # set hostname; it may be 5-10 seconds for the metadata service + # to become reachable. + try=0 + while [ $((try++)) -lt 20 ] + do + HOSTNAME=$(ftp -o - -q 1 "${METADATA_URL}${HOSTNAME_URL}") + if [ -n "$HOSTNAME" ]; then + echo "Setting EC2 hostname: ${HOSTNAME}" + echo "$HOSTNAME" > /etc/myname + hostname "$HOSTNAME" + break + fi + echo "EC2 hostname not available yet (try $try)" + sleep 1 + done + # create EC2 user id "${EC2_USER}" >/dev/null 2>&1 || ec2_newuser - # fetch the key pair from Amazon Web Services - EC2_SSH_KEY=$(ftp -o - "${METADATA_URL}${SSH_KEY_URL}") + # fetch the public key from Amazon Web Services + EC2_SSH_KEY=$(ftp -o - -q 1 "${METADATA_URL}${SSH_KEY_URL}") if [ -n "$EC2_SSH_KEY" ]; then # A key pair is associated with this instance, add it @@ -48,16 +66,16 @@ ec2_init() grep -q "$EC2_SSH_KEY" "$SSH_KEY_FILE" if [ $? -ne 0 ]; then - echo "Setting EC2 SSH key pair: ${EC2_SSH_KEY##* }" + echo "Setting EC2 SSH public key for user ${EC2_USER}: ${EC2_SSH_KEY##* }" echo "$EC2_SSH_KEY" >> "$SSH_KEY_FILE" fi fi - # set hostname - HOSTNAME=$(ftp -o - "${METADATA_URL}${HOSTNAME_URL}") - echo "Setting EC2 hostname: ${HOSTNAME}" - echo "$HOSTNAME" > /etc/myname - hostname "$HOSTNAME" + # May contain a "random_seed". Everything else doesn't matter. + OS_METADATA="$(ftp -o - -q 1 ${OS_METADATA_URL})" + if echo "$OS_METADATA" | grep -q random_seed; then + echo "$OS_METADATA" >> /dev/urandom + fi ) }
CVS commit: src/distrib/utils/embedded/files
Module Name:src Committed By: jmcneill Date: Thu Jul 1 18:05:45 UTC 2021 Modified Files: src/distrib/utils/embedded/files: ec2_init Log Message: AWS marketplace does not allow root ssh logins. Create an ec2-user account and install the ssh key in that user's home directory instead. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/distrib/utils/embedded/files/ec2_init 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/files/ec2_init diff -u src/distrib/utils/embedded/files/ec2_init:1.1 src/distrib/utils/embedded/files/ec2_init:1.2 --- src/distrib/utils/embedded/files/ec2_init:1.1 Fri Nov 30 20:53:02 2018 +++ src/distrib/utils/embedded/files/ec2_init Thu Jul 1 18:05:45 2021 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: ec2_init,v 1.1 2018/11/30 20:53:02 jmcneill Exp $ +# $NetBSD: ec2_init,v 1.2 2021/07/01 18:05:45 jmcneill Exp $ # # PROVIDE: ec2_init # REQUIRE: NETWORKING @@ -13,24 +13,37 @@ rcvar=${name} start_cmd="ec2_init" stop_cmd=":" +EC2_USER="ec2-user" METADATA_URL="http://169.254.169.254/latest/meta-data/"; SSH_KEY_URL="public-keys/0/openssh-key" HOSTNAME_URL="hostname" -SSH_KEY_FILE="/root/.ssh/authorized_keys" +SSH_KEY_FILE="/home/${EC2_USER}/.ssh/authorized_keys" + +ec2_newuser() +{ + echo "Creating EC2 user account ${EC2_USER}" + useradd -g users -G wheel,operator -m "${EC2_USER}" +} ec2_init() { ( umask 022 + + # create EC2 user + id "${EC2_USER}" >/dev/null 2>&1 || ec2_newuser + # fetch the key pair from Amazon Web Services EC2_SSH_KEY=$(ftp -o - "${METADATA_URL}${SSH_KEY_URL}") if [ -n "$EC2_SSH_KEY" ]; then # A key pair is associated with this instance, add it - # to root 'authorized_keys' file + # to EC2_USER's 'authorized_keys' file mkdir -p $(dirname "$SSH_KEY_FILE") + chown "${EC2_USER}:users" $(dirname "$SSH_KEY_FILE") touch "$SSH_KEY_FILE" + chown "${EC2_USER}:users" "$SSH_KEY_FILE" cd $(dirname "$SSH_KEY_FILE") grep -q "$EC2_SSH_KEY" "$SSH_KEY_FILE"
CVS commit: src/distrib/utils/embedded/files
Module Name:src Committed By: jmcneill Date: Thu Apr 4 14:26:40 UTC 2019 Modified Files: src/distrib/utils/embedded/files: armv7_boot.cmd Log Message: Re-enable efiboot for armv7 (thanks skrll@) To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 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/files/armv7_boot.cmd diff -u src/distrib/utils/embedded/files/armv7_boot.cmd:1.13 src/distrib/utils/embedded/files/armv7_boot.cmd:1.14 --- src/distrib/utils/embedded/files/armv7_boot.cmd:1.13 Tue Apr 2 10:00:32 2019 +++ src/distrib/utils/embedded/files/armv7_boot.cmd Thu Apr 4 14:26:39 2019 @@ -2,59 +2,19 @@ if test "${board}" = "am335x" ; then setenv kernel netbsd-BEAGLEBONE.ub setenv mmcpart 0:1 setenv bootargs root=ld0a +else + setenv use_efi 1 fi -if test "${board}" = "de0-nano-soc" ; then - setenv kernel netbsd-GENERIC.ub - setenv bootargs 'root=ld0a' - setenv mmcpart 0:1 - setenv use_fdt 1 -fi -if test "${soc}" = "exynos" ; then - setenv kernel netbsd-GENERIC.ub - setenv bootargs 'root=ld1a' - setenv mmcpart 2:1 - setenv use_fdt 1 -fi -if test "${soc}" = "sunxi" ; then - setenv kernel netbsd-GENERIC.ub - setenv bootargs 'root=ld0a' - setenv mmcpart 0:1 - setenv use_fdt 1 -fi -if test "${soc}" = "tegra" ; then - setenv kernel netbsd-GENERIC.ub - setenv bootargs root=ld1a - setenv mmcpart 1:1 - setenv use_fdt 1 -fi -if test "${soc}" = "tegra124" ; then - setenv kernel netbsd-GENERIC.ub - setenv bootargs root=ld0a - setenv mmcpart 1:1 - setenv use_fdt 1 -fi + if test "${soc}" = "tegra210" ; then - setenv kernel netbsd-GENERIC.ub - setenv bootargs root=ld0a - 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} +if test "${use_efi}" = "1" ; then + setenv boot_scripts + setenv boot_script_dhcp + run distro_bootcmd else fatload mmc ${mmcpart} ${kernel_addr_r} ${kernel} bootm ${kernel_addr_r} ${bootargs}
CVS commit: src/distrib/utils/embedded/files
Module Name:src Committed By: jmcneill Date: Tue Apr 2 10:00:32 UTC 2019 Modified Files: src/distrib/utils/embedded/files: armv7_boot.cmd Log Message: Turn off efiboot until we figure out why it fails on some boards. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 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/files/armv7_boot.cmd diff -u src/distrib/utils/embedded/files/armv7_boot.cmd:1.12 src/distrib/utils/embedded/files/armv7_boot.cmd:1.13 --- src/distrib/utils/embedded/files/armv7_boot.cmd:1.12 Sat Mar 30 13:37:45 2019 +++ src/distrib/utils/embedded/files/armv7_boot.cmd Tue Apr 2 10:00:32 2019 @@ -2,19 +2,59 @@ if test "${board}" = "am335x" ; then setenv kernel netbsd-BEAGLEBONE.ub setenv mmcpart 0:1 setenv bootargs root=ld0a -else - setenv use_efi 1 fi - +if test "${board}" = "de0-nano-soc" ; then + setenv kernel netbsd-GENERIC.ub + setenv bootargs 'root=ld0a' + setenv mmcpart 0:1 + setenv use_fdt 1 +fi +if test "${soc}" = "exynos" ; then + setenv kernel netbsd-GENERIC.ub + setenv bootargs 'root=ld1a' + setenv mmcpart 2:1 + setenv use_fdt 1 +fi +if test "${soc}" = "sunxi" ; then + setenv kernel netbsd-GENERIC.ub + setenv bootargs 'root=ld0a' + setenv mmcpart 0:1 + setenv use_fdt 1 +fi +if test "${soc}" = "tegra" ; then + setenv kernel netbsd-GENERIC.ub + setenv bootargs root=ld1a + setenv mmcpart 1:1 + setenv use_fdt 1 +fi +if test "${soc}" = "tegra124" ; then + setenv kernel netbsd-GENERIC.ub + setenv bootargs root=ld0a + setenv mmcpart 1:1 + setenv use_fdt 1 +fi if test "${soc}" = "tegra210" ; then + setenv kernel netbsd-GENERIC.ub + setenv bootargs root=ld0a + setenv mmcpart 1:1 + setenv use_fdt 1 + setenv fdtfile ${soc}-${board}.dtb # enable PCIe pci enum fi -if test "${use_efi}" = "1" ; then - setenv boot_scripts - setenv boot_script_dhcp - run distro_bootcmd +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}
CVS commit: src/distrib/utils/embedded/files
Module Name:src Committed By: jmcneill Date: Sat Mar 30 13:37:45 UTC 2019 Modified Files: src/distrib/utils/embedded/files: armv7_boot.cmd Log Message: Switch to efiboot To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 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/files/armv7_boot.cmd diff -u src/distrib/utils/embedded/files/armv7_boot.cmd:1.11 src/distrib/utils/embedded/files/armv7_boot.cmd:1.12 --- src/distrib/utils/embedded/files/armv7_boot.cmd:1.11 Sat Jan 5 13:55:46 2019 +++ src/distrib/utils/embedded/files/armv7_boot.cmd Sat Mar 30 13:37:45 2019 @@ -2,59 +2,19 @@ if test "${board}" = "am335x" ; then setenv kernel netbsd-BEAGLEBONE.ub setenv mmcpart 0:1 setenv bootargs root=ld0a +else + setenv use_efi 1 fi -if test "${board}" = "de0-nano-soc" ; then - setenv kernel netbsd-GENERIC.ub - setenv bootargs 'root=ld0a' - setenv mmcpart 0:1 - setenv use_fdt 1 -fi -if test "${soc}" = "exynos" ; then - setenv kernel netbsd-GENERIC.ub - setenv bootargs 'root=ld1a' - setenv mmcpart 2:1 - setenv use_fdt 1 -fi -if test "${soc}" = "sunxi" ; then - setenv kernel netbsd-GENERIC.ub - setenv bootargs 'root=ld0a' - setenv mmcpart 0:1 - setenv use_fdt 1 -fi -if test "${soc}" = "tegra" ; then - setenv kernel netbsd-GENERIC.ub - setenv bootargs root=ld1a - setenv mmcpart 1:1 - setenv use_fdt 1 -fi -if test "${soc}" = "tegra124" ; then - setenv kernel netbsd-GENERIC.ub - setenv bootargs root=ld0a - setenv mmcpart 1:1 - setenv use_fdt 1 -fi + if test "${soc}" = "tegra210" ; then - setenv kernel netbsd-GENERIC.ub - setenv bootargs root=ld0a - 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} +if test "${use_efi}" = "1" ; then + setenv boot_scripts + setenv boot_script_dhcp + run distro_bootcmd else fatload mmc ${mmcpart} ${kernel_addr_r} ${kernel} bootm ${kernel_addr_r} ${bootargs}
CVS commit: src/distrib/utils/embedded/files
Module Name:src Committed By: jmcneill Date: Thu Jan 3 18:21:55 UTC 2019 Modified Files: src/distrib/utils/embedded/files: armv7_boot.cmd Log Message: Fix mmcpart for exynos SD card To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 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/files/armv7_boot.cmd diff -u src/distrib/utils/embedded/files/armv7_boot.cmd:1.9 src/distrib/utils/embedded/files/armv7_boot.cmd:1.10 --- src/distrib/utils/embedded/files/armv7_boot.cmd:1.9 Thu Nov 22 21:11:37 2018 +++ src/distrib/utils/embedded/files/armv7_boot.cmd Thu Jan 3 18:21:55 2019 @@ -13,7 +13,7 @@ fi if test "${soc}" = "exynos" ; then setenv kernel netbsd-GENERIC.ub setenv bootargs 'root=ld1a' - setenv mmcpart 0:1 + setenv mmcpart 2:1 setenv use_fdt 1 fi if test "${soc}" = "sunxi" ; then
CVS commit: src/distrib/utils/embedded/files
Module Name:src Committed By: skrll Date: Sat Oct 20 08:29:11 UTC 2018 Modified Files: src/distrib/utils/embedded/files: armv7_boot.cmd Log Message: Sort To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 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/files/armv7_boot.cmd diff -u src/distrib/utils/embedded/files/armv7_boot.cmd:1.6 src/distrib/utils/embedded/files/armv7_boot.cmd:1.7 --- src/distrib/utils/embedded/files/armv7_boot.cmd:1.6 Wed Jul 4 23:10:06 2018 +++ src/distrib/utils/embedded/files/armv7_boot.cmd Sat Oct 20 08:29:11 2018 @@ -1,3 +1,8 @@ +if test "${board}" = "am335x" ; then + setenv kernel netbsd-BEAGLEBONE.ub + setenv mmcpart 0:1 + setenv bootargs root=ld0a +fi if test "${soc}" = "exynos" ; then setenv kernel netbsd-EXYNOS.ub setenv bootargs 'root=ld1a' @@ -25,11 +30,6 @@ if test "${soc}" = "tegra210" ; then # enable PCIe pci enum 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 '>>>'
CVS commit: src/distrib/utils/embedded/files
Module Name:src Committed By: jmcneill Date: Wed Jul 4 23:10:06 UTC 2018 Modified Files: src/distrib/utils/embedded/files: armv7_boot.cmd Log Message: Enable booting of netbsd-EXYNOS kernel To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 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/files/armv7_boot.cmd diff -u src/distrib/utils/embedded/files/armv7_boot.cmd:1.5 src/distrib/utils/embedded/files/armv7_boot.cmd:1.6 --- src/distrib/utils/embedded/files/armv7_boot.cmd:1.5 Sat Jan 6 20:27:31 2018 +++ src/distrib/utils/embedded/files/armv7_boot.cmd Wed Jul 4 23:10:06 2018 @@ -1,3 +1,9 @@ +if test "${soc}" = "exynos" ; then + setenv kernel netbsd-EXYNOS.ub + setenv bootargs 'root=ld1a' + setenv mmcpart 0:1 + setenv use_fdt 1 +fi if test "${soc}" = "sunxi" ; then setenv kernel netbsd-SUNXI.ub setenv bootargs 'root=ld0a'
CVS commit: src/distrib/utils/embedded/files
Module Name:src Committed By: jmcneill Date: Sat Jan 6 20:27:31 UTC 2018 Modified Files: src/distrib/utils/embedded/files: armv7_boot.cmd Log Message: Enable automatic booting on tegra210 To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 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/files/armv7_boot.cmd diff -u src/distrib/utils/embedded/files/armv7_boot.cmd:1.4 src/distrib/utils/embedded/files/armv7_boot.cmd:1.5 --- src/distrib/utils/embedded/files/armv7_boot.cmd:1.4 Mon Dec 18 19:08:16 2017 +++ src/distrib/utils/embedded/files/armv7_boot.cmd Sat Jan 6 20:27:31 2018 @@ -10,6 +10,15 @@ if test "${soc}" = "tegra" ; then setenv mmcpart 1:1 setenv use_fdt 1 fi +if test "${soc}" = "tegra210" ; then + setenv kernel netbsd-TEGRA.ub + setenv bootargs root=ld0a + setenv mmcpart 1:1 + setenv use_fdt 1 + setenv fdtfile ${soc}-${board}.dtb + # enable PCIe + pci enum +fi if test "${board}" = "am335x" ; then setenv kernel netbsd-BEAGLEBONE.ub setenv mmcpart 0:1
CVS commit: src/distrib/utils/embedded/files
Module Name:src Committed By: jmcneill Date: Mon Dec 18 19:08:16 UTC 2017 Modified Files: src/distrib/utils/embedded/files: armv7_boot.cmd Log Message: No need to specify console=fb for pinebook anymore as WSDISPLAY_MULTICONS will give us a framebuffer console To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 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/files/armv7_boot.cmd diff -u src/distrib/utils/embedded/files/armv7_boot.cmd:1.3 src/distrib/utils/embedded/files/armv7_boot.cmd:1.4 --- src/distrib/utils/embedded/files/armv7_boot.cmd:1.3 Sat Dec 16 21:28:19 2017 +++ src/distrib/utils/embedded/files/armv7_boot.cmd Mon Dec 18 19:08:16 2017 @@ -1,10 +1,6 @@ if test "${soc}" = "sunxi" ; then setenv kernel netbsd-SUNXI.ub - if test "${fdtfile}" = "allwinner/sun50i-a64-pinebook.dtb" ; ten - setenv bootargs 'root=ld0a console=fb' - else - setenv bootargs 'root=ld0a' - fi + setenv bootargs 'root=ld0a' setenv mmcpart 0:1 setenv use_fdt 1 fi
CVS commit: src/distrib/utils/embedded/files
Module Name:src Committed By: jmcneill Date: Sat Dec 16 21:28:19 UTC 2017 Modified Files: src/distrib/utils/embedded/files: armv7_boot.cmd Log Message: Use fb console by default on Pinebook To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 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/files/armv7_boot.cmd diff -u src/distrib/utils/embedded/files/armv7_boot.cmd:1.2 src/distrib/utils/embedded/files/armv7_boot.cmd:1.3 --- src/distrib/utils/embedded/files/armv7_boot.cmd:1.2 Sun Oct 8 00:35:26 2017 +++ src/distrib/utils/embedded/files/armv7_boot.cmd Sat Dec 16 21:28:19 2017 @@ -1,6 +1,10 @@ if test "${soc}" = "sunxi" ; then setenv kernel netbsd-SUNXI.ub - setenv bootargs root=ld0a + if test "${fdtfile}" = "allwinner/sun50i-a64-pinebook.dtb" ; ten + setenv bootargs 'root=ld0a console=fb' + else + setenv bootargs 'root=ld0a' + fi setenv mmcpart 0:1 setenv use_fdt 1 fi
CVS commit: src/distrib/utils/embedded/files
Module Name:src Committed By: sevan Date: Sun Oct 8 00:35:26 UTC 2017 Modified Files: src/distrib/utils/embedded/files: armv7_boot.cmd Log Message: Fix test otherwise we try to load a fdtfile for boards which do not have use_fdt set. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 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/files/armv7_boot.cmd diff -u src/distrib/utils/embedded/files/armv7_boot.cmd:1.1 src/distrib/utils/embedded/files/armv7_boot.cmd:1.2 --- src/distrib/utils/embedded/files/armv7_boot.cmd:1.1 Sat Oct 7 23:40:00 2017 +++ src/distrib/utils/embedded/files/armv7_boot.cmd Sun Oct 8 00:35:26 2017 @@ -23,7 +23,7 @@ if test "${kernel}" = "" ; then exit fi -if test "1" -eq ${use_fdt} ; then +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}
CVS commit: src/distrib/utils/embedded/files
Module Name:src Committed By: jmcneill Date: Fri Apr 14 13:47:22 UTC 2017 Modified Files: src/distrib/utils/embedded/files: resize_disklabel Log Message: Grow the MBR partition table entry for the BSD partition before growing the disklabel. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/distrib/utils/embedded/files/resize_disklabel 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/files/resize_disklabel diff -u src/distrib/utils/embedded/files/resize_disklabel:1.1 src/distrib/utils/embedded/files/resize_disklabel:1.2 --- src/distrib/utils/embedded/files/resize_disklabel:1.1 Mon Apr 6 20:19:28 2015 +++ src/distrib/utils/embedded/files/resize_disklabel Fri Apr 14 13:47:21 2017 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: resize_disklabel,v 1.1 2015/04/06 20:19:28 jmcneill Exp $ +# $NetBSD: resize_disklabel,v 1.2 2017/04/14 13:47:21 jmcneill Exp $ # # PROVIDE: resize_disklabel @@ -33,6 +33,30 @@ get_rawpart_sectors() /sbin/disklabel $disk | grep "^ $rawpart:" | awk '{ print $2; }' } +grow_mbrpart() +{ + disk=$1 + rawpart=$(get_rawpart) + + eval $(/sbin/fdisk -S $disk) + if [ ! "$PART1ID" = "169" ]; then + warn "No NetBSD partition found in MBR partition #1" + return + fi + + ts=$(($(get_total_sectors $disk) - ${PART1START})) + rs=${PART1SIZE} + + if [ "$ts" = "$rs" ]; then + return + fi + + oldsize=$(($rs * 512 / 1024 / 1024)) + newsize=$(($ts * 512 / 1024 / 1024)) + echo "Growing $disk MBR partition #1 (${oldsize}MB -> ${newsize}MB)" + /sbin/fdisk -f -u -1 -s 169/${PART1START}/${ts} ${disk} +} + grow_disklabel() { disk=$1 @@ -64,6 +88,7 @@ resize_disklabel_start() return fi + grow_mbrpart "${resize_disklabel_disk}" grow_disklabel "${resize_disklabel_disk}" "${resize_disklabel_part}" }