#!/bin/bash dd if=/dev/zero of=harddisk.img count=10 bs=1048576 parted -s -a cylinder harddisk.img mklabel msdos parted -s -a cylinder harddisk.img mkpart primary ext2 63s 10M parted -s -a cylinder harddisk.img toggle 1 boot lo=`losetup -f` echo ${lo} losetup -P ${lo} harddisk.img mkfs.ext2 ${lo}p1 mount ${lo}p1 /mnt grub-install --no-floppy --install-modules="biosdisk part_msdos ext2 configfile normal linux16 vbe png gfxmenu video video_colors video_cirrus video_fb" --boot-directory=/mnt/boot ${lo} --target=i386-pc echo -en "\ insmod ext2 insmod biosdisk insmod part_msdos insmod linux insmod vbe insmod gfxterm insmod png insmod font set timeout=4\n\ set default=0\n\ menuentry "cos2000" {\n\ set root=(hd0,1)\n\ linux16 /boot/system.sys root=hd0,2\n boot\n\ }" > /mnt/boot/grub/grub.cfg umount /mnt losetup -d ${lo} #xz -c harddisk.img > harddisk.img.xz