Files
acrn-hypervisor/misc/packaging/acrn-kernel.postinst
2020-07-20 11:44:07 +08:00

53 lines
1.6 KiB
Bash

#!/bin/bash
#* Copyright (c) 2020 Intel Corporation All rights reserved.
# 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
multiboot2 /boot/acrn.bin root=PARTUUID=$partuuid i915.modeset=0 video=efifb:off
}
menuentry 'ACRN efi' --id ACRN_deb_efi {
recordfail
load_video
insmod gzio
insmod part_gpt
insmod ext2
linux /boot/kernelimg pci_devices_ignore=(0:18:1) console=tty0 console=ttyS0 root=PARTUUID=$partuuid rw rootwait ignore_loglevel no_timer_check consoleblank=0 i915.nuclear_pageflip=1 i915.avail_planes_per_pipe=0x01010F i915.domain_plane_owners=0x011111110000 i915.enable_gvt=1 i915.enable_guc=0 hvlog=2M@0xE00000
}
EOF
fi
sed -i '/module/d' ${filename} || true
bzImage=$(cat /boot/version.txt)
sed -i '/multiboot2 \/boot/a\module2 /boot/'${bzImage}' Linux_bzImage' ${filename}
str=$(grep hvlog=2M@0xE00000 ${filename} || true)
old=${str%pci*}
echo $old
bzImage=$(cat /boot/version.txt)
new=$(echo linux \/boot\/${bzImage})
echo $new
sed -i "s:$old:$new :" ${filename}
sync
update-grub