From: Sebastian Pipping Date: Tue, 4 Aug 2015 11:09:29 +0000 (+0200) Subject: Ensure that MBR jumping to GRUB's core.img code X-Git-Tag: v0.74~5 X-Git-Url: https://git.grml.org/?p=grml-debootstrap.git;a=commitdiff_plain;h=8a2c5525b227e8f09e3b068236eebf619eae5393 Ensure that MBR jumping to GRUB's core.img code Previously, bootgrub.mksh took that job but we just resolved it. New approach based as done on [1] but with copying 440 bytes only (rather than 446), to keep existing disk identifier in place [2]. [1] http://pete.akeo.ie/2014/05/compiling-and-installing-grub2-for.html [2] https://en.wikipedia.org/wiki/Master_boot_record#Sector_layout --- diff --git a/grml-debootstrap b/grml-debootstrap index 0feed2a..322c931 100755 --- a/grml-debootstrap +++ b/grml-debootstrap @@ -1191,8 +1191,9 @@ if [[ -z "${GRUB}" ]] || ! dd if="${GRUB}" bs=512 count=1 2>/dev/null | cat -v | cp -a "${MNTPOINT}"/usr/lib/grub/i386-pc "${MNTPOINT}/boot/grub/" ;; esac + dd if="${MNTPOINT}/usr/lib/grub/i386-pc/boot.img" of="${ORIG_TARGET}" conv=notrunc bs=440 count=1 chroot "${MNTPOINT}" grub-mkimage -O i386-pc -p "(hd0,msdos1)/boot/grub" -o /tmp/core.img biosdisk part_msdos ext2 - dd if="${MNTPOINT}/tmp/core.img" of="${ORIG_TARGET}" conv=notrunc seek=4 + dd if="${MNTPOINT}/tmp/core.img" of="${ORIG_TARGET}" conv=notrunc seek=1 rm -f "${MNTPOINT}/tmp/core.img" fi