QEMU not booting my image

wat

---------- Post updated at 04:50 PM ---------- Previous update was at 04:35 PM ----------

Now do you see what I mean? :smiley:

If it can fit on a floppy, maybe fpmurphy's way will work.

You know, NeurOn, if you just followed the instructions on the page (http://os.ibds.kit.edu/2101/php\) you provided us, you should have no difficulty building a bootable 1.4Mb floppy containing L4. All the steps to do this are quite clearly documented on that page. It took me about 10 minutes.

OK, I got it to work now, and to be completely honest I don't know why it didn't work the first time. I have one more problem however, and I'm not sure what's causing it. When I boot the image using QEMU, I select the boot option, then I get an error saying:

Error 16: Inconsistent filesystem structure

why is this happening and how can I fix it?

I've said it before, and I'll say it again: Tell us all the steps you followed to create, and run, the image. Word for word. Letter for letter. Keystroke for keystroke. Whenever you post a question without doing this you're wasting your time.

We don't know what went wrong given that minimal information. Bootloaders are bad for this -- their tiny little brains can't cough up more than a general "it doesn't work" kind of error message when things aren't precisely as they expected, and that's best case. Worst case they just freeze and tell you nothing.

We are not mind readers. We don't even know what you did yet, let alone how to fix it...

I followed the instructions here, like fpmurphy said I should in his last post. The one that required root privilege to be exact

I didn't ask what set of instructions you followed, I asked what you actually did -- word for word, letter for letter, keystroke for keystroke. Surely you had to adapt them in some way. Copy-paste it if necessary.

to create the image i used:

$dd if=/dev/zero of=kernel.img bs=512 count=8640
8640+0 records in
8640+0 records out
4423680 bytes (4.4 MB) copied, 0.0893247 s, 49.5 MB/s
$losetup /dev/loop0 kernel.img
$mke2fs /dev/loop0
mke2fs 1.41.4 (27-Jan-2009)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
1080 inodes, 4320 blocks
216 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=4456448

1 block group
8192 blocks per group, 8192 fragments per group
1080 inodes per group


Writing inode tables: done                            
Writing superblocks and filesystem accounting information: done


This filesystem will be automatically checked every 27 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
$mount /dev/loop0 -o loop /media/mount_point
$chmod 777 /media/mount_point
$cp -aR kernel_files/* /media/mount_point
$umount /media/mount_point

$cat <<EOF | /sbin/grub --batch --device-map=/dev/null 
>device (fd0) /dev/loop0
>root (fd0)
>setup (fd0)
>quit
>EOF 
       [ Minimal BASH-like line editing is supported.   For
         the   first   word,  TAB  lists  possible  command
         completions.  Anywhere else TAB lists the possible
         completions of a device/filename. ]
grub> device (fd0) /dev/loop0
grub> root (fd0)
Unknown partition table signature
grub> setup (fd0)
 Checking if "/boot/grub/stage1" exists... yes
 Checking if "/boot/grub/stage2" exists... yes
 Checking if "/boot/grub/e2fs_stage1_5" exists... no
 Running "install /boot/grub/stage1 (fd0) /boot/grub/stage2 p /boot/grub/menu.lst "... succeeded
Done.
grub> quit


$losetup -d /dev/loop0

then to boot the image i used

$qemu -fda kernel.img

exactly that, nothing else

---------- Post updated 01-07-11 at 10:16 AM ---------- Previous update was 01-06-11 at 11:12 AM ----------

hope this helps

it should help a lot. sorry for my lack of reply I've been on continuous emergency road trips at work, I'll try and take a closer look on the weekend

OK, I am looking forward to it

Bleh. I hate being sick. attempting to follow your steps now.

---------- Post updated at 12:50 PM ---------- Previous update was at 12:21 PM ----------

I don't have qemu, and haven't figured out how to build pistachio yet, so I just used one of the many pre-built example disks they have on their download page. They come with grub and work fine and should be an excellent base to build your own project with. It's vfat, not ext2, but considering you're on a floppy disk... If your qemu refuses to boot one of those boot images, then it's a problem with qemu. If it's just a problem with your own image, it's a problem with this software, with which I have no experience.

---------- Post updated at 12:57 PM ---------- Previous update was at 12:50 PM ----------

The 'make menuconfig' doesn't even recognize my escape key so I can't leave menus, and I have no idea what kernel options you built your kernel with anyway.

In 'menuconfig' I think you're suppose to press the left arrow to go back. But anyways I think I figured out what the problem was. I used a block count of 8640:

dd if=/dev/zero of=kernel.img bs=512 count=8640

which is not the usual block count for a floppy. Perhaps this is what cause the problem. Because after I went back and used the example disk on the site like you said, I decided to use the block count they recommended (2880) and it worked. The only thing however, is that my project is over 3MB which means I need a lot more than 1.44MB. I was thinking about changing the settings in the grub commands but I'm not sure if they would work. Here is my intended setup:

$cat <<EOF | /sbin/grub --batch --device-map=/dev/null 
>device (hd0) /dev/loop0
>root (hd0)
>setup (hd0)
>quit
>EOF

instead of

$cat <<EOF | /sbin/grub --batch --device-map=/dev/null 
>device (fd0) /dev/loop0
>root (fd0)
>setup (fd0)
>quit
>EOF

the idea in my head is that if grub is looking for a floppy it looks for a 1.44MB image, so if it is looking for a harddrive then it looks for a random size image :stuck_out_tongue:

---------- Post updated at 04:06 PM ---------- Previous update was at 03:48 PM ----------

By the way, when the image boot it says

Error 13: Invalid executable

This just mean that the executable is not compatible with my processor right? Because the example disk I downloaded was for Pentium 3 but my processor is a Pentium 4.
I simply booted the image using

qemu -fda the_image.img

I tried that too.

You'd think a pentium 3 image should boot on a pentium 4. But, I have no idea, as I don't use this software.

You've spent how many weeks trying to create a bootable image now, when their own download page has several premade ones with GRUB and a working filesystem available? At least use it as an example.

Yea, they have a demo image. I don't intend to just boot a demo and stop there I want to know this stuff for when my project progresses. But anyways thanks a lot for all your help.

...linux understands vfat. You can modify them. :wall: Besides, have you even proven that your installation of qemu is willing to boot a known-good pist. floppy yet? You may be hitting a software incompatibility and not realizing.

I'd never have gotten anywhere making boot ISOs if I hadn't had one good, working example to look at. Having examined a working one, I was able to reverse-engineer it, and now can make them from scratch.. The same goes for initrds. For the boot process to work, everything has to be absolutely perfect because, if it doesn't work, it's mostly incapable of telling you why. The path of most resistance is not a winning plan.

I got it to work now. Apparently, there were some option in the compilation that caused the incompatibility issue. As far as boot ISOs go I've already started learning how to make one :smiley: