Initial revision

This commit is contained in:
Ben Gras
2005-04-21 14:53:53 +00:00
commit 9865aeaa79
2264 changed files with 411685 additions and 0 deletions
Executable
+76
View File
@@ -0,0 +1,76 @@
# Makefile for the kernel image.
#
u=/usr
CC= exec cc
CFLAGS= -O -D_MINIX -D_POSIX_SOURCE
MDEC= /usr/mdec
MAKE= exec make -$(MAKEFLAGS)
# specify the programs that are part of the system image
PROGRAMS= ../kernel/kernel \
../servers/mm/mm \
../servers/fs/fs \
../servers/is/is \
../drivers/tty/tty \
../drivers/memory/memory \
../drivers/at_wini/at_wini \
../drivers/floppy/floppy \
../drivers/printer/printer \
../servers/init/init \
#bootfs.img
usage:
@echo " " >&2
@echo "Master Makefile to create new MINIX configuration. Root privileges required." >&2
@echo "Usage:" >&2
@echo " make libraries # Make system libraries" >&2
@echo " make programs # Compile and install all programs" >&2
@echo " make fresh # Make clean, libraries, and programs" >&2
@echo " make image # Make programs and create system image" >&2
@echo " make hdboot # Make image, and install to hard disk" >&2
@echo " make fdboot # Make image, and install to floppy disk" >&2
@echo " make bootable # Make hard disk bootable" >&2
@echo " make clean # Remove all compiler results, except libs" >&2
@echo " " >&2
@echo "To create a fresh MINIX configuration, try:" >&2
@echo " make fresh hdboot" >&2
@echo " " >&2
# create a fresh configuration or system image
fresh:
cd ../lib && $(MAKE) clean
$(MAKE) clean
$(MAKE) libraries programs
image: programs
installboot -image $@ $(PROGRAMS)
# rebuild the program or system libraries
programs:
cd ../kernel && $(MAKE)
cd ../servers && $(MAKE) install
cd ../drivers && $(MAKE) install
libraries:
cd ../lib && $(MAKE) install
# make bootable and place system images
bootable:
exec su root mkboot bootable
hdboot: image
exec sh mkboot $@
fdboot: image
exec su root mkboot $@
# clean up compile results
clean:
cd ../kernel && $(MAKE) $@
cd ../servers && $(MAKE) $@
cd ../drivers && $(MAKE) $@
rm -f *.bak image
+20
View File
@@ -0,0 +1,20 @@
#!/bin/sh
DIST=/usr/dist
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
cd /usr/src || exit 1
mkdir -p $DIST
#echo "Making src.tar"
#tar cf /dist/src.tar /usr/src || exit 1
make world install || exit 1
cd tools || exit 1
make hdboot
#rm -rf /usr/src
#echo "Making bin.tar"
#tar cf /dist/bin.tar /
exit 0
Executable
+159
View File
@@ -0,0 +1,159 @@
#!/bin/sh
#
# mkboot 2.0 - make boot floppy, make root device bootable, etc.
# Author: Kees J. Bot
trap 'e=$?; rm -f /tmp/mkb.$$; exit $e' 0 2
mdec=/usr/mdec # bootstraps
# Check arguments.
case "$#:$1" in
1:bootable | 1:hdboot | [12]:fdboot | 1:cdfdboot )
action=$1 dev=$2
;;
*) echo "Usage: $0 [bootable | hdboot | cdfdboot | fdboot [device]]" >&2
exit 1
esac
# Get the device table.
. /etc/fstab
# The real root device may be the RAM disk.
realroot=`printroot -r`
case $action in
bootable | hdboot)
# We need the root device.
if [ $realroot = $root ]
then
rootdir=
else
umount $root 2>/dev/null
mount $root /mnt || exit
rootdir=/mnt
fi
esac
case $action in
bootable)
# Install the boot monitor on the root device and make it bootable.
install -cs -m 644 $mdec/boot $rootdir/boot/boot || exit
sync
installboot -device $root $mdec/bootblock /boot/boot || exit
test $realroot != $root && umount $root
;;
hdboot)
# Install a new image on the root device.
if [ ! -d $rootdir/boot/image ]
then
# /boot/image is not yet a directory! Fix it.
su root -c \
"exec mv $rootdir/boot/image /M"
install -d $rootdir/boot/image
su root -c \
"exec mv $rootdir/M $rootdir/boot/image/`uname -r`.`uname -v`"
fi
./tell_config OS_RELEASE . OS_VERSION >/tmp/mkb.$$
version=`sed 's/[" ]//g;/^$/d' </tmp/mkb.$$`
revision=`cat revision 2>/dev/null`
oldrev=$revision
target="${version}r${revision}"
if [ -z "$revision" ]
then
revision=0
elif [ -f $rootdir/boot/image/$target ]
then
if [ $rootdir/boot/image/$target -newer image ]
then
echo "$root:/boot/image/$target is up to date"
test $realroot != $root && umount $root
exit 0
fi
revision=`expr $revision + 1`
fi
target="${version}r${revision}"
set -- `ls -t $rootdir/boot/image`
case $# in
0|1)
# Not much there, do not remove a thing.
;;
*)
# Remove the newest image in /boot/image. This seems strange,
# but the old image is normally the "stable" image.
echo "rm $root:/boot/image/$1"
rm -f "$rootdir/boot/image/$1"
esac
# Install the new image.
echo "cp image $root:/boot/image/$target"
cp -p image $rootdir/boot/image/$target || exit
# Save the revision number.
test "$revision" != "$oldrev" && echo $revision >revision
test $realroot != $root && umount $root
echo "Done."
;;
fdboot)
# fdboot: Make a boot floppy.
if [ -z "$dev" ]
then
echo -n \
"Finish the name of the floppy device to write (by default 'fd0'): /dev/";
read dev
case "$dev" in
'') dev=/dev/fd0
;;
/dev/*)
;;
*) dev=/dev/$dev
esac
fi
# Make a file system.
umount $dev 2>/dev/null
mkfs -B 1024 -i 512 $dev || exit
# Install /dev, /boot/boot and /boot/image.
mount $dev /mnt || exit
mkdir /mnt/boot || exit
mkdir /mnt/image || exit
cpdir /dev /mnt/dev || exit
cp -p $mdec/boot /mnt/boot/boot || exit
cp -p image /mnt/boot/image/ || exit
umount $dev || exit
# Make bootable and copy the boot parameters.
installboot -d $dev $mdec/bootblock /boot/boot || exit
dd if=$root of=$dev skip=1 seek=1 count=1 conv=silent || exit
edparams $dev 'main(){delay 2000;boot}; save' || exit
echo "Test kernel installed on $dev with boot parameters from $root"
;;
cdfdboot)
# cdfdboot: Make a boot floppy image to go on a CD for booting from.
dev=/dev/ram
umount $dev 2>/dev/null
mkfs -B 1024 -b 1440 -i 512 $dev || exit 1
# Install /dev, /boot
mount $dev /mnt || exit 1
mkdir /mnt/dev
( cd /mnt/dev && /usr/src/commands/scripts/MAKEDEV.sh std )
cp -p image /mnt/minix || exit 1
cp -p ../boot/boot /mnt/boot || exit 1
umount $dev || exit 1
installboot -d $dev ../boot/bootblock boot || exit 1
# copy image
dd if=$dev of=cdfdimage bs=8192 count=180
esac
exit 0
+59
View File
@@ -0,0 +1,59 @@
#!/bin/sh
COPYITEMS="usr/src usr/bin bin usr/lib"
RELEASEDIR=/usr/r/release
IMAGE=cdfdimage
ISO=minix.iso
RAM=/dev/ram
if [ `wc -c $RAM | awk '{ print $1 }'` -ne 1474560 ]
then echo "$RAM should be exactly 1440k."
exit 1
fi
echo "Warning: I'm going to mkfs $RAM!"
echo "Temporary (sub)partition to use to make the /usr FS image? "
echo "It has to be at least 40MB, not much more because it's going to be "
echo "appended to the .iso. It will be mkfsed!"
echo -n "Device: /dev/"
read dev || exit 1
TMPDISK=/dev/$dev
if [ -b $TMPDISK ]
then :
else echo "$TMPDISK is not a block device.."
exit 1
fi
umount $TMPDISK
umount $RAM
( cd .. && make clean )
rm -rf $RELEASEDIR $ISO $IMAGE
mkdir -p $RELEASEDIR
mkfs -b 1440 -B 1024 $RAM || exit
echo " * mounting $RAM as $RELEASEDIR"
mount $RAM $RELEASEDIR || exit
mkdir $RELEASEDIR/usr
mkfs -B 1024 $TMPDISK
echo " * mounting $TMPDISK as $RELEASEDIR/usr"
mount $TMPDISK $RELEASEDIR/usr || exit
mkdir -p $RELEASEDIR/tmp
mkdir -p $RELEASEDIR/usr/tmp
echo " * Transfering $COPYITEMS to $RELEASEDIR"
( cd / && tar cf - $COPYITEMS ) | ( cd $RELEASEDIR && tar xf - ) || exit 1
echo " * Chroot build"
chroot $RELEASEDIR '/bin/sh -x /usr/src/tools/chrootmake.sh' || exit 1
echo " * Chroot build done"
umount $TMPDISK || exit
umount $RAM || exit
cp $RAM rootimage
make programs image
(cd ../boot && make)
make image || exit 1
./mkboot cdfdboot
writeisofs -l MINIX -b $IMAGE /tmp $ISO || exit 1
echo "Appending Minix root filesystem"
cat >>$ISO rootimage || exit 1
echo "Appending Minix usr filesystem"
cat >>$ISO $TMPDISK || exit 1
ls -al $ISO
+1
View File
@@ -0,0 +1 @@
61
+13
View File
@@ -0,0 +1,13 @@
#!/bin/sh
#
# tellconfig - Tell the value of a <minix/config.h> parameter
# Author: Kees J. Bot
echo "
#include <minix/config.h>
$*
" >/tmp/tell.$$
exec </tmp/tell.$$
rm /tmp/tell.$$
exec cc -P -E -