fdisk -l /dev/sdc Disk /dev/sdc: 4040 MB, 4040724480 bytes 125 heads, 62 sectors/track, 1018 cylinders Units = cylinders of 7750 * 512 = 3968000 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0xac78ac78 Device Boot Start End Blocks Id System /dev/sdc1 * 1 1018 3944719 c W95 FAT32 (LBA)
wget http://download.gna.org/grub4dos/grub4dos-0.4.4.zip unzip grub4dos-0.4.4.zip ./grub4dos-0.4.4/bootlace.com /dev/sdc
splashimage=(hd0,0)/Boot/tenerife.xpm.gz timeout 30 default saved title Boot from Disk C: savedefault 1 map (hd1) (hd0) map --hook rootnoverify (hd0,0) chainloader +1 title SystemRescueCd from hard-disk savedefault 0 map --mem (hd0,0)/img/systemrescuecd-x86-1.6.3.iso (hd32) map --hook chainloader (hd32) boot title frenzy 1.3 savedefault 0 map --mem (hd0,0)/frenzy/frenzy1.3.iso (hd32) map --hook chainloader (hd32) boot title ---------------------------------------------------------------- root title netinstall bsd/linux ==> configfile (hd0,0)/Boot/NETINSTALL.LST title Live CD ==> configfile (hd0,0)/Boot/LIVE_CD.LST title Recovery & test HDD ==> configfile (hd0,0)/Boot/HDD.LST title Recovery Console of Windows NT/2K/XP find --set-root /cmdcons/setupldr.bin chainloader /cmdcons/setupldr.bin write 0x7C03 0x63646D63 write 0x7C07 0x00736E6F title ---------------------------------------------------------------- root title MemTest86+ v2.11 find --set-root /img/Memtest.img map --mem /img/Memtest.img (fd0) map --hook chainloader (fd0)+1 title ---------------------------------------------------------------- root title boot floppy chainloader (fd0)+1 rootnoverify (fd0) savedefault --wait=2 title boot CD cdrom --init map --hook chainloader (cd0) title Reboot savedefault --wait=2 reboot title ShutDown PC halt
in order to get 'savedefault' feature working. we should create “default” file on the flash, 2048 bytes long:
cat default 0 # # # # # # # # # # # !!!!!!! The file size is 2048 bytes. Don't change the file size !!!!!!! # XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX # XXXXXXXXXXXXXXXXXXXXX # WARNING: If you want to edit this file directly, do not remove any line # from this file, including this warning. XXXXXXXXXXXXXXXXXXXXXXXXXXX # XXXXXXXXXXXXXXXXXXXXX # WARNING: If you want to edit this file directly, do not remove any line # from this file, including this warning. XXXXXXXXXXXXXXXXXXXXXXXXXXX # XXXXXXXXXXXXXXXXXXXXX # WARNING: If you want to edit this file directly, do not remove any line # from this file, including this warning. XXXXXXXXXXXXXXXXXXXXXXXXXXX # XXXXXXXXXXXXXXXXXXXXX # WARNING: If you want to edit this file directly, do not remove any line # from this file, including this warning. XXXXXXXXXXXXXXXXXXXXXXXXXXX # XXXXXXXXXXXXXXXXXXXXX # WARNING: If you want to edit this file directly, do not remove any line # from this file, including this warning. XXXXXXXXXXXXXXXXXXXXXXXXXXX # XXXXXXXXXXXXXXXXXXXXX # WARNING: If you want to edit this file directly, do not remove any line # from this file, including this warning. XXXXXXXXXXXXXXXXXXXXXXXXXXX # XXXXXXXXXXXXXXXXXXXXX # WARNING: If you want to edit this file directly, do not remove any line # from this file, including this warning. XXXXXXXXXXXXXXXXXXXXXXXXXXX # XXXXXXXXXXXXXXXXXXXXX # WARNING: If you want to edit this file directly, do not remove any line # from this file, including this warning. XXXXXXXXXXXXXXXXXXXXXXXXXXX # XXXXXXXXXXXXXXXXXXXXX # WARNING: If you want to edit this file directly, do not remove any line # from this file, including this warning. XXXXXXXXXXXXXXXXXXXXXXXXXXX # XXXXXXXXXXXXXXXXXXXXX # WARNING: If you want to edit this file directly, do not remove any line # from this file, including this warning. XXXXXXXXXXXXXXXXXXXXXXXXXXX # XXXXXXXXXXXXXXXXXXXXX # !!!!!!! The file size is 2048 bytes. Don't change the file size !!!!!!! # XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
we will make customization through config.txt file, that we will place in root of flash:
cat config.txt ROOT=somepasswordhere DEV=em0 IP=192.168.5.5/24 GW=192.168.5.1 NS=8.8.8.8
let us boot from sysresccd
from there we should make following:
mount /dev/othderdevice_with_posix_fs /mnt/custom/ mkdir -p /mnt/custom/customcd/files cp -a /livemnt/squashfs/* /mnt/custom/customcd/files/ mount -o bind /dev/ /mnt/custom/customcd/files/dev mount -t proc proc /mnt/custom/customcd/files/proc chroot /mnt/custom/customcd/files/
copy from some i386 debian: -/usr/bin/expect -/usr/lib/libexpect.so.5.43.0 -/usr/lib/libtcl8.4.so.0 -/usr/share/tcltk
cat > /root/chpass #!/usr/bin/expect -f spawn passwd [lindex $argv 0] set password [lindex $argv 1] expect "password:" send "$password\r" expect "password:" send "$password\r" expect eof
cat > autorun #!/bin/sh PASS=`cat /livemnt/boot/config.txt|grep ROOT|cut -d= -f2` IP=`cat /livemnt/boot/config.txt|grep IP|cut -d= -f2` GW=`cat /livemnt/boot/config.txt|grep GW|cut -d= -f2` NS=`cat /livemnt/boot/config.txt|grep NS|cut -d= -f2` /sbin/ifconfig eth0 $IP up echo nameserver $NS > /etc/resolv.conf /root/chpass root $PASS /sbin/route add default gw $GW
/usr/sbin/autorun
ar_nowait='y'
/etc/ssh/sshd_config
PasswordAuthentication yes
/usr/sbin/sysresccd-custom squashfs
/mnt/custom/customcd/isoroot/
let us boot from frenzy
from there we should make following:
mkdir /mnt/frenzyfs mount -t tmpfs tmpfs /mnt/frenzyfs cp -Rfp /Frenzy/fs/* /mnt/frenzyfs chroot /mnt/frenzyfs/
cat > /root/autorun #!/bin/sh /bin/cat /Frenzy/boot/config.txt | /usr/bin/grep ROOT | /usr/bin/cut -d= -f2 | /usr/sbin/pw usermod root -h 0 /bin/echo "PermitRootLogin yes" >> /etc/ssh/sshd_config /sbin/ifconfig `/bin/cat /Frenzy/boot/config.txt | /usr/bin/grep DEV | /usr/bin/cut -d= -f2` `/bin/cat /Frenzy/boot/config.txt | /usr/bin/grep IP | /usr/bin/cut -d= -f2` /sbin/route add default `/bin/cat /Frenzy/boot/config.txt | /usr/bin/grep GW |/usr/bin/cut -d= -f2` /bin/echo "nameserver `/bin/cat /Frenzy/boot/config.txt | /usr/bin/grep NS | /usr/bin/cut -d= -f2`" > /etc/resolv.conf /etc/rc.d/sshd forcestart chmod +x /root/autorun echo /root/autorun >> /etc/rc.d/FRENZY exit mkisofs -lRNU -quiet -ldots -o frenzynew.iso frenzyfs mkuzip -o frenzy.uzip -s 130560 frenzynew.iso
now we get new frenzy.uzip, that we will put to /frenzy/ catalog