uClibcベースで再構築、仕様を中変更しました。 (2007/06/02)
set_bootlabel() { case "$1" in 1 ) # search for /zImage /vmlinuz /boot/zImage /boot/vmlinuz IMAGE=/dev/sda3 APPEND="mem=64M console=ttySC1,9600 root=/dev/sda3" ;; 2 ) # LANDISK original 2.4.21 kernel IMAGE=/dev/sda1 APPEND="mem=64M console=ttySC1,9600 root=/dev/hda1" ;; 3 ) # from usb-storage IMAGE=/dev/sdb1 APPEND="mem=64M console=ttySC1,9600 root=/dev/sdb1" ;; sample1 ) # full path IMAGE=/dev/sda3:/boot/vmlinuz-2.6.22-rc2-landisk APPEND="mem=64M console=ttySC1,9600 root=/dev/sda3" ;; sample2 ) # from Network IMAGE=http://192.168.1.80/zImage APPEND="mem=64M console=ttySC1,9600 root=/dev/sda3" ;; esac }
set_network() { hostname bootld ifup -a }
set_network() { hostname bootld # over write /etc/network/interfaces cat <<EOF > /etc/network/interfaces auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 192.168.1.80 netmask 255.255.255.0 gateway 192.168.1.1 EOF # over write /etc/resolv.conf cat <<EOF > /etc/resolv.conf nameserver 192.168.1.1 EOF ifup -a }
#!/bin/sh export PATH=/sbin:/bin:/usr/bin /bin/mount -a echo ; echo "BOOT loader LanDisk V1.3" #---------------------------------------------- # 1. boot select #---------------------------------------------- LABEL=0 BTN=push-switch.0 SELECT_DELAY=6 while [ "$BTN" != "" ] ; do LABEL=`expr \( $LABEL + 1 \) % 4` echo "Select Boot Label $LABEL" case "$LABEL" in 0 ) ledctrl pwr=0 status=1 ;; 1 ) ledctrl pwr=0 status=10R,200 ;; 2 ) ledctrl pwr=0 status=10100000R,150 ;; 3 ) ledctrl pwr=0 status=1010100000R,150 ;; esac BTN=`select_btn $SELECT_DELAY` done
#---------------------------------------------- # 2. search /boot/bootld.conf #---------------------------------------------- . /boot/bootld.conf DEVLIST=$(fdisk -l /dev/sd? | awk '$1 ~ /^\/dev/ {print $1}' | sort -r ) for CDEV in $DEVLIST ; do mount -r $CDEV /mnt || continue if [ -r /mnt/boot/bootld.conf ] ; then echo "/boot/bootld.conf found in $CDEV" . /mnt/boot/bootld.conf umount -l /mnt break fi umount -l /mnt done
#---------------------------------------------- # 3. search and copy kernel #---------------------------------------------- [ "$LABEL" != "0" ] && set_bootlabel $LABEL IMAGE_="$IMAGE:" KERNEL=$(echo $IMAGE_ | cut -d: -f2) DEV=$(echo $IMAGE_ | cut -d: -f1) rm -rf /tmp/zImage.tmp case $DEV in http ) echo "setup Network" set_network NETWORK=ON wget $IMAGE -O /tmp/zImage.tmp ;; /dev/sd* ) mkdir /mnt2 mount -r $DEV /mnt2 || break if [ "$KERNEL" = "" ] ; then for SIMG in /zImage /vmlinuz /boot/zImage /boot/vmlinuz ; do if [ -e "/mnt2$SIMG" ] ; then KERNEL=$SIMG break fi done fi cp /mnt2$KERNEL /tmp/zImage.tmp umount -l /mnt2 ;; esac
#---------------------------------------------- # 4. do kexec #---------------------------------------------- if [ -e /tmp/zImage.tmp ] ; then echo "Start Booting from Label $LABEL ..." echo "IMAGE=$DEV:$KERNEL" echo "APPEND=\"$APPEND\"" /bin/umount -a exec /sbin/kexec -f --append="$APPEND" /tmp/zImage.tmp else echo "Start Booting from Rescue mode ..." # Network [ "$NETWORK" = "" ] && set_network # Daemon inetd btnctrl /etc/btn_action.conf & ledctrl pwr=0 status=1 buzzer=10 fi exit 0
IMAGE=$CDEV:/vmlinuz APPEND="mem=64M console=ttySC1,9600 root=$CDEV"
# mount /dev/sda1 /mnt
# tar vxfz bootld-20070617.tgz -C /mnt
./boot
./boot/bootld.conf
./boot/bootld.dont_touch
./boot/bootld.dont_touch/lilo
./boot/bootld.dont_touch/boot.b-selk
./boot/bootld.dont_touch/lilo.conf
./boot/bootld.dont_touch/vmlinuz-initramfs-landisk.08
./boot/bootld.dont_touch/lilo.x86
linear boot=/dev/sda disk=/dev/sda bios=0x80 timeout=0 install=/boot/bootld.dont_touch/boot.b-selk map=/boot/bootld.dont_touch/map default=bootld image=/boot/bootld.dont_touch/vmlinuz-initramfs-landisk.08 label=bootld read-only append="mem=64M usb-storage.delay_use=0 bootld=/etc/init.d/bootld"usb-storage.delay_use=0 : USBストレージを即座に認識させるためのオマジナイ。
# /mnt/boot/bootld.dont_touch/lilo -r /mnt -C /boot/bootld.dont_touch/lilo.conf Added bootld *
linear boot=/dev/sda disk=/dev/sda bios=0x80 timeout=0 install=/mnt/boot/bootld.dont_touch/boot.b-selk map=/mnt/boot/bootld.dont_touch/map default=bootld image=/mnt/boot/bootld.dont_touch/vmlinuz-initramfs-landisk.08 label=bootld read-only append="mem=64M usb-storage.delay_use=0 bootld=/etc/init.d/bootld"
# /mnt/boot/bootld.dont_touch/lilo -C /mnt/boot/bootld.dont_touch/lilo.conf
# gzip -d bootld_255h_63s.mbr.gz # dd if=bootld_255h_63s.mbr of=/dev/sdb # sync;sync;sync以上で終了です。
# fdisk -l /dev/sdb Disk /dev/sdb: 40.9 GB, 40982151168 bytes 255 heads, 63 sectors/track, 4982 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sdb1 1 1 8001 83 Linux