Files
acrn-hypervisor/misc/packaging/acrn-hypervisor.postinst
Hu Fenglin f65a87585b deb-pkg: add acrn-hypervisor and acrn-board-inspector into debian package
1. "make clean && make BOARD=nuc11tnbi5  SCENARIO=shared" will generate the acrn debian package.
 2. "make clean && make board_inspector" will generate the acrn board_inspector debian package

Tracked-On: #6688
Signed-off-by: Hu Fenglin <fenglin.hu@intel.com>
2021-11-02 15:31:18 +08:00

103 lines
2.7 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
#* Copyright (c) 2020 Intel Corporation SPDX-License-Identifier: BSD-3-Clause
# postinst script for acrn-hypervisor
# please NOTE scenario_info/board_info changed by python scripts, so do not add content there!!!
# please NOTE scenario_info/board_info please add in release.json if needed !!!
set -e
#Build info Start
SCENARIO=(shared)
BOARD=(nuc11tnbi5)
#Build info End
ACRNBIN="/boot/acrn.${SCENARIO}.${BOARD}.bin"
type=$(lsblk -l |awk '$NF == "/" {print $1}')
pattern='^/dev/.* UUID="([^"]+)".* PARTUUID="([^"]+)"'
while IFS= read -r line; do
if [[ $line =~ $pattern ]]; then
uuid="${BASH_REMATCH[1]}"
partuuid="${BASH_REMATCH[2]}"
fi
done < <(blkid |grep ext4 |grep ${type})
filename="/etc/grub.d/40_custom"
kernelimg=$(grep module ${filename} | tail -1 || true)
if [ $SCENARIO == shared ];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 $ACRNBIN root=PARTUUID=$partuuid
$kernelimg
}
EOF
elif [ $SCENARIO == hybrid ];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 $ACRNBIN root=PARTUUID=$partuuid
$kernelimg
module2 /boot/zephyr64.elf Zephyr_ElfImage
module2 /boot/ACPI_VM0.bin ACPI_VM0
}
EOF
elif [ $SCENARIO == partitioned ];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
echo 'loading ACRN...'
multiboot2 $ACRNBIN root=PARTUUID=$partuuid
$kernelimg
module2 /boot/ACPI_VM0.bin ACPI_VM0
module2 /boot/ACPI_VM1.bin ACPI_VM1
}
EOF
fi
filename='/etc/default/grub'
sed -i '/GRUB_DEFAULT=/d' ${filename}
sed -i '/GRUB_TIMEOUT=/d' ${filename}
sed -i '/GRUB_HIDDEN_TIMEOUT=/d' ${filename}
sed -i '/GRUB_CMDLINE_LINUX_DEFAULT=/d' ${filename}
sed -i '/GRUB_CMDLINE_LINUX=/d' ${filename}
sed -i '/GRUB_TERMINAL=/d' ${filename}
sed -i '/GRUB_SERIAL_COMMAND=/d' ${filename}
sed -i '$a GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"' ${filename}
sed -i '$a GRUB_TERMINAL="console serial"' ${filename}
sed -i '$a GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"' ${filename}
sed -i '$a GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,115200n8"' ${filename}
sed -i '$a GRUB_DEFAULT=ACRN_deb_multiboot2' ${filename}
sed -i '$a GRUB_TIMEOUT=20' ${filename}
sync
update-grub
exit 0