mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-28 04:43:32 +00:00
Cleanup the build scripts.
Approved-by: jordan
This commit is contained in:
parent
f144de8b3d
commit
f908e29f8d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=57038
@ -11,11 +11,16 @@ KERNFILE=$(COMPILE)/kernel
|
||||
|
||||
all: $(KERNFILE)
|
||||
|
||||
$(KERNFILE): PICOBSD
|
||||
cat PICOBSD | grep -v "MD_ROOT" > ${CONF}/${CONFFILE}
|
||||
echo "options MD_ROOT" >> ${CONF}/${CONFFILE}
|
||||
|
||||
${CONF}/${CONFFILE}: PICOBSD
|
||||
cp PICOBSD ${CONF}/${CONFFILE}
|
||||
(cd ${CONF}; \
|
||||
config ${CONFFILE}; \
|
||||
cd ${COMPILE}; \
|
||||
make depend all)
|
||||
make depend )
|
||||
|
||||
${COMPILE}: ${CONF}/${CONFFILE}
|
||||
|
||||
$(KERNFILE): ${COMPILE}
|
||||
(cd ${COMPILE}; make )
|
||||
|
||||
|
@ -4,16 +4,20 @@
|
||||
|
||||
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
|
||||
STAND_LINKS?= bin sbin usr/local/bin
|
||||
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}
|
||||
@( if [ -f mfs.mtree ] ; then \
|
||||
mtree -deU -f mfs.mtree -p ${DESTDIR}; \
|
||||
else \
|
||||
mtree -deU -f ../build/mfs.mtree -p ${DESTDIR} ; \
|
||||
fi )
|
||||
|
||||
links: tree
|
||||
@echo "--- making links"
|
||||
|
@ -41,24 +41,24 @@ export BUILDDIR
|
||||
set_defaults() {
|
||||
TYPE=${TYPE:-dial} # PicoBSD type (isp, router, net, custom, ...
|
||||
|
||||
while read name suff sz init mfs_in floppy_in ; do
|
||||
# build image list
|
||||
cat /dev/null > .image.list
|
||||
for i in ../* ; do
|
||||
if [ -d $i -a -f $i/PICOBSD ] ; then
|
||||
a=`awk '/^#PicoBSD/ {print $2, $3, $4, $5, $6}' < $i/PICOBSD`
|
||||
if [ "$a" != "" ]; then
|
||||
echo "`basename $i` $a" >>.image.list
|
||||
fi
|
||||
fi
|
||||
done
|
||||
while read name sz init mfs_in floppy_in ; do
|
||||
if [ "$name" != "#" -a $name != "" ] ; then
|
||||
eval ${name}_suffix=$suff
|
||||
eval ${name}_DFLT_SIZE=$sz
|
||||
eval ${name}_INIT=$init
|
||||
eval ${name}_MFS_INODES=$mfs_in
|
||||
eval ${name}_FLOPPY_INODES=$floppy_in
|
||||
fi
|
||||
done <<__eof__
|
||||
# build MFS - Byte/inode -
|
||||
# name suffix DFLT_SZ init MFS FLOPPY
|
||||
dial -D 2400 init 4096 32768
|
||||
router -R 2400 oinit 3072 32768
|
||||
net -N 2400 init 4096 32768
|
||||
isp -I 2400 init 4096 32768
|
||||
install -S 2400 init 4096 4096
|
||||
custom -C 2400 init 8192 32768
|
||||
__eof__
|
||||
done < .image.list
|
||||
}
|
||||
|
||||
set_msgs() {
|
||||
@ -68,7 +68,7 @@ set_msgs() {
|
||||
fi
|
||||
|
||||
MSG="PicoBSD build -- Current parameters:\n\n\t1. ${MSG1}\n\
|
||||
\t2. MFS size: ${SIZE} kB\n\t3. Language: ${LANGUAGE}\n\
|
||||
\t2. MFS size: ${MFS_SIZE} kB\n\t3. Language: ${LANGUAGE}\n\
|
||||
\t4. Site-info: ${SITE}\n"
|
||||
}
|
||||
|
||||
@ -76,6 +76,11 @@ set_msgs() {
|
||||
# Main build procedure. It calls another scripts (stage1)
|
||||
main() {
|
||||
|
||||
if [ "X${TYPE}" = "X" ] ; then
|
||||
echo "^G^G^G-> wrong floppy type"
|
||||
exit 10
|
||||
fi
|
||||
|
||||
export suffix
|
||||
|
||||
clear
|
||||
@ -88,15 +93,9 @@ main() {
|
||||
echo ""
|
||||
sleep 2
|
||||
|
||||
export SIZE LANGUAGE TYPE SRC NO_DEVFS INIT
|
||||
export MFS_SIZE LANGUAGE TYPE SRC NO_DEVFS INIT
|
||||
export SITE MFS_INODES FLOPPY_INODES FLOPPY_SIZE
|
||||
|
||||
# Build the kernel, if necessary
|
||||
echo ""
|
||||
echo "-> Checking if we have to build the PICOBSD kernel..."
|
||||
(cd ../${TYPE}; make -f ${BUILDDIR}/Makefile.conf )
|
||||
echo ""
|
||||
|
||||
./stage1
|
||||
if [ "X$?" != "X0" ] ; then
|
||||
echo ""
|
||||
@ -152,12 +151,16 @@ set_custom() {
|
||||
# associated to each type. We can override them manually afterwards.
|
||||
|
||||
set_type() {
|
||||
|
||||
eval SIZE=$"${TYPE}_DFLT_SIZE"
|
||||
eval MFS_SIZE=$"${TYPE}_DFLT_SIZE"
|
||||
eval INIT=$"${TYPE}_INIT"
|
||||
eval MFS_INODES=$"${TYPE}_MFS_INODES"
|
||||
eval FLOPPY_INODES=$"${TYPE}_FLOPPY_INODES"
|
||||
eval suffix=$"${TYPE}_suffix"
|
||||
suffix="-${TYPE}"
|
||||
if [ "${MFS_SIZE}" = "" ] ; then
|
||||
echo "TYPE $TYPE not found!"
|
||||
sleep 2
|
||||
TYPE=""
|
||||
fi
|
||||
|
||||
case ${TYPE} in
|
||||
custom)
|
||||
@ -185,7 +188,7 @@ build_package() {
|
||||
LANGUAGE=${y}
|
||||
set_type
|
||||
echo "---------------------------------------------">>build.status
|
||||
echo "Building TYPE=${z}, LANGUAGE=${y}, SIZE=${SIZE}" >>build.status
|
||||
echo "Building TYPE=${z}, LANGUAGE=${y}, SIZE=${MFS_SIZE}" >>build.status
|
||||
main
|
||||
if [ "X$?" != "X0" ] ; then
|
||||
echo " ** FAILED! **">>build.status
|
||||
@ -193,7 +196,7 @@ build_package() {
|
||||
echo " (ok)">>build.status
|
||||
fi
|
||||
mv picobsd.bin pb_${y}${suffix}.bin
|
||||
echo "Calling ./clean for ${TYPE}, ${LANGUAGE}, ${SIZE}">>build.status
|
||||
echo "Calling ./clean for ${TYPE}, ${LANGUAGE}, ${MFS_SIZE}">>build.status
|
||||
./clean ${TYPE}
|
||||
done
|
||||
done
|
||||
@ -210,7 +213,7 @@ main_dialog() {
|
||||
T "${MSG1}" \
|
||||
K "edit Kernel config file for ${TYPE}" \
|
||||
E "Edit crunch.conf file for ${TYPE}" \
|
||||
S "MFS Size: ${SIZE}kB" \
|
||||
S "MFS Size: ${MFS_SIZE}kB" \
|
||||
L "Language: ${LANGUAGE}" \
|
||||
I "Init type: ${INIT}" \
|
||||
F "Floppy size: ${FLOPPY_SIZE}kB" \
|
||||
@ -224,12 +227,8 @@ main_dialog() {
|
||||
case ${ans} in
|
||||
T)
|
||||
dialog --menu "Setup the type of configuration" 12 70 5 \
|
||||
dial "dialin (ppp etc.)" \
|
||||
router "router/bridge/mrouter" \
|
||||
net "net admin tool" \
|
||||
install "network system installer" \
|
||||
isp "isp (ppp and terminal server)" \
|
||||
custom "custom config (need pathname)" 2> ${RISU} || rm ${RISU}
|
||||
`awk '{ print $1, $1 }' < .image.list` \
|
||||
2> ${RISU} || rm ${RISU}
|
||||
if [ -f ${RISU} ] ; then
|
||||
TYPE=`cat ${RISU}`
|
||||
set_type
|
||||
@ -257,9 +256,9 @@ Keep in mind that this memory is \
|
||||
totally lost to other programs. Usually you want to keep \
|
||||
this as small as possible. " 10 70 2> ${RISU} || rm ${RISU}
|
||||
if [ -f ${RISU} ] ; then
|
||||
SIZE=`cat ${RISU}`
|
||||
if [ "${SIZE}" = "" ] ; then
|
||||
eval SIZE=$"${TYPE}_DFLT_SIZE"
|
||||
MFS_SIZE=`cat ${RISU}`
|
||||
if [ "${MFS_SIZE}" = "" ] ; then
|
||||
eval MFS_SIZE=$"${TYPE}_DFLT_SIZE"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
@ -337,6 +336,7 @@ this as small as possible. " 10 70 2> ${RISU} || rm ${RISU}
|
||||
do_install() {
|
||||
dialog --title "Build ${TYPE} completed" --inputbox \
|
||||
"\nThe build process was completed successfuly.\n\
|
||||
`cat .build.reply` \
|
||||
Now we are going to install the image on the floppy.\n\
|
||||
Please insert a blank floppy in /dev/fd0.\\n
|
||||
WARNING: the contents of the floppy will be permanently erased!\n\
|
||||
@ -345,7 +345,7 @@ Your options:\n\
|
||||
* ^C or [Cancel] to abort,\n\
|
||||
* Enter to install \"picobsd.bin\",\n\
|
||||
* name of other file to install.\n\
|
||||
" 20 70 2> ${RISU}
|
||||
" 20 80 2> ${RISU}
|
||||
if [ "$?" = "0" ]; then
|
||||
FILENAME=`cat ${RISU}`
|
||||
if [ "${FILENAME}" = "" ] ; then
|
||||
@ -368,6 +368,7 @@ if [ "$1" = "-n" ] ; then
|
||||
shift
|
||||
fi
|
||||
TYPE=$1
|
||||
SITE=$2
|
||||
set_defaults
|
||||
set_type
|
||||
|
||||
|
@ -27,17 +27,16 @@ rm -f kernel kernel.gz fs.PICOBSD *.o *core *.db \
|
||||
cd ..
|
||||
rm -rf help/tmp_hlp
|
||||
echo "===================== $0 tools started ===================="
|
||||
for i in `ls -d tinyware/[a-z]*` tools/write_mfs_in_kernel ; do
|
||||
for i in `ls -d tinyware/[a-z]*` ; do
|
||||
(cd ${i}; \
|
||||
if [ -f Makefile ]; then \
|
||||
make clean && make cleandepend;\
|
||||
make clean && make cleandepend;\
|
||||
fi)
|
||||
done
|
||||
for j in $list ; do
|
||||
echo "===================== $0 $j started ======================"
|
||||
(cd ${j}/crunch1; \
|
||||
if [ -f Makefile ]; then \
|
||||
make clean ; \
|
||||
fi)
|
||||
make -f ../../build/Makefile.crunch clean ; \
|
||||
)
|
||||
echo "=============== $0 $j completed successfuly =============="
|
||||
done
|
||||
|
@ -9,6 +9,7 @@
|
||||
set -e # abort in case of untested errors
|
||||
|
||||
MFS_NAME=fs.PICOBSD
|
||||
MFS_MOUNTPOINT=/mnt
|
||||
# fail errno errcode
|
||||
# This function is used to trap errors and print msgs
|
||||
#
|
||||
@ -22,16 +23,16 @@ fail() {
|
||||
echo " Most probably your running kernel doesn't have the vn(4) device."
|
||||
;;
|
||||
disklabel)
|
||||
echo "Error while labeling ${MFS_NAME} size $SIZE"
|
||||
echo "Error while labeling ${MFS_NAME} size ${MFS_SIZE}"
|
||||
;;
|
||||
no_mount)
|
||||
echo "Error while mounting ${MFS_NAME} (/dev/vn0c) on /mnt"
|
||||
echo "Error while mounting ${MFS_NAME} (/dev/vn0c) on ${MFS_MOUNTPOINT}"
|
||||
;;
|
||||
mtree)
|
||||
echo "Error while making hierarchy in /mnt"
|
||||
echo "Error while making hierarchy in ${MFS_MOUNTPOINT}"
|
||||
;;
|
||||
makedevs)
|
||||
echo "Error while making devices in /mnt"
|
||||
echo "Error while making devices in ${MFS_MOUNTPOINT}"
|
||||
;;
|
||||
crunch)
|
||||
echo "Error while building ../${TYPE}/crunch1..."
|
||||
@ -56,191 +57,217 @@ fail() {
|
||||
exit 10
|
||||
}
|
||||
|
||||
echo "-> Preparing MFS filesystem..."
|
||||
umount /dev/vn0 2> /dev/null || true
|
||||
umount /mnt 2> /dev/null || true
|
||||
vnconfig -u /dev/rvn0 2> /dev/null || true
|
||||
rm -f kernel.gz ${MFS_NAME} # cleanup...
|
||||
|
||||
dd of=${MFS_NAME} if=/dev/zero count=${SIZE} bs=1k 2> /dev/null
|
||||
create_mfs() {
|
||||
echo "-> Preparing MFS filesystem..."
|
||||
umount /dev/vn0 2> /dev/null || true
|
||||
umount ${MFS_MOUNTPOINT} 2> /dev/null || true
|
||||
vnconfig -u /dev/rvn0 2> /dev/null || true
|
||||
|
||||
awk 'BEGIN {printf "%c%c", 85, 170}' | \
|
||||
dd of=${MFS_NAME} obs=1 seek=510 conv=notrunc 2> /dev/null
|
||||
dd of=${MFS_NAME} if=/dev/zero count=${MFS_SIZE} bs=1k 2> /dev/null
|
||||
|
||||
vnconfig -s labels -c /dev/rvn0 ${MFS_NAME} 2>/dev/null || fail $? no_vnconfig
|
||||
awk 'BEGIN {printf "%c%c", 85, 170}' | \
|
||||
dd of=${MFS_NAME} obs=1 seek=510 conv=notrunc 2> /dev/null
|
||||
|
||||
dd if=/boot/boot1 of=${MFS_NAME} conv=notrunc 2> /dev/null
|
||||
vnconfig -s labels -c /dev/rvn0 ${MFS_NAME} 2>/dev/null || \
|
||||
fail $? no_vnconfig
|
||||
|
||||
# This command does weird things on 2.2.x systems.
|
||||
# For small image sizes, use std disktypes
|
||||
if [ ${SIZE} -lt 1024 ] ; then
|
||||
disklabel -rw /dev/rvn0 fd${SIZE} || fail $? disklabel
|
||||
else
|
||||
disklabel -rw vn0 auto || fail $? disklabel
|
||||
fi
|
||||
dd if=/boot/boot1 of=${MFS_NAME} conv=notrunc 2> /dev/null
|
||||
|
||||
newfs -i ${MFS_INODES} -m 0 -p 0 -o space /dev/rvn0c
|
||||
mount /dev/vn0c /mnt || fail $? no_mount
|
||||
|
||||
pwd=`pwd`
|
||||
|
||||
echo "-> Populating MFS tree..."
|
||||
cd ../${TYPE}
|
||||
make -f Makefile.mfs || fail $? mtree
|
||||
if [ X"${NO_DEVFS}" != X"" ] ; then
|
||||
make -f Makefile.mfs devnodes || fail $? makedevs
|
||||
fi
|
||||
|
||||
MFS_RC=floppy.tree/etc/mfs.rc
|
||||
if [ ! -f ${MFS_RC} ] ; then # no private version. use generic mfs.rc
|
||||
MFS_RC=${BUILDDIR}/../${MFS_RC}
|
||||
fi
|
||||
if [ "${INIT}" = "oinit" ] ; then
|
||||
cat ${MFS_RC} | sed -e "s/@VER@/${VER}/g" > /mnt/etc/oinit.rc
|
||||
else
|
||||
cat ${MFS_RC} | sed -e "s/@VER@/${VER}/g" > /mnt/etc/rc
|
||||
if [ -f floppy.tree/etc/mfs.login.conf ] ; then
|
||||
cp floppy.tree/etc/mfs.login.conf /mnt/etc/login.conf
|
||||
# This command does weird things on 2.2.x systems.
|
||||
# For small image sizes, use std disktypes
|
||||
if [ ${MFS_SIZE} -lt 1024 ] ; then
|
||||
disklabel -rw /dev/rvn0 fd${MFS_SIZE} || fail $? disklabel
|
||||
else
|
||||
cp ${BUILDDIR}/../floppy.tree/etc/mfs.login.conf /mnt/etc/login.conf
|
||||
disklabel -rw vn0 auto || fail $? disklabel
|
||||
fi
|
||||
cat lang/README.${LANGUAGE} | sed -e "s/@VER@/${VER}/g" > /mnt/README
|
||||
fi
|
||||
cp lang/update.${LANGUAGE} /mnt/stand/update
|
||||
if [ "${TYPE}" = "dial" ] ; then
|
||||
for i in reboot login dialup; do
|
||||
cp lang/${i}.${LANGUAGE} /mnt/stand/${i}
|
||||
done
|
||||
ln -f /mnt/stand/reboot /mnt/stand/shutdown
|
||||
(cd ../help;\
|
||||
rm -rf tmp_hlp;\
|
||||
mkdir tmp_hlp;\
|
||||
for i in `ls *.hlp.${LANGUAGE}`; do \
|
||||
|
||||
newfs -i ${MFS_INODES} -m 0 -p 0 -o space /dev/rvn0c
|
||||
mount /dev/vn0c ${MFS_MOUNTPOINT} || fail $? no_mount
|
||||
|
||||
pwd=`pwd`
|
||||
}
|
||||
|
||||
populate_mfs() {
|
||||
echo "-> Populating MFS tree..."
|
||||
cd ../${TYPE}
|
||||
make -f Makefile.mfs DESTDIR=${MFS_MOUNTPOINT} > /dev/null || \
|
||||
fail $? mtree
|
||||
if [ X"${NO_DEVFS}" != X"" ] ; then
|
||||
make -f Makefile.mfs DESTDIR=${MFS_MOUNTPOINT} devnodes \
|
||||
> /dev/null || fail $? makedevs
|
||||
fi
|
||||
|
||||
MFS_RC=floppy.tree/etc/mfs.rc
|
||||
if [ ! -f ${MFS_RC} ] ; then # no private version. use generic mfs.rc
|
||||
MFS_RC=${BUILDDIR}/../${MFS_RC}
|
||||
fi
|
||||
if [ "${INIT}" = "oinit" ] ; then
|
||||
cat ${MFS_RC} | sed -e "s/@VER@/${VER}/g" > ${MFS_MOUNTPOINT}/etc/oinit.rc
|
||||
else
|
||||
cat ${MFS_RC} | sed -e "s/@VER@/${VER}/g" > ${MFS_MOUNTPOINT}/etc/rc
|
||||
if [ -f floppy.tree/etc/mfs.login.conf ] ; then
|
||||
cp floppy.tree/etc/mfs.login.conf ${MFS_MOUNTPOINT}/etc/login.conf
|
||||
else
|
||||
cp ${BUILDDIR}/../floppy.tree/etc/mfs.login.conf \
|
||||
${MFS_MOUNTPOINT}/etc/login.conf
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${TYPE}" = "dial" ] ; then
|
||||
for i in login dialup; do
|
||||
cp lang/${i}.${LANGUAGE} ${MFS_MOUNTPOINT}/stand/${i}
|
||||
done
|
||||
ln -s /stand/reboot ${MFS_MOUNTPOINT}/stand/shutdown
|
||||
(cd ../help;\
|
||||
rm -rf tmp_hlp;\
|
||||
mkdir tmp_hlp;\
|
||||
for i in `ls *.hlp.${LANGUAGE}`; do \
|
||||
cp $i tmp_hlp/`basename $i .hlp.${LANGUAGE}`;\
|
||||
done;\
|
||||
cd tmp_hlp;\
|
||||
ar -cru help.a *;\
|
||||
cp help.a /mnt/help.a)
|
||||
fi
|
||||
done;\
|
||||
cd tmp_hlp;\
|
||||
ar -cru help.a *;\
|
||||
cp help.a ${MFS_MOUNTPOINT}/help.a)
|
||||
fi
|
||||
|
||||
echo "-> Making and installing crunch1..."
|
||||
cd crunch1
|
||||
make "SRC=${SRC}" && make install 2>&1 >/dev/null || fail $? crunch
|
||||
echo "-> Making and installing crunch1..."
|
||||
cd crunch1
|
||||
make -f ../../build/Makefile.crunch "SRC=${SRC}" && \
|
||||
make -f ../../build/Makefile.crunch install 2>&1 >/dev/null || \
|
||||
fail $? crunch
|
||||
|
||||
cd ${pwd}
|
||||
cd ${pwd}
|
||||
if [ -f ${MFS_MOUNTPOINT}/stand/sshd ] ; then
|
||||
echo "creating host key for sshd"
|
||||
ssh-keygen1 -f ${MFS_MOUNTPOINT}/etc/ssh_host_key -N "" -C "root@picobsd"
|
||||
fi
|
||||
|
||||
(echo "-> Fixing permissions"; cd /mnt; chown -R root *)
|
||||
(echo "-> Fixing permissions"; cd ${MFS_MOUNTPOINT}; chown -R root *)
|
||||
df -ik ${MFS_MOUNTPOINT}
|
||||
umount ${MFS_MOUNTPOINT}
|
||||
fsck -p /dev/rvn0c
|
||||
vnconfig -u /dev/rvn0
|
||||
}
|
||||
|
||||
# stage2
|
||||
|
||||
echo "-> Preparing kernel..."
|
||||
cp -p ${SRC}/sys/compile/PICOBSD${suffix}/kernel kernel || \
|
||||
do_kernel() {
|
||||
echo "-> Preparing kernel..."
|
||||
(cd ../${TYPE}; make -v -f ${BUILDDIR}/Makefile.conf )
|
||||
cp -p ${SRC}/sys/compile/PICOBSD${suffix}/kernel kernel || \
|
||||
fail $? missing_kernel
|
||||
strip kernel
|
||||
strip --remove-section=.note --remove-section=.comment kernel
|
||||
gzip -9 -v -n kernel
|
||||
}
|
||||
|
||||
echo "-> Preparing kernel with MFS filesystem inside..."
|
||||
df -ik /mnt
|
||||
umount /mnt
|
||||
fsck -p /dev/rvn0c
|
||||
vnconfig -u /dev/rvn0
|
||||
do_floppy() {
|
||||
# On entry we are in /usr/src/release/build.
|
||||
|
||||
strip kernel
|
||||
strip --remove-section=.note --remove-section=.comment kernel
|
||||
gzip -9 -v -n kernel
|
||||
echo "==> Preparing ${FLOPPY_SIZE}kB floppy filesystem..."
|
||||
|
||||
#---- stage3
|
||||
dd of=picobsd.bin if=/dev/zero count=${FLOPPY_SIZE} bs=1k
|
||||
|
||||
# stage3 -- prepare floppy filesystem and image.
|
||||
# by default we are in /usr/src/release/build
|
||||
#
|
||||
|
||||
echo "-> Preparing ${FLOPPY_SIZE}kB floppy filesystem..."
|
||||
umount /dev/vn0 2> /dev/null || true
|
||||
umount /mnt 2> /dev/null || true
|
||||
vnconfig -u /dev/rvn0 2> /dev/null || true
|
||||
|
||||
dd of=picobsd.bin if=/dev/zero count=${FLOPPY_SIZE} bs=1k
|
||||
|
||||
awk 'BEGIN {printf "%c%c", 85, 170}' | \
|
||||
awk 'BEGIN {printf "%c%c", 85, 170}' | \
|
||||
dd of=picobsd.bin obs=1 seek=510 conv=notrunc 2> /dev/null
|
||||
|
||||
#vnconfig -s labels -c /dev/rvn0 picobsd.bin 2>/dev/null
|
||||
vnconfig -c /dev/rvn0 picobsd.bin || fail $? vnconfig2
|
||||
vnconfig -c /dev/rvn0 picobsd.bin || fail $? vnconfig2
|
||||
|
||||
dd if=/boot/boot1 of=picobsd.bin conv=notrunc 2> /dev/null
|
||||
dd if=/boot/boot1 of=picobsd.bin conv=notrunc 2> /dev/null
|
||||
|
||||
# XXX todo: right floppy size!
|
||||
disklabel -Brw -b /boot/boot1 -s /boot/boot2 /dev/rvn0 fd1440 || \
|
||||
# XXX todo: use a type matching floppy size.
|
||||
disklabel -Brw -b /boot/boot1 -s /boot/boot2 /dev/rvn0 fd1440 || \
|
||||
fail $? disklabel
|
||||
|
||||
newfs -i ${FLOPPY_INODES} -m 0 -p 0 -o space /dev/rvn0c
|
||||
newfs -i ${FLOPPY_INODES} -m 0 -p 0 -o space /dev/rvn0c
|
||||
|
||||
mount /dev/vn0c /mnt
|
||||
mount /dev/vn0c ${MFS_MOUNTPOINT}
|
||||
|
||||
echo "-> Populating floppy filesystem..."
|
||||
echo "==> Populating floppy filesystem..."
|
||||
|
||||
### copy floppy tree excluding private files.
|
||||
excl=${BUILDDIR}/../${TYPE}/floppy.tree.exclude
|
||||
if [ -f ${excl} ] ; then
|
||||
excl="--exclude-from ${excl}"
|
||||
echo "Exclude following files from ${excl}:\n==="
|
||||
cat ${excl}
|
||||
echo "==="
|
||||
else
|
||||
excl=""
|
||||
fi
|
||||
(cd ${BUILDDIR}/../floppy.tree ; tar -cf - ${excl} . ) | (cd /mnt ; tar xvf - )
|
||||
# Configuration files are first copied to a local tree, then
|
||||
# compressed, then transferred back to the floppy.
|
||||
rm -rf floppy.tree || true
|
||||
mkdir floppy.tree
|
||||
|
||||
if [ -d ${BUILDDIR}/../${TYPE}/floppy.tree ] ; then
|
||||
echo "-> update with private files:"
|
||||
(cd ${BUILDDIR}/../${TYPE}/floppy.tree ; tar cf - . ) | (cd /mnt ; tar xvf - )
|
||||
fi
|
||||
excl=${BUILDDIR}/../${TYPE}/floppy.tree.exclude
|
||||
if [ -f ${excl} ] ; then
|
||||
excl="--exclude-from ${excl}"
|
||||
echo "Exclude following files from ${excl}:\n==="
|
||||
cat ${excl}
|
||||
echo "==="
|
||||
else
|
||||
excl=""
|
||||
fi
|
||||
(cd ${BUILDDIR}/../floppy.tree ; tar -cf - ${excl} . ) | \
|
||||
(cd floppy.tree ; tar xvf - )
|
||||
|
||||
files="hosts motd"
|
||||
echo "-> Copying language dependent files: ${files} -> /mnt/etc ..."
|
||||
for i in ${files} ; do
|
||||
if [ -d ${BUILDDIR}/../${TYPE}/floppy.tree ] ; then
|
||||
echo "-> update with private files:"
|
||||
(cd ${BUILDDIR}/../${TYPE}/floppy.tree ; tar cf - . ) | \
|
||||
(cd floppy.tree ; tar xvf - )
|
||||
fi
|
||||
if [ -d ${BUILDDIR}/../${TYPE}/floppy.tree.${SITE} ] ; then
|
||||
echo "-> update with site-specific (${SITE}) files:"
|
||||
(cd ${BUILDDIR}/../${TYPE}/floppy.tree.${SITE} ; tar cf - . ) | \
|
||||
(cd floppy.tree ; tar xvf - )
|
||||
fi
|
||||
rm -f floppy.tree/etc/mfs\.* # mfs.rc, mfs.login.conf
|
||||
files="motd"
|
||||
echo "-> Copying language dependent files: ${files} -> /mnt/etc ..."
|
||||
for i in ${files} ; do
|
||||
cat ${BUILDDIR}/../${TYPE}/lang/${i}.${LANGUAGE} | \
|
||||
sed -e "s/@VER@/${VER}/g" > /mnt/etc/${i}
|
||||
done
|
||||
sed -e "s/@VER@/${VER}/g" > floppy.tree/etc/${i}
|
||||
done
|
||||
|
||||
if [ "${TYPE}" = "dial" ] ; then
|
||||
cp -p /mnt/etc/master.passwd .
|
||||
pwd_mkdb -d . master.passwd
|
||||
mv spwd.db /mnt/etc/
|
||||
rm pwd.db master.passwd
|
||||
fi
|
||||
# XXX check this! i am unsure how it is necessary.
|
||||
if [ "${TYPE}" = "dial" ] ; then
|
||||
cp -p floppy.tree/etc/master.passwd .
|
||||
pwd_mkdb -d . master.passwd
|
||||
mv spwd.db floppy.tree/etc/
|
||||
rm pwd.db master.passwd
|
||||
fi
|
||||
# gzip returns an error if it fails to compress some file
|
||||
gzip -9 floppy.tree/etc/* || true
|
||||
|
||||
cp kernel.gz /mnt/kernel.gz || fail $? kernel_compress
|
||||
# Now, first copy large files, then small ones.
|
||||
cp -p kernel.gz ${MFS_MOUNTPOINT}/kernel.gz || fail $? kernel_compress
|
||||
|
||||
gzip -9cv ${MFS_NAME} > /mnt/${MFS_NAME}.gz || fail $? mfs_compress
|
||||
gzip -9cv ${MFS_NAME} > ${MFS_MOUNTPOINT}/${MFS_NAME}.gz || \
|
||||
fail $? mfs_compress
|
||||
|
||||
if [ ! -d /mnt/boot/defaults ] ; then
|
||||
mkdir -p /mnt/boot/defaults
|
||||
fi
|
||||
cp /boot/loader .
|
||||
# Make sure we have the a.out stubs we need...
|
||||
# This is deprecated for 3.X
|
||||
if [ ! -f /usr/lib/aout/kzhead.o ] ; then
|
||||
(cd ${SRC}/sys/i386/boot/kzipboot && make all install clean)
|
||||
fi
|
||||
/usr/bin/kzip -v loader
|
||||
mv loader.kz /mnt/boot/loader
|
||||
rm -f loader loader.o
|
||||
# XXX is next line ok ?
|
||||
echo "/boot/loader" >/mnt/boot.config
|
||||
cp ${SRC}/sys/boot/forth/loader.4th /mnt/boot/
|
||||
cp ${SRC}/sys/boot/forth/support.4th /mnt/boot/
|
||||
cp ${SRC}/sys/boot/forth/loader.conf /mnt/boot/defaults
|
||||
echo "userconfig_script_load=\"YES\"" >/mnt/boot/loader.conf
|
||||
echo "rootfs_load=\"YES\"" >>/mnt/boot/loader.conf
|
||||
echo "rootfs_name=\"${MFS_NAME}\"" >>/mnt/boot/loader.conf
|
||||
echo "rootfs_type=\"mfs_root\"" >>/mnt/boot/loader.conf
|
||||
for i in frames screen ; do
|
||||
cp ${SRC}/share/examples/bootforth/${i}.4th /mnt/boot/
|
||||
done
|
||||
cp ../forth/loader.rc /mnt/boot/loader.rc
|
||||
cp ../forth/menu.4th /mnt/boot/menu.4th
|
||||
(echo "-> Fixing permissions"; cd /mnt; chown -R root *)
|
||||
if [ ! -d ${MFS_MOUNTPOINT}/boot ] ; then
|
||||
mkdir -p ${MFS_MOUNTPOINT}/boot
|
||||
fi
|
||||
#
|
||||
# make small loader
|
||||
#(cd /usr/src/sys/boot/i386/loader ; make clean ;
|
||||
# cd /usr/src/sys/boot/i386 ; make -DNOFORTH )
|
||||
if [ -f /usr/src/sys/boot/i386/loader/loader ]; then
|
||||
theloader=/usr/src/sys/boot/i386/loader/loader
|
||||
else
|
||||
theloader=/boot/loader
|
||||
fi
|
||||
kgzip -o loader $theloader
|
||||
cp -p loader ${MFS_MOUNTPOINT}/boot/loader
|
||||
|
||||
df -ik /mnt
|
||||
umount /mnt
|
||||
vnconfig -u /dev/rvn0
|
||||
rm kernel.gz ${MFS_NAME}
|
||||
#
|
||||
# now transfer the floppy tree
|
||||
cp -Rp floppy.tree/* ${MFS_MOUNTPOINT}
|
||||
cat <<__EOF > ${MFS_MOUNTPOINT}/boot/loader.rc
|
||||
load kernel
|
||||
load -t mfs_root ${MFS_NAME}
|
||||
__EOF
|
||||
(echo "-> Fixing permissions"; cd ${MFS_MOUNTPOINT} ; chown -R root *)
|
||||
|
||||
df -ik ${MFS_MOUNTPOINT} > .build.reply
|
||||
umount ${MFS_MOUNTPOINT}
|
||||
vnconfig -u /dev/rvn0
|
||||
# rm kernel.gz ${MFS_NAME}
|
||||
}
|
||||
|
||||
do_kernel
|
||||
create_mfs
|
||||
populate_mfs
|
||||
do_floppy
|
||||
|
Loading…
Reference in New Issue
Block a user