2020-07-09 19:02:32 +08:00
|
|
|
#!/bin/bash
|
2022-07-13 09:21:24 +08:00
|
|
|
#* Copyright (c) 2020-2022 Intel Corporation.
|
2020-07-09 19:02:32 +08:00
|
|
|
# postinst script for acrn kernel
|
|
|
|
filename="/etc/grub.d/40_custom"
|
|
|
|
menu=$(grep ACRN_deb_multiboot2 ${filename}) || true
|
|
|
|
type=$(lsblk -l |awk '$NF == "/" {print $1}')
|
|
|
|
str=$(blkid |grep ${type})
|
|
|
|
uuid=$(echo $str |cut -d " " -f 2|cut -d "=" -f 2)
|
|
|
|
str=$(blkid |grep ${type})
|
|
|
|
partuuid=$(echo ${str##*PARTUUID=})
|
|
|
|
if [ -z "$menu" ]
|
|
|
|
then
|
|
|
|
cat>"${filename}"<<EOF
|
|
|
|
#!/bin/sh
|
|
|
|
exec tail -n +3 \$0
|
|
|
|
menuentry 'ACRN multiboot2 ' --id ACRN_deb_multiboot2 {
|
|
|
|
load_video
|
|
|
|
insmod gzio
|
|
|
|
insmod part_gpt
|
|
|
|
insmod ext2
|
|
|
|
search --no-floppy --fs-uuid --set $uuid
|
2021-09-26 22:42:40 +08:00
|
|
|
multiboot2 /boot/acrn.bin root=PARTUUID=$partuuid
|
2020-07-09 19:02:32 +08:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
EOF
|
|
|
|
fi
|
|
|
|
|
|
|
|
sed -i '/module/d' ${filename} || true
|
|
|
|
bzImage=$(cat /boot/version.txt)
|
|
|
|
sed -i '/multiboot2 \/boot/a\module2 /boot/'${bzImage}' Linux_bzImage' ${filename}
|
|
|
|
|
|
|
|
sync
|
|
|
|
update-grub
|