It seems that booting systems is giving me a headache again.

I had to flash the firmware of my Infoway Note N8320 notebook which is an MSI Aesthetics PR200 disguised in a nice clothing. Of course, it had a firmware update that required being applied only from a regular DOS floppy. But the size of a floppy isn't enough to hold the new firmware.

To cut a long story short, it was quite painful to get things going, but here are the distilled situation:


# Collection of information from:

# needed: syslinux, parted, grub

# Create the basic disk image
dd if=/dev/zero of=disk.img bs=1M count=$SIZE
parted --script disk.img mktable msdos
parted --script disk.img mkpart primary fat16 0 ${SIZE}MB
parted --script disk.img mkfs 1 fat16
parted --script disk.img set 1 boot on

# Mount it
SECTORS=\((fdisk -l -u disk.img 2>&1| tail -1 | perl -ne 'prýÊ{úkz––çBf×·V÷C\)1" if (m/\s+(\d+)\s+/);')
    mount -t vfat -o loop,offset=$((SECTORS * 512)) disk.img /mnt

# Copy the bootloader
# Copy a FreeDOS image and treat it as a ramdisk (it will be the "A:" drive)
mkdir -p /mnt/grub
cp /usr/lib/grub/x86_64-pc/* /mnt/grub
cp /usr/lib/syslinux/memdisk /mnt
wget -O /mnt/odin1440.img

# Set up grub (grub legacy)
cat <<EOF0 > /mnt/grub/menu.lst
title FreeDOS
kernel /memdisk
initrd /odin1440.img

grub --device-map=/dev/null --batch <<EOF1
device (hd0) /tmp/disk.img
root (hd0,0)
setup (hd0)

# Copy extra contents (e.g., the firmware) to the disk here (the "C:" drive)
touch /mnt/example.txt

# Finish it
umount /mnt
blog comments powered by Disqus