1
0
mirror of https://github.com/MichielDerhaeg/build-linux.git synced 2025-09-02 20:52:36 +02:00

did lots of work

This commit is contained in:
Michiel Derhaeg
2016-08-06 10:08:36 +02:00
parent c66748b657
commit 517586891e
8 changed files with 53 additions and 19 deletions

View File

@@ -5,10 +5,12 @@ if [[ $(id -u) -ne 0 ]]; then
exit 1
fi
rm -f mdos.img
fallocate -l 100M mdos.img
echo -e "o\nn\n\n\n\n\nw\n" | fdisk mdos.img
loopdevice="$(losetup -P --show -f mdos.img)"
image=mdos.img
rm -f $image
fallocate -l 100M $image
echo -e "o\nn\n\n\n\n\nw\n" | fdisk $image
loopdevice="$(losetup -P --show -f $image)"
looppart=${loopdevice}p1
mkfs.ext4 $looppart
@@ -16,9 +18,18 @@ mkdir -p mountdir
mount $looppart mountdir
cd mountdir
tar --xattrs -xpf ../fs.tar
grub-install --target=i386-pc --boot-directory="$PWD/boot/grub" $loopdevice
grub-install --target=i386-pc --boot-directory="$PWD/boot" $loopdevice
cd ..
## generate grub.cfg (since linux 3.8 32-bit MBR "NT disk signatures" are allowed)
uuid=$(fdisk -l $image | grep "Disk identifier" | cut -d " " -f 3 | cut --complement -c 1,2)-01
echo -e "linux /boot/bzImage root=PARTUUID=$uuid\nboot" > "mountdir/boot/grub/grub.cfg"
umount mountdir
sync
rm -rf mountdir
losetup -d $loopdevice
if [[ -n $SUDO_UID ]]; then
chown $SUDO_UID:$SUDO_GID $image
fi