Issue
I'm following the babystep bootloader guide writing the code on GAS as suggested here when I run the image with qemu-system-x86_64 -machine type=pc,accel=kvm -drive 'format=raw,file=boot.bin'
it works as expected, but I'd like to change the machine type to q35
.
Here is my code:
.global _start
.code16
.text
_start:
cli
jmp .
.org 510
.word 0xaa55
Compiled with:
gcc \
-Wl,--oformat=binary \
-Wl,-Ttext=0x7c00 \
-Wl,--build-id=none \
-nostartfiles \
-nostdlib \
-m32 \
-o boot.bin \
boot.s
It's supposed to hang, with type=pc
I have the following result:
If you try to type Ctrl-Alt-Delete
here nothing happens, that is the expected behavior.
And with type=q35
the following result:
How can I achieve the same result as on type=pc
using type=q35
?
P.S.: partial solution:
qemu-img create -f qcow2 -o lazy_refcounts=on disk.qcow2 16G
sudo modprobe nbd max_part=8
sudo qemu-nbd --connect=/dev/nbd0 disk.qcow2
sudo dd if=boot.bin of=/dev/nbd0 status=progress
sudo qemu-nbd --disconnect /dev/nbd0
# ... -drive 'format=qcow2,l2-cache-size=2M,cache-clean-interval=900,file=disk.qcow2' ....
I'm not going to accept that yet until I understand why raw
format is not working and if is really the only one possible way to fix that.
Solution
To fix that bug the image should have 515585 bytes or more, I don't know where this number comes from, I have tested several combinations until achieve this result, if you try one single byte less it doesn't work, but more bytes works fine.
truncate -s515585 boot.bin
Answered By - Tiago Pimenta
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.