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.
I tackle this by loading a 32 bit elf second stage boot loader as the 'kernel' in GRUB. The actual kernel is loaded as a module, which my 32 bit elf loader relocates.
grub-32 loads linux_kernel which is compiled by pure-64 gcc, i.e. 64bit kernel.
But, grub-32 itself doesn't compiled by pure-64 gcc, ATM.
Better off to try lilo.
binutils wrote:grub-32 loads linux_kernel which is compiled by pure-64 gcc, i.e. 64bit kernel.
GRUB puts any Linux kernel it loads on x86, regardless of whether it's 32-bit or 64-bit, in 16-bit real-mode. Therefore, Linux still has some 16-bit real mode startup code on both i386 and x86_64, with some extra code for x86_64 to get it into long mode.
binutils wrote:grub-32 loads linux_kernel which is compiled by pure-64 gcc, i.e. 64bit kernel.
GRUB puts any Linux kernel it loads on x86, regardless of whether it's 32-bit or 64-bit, in 16-bit real-mode. Therefore, Linux still has some 16-bit real mode startup code on both i386 and x86_64, with some extra code for x86_64 to get it into long mode.
weird, gnu grub is in real-mode? i thought it is protected-mode.
lilo is ofcourse real-mode, it depend on bin86.
Linux has always been started in real-mode on i386 and x86_64. AFAIK Grub does run in 32-bit pmode, but it definitely drops back to 16-bit real mode when loading a Linux kernel