Bootstrap in real mode on x86_64: Possible?

Maxim Baryshnikov barysmax at fel.cvut.cz
Sat Apr 2 14:49:00 CEST 2016


Hello everyone,

     I am trying to find some ways to port/launch Fiasco.OS into "The 
Jailhouse hypervisor <https://github.com/siemens/jailhouse.git>" 
environment using x86_64 architecture.
     This hypervisor does not provide any bootloader at all. It simply 
loads raw binary on the specified address and launches it in real mode 
from this address.

     In 'l4/pkg/bootstrap/server/src/README' I found two options 
described. I think it might be suitable for me.

3)
           bootstrap can boot from real-mode, esp. with pxelinux, i.e. 
it can be
           booted via PXE. For that it also needs include all images.
           This should also work with syslinux (e.g. from CDs/DVDs). 
(Note, grub
           can also read is9660 filesystems.)
    4)
           bootstrap starts from protected mode but isn't started by a 
multiboot
           compliant loader. Also needs to include all modules.

     So, I started my tries from the 3th option.

     Following the bootstrap code, I find out that there is some piece 
of code for real mode bootstrapping and the defining of 
"REALMODE_LOADING" directive switches it on.
     I have tried to compile it with REALMODE_LOADING = 1 (and also with 
IMAGE_MODE = 1, and RML = 1), which I added in 
'bootstrap/server/src/Makeconf.local' folder.
     Also, I commented the row with error command in Makefile.rules:

|ifneq ($(REALMODE_LOADING)$(RML),00)
             REALMODE_LOADING := 1
             #$(error Info: Default reloc needs to be 0x00100000)
     # And if you have done so you probably need to relink sigma0 and/or moe
      endif|||

     I admit that I did not actually understand the purpose of this 
block here.. I would really appreciate if someone explains it to me.

     Unfortunately, when I continue to make it without command mentioned 
above I've faced with the following compilation error:
|          [bootstrap] ... Compiling platform/x86_pc.o||
||/home/coon848/projekt-git-clones/l4re-snap/src/l4/pkg/bootstrap/server/src/platform/x86_pc.cc: 
In member function ‘const char* {anonymous}::Platform_x86_1::cmdline() 
const’:||
||/home/coon848/projekt-git-clones/l4re-snap/src/l4/pkg/bootstrap/server/src/platform/x86_pc.cc:73:26: 
warning: cast to pointer from integer of different size 
[-Wint-to-pointer-cast]||
||     return (char const *)p;||
||                          ^||
||/home/coon848/projekt-git-clones/l4re-snap/src/l4/pkg/bootstrap/server/src/platform/x86_pc.cc: 
In member function ‘virtual Boot_modules::Module 
{anonymous}::Platform_x86_multiboot::module(unsigned int, bool) const’:||
||/home/coon848/projekt-git-clones/l4re-snap/src/l4/pkg/bootstrap/server/src/platform/x86_pc.cc:176:64: 
error: ‘mbi’ was not declared in this scope||
||     l4util_mb_mod_t *mb_mod = (l4util_mb_mod_t*)(unsigned 
long)mbi->mods_addr;||
||^||
||/home/coon848/projekt-git-clones/l4re-snap/src/l4/pkg/bootstrap/server/src/platform/x86_pc.cc: 
In member function ‘virtual unsigned int 
{anonymous}::Platform_x86_multiboot::num_modules() const’:||
||/home/coon848/projekt-git-clones/l4re-snap/src/l4/pkg/bootstrap/server/src/platform/x86_pc.cc:184:41: 
error: ‘mbi’ was not declared in this scope||
||   unsigned num_modules() const { return mbi->mods_count; }||
||                                         ^||
||/home/coon848/projekt-git-clones/l4re-snap/src/l4/pkg/bootstrap/server/src/platform/x86_pc.cc: 
In member function ‘virtual void 
{anonymous}::Platform_x86_multiboot::reserve()’:||
||/home/coon848/projekt-git-clones/l4re-snap/src/l4/pkg/bootstrap/server/src/platform/x86_pc.cc:190:43: 
error: ‘mbi’ was not declared in this scope||
||     regions->add(Region::n((unsigned long)mbi,||
||                                           ^||
||/home/coon848/projekt-git-clones/l4re-snap/src/l4/pkg/bootstrap/server/src/platform/x86_pc.cc: 
In member function ‘virtual void 
{anonymous}::Platform_x86_multiboot::move_module(unsigned int, void*, 
bool)’:||
||/home/coon848/projekt-git-clones/l4re-snap/src/l4/pkg/bootstrap/server/src/platform/x86_pc.cc:232:61: 
error: ‘mbi’ was not declared in this scope||
||     l4util_mb_mod_t *mod = (l4util_mb_mod_t*)(unsigned 
long)mbi->mods_addr + index;||
||^||
||/home/coon848/projekt-git-clones/l4re-snap/src/l4/pkg/bootstrap/server/src/platform/x86_pc.cc: 
In member function ‘virtual l4util_mb_info_t* 
{anonymous}::Platform_x86_multiboot::construct_mbi(long unsigned int)’:||
||/home/coon848/projekt-git-clones/l4re-snap/src/l4/pkg/bootstrap/server/src/platform/x86_pc.cc:249:9: 
error: ‘mbi’ was not declared in this scope||
||     if (mbi->flags & L4UTIL_MB_CMDLINE)||
||         ^||
||/home/coon848/projekt-git-clones/l4re-snap/src/l4/pkg/bootstrap/server/src/platform/x86_pc.cc:253:9: 
error: ‘mbi’ was not declared in this scope||
||     if (mbi->flags & L4UTIL_MB_VIDEO_INFO)||
||         ^||
||/home/coon848/projekt-git-clones/l4re-snap/src/l4/pkg/bootstrap/server/src/platform/x86_pc.cc:263:45: 
error: ‘mbi’ was not declared in this scope||
||     total_size += sizeof(l4util_mb_mod_t) * mbi->mods_count;||
||                                             ^||
||/home/coon848/projekt-git-clones/l4re-snap/src/l4/pkg/bootstrap/server/src/platform/x86_pc.cc:345:3: 
warning: control reaches end of non-void function [-Wreturn-type]||
||   }||
||   ^||
||/home/coon848/projekt-git-clones/l4re-snap/src/l4/pkg/bootstrap/server/src/platform/x86_pc.cc: 
In member function ‘virtual unsigned int 
{anonymous}::Platform_x86_multiboot::num_modules() const’:||
||/home/coon848/projekt-git-clones/l4re-snap/src/l4/pkg/bootstrap/server/src/platform/x86_pc.cc:184:58: 
warning: control reaches end of non-void function [-Wreturn-type]||
||   unsigned num_modules() const { return mbi->mods_count; }||
||^||
||/||home/coon848/projekt-git-clones/l4re-snap/src/l4/mk/binary.inc:825: 
recipe for target 'platform/x86_pc.o' failed|

     It says that problem is in 'platform/x86_pc.cc'.
     So, my question is, does the real mode option switch on like that 
or I did something wrong? How should it be done?
     And if it is possible to bootstrap without multiboot complaint 
loader in protected mode, how should it be compiled?

     Thank you in advance.

     Sincerely,

Maxim Baryshnikov.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://os.inf.tu-dresden.de/pipermail/l4-hackers/attachments/20160402/7f55c932/attachment.html>


More information about the l4-hackers mailing list