OSDev.org https://forum.osdev.org/ |
|
[SOLVED] Need help with GRUB https://forum.osdev.org/viewtopic.php?f=1&t=33857 |
Page 1 of 1 |
Author: | 0xd3ba [ Fri Aug 23, 2019 9:36 am ] |
Post subject: | [SOLVED] Need help with GRUB |
So I've been trying to boot a sample "hello world" kernel with GRUB2 and I've been encountering some issues. I created the disk image (inside virtualbox) following this: https://wiki.osdev.org/GRUB I added the kernel image to /mnt/boot and added grub.cfg to /mnt/boot/grub grub.cfg contains : Code: menuentry "sample" { multiboot /boot/kernel boot } What happens is that it boots to a grub prompt, not to the kernel. This happens when I try to do it manually after: I've tried searching for the issue, but didn't find anything. I hope someone can help me out and point me in the right direction. Thank you |
Author: | iansjack [ Fri Aug 23, 2019 9:40 am ] |
Post subject: | Re: Need help with GRUB |
The message is saying that there is something wrong with your kernel image file (it's too short). With no details of this file it's difficult to know what the problem is, or why. It would help if you linked to a repository of your source code and the exact instructions that you used. |
Author: | 0xd3ba [ Fri Aug 23, 2019 11:34 am ] |
Post subject: | Re: Need help with GRUB |
iansjack wrote: The message is saying that there is something wrong with your kernel image file (it's too short). With no details of this file it's difficult to know what the problem is, or why. It would help if you linked to a repository of your source code and the exact instructions that you used. It doesn't contain much - just multiboot stuff and 2 instructions (movl $0xabcdabcd, %eax and hang: jmp hang ) to see if the code's executing or not. However I don't feel that's what causing the issue though. |
Author: | iansjack [ Fri Aug 23, 2019 11:52 am ] |
Post subject: | Re: Need help with GRUB |
Well, if you want to keep it secret that's fine. I hope you manage to find the solution to your problem. |
Author: | 0xd3ba [ Fri Aug 23, 2019 1:34 pm ] |
Post subject: | Re: Need help with GRUB |
iansjack wrote: Well, if you want to keep it secret that's fine. I hope you manage to find the solution to your problem. Huh, like I've mentioned there's nothing much except the multiboot header and the 2 instructions. Its just that I didn't feel like it's worth writing it down (as the code is trivial) Anyways - Code: .code32 .section .text .globl _start MB_MAGIC = 0xe85250d6 MB_ARCH = 0 MB_HLEN = mbend - mbstart MB_CHKSUM = -(MB_MAGIC + MB_HLEN) .p2align 3 mbstart: .long MB_MAGIC .long MB_ARCH .long MB_HLEN .long MB_CHKSUM .word 0 .word 0 .long 8 mbend: _start: movl $0xabcdabcd, %eax hang: jmp hang EDIT I managed to solve the problem. The issue was that the executable was a raw binary (--oformat=binary set during linking) instead of an elf executable |
Author: | iansjack [ Fri Aug 23, 2019 3:01 pm ] |
Post subject: | Re: [SOLVED] Need help with GRUB |
I'm glad you solved your problem. Perhaps you can understand now why asked to see what instructions you had used to produce your kernel. Just asking "what's wrong" without showing what you have done is a very difficult question to answer. |
Page 1 of 1 | All times are UTC - 6 hours |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |