tmake_qemu_image produces an "almost-bootable" qemu image - libdevuansdk - common library for devuan's simple distro kits (HTM) git clone https://git.parazyd.org/libdevuansdk (DIR) Log (DIR) Files (DIR) Refs (DIR) Submodules (DIR) README (DIR) LICENSE --- (DIR) commit 5787cc14c4ab207fd634919196799bff6e585909 (DIR) parent ad29e93415d6796ea1b0fd07f68827b8fe5fc68a (HTM) Author: KatolaZ <katolaz@yahoo.it> Date: Mon, 13 Jun 2016 00:44:54 +0100 make_qemu_image produces an "almost-bootable" qemu image Diffstat: M doc/README-functions.md | 7 +++++-- M zlibs/customise | 29 +++++++++++++++++++++++++++-- 2 files changed, 32 insertions(+), 4 deletions(-) --- (DIR) diff --git a/doc/README-functions.md b/doc/README-functions.md t@@ -116,4 +116,7 @@ Prints default `/etc/apt/sources.list` # zlibs/customise ## install_default_kernel() -Install the default kernel in the bootstrapped system -\ No newline at end of file +Install the default kernel in the bootstrapped system + +## make_qemu_image() +Make a raw/qcow2 qemu image of workdir +\ No newline at end of file (DIR) diff --git a/zlibs/customise b/zlibs/customise t@@ -56,6 +56,30 @@ install_default_kernel(){ notice "default kernel installed" } +_install_bootloader(){ + fn _install_bootloader $@ + root=$1 + install_dev=$2 + + sudo chroot ${root} apt-get install --assume-yes --no-install-recommends grub-pc + if [[ ! -d ${root}/boot/grub ]]; then + sudo mkdir ${root}/boot/grub + fi + + ztmp + devicemap=$ztmpfile + + + cat > ${devicemap} <<EOF +(hd0) /dev/loop0 +(hd0,1) /dev/loop1 +EOF + sudo cp ${devicemap} ${root}/boot/grub/device.map + sudo chroot ${root} grub-mkconfig -o /boot/grub/grub.cfg + + sudo grub-install --root-directory=${root} --no-floppy \ + --modules="ext2 part_msdos" ${install_dev} +} make_qemu_img(){ t@@ -103,8 +127,9 @@ make_qemu_img(){ sudo rsync -av ${strapdir}/ $mntdir # we now install the grub bootloader - #_install_bootloader $mntdir - + mountdevprocsys ${mntdir} + _install_bootloader $mntdir ${loop1} + umountdevprocsys ${mntdir} sync sudo umount ${mntdir}