#!/bin/sh
#
# mkbootimg - make boot.img for ROOT
#

if [ -z "$1" ]; then
  echo "mkbootimg: no kernel specified - using /vmlinuz"
  KERNEL="/vmlinuz"
 else
  KERNEL="$1"
fi

if [ ! $UID = 0 ]; then
  echo "`basename $0`: must be root."         
  exit 1
fi


dd if=/dev/zero of=boot.img bs=1024 count=2880
losetup /dev/loop4 boot.img
mke2fs -qm0 -b 1024 /dev/loop4
#mkreiserfs /dev/loop4
mount /dev/loop4 /mnt
cat << EOF >/mnt/message


ROOT GNU/Linux 1.5 (Newton)

   -  To install from /dev/hdc, press ENTER.

   -  To install from other device, type 'install root=x'
        Where 'x' is the name of the device to install from.

Copyright (C) 2000-2006 John Eriksson

EOF
cat << EOF >/tmp/bootlilo.conf
disk=/dev/loop4
bios=0x00
sectors=36
heads=2
cylinders=80
#sectors=18
#heads=2
#cylinders=80
boot=/dev/loop4
backup=/dev/null
map=/mnt/map
install=text
message=/mnt/message
geometric
compact
prompt
image=/mnt/vmlinuz
label=install
append="root=/dev/hdc"
read-only
EOF
cp $KERNEL /mnt/vmlinuz
lilo -V
lilo -C /tmp/bootlilo.conf
umount /mnt
losetup -d /dev/loop4

# EOF
