Skip to content

Commit

Permalink
Merge pull request #639 from AuxXxilium/dev
Browse files Browse the repository at this point in the history
grub: update build script
  • Loading branch information
AuxXxilium authored Oct 30, 2023
2 parents cfddf2a + eb0765a commit 7b98aa4
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions scripts/grub.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

GRUB=${1:-"grub-2.06"}
BIOS=${2:-"i386-pc i386-efi x86_64-efi"}
NAME=${3:-"ARC"}

curl -#kLO https://ftp.gnu.org/gnu/grub/${GRUB}.tar.gz
tar -zxvf ${GRUB}.tar.gz
Expand All @@ -34,40 +35,40 @@ fdisk -l grub.img

LOOPX=$(sudo losetup -f)
sudo losetup -P ${LOOPX} grub.img
sudo mkdosfs -F32 -n ARC1 ${LOOPX}p1
sudo mkfs.ext2 -F -L ARC2 ${LOOPX}p2
sudo mkfs.ext4 -F -L ARC3 ${LOOPX}p3
sudo mkdosfs -F32 -n ${NAME}1 ${LOOPX}p1
sudo mkfs.ext2 -F -L ${NAME}2 ${LOOPX}p2
sudo mkfs.ext4 -F -L ${NAME}3 ${LOOPX}p3

rm -rf ARC1
mkdir -p ARC1
sudo mount ${LOOPX}p1 ARC1
rm -rf ${NAME}1
mkdir -p ${NAME}1
sudo mount ${LOOPX}p1 ${NAME}1

sudo mkdir -p ARC1/EFI
sudo mkdir -p ARC1/boot/grub
sudo mkdir -p ${NAME}1/EFI
sudo mkdir -p ${NAME}1/boot/grub
cat >device.map <<EOF
(hd0) ${LOOPX}
EOF
sudo mv device.map ARC1/boot/grub/device.map
sudo mv device.map ${NAME}1/boot/grub/device.map

for B in ${BIOS}; do
args=""
args+=" ${LOOPX} --target=${B} --no-floppy --recheck --grub-mkdevicemap=ARC1/boot/grub/device.map --boot-directory=ARC1/boot"
args+=" ${LOOPX} --target=${B} --no-floppy --recheck --grub-mkdevicemap=${NAME}1/boot/grub/device.map --boot-directory=${NAME}1/boot"
if [[ "${B}" == *"efi" ]]; then
args+=" --efi-directory=ARC1 --removable --no-nvram"
args+=" --efi-directory=${NAME}1 --removable --no-nvram"
else
args+=" --root-directory=ARC1"
args+=" --root-directory=${NAME}1"
fi
sudo ${GRUB}/${B}/grub-install ${args}
done

if [ -d ARC1/boot/grub/fonts ] && [ -f /usr/share/grub/unicode.pf2 ]; then
sudo cp /usr/share/grub/unicode.pf2 ARC1/boot/grub/fonts
if [ -d ${NAME}1/boot/grub/fonts ] && [ -f /usr/share/grub/unicode.pf2 ]; then
sudo cp /usr/share/grub/unicode.pf2 ${NAME}1/boot/grub/fonts
fi

sudo sync

sudo umount ${LOOPX}p1
sudo losetup -d ${LOOPX}
sudo rm -rf ARC1
sudo rm -rf ${NAME}1

gzip grub.img

0 comments on commit 7b98aa4

Please sign in to comment.