Convert to new common ramdisk build infrastructure, which supports

unprivileged cross builds.

XXX: untested as yet; probably needs minor image sizing tweaks
This commit is contained in:
lukem 2002-03-06 13:21:00 +00:00
parent 29173b1fb0
commit 87e13d110a
6 changed files with 92 additions and 303 deletions

View File

@ -1,44 +1,42 @@
# $NetBSD: Makefile,v 1.3 2002/03/06 12:39:10 lukem Exp $
# $NetBSD: Makefile,v 1.4 2002/03/06 13:21:00 lukem Exp $
TOP= ${.CURDIR}/..
.include "${.CURDIR}/../../Makefile.inc"
.include <bsd.own.mk>
.include "${TOP}/Makefile.inc"
IMAGEDIR= ${.OBJDIR}/ramdisk-image
IMAGE= ${.OBJDIR}/ramdisk-${DISTRIBREV}.fs
IMAGE= ramdisk.fs
CBIN= ramdiskbin
WARNS= 1
LISTS= list
CRUNCHCONF= ${CBIN}.conf
MTREECONF= mtree.conf
CRUNCHBIN= ramdiskbin
LISTS= ${.CURDIR}/list ${DISTRIBDIR}/common/list.sysinst
MTREECONF= ${DISTRIBDIR}/common/mtree.common
IMAGEENDIAN= le
IMAGEDEPENDS+= ${CRUNCHBIN} \
disktab.preinstall dot.hdprofile dot.profile termcap.vt100 \
${_SRC_TOP_}/etc/group ${_SRC_TOP_}/etc/master.passwd \
${_SRC_TOP_}/etc/netconfig ${_SRC_TOP_}/etc/protocols \
${_SRC_TOP_}/etc/services
CRUNCHGEN?= crunchgen
MTREE?= mtree
MAKEDEVTARGETS= ramdisk
DISKTYPE= install-ramdisk
RDSIZE= 3800
realall: ${IMAGE}
all: ${CBIN}
rm -rf ${IMAGEDIR}
mkdir ${IMAGEDIR}
${MTREE} -def ${.CURDIR}/${MTREECONF} -p ${IMAGEDIR} -u
TOPDIR=${TOP} CURDIR=${.CURDIR} OBJDIR=${.OBJDIR} \
KERNOBJDIR=${KERNOBJDIR} \
TARGDIR=${IMAGEDIR} sh ${.CURDIR}/runlist.sh ${.CURDIR}/${LISTS}
${MAKEFS} -B le ${IMAGE} ${IMAGEDIR}
gzip -c9 ${IMAGE} > ${IMAGE}.gz
release:
unconfig:
-/bin/rm -rf ${IMAGEDIR} ${IMAGE} ${IMAGE}.gz
${CBIN}.mk ${CBIN}.cache ${CBIN}.c: ${CRUNCHCONF}
${CRUNCHGEN} -D ${TOP}/../.. -L ${DESTDIR}/usr/lib ${.ALLSRC}
# Use stubs to eliminate some large stuff from libc
HACKSRC=${DISTRIBDIR}/utils/libhack
.include "${HACKSRC}/Makefile.inc"
${CBIN}: ${CBIN}.mk ${CBIN}.cache ${CBIN}.c
${MAKE} -f ${CBIN}.mk all
# Turn off libhack's gethostby*() as it only supports /etc/hosts
HACKOBJS:= ${HACKOBJS:Ngethost.o}
clean cleandir distclean:
/bin/rm -rf ${AUXCLEAN} *.core ${IMAGEDIR}/* ${IMAGE} ${IMAGE}.gz ${CBIN} ${CBIN}.mk ${CBIN}.cache *.o *.cro *.c
# This is listed in ramdiskbin.conf but is built here.
${CRUNCHBIN}: libhack.o
.include <bsd.obj.mk>
.include <bsd.subdir.mk>
.include "${DISTRIBDIR}/common/Makefile.crunch"
.include "${DISTRIBDIR}/common/Makefile.makedev"
.include "${DISTRIBDIR}/common/Makefile.image"
.include <bsd.prog.mk>

View File

@ -1,78 +1,72 @@
# $NetBSD: list,v 1.4 2002/01/31 02:01:40 reinoud Exp $
# $NetBSD: list,v 1.5 2002/03/06 13:21:00 lukem Exp $
# copy the crunched binary, link to it, and kill it
COPY ${OBJDIR}/ramdiskbin ramdiskbin
LINK ramdiskbin sysinst
LINK ramdiskbin bin/cat
LINK ramdiskbin bin/chmod
LINK ramdiskbin bin/cp
LINK ramdiskbin bin/dd
LINK ramdiskbin bin/df
LINK ramdiskbin bin/ed
LINK ramdiskbin bin/ln
LINK ramdiskbin bin/ls
LINK ramdiskbin bin/mkdir
LINK ramdiskbin bin/mv
LINK ramdiskbin bin/pax
LINK ramdiskbin bin/pwd
LINK ramdiskbin bin/rm
LINK ramdiskbin bin/sh
LINK ramdiskbin bin/stty
LINK ramdiskbin bin/sync
LINK ramdiskbin bin/test
LINK ramdiskbin bin/[
LINK ramdiskbin sbin/disklabel
LINK ramdiskbin sbin/fsck
LINK ramdiskbin sbin/fsck_ffs
LINK ramdiskbin sbin/halt
LINK ramdiskbin sbin/ifconfig
LINK ramdiskbin sbin/init
LINK ramdiskbin sbin/mknod
LINK ramdiskbin sbin/mount
LINK ramdiskbin sbin/mount_cd9660
LINK ramdiskbin sbin/mount_ffs
LINK ramdiskbin sbin/mount_filecore
LINK ramdiskbin sbin/mount_kernfs
LINK ramdiskbin sbin/mount_msdos
LINK ramdiskbin sbin/mount_nfs
LINK ramdiskbin sbin/newfs
LINK ramdiskbin sbin/ping
LINK ramdiskbin sbin/reboot
LINK ramdiskbin sbin/restore
LINK ramdiskbin sbin/route
LINK ramdiskbin sbin/rrestore
LINK ramdiskbin sbin/shutdown
LINK ramdiskbin sbin/slattach
LINK ramdiskbin sbin/swapctl
LINK ramdiskbin sbin/umount
SYMLINK /bin/cat usr/bin/chgrp
SYMLINK /bin/cat usr/bin/ftp
SYMLINK /bin/cat usr/bin/gunzip
SYMLINK /bin/cat usr/bin/gzcat
SYMLINK /bin/cat usr/bin/gzip
SYMLINK /bin/cat usr/bin/more
SYMLINK /bin/cat usr/bin/sed
SYMLINK /bin/cat usr/bin/tar
SYMLINK /bin/cat usr/bin/tip
SYMLINK /bin/cat usr/sbin/chown
SYMLINK /bin/cat usr/sbin/chroot
SPECIAL /bin/rm ramdiskbin
SRCDIRS bin sbin usr.bin/less usr.bin usr.sbin gnu/usr.bin
# copy the MAKEDEV script and make some devices
COPY ${CURDIR}/../../../etc/etc.acorn32/MAKEDEV dev/MAKEDEV
SPECIAL cd dev; sh MAKEDEV ramdisk
SPECIAL /bin/rm dev/MAKEDEV
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/sh
PROG bin/stty
PROG bin/sync
PROG sbin/disklabel
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_filecore
PROG sbin/mount_kernfs
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/slattach
PROG sbin/swapctl
PROG sbin/umount
PROG usr/bin/ftp
PROG usr/bin/gzip usr/bin/gunzip usr/bin/gzcat
PROG usr/bin/less usr/bin/more
PROG usr/bin/sed
PROG usr/bin/tip
PROG usr/sbin/chown usr/bin/chgrp
PROG usr/sbin/chroot
SPECIAL ping srcdir distrib/utils/x_ping
LIBS libhack.o -lbz2 -ledit -lutil -lcurses -ltermcap -lrmt -lcrypt -ll -lm
# init invokes the shell as -sh
ARGVLN sh -sh
# we need the boot blocks /usr/mdec
#COPYDIR ${DESTDIR}/usr/mdec usr/mdec
# various files that we need in /etc for the install
COPY ${CURDIR}/../../../etc/group etc/group
COPY ${CURDIR}/../../../etc/master.passwd etc/master.passwd
COPY ${CURDIR}/../../../etc/protocols etc/protocols
COPY ${CURDIR}/../../../etc/netconfig etc/netconfig
COPY ${CURDIR}/../../../etc/services etc/services
SPECIAL pwd_mkdb -p -d ./ etc/master.passwd
COPY ${_SRC_TOP_}/etc/group etc/group
COPY ${_SRC_TOP_}/etc/master.passwd etc/master.passwd
COPY ${_SRC_TOP_}/etc/netconfig etc/netconfig
COPY ${_SRC_TOP_}/etc/protocols etc/protocols
COPY ${_SRC_TOP_}/etc/services etc/services
# and the common installation tools
COPY ${CURDIR}/termcap.vt100 usr/share/misc/termcap
@ -85,7 +79,3 @@ COPY ${CURDIR}/disktab.preinstall etc/disktab.preinstall
# and the installation tools
COPY ${CURDIR}/dot.profile .profile
COPY ${CURDIR}/dot.hdprofile tmp/.hdprofile
#the lists of obsolete files used by sysinst
SPECIAL sh ${CURDIR}/../../../distrib/sets/makeobsolete -b -s ${CURDIR}/../../../distrib/sets -t ./dist

View File

@ -1,70 +0,0 @@
# $NetBSD: list2sh.awk,v 1.1 2002/01/25 15:28:47 reinoud Exp $
BEGIN {
printf("cd ${OBJDIR}\n");
printf("\n");
}
/^$/ || /^#/ {
print $0;
next;
}
$1 == "COPY" {
printf("echo '%s'\n", $0);
printf("rm -f ${TARGDIR}/%s\n", $3);
printf("cp %s ${TARGDIR}/%s\n", $2, $3);
next;
}
$1 == "LINK" {
printf("echo '%s'\n", $0);
for (i = 3; i <= NF; i++) {
printf("rm -f ${TARGDIR}/%s\n", $i);
printf("(cd ${TARGDIR}; ln %s %s)\n", $2, $i);
}
next;
}
$1 == "SYMLINK" {
printf("echo '%s'\n", $0);
for (i = 3; i <= NF; i++) {
printf("rm -f ${TARGDIR}/%s\n", $i);
printf("(cd ${TARGDIR}; ln -s %s %s)\n", $2, $i);
}
next;
}
$1 == "ARGVLINK" {
# crunchgen directive; ignored here
next;
}
$1 == "SRCDIRS" {
# crunchgen directive; ignored here
next;
}
$1 == "CRUNCHSPECIAL" {
# crunchgen directive; ignored here
next;
}
$1 == "COPYDIR" {
printf("echo '%s'\n", $0);
printf("(cd ${TARGDIR}/%s && find . ! -name . | xargs /bin/rm -rf)\n",
$3);
printf("(cd %s && pax -pe -rw . ${TARGDIR}/%s)\n", $2, $3);
next;
}
$1 == "SPECIAL" {
printf("echo '%s'\n", $0);
printf("(cd ${TARGDIR};");
for (i = 2; i <= NF; i++)
printf(" %s", $i);
printf(")\n");
next;
}
{
printf("echo '%s'\n", $0);
printf("echo 'Unknown keyword \"%s\" at line %d of input.'\n", $1, NR);
printf("exit 1\n");
exit 1;
}
END {
printf("\n");
printf("exit 0\n");
exit 0;
}

View File

@ -1,82 +0,0 @@
# $NetBSD: mtree.conf,v 1.1 2002/01/25 15:28:47 reinoud Exp $
/set type=dir uname=root gname=wheel mode=0755
# .
.
# ./bin
bin
# ./bin
..
# ./dev
dev
# ./dev
..
# ./dist
dist
# ./dist
..
# ./etc
etc
# ./etc
..
# ./mnt
mnt
# ./mnt
..
# ./mnt2
mnt2
# ./mnt2
..
# ./kern
kern
# ./kern
..
# ./sbin
sbin
# ./sbin
..
# ./tmp
tmp mode=01777
# ./tmp
..
# ./usr
usr
# ./usr/bin
bin
# ./usr/bin
..
# ./usr/mdec
mdec
# ./usr/mdec
..
# ./usr/sbin
sbin
# ./usr/sbin
..
# ./usr/share
share
# ./usr/share/misc
misc
# ./usr/share/misc
..
# ./usr/share
..
# ./usr
..

View File

@ -1,34 +0,0 @@
# $NetBSD: ramdiskbin.conf,v 1.2 2002/01/31 02:01:40 reinoud Exp $
#
# ramdiskbin.conf - unified binary for the install ramdisk
#
srcdirs bin sbin usr.bin/less usr.bin usr.sbin gnu/usr.bin
progs cat chmod chown chroot cp dd df disklabel ed
progs fsck fsck_ffs ftp gzip ifconfig init less ln ls
progs mkdir mknod mount mount_cd9660 mount_ffs mount_filecore mount_msdos
progs mount_nfs mount_kernfs mv newfs ping pwd reboot restore rm route
progs sed sh shutdown slattach stty swapctl sync test tip
progs umount
progs sysinst pax
special sysinst srcdir distrib/utils/sysinst/arch/acorn32
special init srcdir distrib/utils/init_s
special ping srcdir distrib/utils/x_ping
ln pax tar
ln chown chgrp
ln gzip gzcat gunzip
ln less more
ln sh -sh # init invokes the shell this way
ln test [
ln mount_cd9660 cd9660
ln mount_ffs ffs
ln mount_filecore filecore
ln mount_msdos msdos
ln mount_nfs nfs
ln mount_kernfs kernfs
ln reboot halt
ln restore rrestore
libs -lbz2 -ledit -lutil -lcurses -ltermcap -lrmt -lcrypt -ll -lm

View File

@ -1,13 +0,0 @@
# $NetBSD: runlist.sh,v 1.1 2002/01/25 15:28:48 reinoud Exp $
if [ "X$1" = "X-d" ]; then
SHELLCMD=cat
shift
else
SHELLCMD="sh -e"
fi
( while [ "X$1" != "X" ]; do
cat $1
shift
done ) | awk -f ${CURDIR}/list2sh.awk | ${SHELLCMD}