0

Say I have a chroot containing what will be a working Linux system, and some additional init scripts to mount an overlay filesystem (e.g. AUFS) over it. I've also generated a GRUB2 boot menu.

What commands would I use to:

  • Install the requisite GRUB2 binary files into $CHROOT/boot, without modifying the host MBR
  • Generate a bootable ISO from $CHROOT, with GRUB2 as the bootloader

Note that I would rather use GRUB2 than syslinux, because syslinux does not automatically detect kernel and initrd versions.

  • Incase if you are experimenting with linux and want to build it from scratch, try linuxfromscratch.org. It has a detailed documentation about how linux can be built from scratch. – Kannan Mohan Sep 9 '14 at 10:23
0

If you have chroot there is no $CHROOT/boot, it will be just /boot.

Assuming you have already mounted --bind /dev /proc /dev/pts and /sys then you only need to do a grub-install --force --no-floppy --boot-directory=/boot /dev/sdX and assuming your boot dir is /boot and /dev/sdX the device where you want the MBR part of grub to be installed.

I'm not sure if your boot menu will be overwritten, so make a copy first.

Regarding the iso creation, this link may have a solution for you, I haven't tried, but if you are planing a live CD thingie you may need to take into account that you will be probably needing it to run the whole system from ram so you may need to create a custom initrd.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.