Grub no longer works to make .iso images

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Kaius
Posts: 20
Joined: Sat Dec 31, 2022 10:59 am
Freenode IRC: Kaius

Grub no longer works to make .iso images

Post by Kaius »

So far in my OS dev journey, I've been using GRUB with multiboot (as used in the Bare Bones tutorial). During VM testing, I just bypass GRUB and give Qemu the raw image, since it has multiboot capabilities. However, every now and again I'll use the .iso file GRUB produces on a USB drive to test on real hardware.

When I went to try the .iso on my real hardware, it just sent me to the GRUB shell (from the USB drive, not from the HDD install), and I couldn't boot into my image.

When I tried to boot into the .iso in Qemu, instead of just not booting, it produced an extremely corrupted VGA-text output, and seemed to be jumping in an infinite loop from GDB's perspective.

Image

Again, I'm just using the commands provided by the Bare Bones tutorial right now, and they've worked up until recently (code is available in the Github repo in my signature). Has anyone had troubles with GRUB like this before, producing corrupted / unbootable .iso images?

For quick reference, these are the commands I run and the output I receive:

Code: Select all

cp ./output/os.bin ./utils/grub/boot/os.bin
grub-mkrescue -o ./output/os.iso ./utils/grub

Code: Select all

xorriso 1.5.4 : RockRidge filesystem manipulator, libburnia project.

Drive current: -outdev 'stdio:./output/os.iso'
Media current: stdio file, overwriteable
Media status : is blank
Media summary: 0 sessions, 0 data blocks, 0 data,  115g free
Added to ISO image: directory '/'='/tmp/grub.dDokt4'
xorriso : UPDATE :     294 files added in 1 seconds
Added to ISO image: directory '/'='/root/nox/utils/grub'
xorriso : UPDATE :     298 files added in 1 seconds
xorriso : NOTE : Copying to System Area: 512 bytes from file '/usr/lib/grub/i386-pc/boot_hybrid.img'
ISO image produced: 2497 sectors
Written to medium : 2497 sectors at LBA 0
Writing to 'stdio:./output/os.iso' completed successfully.

Kaius
Posts: 20
Joined: Sat Dec 31, 2022 10:59 am
Freenode IRC: Kaius

Re: Grub no longer works to make .iso images

Post by Kaius »

After many hours of debugging, I finally realized that I had made a very silly mistake. I was going to remove this post, but I decided to keep it in case somebody in the future comes across this issue.

The command I normally use to run my OS (the .bin, not the .iso) was:

Code: Select all

qemu-system-i386 -kernel ./output/os.bin -vnc :0
When I wanted to test the .iso, I just swapped .bin for .iso in the previous command, which caused a horrible failure within Qemu. The issue was that I had kept the "-kernel" directive, which ultimately made Qemu treat the .iso image differently than it should've. The correct command to test the .iso is:

Code: Select all

qemu-system-i386 ./output/os.iso -vnc :0
Without the "-kernel" flag, and it all runs as it should.
Post Reply