mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-14 10:09:48 +00:00
Add 'custom' directory with significantly restructured build (now
using make instead of custom scripts) and two floppies instead of one. The resultant floppy can do everything that the individual floppies (dial, net, install, isp, router) could do, modulo some bit rot that has occurred since PicoBSD last compiled. It also includes all the programs on the fixit floppy, which could thus also die. /bin currently contains the following files: -sh dump ln ns sps [ ed login ping stty badsect ex ls ps swapon cat expr mkdir pwd sync chgrp fdisk mknod pwd_mkdb sysctl chmod find more rdump syslogd chown fsck mount reboot tar chroot ftp mount_cd9660 restore telnet clri getty mount_msdos rlogin telnetd cp grep mount_nfs rm test date gunzip mount_std rmdir traceroute dd gzip msg route umount dev_mkdb hostname mt routed vi df ifconfig mv rrestore view dhclient inetd natd rsh vm dhclient-script init netstat sed w disklabel kget newfs sh zcat dmesg kill nfs sleep Structure is in place for using the same build for the other directories, but I'm no longer sure we need this. The current first floppy will run fine by itself, but the size of a compressed kernel has increased by nearly 50% since 3.2, and there's not much space for anything useful on the remainder of the floppy. The current method creates a larger mfs and can read as many floppies as the user can stand. The footprint appears to be round 14 MB. Work-sponsored-by: Sitara Networks Inc.
This commit is contained in:
parent
0e5a7be513
commit
2bdf2cff05
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=54417
23
release/picobsd/Makefile
Normal file
23
release/picobsd/Makefile
Normal file
@ -0,0 +1,23 @@
|
||||
# Top level Makefile for PicoBSD
|
||||
# install looks like a partially completed target,
|
||||
# but I don't want to finish this work.
|
||||
# FIXME
|
||||
# CONFIGS = custom dial isp net router
|
||||
CONFIGS = custom
|
||||
|
||||
all clean tidy:
|
||||
for i in ${CONFIGS}; do \
|
||||
(cd $$i; \
|
||||
echo '----- Building in' $$i; \
|
||||
make $@); \
|
||||
done
|
||||
@if [ "$@" = "clean" ]; then \
|
||||
rm -f *~; \
|
||||
fi
|
||||
|
||||
floppy floppy2:
|
||||
@echo Please build this target from one of the ${CONFIGS} subdirectories.
|
||||
|
||||
# Build one subdirectory
|
||||
${CONFIGS}:
|
||||
cd $@; make clean all
|
254
release/picobsd/build/Makefile
Normal file
254
release/picobsd/build/Makefile
Normal file
@ -0,0 +1,254 @@
|
||||
# PicoBSD Makefile
|
||||
#
|
||||
# $Id: Makefile,v 1.1 1999/12/10 17:38:06 grog Exp $
|
||||
#
|
||||
# Taken from:
|
||||
#
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
# Building a PicoBSD kernel involves four basic operations:
|
||||
#
|
||||
# 1. Build a kernel. This is done by the 'kernel' target.
|
||||
# 2. Build a PicoBSD file system. This file system is loaded into an
|
||||
# MFS at boot time. This is done by the 'fs' target.
|
||||
# 3. Build a single executable file for all the programs, and install it in
|
||||
# the mfs image. This is done by the 'crunch' target.
|
||||
# 4. Build a floppy image containing the MFS image and some helper code
|
||||
# to boot it. This is done by the 'image' target.
|
||||
# 5. Copy the image to the floppy. Done by the 'copy' target.
|
||||
|
||||
# You can set the SRC variable which points to your source tree. It's
|
||||
# /usr/src by default (most people shouldn't change it).
|
||||
SRC ?= /usr/src
|
||||
EDITOR = vi
|
||||
|
||||
# LANGUAGE language to be used (en or pl)
|
||||
LANGUAGE = en
|
||||
|
||||
# FLOPPY_SIZE floppy size in KB (default to 1440)
|
||||
FLOPPY_SIZE = 1440
|
||||
|
||||
# BUILDDIR is this directory
|
||||
BUILDDIR = ${.CURDIR}
|
||||
|
||||
# These programs are built with non-standard parameters. To be sure of
|
||||
# getting them right, we need to rebuild every time; otherwise we might
|
||||
# trip over the 'make world' objects.
|
||||
# To do this right, we need to build the objects in a different directory.
|
||||
# FIXME.
|
||||
SPECIAL_PROGS = ../../../usr.bin/login ../../../usr.bin/passwd
|
||||
|
||||
# Get default parameters for MFS
|
||||
.include "mfsinfo"
|
||||
|
||||
# MFS information
|
||||
MFS_NAME = fs.PICOBSD
|
||||
MFS_MOUNTPOINT = mmnt
|
||||
MFS_VNODE = /dev/vn0
|
||||
# /etc/rc for the mfs image. This reads the real stuff off the floppy
|
||||
MFS_RC = floppy.tree/etc/mfs.rc
|
||||
|
||||
FLOPPY_NAME = picobsd.bin
|
||||
FLOPPY_VNODE = /dev/vn1
|
||||
FLOPPY_MOUNTPOINT = fmnt
|
||||
|
||||
# Variables for building kernel
|
||||
CONF ?= $(SRC)/sys/i386/conf
|
||||
CONFFILE = PICOBSD${suffix}
|
||||
COMPILE = $(SRC)/sys/compile/$(CONFFILE)
|
||||
KERNFILE = $(COMPILE)/kernel
|
||||
|
||||
FDEV ?= /dev/fd0
|
||||
|
||||
# DEVFS is currently broken. Always set this.
|
||||
#
|
||||
NO_DEVFS = yes
|
||||
|
||||
# Should we keep this?
|
||||
VER = 0.445
|
||||
|
||||
all: kernel.gz ${MFS_NAME} crunch ${FLOPPY_NAME} copy crunch-2
|
||||
|
||||
kernel.gz: ${COMPILE}/kernel
|
||||
@echo "--> Compressing kernel"
|
||||
cp -p ${COMPILE}/kernel kernel
|
||||
strip kernel
|
||||
strip --remove-section=.note --remove-section=.comment kernel
|
||||
gzip -f -9 -v -n kernel
|
||||
@ls -l kernel.gz
|
||||
|
||||
# Create the MFS image file
|
||||
${MFS_NAME}: ${MFS_VNODE} ${MFS_MOUNTPOINT}
|
||||
@echo "--> Building and mounting MFS image vnode"
|
||||
-umount -f ${MFS_MOUNTPOINT}
|
||||
-umount -f ${MFS_VNODE}
|
||||
-vnconfig -u ${MFS_VNODE}
|
||||
rm -f ${MFS_NAME}
|
||||
dd of=${MFS_NAME} if=/dev/zero count=${MFS_SIZE} bs=1k
|
||||
awk 'BEGIN {printf "%c%c", 85, 170}' | \
|
||||
dd of=${MFS_NAME} obs=1 seek=510 conv=notrunc 2> /dev/null
|
||||
vnconfig -s labels -c ${MFS_VNODE} ${MFS_NAME}
|
||||
dd if=/boot/boot1 of=${MFS_NAME} conv=notrunc
|
||||
disklabel -rw vn0 auto
|
||||
newfs -i ${MFS_INODES} -m 0 -p 0 -o space ${MFS_VNODE}c
|
||||
mount ${MFS_VNODE} ${MFS_MOUNTPOINT}
|
||||
make -f Makefile.mfs DESTDIR=${MFS_MOUNTPOINT} LANGUAGE=${LANGUAGE}
|
||||
make -f Makefile.mfs devnodes DESTDIR=${MFS_MOUNTPOINT} LANGUAGE=${LANGUAGE}
|
||||
MFS_MOUNTPOINT=${MFS_MOUNTPOINT} INIT=${INIT} VER=${VER} BUILDDIR=${BUILDDIR} LANGUAGE=${LANGUAGE}
|
||||
|
||||
# Populate the MFS image.
|
||||
crunch: ${MFS_MOUNTPOINT}
|
||||
@echo "--> Populating MFS image"
|
||||
-mount ${MFS_VNODE} ${MFS_MOUNTPOINT}
|
||||
# We need to make login with other options
|
||||
for i in ${SPECIAL_PROGS}; do (cd $$i; make clean); done
|
||||
cd crunch1; make SRC=${SRC} INIT=${INIT}; make install MFS_MOUNTPOINT=../${MFS_MOUNTPOINT}
|
||||
# who can tell me how these damned help files get in here?
|
||||
rm -rf ${MFS_MOUNTPOINT}/sbin/help
|
||||
# Other files for the mfs file system
|
||||
(cd mfs; tar cf - . | (cd ../${MFS_MOUNTPOINT}; tar xf -))
|
||||
cd ${MFS_MOUNTPOINT}; chown -R root *
|
||||
df -ik ${MFS_MOUNTPOINT}
|
||||
umount ${MFS_MOUNTPOINT}
|
||||
fsck -p ${MFS_VNODE}
|
||||
|
||||
# Create and mount the floppy image
|
||||
${FLOPPY_NAME}: ${FLOPPY_VNODE} ${FLOPPY_MOUNTPOINT} ${MFS_NAME}
|
||||
@echo "--> Preparing ${FLOPPY_SIZE}kB floppy filesystem"
|
||||
-umount ${FLOPPY_VNODE}
|
||||
-vnconfig -u ${FLOPPY_VNODE}
|
||||
dd of=${FLOPPY_NAME} if=/dev/zero count=${FLOPPY_SIZE} bs=1k
|
||||
awk 'BEGIN {printf "%c%c", 85, 170}' | \
|
||||
dd of=${FLOPPY_NAME} obs=1 seek=510 conv=notrunc
|
||||
-vnconfig -s labels -c ${FLOPPY_VNODE} ${FLOPPY_NAME}
|
||||
dd if=/boot/boot1 of=${FLOPPY_NAME} conv=notrunc
|
||||
disklabel -Brw -b /boot/boot1 -s /boot/boot2 ${FLOPPY_VNODE}c fd${FLOPPY_SIZE}
|
||||
newfs -i ${FLOPPY_INODES} -m 0 -p 0 -o space ${FLOPPY_VNODE}c
|
||||
mount ${FLOPPY_VNODE} ${FLOPPY_MOUNTPOINT}
|
||||
|
||||
copy: ${FLOPPY_MOUNTPOINT}/boot/defaults ../floppy.tree/boot
|
||||
@echo "--> Populating floppy filesystem from ../floppy.tree"
|
||||
@echo -- Make a loader
|
||||
cp /boot/loader floppy.tree/boot
|
||||
kzip floppy.tree/boot/loader
|
||||
mv floppy.tree/boot/loader.kz floppy.tree/boot/loader
|
||||
.if foo
|
||||
rm ../floppy.tree/boot/loader
|
||||
mv ../floppy.tree/boot/loader.kz ../floppy.tree/boot/loader
|
||||
.endif
|
||||
@echo -- copy base floppy tree
|
||||
@echo -- Base files
|
||||
(wd=`pwd`; cd ../floppy.tree ; tar cXhf $${wd}/floppy.tree.exclude - . ) | \
|
||||
(cd ${FLOPPY_MOUNTPOINT} ; tar xvf - )
|
||||
@echo -- Now update from our private floppy tree if it exists
|
||||
@echo -- Local files in `pwd`/floppy.tree
|
||||
if [ -d floppy.tree ] ; then \
|
||||
(cd floppy.tree; tar cXhf ../floppy.tree.exclude - .) | (cd ${FLOPPY_MOUNTPOINT} ; tar xvf - ); \
|
||||
fi
|
||||
# We get stuff here that we can't use. When the transition
|
||||
# to Makefile-based build is complete, we can delete this.
|
||||
# XXX
|
||||
rm -rf ${FLOPPY_MOUNTPOINT}/etc
|
||||
(cd floppy.etc; tar czvXf ../floppy.tree.exclude ../${FLOPPY_MOUNTPOINT}/etc.tar.gz .)
|
||||
df -ik ${FLOPPY_MOUNTPOINT}
|
||||
@echo -- Generate password file if we don't have one on the floppy.
|
||||
@echo -- The variable PASSWD is defined in mfsinfo
|
||||
if [ ${PASSWD} = NO ] ; then \
|
||||
cp -p ${FLOPPY_MOUNTPOINT}/etc/master.passwd .; \
|
||||
pwd_mkdb -d . master.passwd; \
|
||||
mv spwd.db ${FLOPPY_MOUNTPOINT}/etc/; \
|
||||
rm pwd.db master.passwd; \
|
||||
fi
|
||||
cp kernel.gz ${FLOPPY_MOUNTPOINT}/kernel.gz
|
||||
@echo -- Insert the MFS image
|
||||
gzip -9cv ${MFS_NAME} > ${FLOPPY_MOUNTPOINT}/${MFS_NAME}.gz
|
||||
.if loaderconf
|
||||
XXX finish this.
|
||||
cp ${SRC}/sys/boot/forth/loader.conf ${FLOPPY_MOUNTPOINT}/boot/defaults
|
||||
echo "userconfig_script_load=\"YES\"" >>${FLOPPY_MOUNTPOINT}/boot/defaults/loader.conf
|
||||
echo "rootfs_load=\"YES\"" >>${FLOPPY_MOUNTPOINT}/boot/defaults/loader.conf
|
||||
echo "rootfs_name=\"${MFS_NAME}\"" >>${FLOPPY_MOUNTPOINT}/boot/defaults/loader.conf
|
||||
echo "rootfs_type=\"mfs_root\"" >>${FLOPPY_MOUNTPOINT}/boot/defaults/loader.conf
|
||||
# for i in frames screen ; do \
|
||||
# cp ${SRC}/share/examples/bootforth/$${i}.4th ${FLOPPY_MOUNTPOINT}/boot/; \
|
||||
# done
|
||||
.endif
|
||||
(echo "-> Fixing permissions"; cd ${FLOPPY_MOUNTPOINT}; chown -R root *)
|
||||
df -ik ${FLOPPY_MOUNTPOINT}
|
||||
umount ${FLOPPY_MOUNTPOINT}
|
||||
|
||||
floppy: ${FLOPPY_NAME}
|
||||
@echo copying ${FLOPPY_NAME} to ${FDEV}c. This will take about 50 seconds.
|
||||
@echo "wait for the message 'safe to remove' before removing the floppy..."
|
||||
@dd if=${FLOPPY_NAME} of=${FDEV}c bs=36b >/dev/null
|
||||
@echo Safe to remove disk from ${FDEV}
|
||||
|
||||
floppy2:
|
||||
@if [ -d crunch2 ]; then \
|
||||
if [ ! -d crunch2/floppy2 ]; then \
|
||||
(cd crunch2; make); \
|
||||
fi; \
|
||||
echo copying crunch2/floppy to ${FDEV}c. This will take about 50 seconds.; \
|
||||
cd crunch2/floppy2; tar czvf - . | dd of=/dev/rfd0 conv=sync; \
|
||||
echo Safe to remove disk from ${FDEV}; \
|
||||
else \
|
||||
echo No second floppy; \
|
||||
fi
|
||||
|
||||
# crunch-2: Build second floppy
|
||||
crunch-2:
|
||||
if [ -d crunch2 ]; then cd crunch2; make; fi
|
||||
|
||||
# Secondary targets
|
||||
|
||||
${COMPILE}/kernel: ${CONFFILE}
|
||||
@echo "--> Building kernel"
|
||||
grep -q MD_ROOT ${CONFFILE}; if [ $$? -ne 0 ]; then \
|
||||
echo -- '***** Config file must include MD_ROOT'; \
|
||||
exit 1; \
|
||||
fi
|
||||
cp ${CONFFILE} ${CONF}; \
|
||||
cd ${CONF}; \
|
||||
config ${CONFFILE}; \
|
||||
cd ${COMPILE}; \
|
||||
make depend all
|
||||
|
||||
# Device nodes for the vnode devices
|
||||
${FLOPPY_VNODE} ${MFS_VNODE}:
|
||||
(cd /dev; ./MAKEDEV `basename $@`)
|
||||
|
||||
# Directories to make
|
||||
${MFS_MOUNTPOINT} ${FLOPPY_MOUNTPOINT} ${FLOPPY_MOUNTPOINT}/boot/defaults ../floppy.tree/boot:
|
||||
mkdir -p $@
|
||||
|
||||
tidy:
|
||||
-umount ${FLOPPY_VNODE} ${MFS_VNODE}
|
||||
-vnconfig -u ${FLOPPY_VNODE}
|
||||
-vnconfig -u ${MFS_VNODE}
|
||||
rm -f ${MFS_NAME} ${MFS_NAME}.gz ${FLOPPY_NAME} *~ Make.log kernel.gz
|
||||
|
||||
clean: tidy
|
||||
if [ -d floppy.tree ]; then \
|
||||
cd floppy.tree; rm -f boot/loader; \
|
||||
fi
|
||||
rm -rf ${MFS_MOUNTPOINT} ${FLOPPY_MOUNTPOINT} crunch1.conf
|
||||
cd crunch1; make clean
|
||||
if [ -d crunch2 ]; then cd crunch2; make clean; fi
|
||||
if [ -d ${COMPILE} ] ; then cd ${COMPILE}; make clean; fi
|
||||
|
||||
# XXX Just for testing
|
||||
vnconfig: vnunconfig
|
||||
vnconfig -c ${MFS_VNODE} ${MFS_NAME}
|
||||
vnconfig -c ${FLOPPY_VNODE} ${FLOPPY_NAME}
|
||||
|
||||
vnunconfig:
|
||||
-vnconfig -u ${MFS_VNODE}
|
||||
-vnconfig -u ${FLOPPY_VNODE}
|
||||
|
||||
mount:
|
||||
mount ${MFS_VNODE} ${MFS_MOUNTPOINT}
|
||||
mount ${FLOPPY_VNODE} ${FLOPPY_MOUNTPOINT}
|
||||
|
||||
umount:
|
||||
-umount ${MFS_VNODE} ${MFS_MOUNTPOINT} ${FLOPPY_VNODE} ${FLOPPY_MOUNTPOINT}
|
44
release/picobsd/build/Makefile.mfs
Normal file
44
release/picobsd/build/Makefile.mfs
Normal file
@ -0,0 +1,44 @@
|
||||
#
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
DESTDIR?=${MFS_MOUNTPOINT}
|
||||
|
||||
STAND_LINKS= bin sbin
|
||||
USR_LINKS= bin sbin libexec
|
||||
PL_LOCALE_LINKS= pl polish
|
||||
MY_DEVS= std tun2 cuaa0 cuaa1 cuaa2 vty10 fd0 wd0s1h pty0 ttyd0 cuaa0 wd1 wd2 wd3 bpf0 bpf1 sa0 sa1
|
||||
|
||||
all: tree links
|
||||
|
||||
tree:
|
||||
@echo "--- making tree"
|
||||
mtree -deU -f mfs.mtree -p ${DESTDIR}
|
||||
|
||||
links: tree
|
||||
@echo "--- making links"
|
||||
(cd ${DESTDIR}; \
|
||||
for i in ${STAND_LINKS}; \
|
||||
do \
|
||||
ln -s /stand $${i}; \
|
||||
done; \
|
||||
cd var/run; \
|
||||
ln -s /dev/null log; \
|
||||
cd ../../usr; \
|
||||
for i in ${USR_LINKS}; \
|
||||
do \
|
||||
ln -s /stand $${i}; \
|
||||
done; \
|
||||
cd share/misc;\
|
||||
ln -s /etc/termcap termcap; )
|
||||
|
||||
|
||||
# We don't do it under 'all' because it's needed only on non-DEVFS systems
|
||||
devnodes: tree
|
||||
@echo "--- making device nodes"
|
||||
(cd ${DESTDIR}/dev; \
|
||||
ln -s /dev/MAKEDEV; \
|
||||
./MAKEDEV ${MY_DEVS}; \
|
||||
rm MAKEDEV)
|
||||
|
||||
clean:
|
Loading…
Reference in New Issue
Block a user