Build a RAMDISK root kernel on NetBSD/next68k release build.

No sysinst(8) yet, but useful on bootstrap and rescue ops.
This commit is contained in:
tsutsui 2023-02-11 19:12:31 +00:00
parent 70f4129b0c
commit 42aea38f3c
8 changed files with 452 additions and 9 deletions

View File

@ -1,6 +1,6 @@
# $NetBSD: Makefile,v 1.1 2023/02/11 07:22:30 tsutsui Exp $
# $NetBSD: Makefile,v 1.2 2023/02/11 19:12:31 tsutsui Exp $
SUBDIR= cdroms
SUBDIR= ramdisk .WAIT instkernel .WAIT cdroms
TARGETS+= release
iso_image:

View File

@ -0,0 +1,14 @@
# $NetBSD: Makefile,v 1.1 2023/02/11 19:12:31 tsutsui Exp $
.include <bsd.own.mk>
.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
RAMDISKDIR!= cd ${.CURDIR}/../ramdisk && ${PRINTOBJDIR}
RAMDISK= ${RAMDISKDIR}/ramdisk.fs
MDSETTARGETS= RAMDISK ${RAMDISK} -
MDSET_RELEASEDIR= binary/kernel
.include "${DISTRIBDIR}/common/Makefile.mdset"
.include <bsd.prog.mk>

View File

@ -0,0 +1,42 @@
# $NetBSD: Makefile,v 1.1 2023/02/11 19:12:31 tsutsui Exp $
.include <bsd.own.mk>
.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
IMAGE= ramdisk.fs
IMAGESIZE= 1536k
MAKEFS_FLAGS+= -f 15
WARNS= 1
DBG= -Os -fno-unwind-tables
DBG+= -DNDEBUG # to remove assert(3) macro
NOIEEE80211= yes
CRUNCHBIN= ramdiskbin
LISTS= ${.CURDIR}/list
#LIST+= ${DISTRIBDIR}/common/list.sysinst.en
MTREECONF= ${DISTRIBDIR}/common/mtree.common
IMAGEENDIAN= be
MAKEDEVTARGETS= raminst
IMAGEDEPENDS= ${CRUNCHBIN} \
dot.profile \
${NETBSDSRCDIR}/etc/group ${NETBSDSRCDIR}/etc/master.passwd \
${NETBSDSRCDIR}/etc/netconfig \
${DISTRIBDIR}/common/protocols \
${DISTRIBDIR}/common/services
# Use stubs to eliminate some large stuff from libc
HACK_CURSES= yes
HACKSRC= ${DISTRIBDIR}/utils/libhack
.include "${HACKSRC}/Makefile.inc"
${CRUNCHBIN}: libhack.o
.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>

View File

@ -0,0 +1,69 @@
# $NetBSD: dot.profile,v 1.1 2023/02/11 19:12:31 tsutsui Exp $
#
# Copyright (c) 1995 Jason R. Thorpe
# 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
ROOTDEV=/dev/md0a
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, status ^T'
stty newcrt werase ^W intr ^C kill ^U erase ^H status ^T
# get the terminal type
eval `tset -s -m ":?$TERM"`
# mount root read-write
mount -u $ROOTDEV /
# run the installation program
if [ -x /sysinst ]; then
# run the installation or upgrade script.
sysinst || stty sane
else
echo "This image contains utilities which may be needed"
echo "on bootstrap or rescue etc."
fi
fi

View File

@ -0,0 +1,84 @@
# $NetBSD: list,v 1.1 2023/02/11 19:12:31 tsutsui Exp $
SRCDIRS bin sbin 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/mt
PROG bin/mv
PROG bin/pax usr/bin/tar
PROG bin/pwd
#PROG bin/rcmd
#PROG bin/rcp
PROG bin/rm
PROG bin/sh
PROG bin/stty
PROG bin/sync
PROG sbin/chown bin/chgrp
PROG sbin/disklabel
PROG sbin/dmesg
PROG sbin/fsck
PROG sbin/fsck_ffs
PROG sbin/ifconfig
PROG sbin/init
PROG sbin/mknod
PROG sbin/mount
PROG sbin/mount_cd9660
PROG sbin/mount_ffs
PROG sbin/mount_msdos
PROG sbin/mount_nfs
PROG sbin/newfs sbin/mount_mfs
PROG sbin/ping
PROG sbin/reboot sbin/halt
PROG sbin/restore sbin/rrestore
PROG sbin/route
#PROG sbin/shutdown
PROG sbin/swapctl sbin/swapon
#PROG sbin/sysctl
PROG sbin/umount
PROG usr/bin/ftp
PROG usr/bin/gzip usr/bin/gzcat usr/bin/gunzip
PROG usr/bin/more
#PROG usr/bin/sed
PROG usr/bin/tset
PROG usr/sbin/chroot
PROG usr/sbin/installboot
# init invokes the shell as -sh
ARGVLN sh -sh
SPECIAL disklabel srcdir distrib/utils/x_disklabel
#SPECIAL ed srcdir distrib/utils/x_ed
SPECIAL gzip srcdir distrib/utils/x_gzip
SPECIAL fsck_ffs srcdir distrib/utils/x_fsck_ffs
SPECIAL ifconfig srcdir distrib/utils/x_ifconfig
SPECIAL more srcdir distrib/utils/more
SPECIAL newfs srcdir distrib/utils/x_newfs
SPECIAL ping srcdir distrib/utils/x_ping
SPECIAL route srcdir distrib/utils/x_route
SPECIAL umount srcdir distrib/utils/x_umount
LIBS libhack.o -ledit -lutil -lcurses -lterminfo -lrmt -ll -lm -lz -lprop
COPY ${DESTDIR}/usr/mdec/boot usr/mdec/boot
# various files that we need in /etc for the install
COPY ${NETBSDSRCDIR}/etc/group etc/group
COPY ${NETBSDSRCDIR}/etc/master.passwd etc/master.passwd
COPY ${NETBSDSRCDIR}/etc/netconfig etc/netconfig
COPY ${DISTRIBDIR}/common/protocols etc/protocols
COPY ${DISTRIBDIR}/common/services etc/services
# and the boot script
COPY ${CURDIR}/dot.profile .profile
MTREE ./.profile type=file uname=root gname=wheel mode=0644

View File

@ -1,4 +1,4 @@
# $NetBSD: MAKEDEV.conf,v 1.6 2023/01/15 16:45:32 tsutsui Exp $
# $NetBSD: MAKEDEV.conf,v 1.7 2023/02/11 19:12:31 tsutsui Exp $
all_md)
makedev wscons sd0 sd1 sd2 sd3 tty0 tty1
@ -9,7 +9,7 @@ all_md)
;;
raminst)
makedev std
makedev std bpf md0
makedev sd0 sd1 sd2 sd3 st0 st1 cd0 cd1
makedev tty0 tty1 opty
;;

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile.inc,v 1.7 2008/03/18 04:20:37 lukem Exp $
# $NetBSD: Makefile.inc,v 1.8 2023/02/11 19:12:31 tsutsui Exp $
#
# etc.next68k/Makefile.inc -- next68k-specific etc Makefile targets
#
@ -7,6 +7,7 @@
# to update the release documentation in distrib/notes/common/contents
KERNEL_SETS= GENERIC
BUILD_KERNELS= RAMDISK
snap_md_post:
# install boot image in installation directory

View File

@ -1,13 +1,246 @@
# $NetBSD: RAMDISK,v 1.4 2009/02/06 18:50:28 jym Exp $
# $NetBSD: RAMDISK,v 1.5 2023/02/11 19:12:31 tsutsui Exp $
#
# RAMDISK: Root/swap on ramdisk
#
include "arch/next68k/conf/GENERIC"
include "arch/next68k/conf/std.next68k"
#options INCLUDE_CONFIG_FILE # embed config file in kernel binary
makeoptions COPTS="-Os -fno-unwind-tables"
# Enable the hooks used for initializing the ram-disk.
options MEMORY_DISK_HOOKS
options MEMORY_DISK_IS_ROOT
options MEMORY_DISK_ROOT_SIZE=768
options MEMORY_DISK_IS_ROOT # Force root on ram-disk
options MEMORY_DISK_SERVER=0 # no userspace md(4) support
options MEMORY_DISK_ROOT_SIZE=3072
options MEMORY_DISK_RBFLAGS=RB_SINGLE # boot in single-user mode
# Needs to be set per system. i.e change these as you see fit
maxusers 4
# Standard system options
#options KTRACE # system call tracing
#options SYSVMSG # System V message queues
#options SYSVSEM # System V semaphores
#options SYSVSHM # System V shared memory
#options MODULAR # new style module(7) framework
#options MODULAR_DEFAULT_AUTOLOAD
#options INSECURE # disable kernel security level
options USERCONF # userconf(4) support
options PIPE_SOCKETPAIR # smaller, but slower pipe(2)
#options SYSCTL_INCLUDE_DESCR # Include sysctl descriptions in kernel
# Alternate buffer queue strategies for better responsiveness under high
# disk I/O load.
#options BUFQ_READPRIO
#options BUFQ_PRIOCSCAN
#options DEBUG # kernel debugging code
#options DIAGNOSTIC # extra kernel sanity checking
# Which kernel debugger? Uncomment either this:
#options DDB
#options DDB_HISTORY_SIZE=100 # enable history editing in DDB
# ... or these for KGDB (gdb remote target)
#makeoptions DEBUG="-g" # debugging symbols for gdb
#options KGDB # support for kernel gdb
#options KGDB_DEV=0xc01 # kgdb device number (dev_t)
#options KGDB_DEVRATE=9600 # baud rate
# Other debugging options
#options PMAP_DEBUG
#options SCSIDEBUG
#options SCSIVERBOSE # Verbose SCSI errors
# Compatibility options
#include "conf/compat_netbsd09.config"
#options COMPAT_M68K4K # compatibility with NetBSD/m68k4k binaries
#options COMPAT_NOMID # compatibility with 386BSD, BSDI, NetBSD 0.8,
#options COMPAT_SUNOS # can run SunOS 4.1.1 executables
#options COMPAT_LINUX # can run Linux/m68k executables
#options COMPAT_OSSAUDIO # can run Linux/m68k executables
#options COMPAT_AOUT_M68K # support for NetBSD a.out executables
#options EXEC_AOUT # support for a.out executables
# File systems
file-system FFS # UFS
#file-system EXT2FS # second extended file system (linux)
#file-system LFS # log-structured file system
file-system MFS # memory file system
file-system NFS # Network File System client
file-system CD9660 # ISO 9660 + Rock Ridge file system
file-system MSDOSFS # MS-DOS file system
#file-system FDESC # /dev/fd
#file-system KERNFS # /kern
#file-system NULLFS # loopback file system
#file-system OVERLAY # overlay file system
#file-system PUFFS # Userspace file systems (e.g. ntfs-3g & sshfs)
#file-system PROCFS # /proc
#file-system UMAPFS # NULLFS + uid and gid remapping
#file-system UNION # union file system
#file-system PTYFS # /dev/pts/N support
#file-system TMPFS # Efficient memory file-system
#file-system UDF # experimental - OSTA UDF CD/DVD file-system
# File system options
options FFS_NO_SNAPSHOT # No FFS snapshot support
#options QUOTA # legacy UFS quotas
#options QUOTA2 # new, in-filesystem UFS quotas
#options UFS_DIRHASH # UFS Large Directory Hashing
#options UFS_EXTATTR # Extended attribute support for UFS1
options WAPBL # File system journaling support
#options EXT2FS_SYSTEM_FLAGS # makes ext2fs file flags (append and
# immutable) behave as system flags.
#options NFSSERVER # Network File System server
# Networking options
#options GATEWAY # packet forwarding
options INET # IP + ICMP + TCP + UDP
#options INET6 # IPV6
#options IPSEC # IP security
#options IPSEC_DEBUG # debug for IP security
#options MROUTING # IP multicast routing
#options PIM # Protocol Independent Multicast
#options NETATALK # AppleTalk networking protocols
#options PPP_BSDCOMP # BSD-Compress compression support for PPP
#options PPP_DEFLATE # Deflate compression support for PPP
#options PPP_FILTER # Active filter support for PPP (requires bpf)
#options TCP_DEBUG # Record last TCP_NDEBUG packets with SO_DEBUG
#options ALTQ # Manipulate network interfaces' output queues
#options ALTQ_BLUE # Stochastic Fair Blue
#options ALTQ_CBQ # Class-Based Queueing
#options ALTQ_CDNR # Diffserv Traffic Conditioner
#options ALTQ_FIFOQ # First-In First-Out Queue
#options ALTQ_FLOWVALVE # RED/flow-valve (red-penalty-box)
#options ALTQ_HFSC # Hierarchical Fair Service Curve
#options ALTQ_LOCALQ # Local queueing discipline
#options ALTQ_PRIQ # Priority Queueing
#options ALTQ_RED # Random Early Detection
#options ALTQ_RIO # RED with IN/OUT
#options ALTQ_WFQ # Weighted Fair Queueing
# NeXT specific options
options M68040
options M68030
options FPSP
#options FPU_EMULATE
options ZS_CONSOLE_ABORT # drop to debugger on break
#options SERCONSOLE # use serial console
options NFS_BOOT_BOOTP
options NFS_BOOT_DHCP
# wscons options
options RCONS_2BPP # necessary for nextdisplay
options RCONS_16BPP # necessary for color nextdisplay
#options WSEMUL_SUN # sun terminal emulation
options WSEMUL_VT100 # VT100 / VT220 emulation
#options WSDISPLAY_COMPAT_SYSCONS # emulate some ioctls
#options WSDISPLAY_COMPAT_USL # wsconscfg VT handling
#options WSDISPLAY_COMPAT_RAWKBD # can get raw scancodes
# see dev/wskbdmap_next.h for implemented layouts
#options PCKBD_LAYOUT="(KB_DE | KB_NODEAD)"
config netbsd root on ? type ?
#
# Device configuration
#
# The root node:
mainbus0 at root
# device space
intio0 at mainbus?
nextkbd0 at intio? ipl 3
nextdisplay0 at mainbus?
wsdisplay* at nextdisplay? console ?
wskbd* at nextkbd? console ?
# INTIO
nextdma* at intio? ipl 6
zsc0 at intio? ipl 5
xe* at intio? ipl 3 # ethernet
esp0 at intio? ipl 3 flags 0xffff00 # Turn off sync negotiation
#
# Serial ports
#
zstty0 at zsc0 channel 0 # Serial Port A
zstty1 at zsc0 channel 1 # Serial Port B
# SCSI bus support
scsibus* at scsi?
# SCSI devices
sd* at scsibus? target ? lun ? # SCSI disk drives
st* at scsibus? target ? lun ? # SCSI tape drives
cd* at scsibus? target ? lun ? # SCSI CD-ROM drives
#ch* at scsibus? target ? lun ? # SCSI autochangers
dse* at scsibus? target ? lun ? # SCSI ethernet (Dayna)
se* at scsibus? target ? lun ? # SCSI ethernet
#ss* at scsibus? target ? lun ? # SCSI scanners
#uk* at scsibus? target ? lun ? # SCSI unknown
# Memory-disk drivers
pseudo-device md
#
# accept filters
#pseudo-device accf_data # "dataready" accept filter
#pseudo-device accf_http # "httpready" accept filter
# Misc.
pseudo-device loop # network loopback
pseudo-device bpfilter # packet filter
#pseudo-device carp # Common Address Redundancy Protocol
#pseudo-device sl # CSLIP
#pseudo-device ppp # PPP
#pseudo-device pppoe # PPP over Ethernet (RFC 2516)
#pseudo-device tun # network tunneling over tty
#pseudo-device tap # virtual Ethernet
#pseudo-device gre # generic L3 over IP tunnel
#pseudo-device npf # NPF packet filter
#pseudo-device gif # IPv[46] over IPv[46] tunnel (RFC1933)
#pseudo-device faith # IPv[46] tcp relay translation i/f
#pseudo-device stf # 6to4 IPv6 over IPv4 encapsulation
#pseudo-device vlan # IEEE 802.1q encapsulation
#pseudo-device bridge # simple inter-network bridging
#pseudo-device vether # Virtual Ethernet for bridge
#pseudo-device agr # IEEE 802.3ad link aggregation
#pseudo-device wsmux # mouse & keyboard multiplexor
pseudo-device pty # pseudo-terminals
#pseudo-device vnd # paging to files
#options VND_COMPRESSION # compressed vnd(4)
#pseudo-device raid # RAIDframe disk driver
#options RAID_AUTOCONFIG # auto-configuration of RAID components
# Options to enable various other RAIDframe RAID types.
# options RF_INCLUDE_EVENODD=1
# options RF_INCLUDE_RAID5_RS=1
# options RF_INCLUDE_PARITYLOGGING=1
# options RF_INCLUDE_CHAINDECLUSTER=1
# options RF_INCLUDE_INTERDECLUSTER=1
# options RF_INCLUDE_PARITY_DECLUSTERING=1
# options RF_INCLUDE_PARITY_DECLUSTERING_DS=1
#pseudo-device fss # file system snapshot device
#pseudo-device ccd # concatenated disks
#pseudo-device clockctl # user control of clock subsystem
#pseudo-device ksyms # /dev/ksyms
#pseudo-device putter # for puffs and pud
#include "dev/veriexec.config"