Using a script to produce a bootable floopy image using grub
Posted: Thu Jul 24, 2008 1:05 pm
I'm trying to automate the process of creating a bootable floppy image using grub.
Currently I am using the following method in my makefile:
But this requires me to type 'kernel 200+18' then 'boot' into bochs whenever I want to test my kernel.
So, I'm trying to use a shell script that uses a loopback device. This is my script:
But bochs says that there is no bootable device.
The same bochsrc.txt file allows me to boot Bran's kernel image which you can download at the end of the tutorial.
Also, I've never been able to get the loopback method to work manually (i.e. typing the comands at the terminal myself). I'm a bit stuck.
Your wonderful help and advice would be very welcome.
Cheers,
Puffy
Currently I am using the following method in my makefile:
Code: Select all
floppy.img: kernel.bin
#@cat ./grub/stage1 ./grub/stage2 ./grub/pad kernel.bin > ./image/floppy.img
So, I'm trying to use a shell script that uses a loopback device. This is my script:
I then try to boot the image with bochs I have a bochsrc.txt file in the same directory as the image which is as follows:echo "mypasswordbutthisisnotit" | sudo -S dd if=/dev/zero of=./image/floppy.img bs=512 count=2880
sudo losetup /dev/loop0 ./image/floppy.img
sudo mkfs -t ext2 /dev/loop0
sudo mount -t ext2 /dev/loop0 ./image/floppy/
sudo mkdir -p ./image/floppy/grub/boot/
sudo cp ./grub/stage1 ./image/floppy/grub/boot/stage1
sudo cp ./grub/stage2 ./image/floppy/grub/boot/stage2
sudo cp ./grub/menu.lst ./image/floppy/grub/boot/menu.lst
sudo cp kernel.bin ./image/floppy/kernel.bin
sudo umount /dev/loop0
Code: Select all
boot: floppy
floppya: 1_44="floppy.img", status=inserted
The same bochsrc.txt file allows me to boot Bran's kernel image which you can download at the end of the tutorial.
Also, I've never been able to get the loopback method to work manually (i.e. typing the comands at the terminal myself). I'm a bit stuck.
Your wonderful help and advice would be very welcome.
Cheers,
Puffy