Skip to content

Commit 72c99c0

Browse files
leiluwenlingz
authored andcommitted
doc: update gsg and acrn_quick_setup.sh
1. From Clear Linux 31030, we could use kernel-iot-lts2018-sos kernel command line as Service OS kernel command line directly, so update the setps and codes to set the Service OS kernel command line. 2. Command "swupd verfiy" and the flag "-m" is superseded, use "swupd repair" and the flag "-V" instead 3. As UOS is launched by OVMF, the old steps and code to set up UOS does not work on Clear Linux 31030, update its related steps and code. 4. Update install Clear Linux steps. 5. Fix some small issues. Signed-off-by: Lei, Lu <leix.lu@intel.com>
1 parent e7d048b commit 72c99c0

File tree

2 files changed

+163
-180
lines changed

2 files changed

+163
-180
lines changed

doc/getting-started/acrn_quick_setup.sh

Lines changed: 26 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ skip_download_uos=0
4141
# switcher for disabling reboot device
4242
disable_reboot=0
4343

44-
# acrn.conf path
45-
acrn_conf_path=/usr/share/acrn/samples/nuc/acrn.conf
4644
# acrn.efi path
4745
acrn_efi_path=/usr/lib/acrn/acrn.efi
4846

@@ -60,8 +58,6 @@ function upgrade_sos()
6058

6159
# Check EFI path exists.
6260
[[ ! -b $efi_partition ]] && echo "Please set the right EFI System partition firstly." && exit 1
63-
efi_mount_point=`findmnt $efi_partition -n | cut -d' ' -f1`
64-
root_partition=`echo $efi_partition | sed 's/1$/3/g'`
6561
partition=`echo $efi_partition | sed 's/1$//g;s/p$//g'`
6662

6763
echo "Disable auto update..."
@@ -72,25 +68,17 @@ function upgrade_sos()
7268
echo "Clear Linux version $sos_ver is already installed. Continuing to setup SOS..."
7369
else
7470
echo "Upgrading Clear Linux version from $VERSION_ID to $sos_ver ..."
75-
swupd verify --fix --picky -m $sos_ver 2>/dev/null
71+
swupd repair --picky -V $sos_ver 2>/dev/null
7672
fi
7773

7874
# Do the setups if previous process succeed.
7975
if [[ $? -eq 0 ]]; then
80-
echo "Adding the service-os, kernel-iot-lts2018 and systemd-networkd-autostart bundles..."
81-
swupd bundle-add service-os kernel-iot-lts2018 systemd-networkd-autostart 2>/dev/null
76+
echo "Adding the service-os and systemd-networkd-autostart bundles..."
77+
swupd bundle-add service-os systemd-networkd-autostart 2>/dev/null
8278

8379
mount $efi_partition /mnt
8480
echo "Add /mnt/EFI/acrn folder"
8581
mkdir -p /mnt/EFI/acrn
86-
echo "Copy $acrn_conf_path /mnt/loader/entries/"
87-
if [[ ! -f $acrn_conf_path ]]; then
88-
echo "Missing acrn.conf file in folder: $acrn_conf_path"
89-
umount /mnt && sync
90-
exit 1
91-
fi
92-
cp -r $acrn_conf_path /mnt/loader/entries/
93-
if [[ $? -ne 0 ]]; then echo "Fail to copy $acrn_conf_path" && exit 1; fi
9482
echo "Copy $acrn_efi_path to /mnt/EFI/acrn"
9583
if [[ ! -f $acrn_efi_path ]]; then
9684
echo "Missing acrn.efi file in folder: $acrn_efi_path"
@@ -101,7 +89,7 @@ function upgrade_sos()
10189
if [[ $? -ne 0 ]]; then echo "Fail to copy $acrn_efi_path" && exit 1; fi
10290
echo "Check ACRN efi boot event"
10391
check_acrn_bootefi=`efibootmgr | grep ACRN`
104-
if [[ "$check_arcn_bootefi" -ge "ACRN" ]]; then
92+
if [[ "$check_acrn_bootefi" -ge "ACRN" ]]; then
10593
echo "Clean all ACRN efi boot event"
10694
efibootmgr | grep ACRN | cut -d'*' -f1 | cut -d't' -f2 | xargs -i efibootmgr -b {} -B >/dev/null
10795
fi
@@ -115,38 +103,22 @@ function upgrade_sos()
115103
echo "Add new ACRN efi boot event"
116104
efibootmgr -c -l "\EFI\acrn\acrn.efi" -d $partition -p 1 -L "ACRN" >/dev/null
117105

118-
echo "Create loader.conf"
119-
mv /mnt/loader/loader.conf /mnt/loader/loader.conf.bck && touch /mnt/loader/loader.conf
120-
echo "Add default (5 seconds) boot wait time"
121-
echo "timeout 5" > /mnt/loader/loader.conf
122-
echo "Add default boot to ACRN"
123-
echo "default acrn" >> /mnt/loader/loader.conf
124-
125106
new_kernel=`ls /mnt/EFI/org.clearlinux/*sos* -tl | grep kernel | head -n1 | awk -F'/' '{print $5}'`
107+
new_kernel=${new_kernel#kernel-}
126108
echo "Getting latest Service OS kernel version: $new_kernel"
127-
cur_kernel=`cat /mnt/loader/entries/acrn.conf | sed -n 2p | cut -d'/' -f4`
128-
echo "Getting current Service OS kernel version: $cur_kernel"
129-
130-
echo "Replacing root partition uuid in acrn.conf"
131-
sed -i "s/<UUID of rootfs partition>/`blkid -s PARTUUID -o value $root_partition`/g" /mnt/loader/entries/acrn.conf
132-
# test replacing succeed or not.
133-
if [[ -z `grep $(blkid -s PARTUUID -o value $root_partition) /mnt/loader/entries/acrn.conf` ]]; then
134-
echo "Fail to replace root uuid in this file: /mnt/loader/entries/acrn.conf"
135-
exit 1
136-
fi
137109

138-
if [[ "$cur_kernel" == "$new_kernel" ]]; then
139-
echo "No need to replace kernel conf info"
140-
else
141-
echo "Replace with new SOS kernel in acrn.conf"
142-
sed -i "s/$cur_kernel/$new_kernel/g" /mnt/loader/entries/acrn.conf
143-
fi
110+
echo "Add default (5 seconds) boot wait time."
111+
clr-boot-manager set-timeout 5 || { echo "Faild to add default boot wait time" && exit 1; }
112+
clr-boot-manager update
113+
114+
echo "Set $new_kernel as default boot kernel."
115+
clr-boot-manager set-kernel $new_kernel || { echo "Fail to set $new_kernel as default boot kernel." && exit 1; }
144116

145117
echo "Service OS setup done!"
146118
else
147119
echo "Fail to upgrade SOS to $sos_ver."
148120
echo "Please try upgrade SOS with this command:"
149-
echo "swupd update -m $sos_ver"
121+
echo "swupd update -V $sos_ver"
150122
exit 1
151123
fi
152124

@@ -198,10 +170,20 @@ function upgrade_uos()
198170
fi
199171

200172
echo "Get UOS image: $uos_img"
201-
uos_partition=`losetup -f -P --show $uos_img`p3
202-
mount $uos_partition /mnt
203-
[[ $? -ne 0 ]] && echo "Fail to mount UOS partition" && exit 1
204-
cp -r /usr/lib/modules/"`readlink /usr/lib/kernel/default-iot-lts2018 | awk -F '2018.' '{print $2}'`.iot-lts2018" /mnt/lib/modules
173+
uos_loop_device=`losetup -f -P --show $uos_img`
174+
175+
mount ${uos_loop_device}p3 /mnt || { echo "Fail to mount UOS rootfs partition" && exit 1; }
176+
mount ${uos_loop_device}p1 /mnt/boot || { echo "Fail to mount UOS EFI partition" && exit 1; }
177+
178+
echo "Install kernel-iot-lts2018 to $uos_img"
179+
swupd bundle-add --path=/mnt kernel-iot-lts2018 || { echo "Fail to install kernel-iot-lts2018" && exit 1; }
180+
181+
echo "Configure kernel-ios-lts2018 as $uos_img default boot kernel"
182+
uos_kernel_conf=`ls -t /mnt/boot/loader/entries/ | grep Clear-linux-iot-lts2018 | head -n1`
183+
uos_kernel=${uos_kernel_conf%.conf}
184+
echo "default $uos_kernel" > /mnt/boot/loader/loader.conf
185+
186+
umount /mnt/boot
205187
umount /mnt
206188
sync
207189

0 commit comments

Comments
 (0)