I have built a custom kernel using the mainline source, latest version and this config.
I've created an image of Bullseye as suggester here
And then I ran it in QEMU (setting the relative environment variables):
qemu-system-x86_64 -m 2G -smp 2 -kernel $KERNEL/arch/x86/boot/bzImage -append "console=ttyS0 root=/dev/sda earlyprintk=serial net.ifnames=0 noxsave" -drive file=$IMAGE/bullseye.img,format=raw -net user,host=10.0.2.10,hostfwd=tcp:127.0.0.1:10021-:22 -net nic,model=e1000 -enable-kvm -nographic -pidfile vm.pid -cpu host 2>&1 | tee vm.log
This is the kernel log I got.
The problem is that there is no login prompt in the console and the console seems to be frozen. So, somehow the boot process gets stuck.
I tried attaching GDB by adding
-s -S options to QEMU and do
gdb vmlinux from the Linux Kernel folder and then I found it got stuck somewhere for some reason (note, I gave the Ctrl-C (SIGINT) once it was stuck at the end of the log where no further output would appear even after minutes).
(gdb) target remote localhost:1234 Remote debugging using localhost:1234 0x000000000000fff0 in cpu_tss_rw () (gdb) c Continuing. ^C Thread 1 received signal SIGINT, Interrupt. 0xffffffff8d7640ce in ?? () (gdb) x/20i $rip-20 0xffffffff8d7640ba: nop 0xffffffff8d7640bb: nop 0xffffffff8d7640bc: nop 0xffffffff8d7640bd: nop 0xffffffff8d7640be: nop 0xffffffff8d7640bf: nop 0xffffffff8d7640c0: endbr64 0xffffffff8d7640c4: xchg %ax,%ax 0xffffffff8d7640c6: verw 0x24c1e13(%rip) # 0xffffffff8fc25ee0 0xffffffff8d7640cd: hlt => 0xffffffff8d7640ce: ret 0xffffffff8d7640cf: int3 0xffffffff8d7640d0: int3 0xffffffff8d7640d1: int3 0xffffffff8d7640d2: int3 0xffffffff8d7640d3: data16 cs nopw 0x0(%rax,%rax,1) 0xffffffff8d7640de: data16 cs nopw 0x0(%rax,%rax,1) 0xffffffff8d7640e9: data16 cs nopw 0x0(%rax,%rax,1) 0xffffffff8d7640f4: data16 cs nopw 0x0(%rax,%rax,1) 0xffffffff8d7640ff: nop (gdb)
hltinstruction before ret suggests the machine halted. Anyone knows what is going wrong here and how to fix it?