Source-Changes-HG archive

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

[src/trunk]: src Add a new installer image for Raspberry PI to evbarm



details:   https://anonhg.NetBSD.org/src/rev/5e3dced0e5df
branches:  trunk
changeset: 785554:5e3dced0e5df
user:      garbled <garbled%NetBSD.org@localhost>
date:      Tue Mar 19 22:16:52 2013 +0000

description:
Add a new installer image for Raspberry PI to evbarm

Includes the following major changes:

1) Add new configmenu item to sysinst to allow creation of users at
post-install time.
2) Add an sshramdisk type to evbarm, which is a ramdisk with sshd
enabled, allowing users to install on a headless PI by sshing to the
device with the account "sysinst" password "netbsd" to begin the
installation. (Note, neither the account, nor the ssh setup are copied to
the finalized installation image)
3) Change mkimage to build a boot-only image, without the root filesystems.

Much of the sshramdisk code could be reused on other ports easily.

diffstat:

 distrib/evbarm/instkernel/Makefile                    |    4 +-
 distrib/evbarm/instkernel/instkernel/Makefile         |    5 +-
 distrib/evbarm/instkernel/sshramdisk/Makefile         |   47 ++++++
 distrib/evbarm/instkernel/sshramdisk/dot.profile      |   75 +++++++++++
 distrib/evbarm/instkernel/sshramdisk/inst.profile     |   27 +++
 distrib/evbarm/instkernel/sshramdisk/list             |   91 +++++++++++++
 distrib/evbarm/instkernel/sshramdisk/master.passwd    |   24 +++
 distrib/evbarm/instkernel/sshramdisk/mtree.conf       |   32 ++++
 distrib/evbarm/instkernel/sshramdisk/ssh_host_dsa_key |   27 +++
 distrib/evbarm/instkernel/sshramdisk/sshd_config      |   20 ++
 distrib/utils/embedded/conf/rpi_inst.conf             |  122 ++++++++++++++++++
 distrib/utils/embedded/mkimage                        |   45 +++--
 distrib/utils/sysinst/arch/evbarm/md.c                |  113 ++++++++++++++++-
 distrib/utils/sysinst/arch/evbarm/md.h                |   13 +-
 distrib/utils/sysinst/arch/evbarm/menus.md.en         |    6 +-
 distrib/utils/sysinst/arch/evbarm/menus.md.es         |    6 +-
 distrib/utils/sysinst/arch/evbarm/menus.md.fr         |    6 +-
 distrib/utils/sysinst/arch/evbarm/menus.md.pl         |    6 +-
 distrib/utils/sysinst/arch/evbarm/msg.md.de           |   10 +-
 distrib/utils/sysinst/arch/evbarm/msg.md.en           |   10 +-
 distrib/utils/sysinst/arch/evbarm/msg.md.es           |   10 +-
 distrib/utils/sysinst/arch/evbarm/msg.md.fr           |   10 +-
 distrib/utils/sysinst/arch/evbarm/msg.md.pl           |   10 +-
 distrib/utils/sysinst/bsddisklabel.c                  |    7 +-
 distrib/utils/sysinst/configmenu.c                    |   28 +++-
 distrib/utils/sysinst/defs.h                          |    6 +-
 distrib/utils/sysinst/main.c                          |   21 ++-
 distrib/utils/sysinst/menus.mi                        |    7 +-
 distrib/utils/sysinst/msg.mi.de                       |    6 +-
 distrib/utils/sysinst/msg.mi.en                       |    6 +-
 distrib/utils/sysinst/msg.mi.es                       |    6 +-
 distrib/utils/sysinst/msg.mi.fr                       |    6 +-
 distrib/utils/sysinst/msg.mi.pl                       |    6 +-
 etc/etc.evbarm/MAKEDEV.conf                           |    4 +-
 etc/etc.evbarm/Makefile.inc                           |   12 +-
 sys/arch/evbarm/conf/Makefile.evbarm.inc              |   12 +-
 sys/arch/evbarm/conf/RPI_INSTALL                      |   14 ++
 sys/arch/evbarm/rpi/rpi_machdep.c                     |    5 +-
 38 files changed, 810 insertions(+), 55 deletions(-)

diffs (truncated from 1486 to 300 lines):

diff -r 383c6633bd26 -r 5e3dced0e5df distrib/evbarm/instkernel/Makefile
--- a/distrib/evbarm/instkernel/Makefile        Tue Mar 19 19:59:40 2013 +0000
+++ b/distrib/evbarm/instkernel/Makefile        Tue Mar 19 22:16:52 2013 +0000
@@ -1,6 +1,6 @@
-#      $NetBSD: Makefile,v 1.3 2002/05/02 18:02:33 lukem Exp $
+#      $NetBSD: Makefile,v 1.4 2013/03/19 22:16:52 garbled Exp $
 
-SUBDIR=                ramdisk .WAIT instkernel
+SUBDIR=                ramdisk sshramdisk .WAIT instkernel
 TARGETS+=      release
 
 .include <bsd.subdir.mk>
diff -r 383c6633bd26 -r 5e3dced0e5df distrib/evbarm/instkernel/instkernel/Makefile
--- a/distrib/evbarm/instkernel/instkernel/Makefile     Tue Mar 19 19:59:40 2013 +0000
+++ b/distrib/evbarm/instkernel/instkernel/Makefile     Tue Mar 19 22:16:52 2013 +0000
@@ -1,10 +1,12 @@
-#      $NetBSD: Makefile,v 1.18 2013/01/30 13:53:54 he Exp $
+#      $NetBSD: Makefile,v 1.19 2013/03/19 22:16:53 garbled Exp $
 
 .include <bsd.own.mk>
 .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
 
 RAMDISKDIR!=   cd ${.CURDIR}/../ramdisk && ${PRINTOBJDIR}
 RAMDISK=       ${RAMDISKDIR}/ramdisk.fs
+SSHRAMDISKDIR!=        cd ${.CURDIR}/../sshramdisk && ${PRINTOBJDIR}
+SSHRAMDISK=    ${SSHRAMDISKDIR}/sshramdisk.fs
 
 .if ${MACHINE_ARCH} == "arm"
 # Little endian platforms.
@@ -20,6 +22,7 @@
                        OPENRD_INSTALL          ${RAMDISK}      -       \
                        TS7200_INSTALL          ${RAMDISK}      -       \
                        TEAMASA_NPWR_INSTALL    ${RAMDISK}      -       \
+                       RPI_INSTALL             ${SSHRAMDISK}   -       \
                        KUROBOX_PRO_INSTALL     ${RAMDISK}      -
 .else
 # Big endian platforms.
diff -r 383c6633bd26 -r 5e3dced0e5df distrib/evbarm/instkernel/sshramdisk/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/distrib/evbarm/instkernel/sshramdisk/Makefile     Tue Mar 19 22:16:52 2013 +0000
@@ -0,0 +1,47 @@
+#      $NetBSD: Makefile,v 1.1 2013/03/19 22:16:53 garbled Exp $
+
+.include <bsd.own.mk>
+.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
+
+IMAGE=         sshramdisk.fs
+IMAGESIZE=     3572k
+MAKEFS_FLAGS=  -f 15
+
+WARNS=         1
+DBG=           -Os
+
+CRUNCHBIN=     ramdiskbin
+LISTS=         ${.CURDIR}/list ${DISTRIBDIR}/common/list.sysinst
+MTREECONF=     ${.CURDIR}/mtree.conf
+IMAGEENDIAN=   le
+MAKEDEVTARGETS=        ramdisk
+IMAGEDEPENDS=  ${CRUNCHBIN} \
+               dot.profile master.passwd sshd_config ssh_host_dsa_key \
+               ${NETBSDSRCDIR}/etc/group \
+               ${NETBSDSRCDIR}/etc/netconfig ${DISTRIBDIR}/common/protocols \
+               ${DISTRIBDIR}/common/services
+
+# Use stubs to eliminate some large stuff from libc
+HACKSRC=       ${DISTRIBDIR}/utils/libhack
+.include       "${HACKSRC}/Makefile.inc"
+${CRUNCHBIN}:  libhack.o
+
+USE_PAM := no
+USE_YP := no
+USE_SKEY := no
+USE_KERBEROS := no
+USE_LDAP := no
+.export USE_PAM
+.export USE_YP
+.export USE_SKEY
+.export USE_KERBEROS
+.export USE_LDAP
+
+.include "${DISTRIBDIR}/common/Makefile.crunch"
+.include "${DISTRIBDIR}/common/Makefile.dhcpcd"
+.include "${DISTRIBDIR}/common/Makefile.makedev"
+.include "${DISTRIBDIR}/common/Makefile.image"
+
+release:
+
+.include <bsd.prog.mk>
diff -r 383c6633bd26 -r 5e3dced0e5df distrib/evbarm/instkernel/sshramdisk/dot.profile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/distrib/evbarm/instkernel/sshramdisk/dot.profile  Tue Mar 19 22:16:52 2013 +0000
@@ -0,0 +1,75 @@
+# $NetBSD: dot.profile,v 1.1 2013/03/19 22:16:53 garbled Exp $
+#
+# Copyright (c) 1997 Perry E. Metzger
+# Copyright (c) 1994 Christopher G. Demetriou
+# All rights reserved.
+# 
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 3. All advertising materials mentioning features or use of this software
+#    must display the following acknowledgement:
+#          This product includes software developed for the
+#          NetBSD Project.  See http://www.NetBSD.org/ for
+#          information about NetBSD.
+# 4. The name of the author may not be used to endorse or promote products
+#    derived from this software without specific prior written permission.
+# 
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+# 
+# <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>>
+
+PATH=/sbin:/bin:/usr/bin:/usr/sbin:/
+export PATH
+TERM=vt100
+export TERM
+HOME=/
+export HOME
+
+umask 022
+
+ROOTDEV=/dev/md0a
+
+if [ "X${DONEPROFILE}" = "X" ]; then
+       DONEPROFILE=YES
+       export DONEPROFILE
+
+       # set up some sane defaults
+       echo 'erase ^H, werase ^W, kill ^U, intr ^C'
+       stty newcrt werase ^W intr ^C kill ^U erase ^H
+       echo ''
+
+       # mount the ramdisk read write
+       mount -u $ROOTDEV /
+
+       # mount the kern_fs so that we can examine the dmesg state
+       mount -t kernfs /kern /kern
+
+       # run the installation or upgrade script.
+       if [ -x "/sbin/dhcpcd" ]; then
+               echo "starting dhcpcd, waiting for carrier"
+               /sbin/dhcpcd -d -n -w
+               if [ -x "/usr/sbin/sshd" ]; then
+                       echo "sleeping 5 seconds, then starting sshd:"
+                       sleep 5
+                       /usr/sbin/sshd
+               fi
+       fi
+       echo
+       echo
+       echo "Please run sysinst to begin your installation."
+fi
diff -r 383c6633bd26 -r 5e3dced0e5df distrib/evbarm/instkernel/sshramdisk/inst.profile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/distrib/evbarm/instkernel/sshramdisk/inst.profile Tue Mar 19 22:16:52 2013 +0000
@@ -0,0 +1,27 @@
+# $NetBSD: inst.profile,v 1.1 2013/03/19 22:16:53 garbled Exp $
+
+PATH=/sbin:/bin:/usr/bin:/usr/sbin:/
+export PATH
+TERM=vt100
+export TERM
+HOME=/
+export HOME
+
+umask 022
+
+if [ "X${DONEPROFILE}" = "X" ]; then
+       DONEPROFILE=YES
+       export DONEPROFILE
+
+       # set up some sane defaults
+       echo 'erase ^H, werase ^W, kill ^U, intr ^C'
+       stty newcrt werase ^W intr ^C kill ^U erase ^H
+       echo ''
+
+       # run the installation or upgrade script.
+       echo "starting sysinst!"
+       cd /
+       /sysinst
+       echo "If you have completed your install, please reboot"
+       echo "into your new OS, otherwise, run sysinst again."
+fi
diff -r 383c6633bd26 -r 5e3dced0e5df distrib/evbarm/instkernel/sshramdisk/list
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/distrib/evbarm/instkernel/sshramdisk/list Tue Mar 19 22:16:52 2013 +0000
@@ -0,0 +1,91 @@
+#      $NetBSD: list,v 1.1 2013/03/19 22:16:53 garbled Exp $
+
+SRCDIRS        bin sbin external/bsd/less/bin crypto/external/bsd/openssh/bin/sshd usr.bin usr.sbin
+
+PROG   bin/cat
+PROG   bin/chmod
+PROG   bin/cp
+PROG   bin/dd
+PROG   bin/df
+PROG   bin/ed
+PROG   bin/ln
+PROG   bin/ls
+PROG   bin/mkdir
+PROG   bin/mv
+PROG   bin/pax         usr/bin/tar
+PROG   bin/pwd
+PROG   bin/rm
+PROG   bin/rmdir
+PROG   bin/sh
+PROG   bin/stty
+PROG   bin/sync
+PROG   bin/sleep
+
+PROG   sbin/chown      bin/chgrp
+PROG   sbin/disklabel
+PROG   sbin/fdisk
+PROG   sbin/fsck
+PROG   sbin/fsck_msdos
+PROG   sbin/fsck_ffs
+PROG   sbin/gpt
+PROG   sbin/ifconfig
+PROG   sbin/init
+PROG   sbin/mknod
+PROG   sbin/mount
+PROG   sbin/mount_cd9660
+PROG   sbin/mount_ext2fs
+PROG   sbin/mount_ffs
+PROG   sbin/mount_kernfs
+PROG   sbin/mount_msdos
+PROG   sbin/mount_nfs
+PROG   sbin/mount_tmpfs
+PROG   sbin/newfs      sbin/mount_mfs
+PROG   sbin/newfs_ext2fs
+PROG   sbin/ping
+PROG   sbin/reboot     sbin/halt
+PROG   sbin/restore    sbin/rrestore
+PROG   sbin/route
+PROG   sbin/shutdown
+PROG   sbin/slattach
+PROG   sbin/swapctl
+PROG   sbin/umount
+
+PROG   usr/bin/ftp
+PROG   usr/bin/tip     usr/bin/cu
+PROG   usr/bin/gzip    usr/bin/gzcat usr/bin/gunzip
+PROG   usr/bin/less    usr/bin/more
+PROG   usr/bin/sed
+PROG   usr/bin/tset
+
+PROG   usr/sbin/chroot
+PROG   usr/sbin/sshd
+
+SPECIAL        ed              srcdir  distrib/utils/x_ed
+SPECIAL        gzip            srcdir  distrib/utils/x_gzip
+SPECIAL        ping            srcdir  distrib/utils/x_ping
+SPECIAL        ifconfig        srcdir  distrib/utils/x_ifconfig
+SPECIAL        route           srcdir  distrib/utils/x_route
+SPECIAL        umount          srcdir  distrib/utils/x_umount
+SPECIAL sshd           srcdir  crypto/external/bsd/openssh/bin/sshd
+SPECIAL sshd           keepsymbols allow_severity deny_severity
+
+LIBS   libhack.o -ledit -lutil -lcurses -lterminfo -lrmt -lcrypt -ll -lm -lz -lprop    -lssh -lcrypto -lwrap
+
+# init invokes the shell as -sh
+ARGVLN sh -sh
+
+# we need the boot blocks /usr/mdec
+#COPY  ${DESTDIR}/usr/mdec/ofwboot     usr/mdec/ofwboot
+
+# various files that we need in /etc for the install
+COPY   ${NETBSDSRCDIR}/etc/group               etc/group
+COPY   ${CURDIR}/master.passwd etc/master.passwd 600
+COPY   ${NETBSDSRCDIR}/etc/netconfig           etc/netconfig
+COPY   ${DISTRIBDIR}/common/protocols          etc/protocols
+COPY   ${DISTRIBDIR}/common/services           etc/services
+
+# and the installation tools
+COPY   ${CURDIR}/dot.profile           .profile
+COPY   ${CURDIR}/inst.profile          inst/.profile
+COPY   ${CURDIR}/sshd_config           etc/ssh/sshd_config
+COPY   ${CURDIR}/ssh_host_dsa_key      etc/ssh/ssh_host_dsa_key 600
diff -r 383c6633bd26 -r 5e3dced0e5df distrib/evbarm/instkernel/sshramdisk/master.passwd
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/distrib/evbarm/instkernel/sshramdisk/master.passwd        Tue Mar 19 22:16:52 2013 +0000
@@ -0,0 +1,24 @@
+root::0:0::0:0:Charlie &:/root:/bin/sh
+sysinst:EHDz7/tNTWGFA:0:0::0:0:System Installer:/inst:/bin/sh
+pi:aBrzVC9eLEoh.:0:0::0:0:System Installer:/inst:/bin/sh



Home | Main Index | Thread Index | Old Index