# 64 bit bootloader

## bjlockie

Is there a 64 bit bootloader yet?

I don't use multilib nor do I want 32 bit software running on my system.

----------

## NeddySeagoon

bjlockie,

You can't have a 64 bit bootloader as much of it must run in real mode, which is only 32 bit.

The CPU starts in real mode, the BIOS runs in real mode and bootloaders make BIOS calls to keep them small.

The bootloader is done when you see the kernel startup message, so its memory space is reused.

Use grub-static if you are on a no-multilib system

----------

## bjlockie

Does a  CPU have to start in real mode?

I can't even run grub-static, my kernel won't run 32 bit code.

Could they make the grub interface 64 bit?

----------

## cyrillic

 *bjlockie wrote:*   

> I can't even run grub-static, my kernel won't run 32 bit code. 

 

Boot a LiveCD, and run grub from there.

----------

## i92guboj

 *bjlockie wrote:*   

> Does a  CPU have to start in real mode?
> 
> I can't even run grub-static, my kernel won't run 32 bit code.
> 
> 

 

Use grub static and use the IA32 emulation in your kernel. It's not like a kitten is gonna die for that. Your whole OS will continue to be a 64 bits OS with no multilib.

 *Quote:*   

> Could they make the grub interface 64 bit?

 

I don't see a problem with having a 64 bits userland (though I have no idea if any bootloader implements it at all). However, the boot image would still be a 32 bits binary living in your system, in both your boot sector and of course inside your gentoo installation where grub will live (yes, I am trying to provoke you a nightmare   :Twisted Evil:  ).

----------

## NeddySeagoon

bjlockie,

grub runs before the kernel is loaded, it cannot use any kernel services. Its only job is to load the kernel.

All 32 bit and 64 bit Intel/AMD compatible CPUs start in real mode. Its the way they initialise when they are reset, in short, its a design feature. Software later switches to protected mode but then you cannot use the BIOS any longer.

As the kernel is used to build grub, you cannot build normal grub on a system that does not support 32 bit code, hence the use of grub-static. The 32 bit code is provided precompiled.

----------

## bjlockie

 *i92guboj wrote:*   

> 
> 
> Use grub static and use the IA32 emulation in your kernel. It's not like a kitten is gonna die for that. Your whole OS will continue to be a 64 bits OS with no multilib.
> 
>  *Quote:*   Could they make the grub interface 64 bit? 
> ...

 

I don't want to accidentally install 32bit software so I disabled it in the kernel.

----------

## NeddySeagoon

bjlockie,

32 bit support is not needed in the kernel.  The kernel has nothing to do with running grub anyway.

----------

## Carnildo

 *bjlockie wrote:*   

> Is there a 64 bit bootloader yet?
> 
> I don't use multilib nor do I want 32 bit software running on my system.

 

I've got bad news for you: the computer starts up in 16-bit mode.

----------

## mv

 *NeddySeagoon wrote:*   

> 32 bit support is not needed in the kernel.  The kernel has nothing to do with running grub anyway.

 

It is needed if you want to run the "grub" command from some shell (which you certainly want to do sometimes). That's why bjlockie asked whether they could make this interface 64 bit. Indeed, it would be reasonable to do so, since enabling 32 bit support in the kernel  just to install the bootloader seems a bit overdone. Maybe grub2 has a better solution for this problem?

----------

## NeddySeagoon

mv,

Well caught.

The initial grub install is done using the liveCD kernel, which has 32 bit support. Without 32 bit support in your own kernel, installing updates to grub-static to the MBR will be a pain. As you say, the kernel needs 32 bit support for that.

I will have that pain to come. I will either need to rebuild the kernel, just for that task or use a liveCD.

----------

## doctork

Other than esthetics, what is the motivation for removing 32-bit support from the kernel?  Does it present a security risk?  Is there a memory-usage problem?

--

doc

----------

## Hu

Supporting IA32 processes on a 64-bit kernel requires compatibility wrappers to adjust the size of values up/down as they enter/leave the kernel.  All kernel code requires some memory allocated, though the memory spent on IA32 compatibility is probably relatively minor compared to the memory wasted including unneeded drivers.  There have been some security vulnerabilities related to improper wrapping.  See commit 176df2457ef6207156ca1a40991c54ca01fef567, for example.

----------

