Switch from extlinux to grub as USB bootloader
This commit is contained in:
parent
9f751541bb
commit
3da224d93b
@ -215,7 +215,7 @@ if [ "$?" != "0" ]; then
|
||||
errorAndExit $"Error:"" \"parted\" "$"exit with error (see $LOGFILE)"
|
||||
fi
|
||||
# EFI partition
|
||||
sudo parted -s -a optimal -- $SELECT_USB mkpart primary hfs+ 0 20M &>>$LOGFILE
|
||||
sudo parted -s -a optimal -- $SELECT_USB mkpart primary hfs+ 1M 20M &>>$LOGFILE
|
||||
if [ "$?" != "0" ]; then
|
||||
errorAndExit $"Error:"" \"parted\" "$"exit with error (see $LOGFILE)"
|
||||
fi
|
||||
@ -282,7 +282,7 @@ mkdir -p $MOUNTDIR_EFI/EFI/BOOT/
|
||||
grub-mkimage -o $MOUNTDIR_EFI/EFI/BOOT/bootx64.efi -O x86_64-efi -p /efi/boot \
|
||||
part_gpt part_msdos ntfs ntfscomp hfsplus fat ext2 normal chain boot linux echo \
|
||||
help gfxterm gettext png efi_gop efi_uga search search_label search_fs_uuid || {
|
||||
errorAndExit $"Error: unable to create GRUB x86_64-efi image"
|
||||
errorAndExit $"Error: unable to create GRUB x86_64-efi image" &>>$LOGFILE
|
||||
}
|
||||
|
||||
# 32bit EFI optional because untested and curently missing in x86_64 arch
|
||||
@ -290,7 +290,7 @@ if [ -d /usr/lib/grub/i386-efi ]; then
|
||||
grub-mkimage -o $MOUNTDIR_EFI/EFI/BOOT/bootia32.efi -O i386-efi -p /efi/boot \
|
||||
part_gpt part_msdos ntfs ntfscomp hfsplus fat ext2 normal chain boot linux echo \
|
||||
help gfxterm gettext png efi_gop efi_uga search search_label search_fs_uuid || {
|
||||
errorAndExit $"Error: unable to create GRUB i386-efi image"
|
||||
errorAndExit $"Error: unable to create GRUB i386-efi image" &>>$LOGFILE
|
||||
}
|
||||
fi
|
||||
|
||||
@ -336,19 +336,9 @@ else
|
||||
mount -o loop $SELECT_ISO $ISOMOUNTDIR || {
|
||||
errorAndExit $"Error: unable to mount ISO image"
|
||||
}
|
||||
|
||||
mkdir boot
|
||||
cp $ISOMOUNTDIR/boot/{initrd*,vmlinuz*} boot/
|
||||
cp $ISOMOUNTDIR/boot/isolinux/* boot/
|
||||
mv boot/isolinux.cfg boot/extlinux.conf
|
||||
sed -i "s|root=[^[:space:]]*|root=live:/openmamba_live/openmamba-live.iso|" boot/extlinux.conf
|
||||
for f in /usr/share/syslinux/{libcom32,libutil,vesamenu}.c32; do
|
||||
if [ -r $f ]; then
|
||||
cp $f boot/ || errorAndExit $"Error: can't copy bootloader file(s) to /boot directory"
|
||||
fi
|
||||
done
|
||||
rm -f boot/isolinux*
|
||||
umount $ISOMOUNTDIR
|
||||
rmdir $ISOMOUNTDIR
|
||||
|
||||
# basic extlinux.conf -> grub.cfg conversion
|
||||
echo "search --no-floppy --label --set=root openmamba_live" > $MOUNTDIR_EFI/EFI/BOOT/grub.cfg
|
||||
@ -371,8 +361,13 @@ else
|
||||
CURR_BRACKET_OPEN=0
|
||||
;;
|
||||
esac
|
||||
done < boot/extlinux.conf
|
||||
done < $ISOMOUNTDIR/boot/isolinux/isolinux.cfg
|
||||
[ "$CURR_BRACKET_OPEN" = "1" ] && echo "}" >> $MOUNTDIR_EFI/EFI/BOOT/grub.cfg
|
||||
|
||||
mkdir boot/grub
|
||||
cp $MOUNTDIR_EFI/EFI/BOOT/grub.cfg boot/grub/grub.cfg
|
||||
umount $ISOMOUNTDIR
|
||||
rmdir $ISOMOUNTDIR
|
||||
fi
|
||||
set_pbar 85
|
||||
|
||||
@ -381,14 +376,16 @@ TARGET_ARCH=`cat $MOUNTDIR/etc/openmamba-release | sed "s|.*for \(.*\) .*|\1|"`
|
||||
[ "$TARGET_ARCH" ] || ARCH=i586
|
||||
|
||||
if [ "$TARGET_ARCH" = "x86_64" ]; then
|
||||
hfs-bless $MOUNTDIR_EFI_MAC/EFI/BOOT/bootia32.efi
|
||||
hfs-bless $MOUNTDIR_EFI_MAC/EFI/BOOT/bootia32.efi &>>$LOGFILE
|
||||
else
|
||||
hfs-bless $MOUNTDIR_EFI_MAC/EFI/BOOT/bootx64.efi
|
||||
hfs-bless $MOUNTDIR_EFI_MAC/EFI/BOOT/bootx64.efi &>>$LOGFILE
|
||||
fi
|
||||
|
||||
set_status $"Writing bootloader..."
|
||||
echo $"Writing bootloader..."
|
||||
sudo extlinux --install boot
|
||||
sudo grub-install --removable --boot-directory boot/ $SELECT_USB &>>$LOGFILE || {
|
||||
errorAndExit $"Error: failed to install bootloader into device (${SELECT_USB})"
|
||||
}
|
||||
set_pbar 90
|
||||
|
||||
popd >/dev/null
|
||||
@ -397,18 +394,18 @@ set_pbar 95
|
||||
|
||||
set_status $"Unmount usb device"
|
||||
echo $"Unmount usb device"
|
||||
LANG=C udisksctl unmount -b ${SELECT_USB1} || {
|
||||
LANG=C udisksctl unmount -b ${SELECT_USB1} &>>$LOGFILE || {
|
||||
errorAndExit $"Error: fail to umount the usb key (${SELECT_USB1})"
|
||||
}
|
||||
LANG=C udisksctl unmount -b ${SELECT_USB2} || {
|
||||
LANG=C udisksctl unmount -b ${SELECT_USB2} &>>$LOGFILE || {
|
||||
errorAndExit $"Error: fail to umount the usb key (${SELECT_USB2})"
|
||||
}
|
||||
LANG=C udisksctl unmount -b ${SELECT_USB3} || {
|
||||
LANG=C udisksctl unmount -b ${SELECT_USB3} &>>$LOGFILE || {
|
||||
errorAndExit $"Error: fail to umount the usb key (${SELECT_USB3})"
|
||||
}
|
||||
|
||||
# WARNING: calling install-mbr after unmounting to prevent problems of FAT since EFI partition introduction
|
||||
sudo install-mbr $SELECT_USB
|
||||
## WARNING: calling install-mbr after unmounting to prevent problems of FAT since EFI partition introduction
|
||||
#sudo install-mbr $SELECT_USB &>>$LOGFILE
|
||||
|
||||
set_pbar 100
|
||||
exit_frontend ""
|
||||
|
Loading…
Reference in New Issue
Block a user