[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re[2]: Building grub2 for use as a kernel on qemu

From: Shaun Reitan
Subject: Re[2]: Building grub2 for use as a kernel on qemu
Date: Fri, 03 Feb 2017 20:49:46 +0000
User-agent: eM_Client/7.0.26356.0


Tried to build a kernel image using the following.

./bin/grub-mkstandalone -O i386-pc -o grub2.img grub.cfg --fonts="" --locales="" --themes="" --install-modules="acpi adler32 affs ahci all_video aout ata at_keyboard biosdisk blocklist boot bufio cat cbfs cbls cbmemc cbtable cbtime chain cmosdump cmp configfile cpio_be cpio cpuid crc64 cryptodisk crypto date datetime diskfilter disk div div_test dm_nv drivemap echo efiemu ehci elf eval exfat exfctest ext2 extcmd fat file gettext gfxmenu gfxterm_background gfxterm_menu gfxterm gptsync gzio halt hashsum help iorw iso9660 keylayouts keystatus ldm legacycfg legacy_password_test linux16 linux loadenv loopback lsacpi lsapm lsmmap ls lspci lzopio macbless macho memdisk memrw minicmd mmap morse mpi mul_test multiboot2 multiboot nativedisk net newc nilfs2 normal ntldr odc offsetio ohci part_gpt password pata pcidump pci priority_queue probe procfs random read reboot regexp relocator romfs scsi search_fs_file search_fs_uuid search_label search sendkey serial setjmp setpci shift_test signature_test sleep syslinuxcfg tar terminal terminfo test_blockarg testload test tga time trig tr true udf uhci usb_keyboard usb usbms usbtest vbe verify vga vga_text video_cirrus video xfs xzio"

basically i took every module from the i386-pc/*.mod directory and attempted to add it. The image was too large so i went through the module list and removed stuff that i was pretty sure i didnt need.

When i boot the image, i see nothing but the memdisk, i'm also in that same grub2 shell. I should see a (hd0) along with my (memdisk)

Do you hang out in the #grub channel on


------ Original Message ------
From: "Andrei Borzenkov" <address@hidden>
To: "Shaun Reitan" <address@hidden>; "address@hidden" <address@hidden>
Sent: 2017-02-03 11:06:28 AM
Subject: Re: Building grub2 for use as a kernel on qemu

03.02.2017 21:23, Shaun Reitan пишет:
 Ya, that’s where i originally started with this was building a bios
(actually started with coreboot + grub2) but the issue i found was that grub doesn't seam to be able to see the disks. It can if i run the qemu
 system using full virt with harddrive emulation but if i try and use
 virtio for better performance the disk is just missing.  I'm guessing
 grub probably needs virtio drivers simular to what was done with xen.

Yes, unfortunately qemu port currently does not support virtio devices.

At this point i'm a bit lost as to what i should try next. Sounds like i386-pc built at a kernel is probably the best solution however i need
 to figure out how to build an image that can search and load a
 configfile from the disk.  grub-mkstandalone says the image is too
 large, i'm not sure how to strip it down.

--fonts= --locales= --themes= --install-modules="..."

This will omit all fonts, locales and themes and only add to memory disk
modules you explicitly listed. I used it successfully more than once on

So then, should i be using grub-mkimage with a memdisk that has another
 grub config?  So i'd build the kernel with a configfile
 (memdisk)/boot/grub/grub.cfg and inside that grub.cfg it would do the
 searching?  Would i be in normal mode then?  I'm going to attempt to
 test this out now, i just wanted to shoot off this email just in-case
your still up since it seams like were on opposite ends of the world :)


 ------ Original Message ------
 From: "Andrei Borzenkov" <address@hidden>
 To: "Shaun Reitan" <address@hidden>; "address@hidden"
 Sent: 2017-02-02 07:15:41 PM
 Subject: Re: Building grub2 for use as a kernel on qemu

 02.02.2017 22:30, Shaun Reitan пишет:
I guess the question is, should i be using i386-qemu? For kicks i just
  built a image using

./grub-mkstandalone -O i386-qemu -o grub2.img boot/grub/grub.cfg -d

and qemu will use it, however when i connect to the VNC console all i
  see is a bunch of colorful giberish.

QEMU platform is intended to run on "bare metal" replacing BIOS, i.e.

 qemu-system-x86_64 -bios grub2.img

 You will need to include at_keyboard in image to get console input.


  ------ Original Message ------
  From: "Andrei Borzenkov" <address@hidden>
  To: "Shaun Reitan" <address@hidden>; "address@hidden"
  Sent: 2017-02-02 12:01:58 AM
  Subject: Re: Building grub2 for use as a kernel on qemu

On Thu, Feb 2, 2017 at 6:25 AM, Andrei Borzenkov <address@hidden>

   grub-mkimage -O i386-pc -c grub.cfg -o grub2.img at_keyboard
biosdisk ext2 linux serial halt minicmd terminal all_video cat echo
search linux16 normal disk test true fat memdisk tar ls sleep -p


Use grub-mkstandalone to create image that includes internal memory
   and place your config on this memory disk. Do not include your
in image itself. By default grub-mkstandalone adds all available
   modules; if size is an issue (but this is really a couple of
   so I do not expect it), you can restrict module list and other
   components - see help output.

Sorry, missed that you use i386-pc platform, not i386-qemu. Then size of boot image does matter, you may want to at least exclude themes and translations (if any). Full standalone image that includes all bells and whistles for GUI boot does not fit in available memory on this

  Help-grub mailing list

Help-grub mailing list

reply via email to

[Prev in Thread] Current Thread [Next in Thread]