From: mitchell@mdd.comm.mot.com (Bill Mitchell) Subject: Re: Bootable RAM version of Linux Date: Thu, 2 Sep 1993 03:47:12 GMT
in comp.os.linux, ctj@fep9.fns.com (Clifton Jones) said:
>I am curious on how you make a bootable RAM version of Linux. I know it
>can be done because the SLS boot disk does this. It seems to copy the floppy
>to RAM disk device when booting the kernel which in turn frees up the floppy.
>Is the SLS boot disk build source on the net? If anyone can answer these
>questions, please send me email. Thanks.
>
Following is a script I recently hacked up to create a boot/root/ramdisk
floppy starting with an installed, running linux system. It works fine
for me, but it obviously needs fleshing out.
#!/bin/sh
#
# script to create a linux boot/root floppy
#
# WARNING - no error handling yet
#
# bill mitchell - 27 aug93
PATH=/bin:/usr/bin:/etc
umount /dev/fd0 2>/dev/null
mkfs /dev/fd0 1440
mount /dev/fd0 /mnt
rm -rf /mnt/*
mkdir /mnt/dev
ls -l /dev | gawk '
{
name = $10
major = $5
maj_len = index(major, ",") - 1
maj_len = 1
if (maj_len > 0)
{
bcu = substr($1, 1, 1)
if (bcu == "b" || bcu == "c" || bcu == "u")
{
minor = $6
printf "mknod /mnt/dev/%s %s %.*s %s\n", name, bcu, maj_len, major, minor
}
}
}' | sh
mkdir /mnt/bin
cp /bin/sh /mnt/bin
cp `type -path cat` /mnt/bin
cp `type -path cp` /mnt/bin
cp `type -path df` /mnt/bin
cp `type -path fdisk` /mnt/bin
cp `type -path gzip` /mnt/bin
cp `type -path ln` /mnt/bin
cp `type -path ls` /mnt/bin
cp `type -path mkdir` /mnt/bin
cp `type -path mke2fs` /mnt/bin
cp `type -path mkfs` /mnt/bin
cp `type -path mv` /mnt/bin
cp `type -path rdev` /mnt/bin
cp `type -path reboot` /mnt/bin
cp `type -path rm` /mnt/bin
cp `type -path su` /mnt/bin
cp `type -path sync` /mnt/bin
mkdir /mnt/etc
cp /etc/init /mnt/etc
cp /etc/login.defs /mnt/etc
cp /etc/mount /mnt/etc
cp /etc/update /mnt/etc
cp /etc/utmp /mnt/etc
cp /etc/umount /mnt/etc
cat >/mnt/etc/passwd <<..EOF
root::0:0::/home/root:/bin/sh
daemon:x:1:1::/etc:
bin:x:2:2::/bin:
adm:x:4:4::/:
uucp::5:5::/usr/uucp:
sync::255:0:::/bin/sync
anonymous:*:403:1::/home/ftp:/bin/sh
ftp:*:404:1::/home/ftp:/bin/sh
..EOF
cat >/mnt/etc/inittab <<..EOF
#
id:S:initdefault:
#
si::sysinit:/etc/update &
#
#
rc:S:wait:/etc/rc.single
..EOF
cat >/mnt/etc/rc.single <<..EOF
/bin/rm -f /etc/mtab* /etc/nologin /etc/utmp
touch /etc/utmp
/bin/mount -av
..EOF
cat >/mnt/etc/fstab <<..EOF
..EOF
mkdir /mnt/lib
cp /lib/libc.so.4 /mnt/lib
mkdir /mnt/mnt
mkdir /mnt/tmp
mkdir /mnt/usr
mkdir /mnt/etc/lilo
cp /etc/lilo/boot.b /mnt/etc/lilo
cp /zImage /mnt
rdev /mnt/zImage /dev/boot0
rdev -r /mnt/zImage 1440
cat >/mnt/etc/lilo/config <<..EOF
install = /etc/lilo/boot.b
prompt
compact
map=/etc/lilo/map
boot= /dev/fd0
image= /zImage
label=linux
vga=ask
root=/dev/fd0
..EOF
cd /mnt/etc/lilo
/etc/lilo/lilo -r /mnt
cd -
sync