aboutsummaryrefslogtreecommitdiffstats
path: root/common/mentor-swupdate/recipes-core/initrdscripts/files/0003-init-install-efi-deploy-kernel-images-as-imageA.patch
blob: c417da6c02485c7c6554c803828c85d566b48c9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
From 5c72bcb27e0d0528abde7e03700a210f38200046 Mon Sep 17 00:00:00 2001
From: Awais Belal <awais_belal@mentor.com>
Date: Sat, 12 Jan 2019 01:22:14 +0500
Subject: [PATCH 3/7] init-install-efi: deploy kernel images as imageA

With a single boot partition we keep two copies of
kernel to support the AB approach so deploy kernels
as imageA on scratch installation.

Signed-off-by: Awais Belal <awais_belal@mentor.com>
---
 init-install-efi.sh | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/init-install-efi.sh b/init-install-efi.sh
index 6e713ba..8905cfa 100644
--- a/init-install-efi.sh
+++ b/init-install-efi.sh
@@ -286,9 +286,9 @@ mkdir -p $EFIDIR
 # Copy the efi loader
 cp /run/media/$1/EFI/BOOT/*.efi $EFIDIR
 
+GRUBCFG="$EFIDIR/grub.cfg"
 if [ -f /run/media/$1/EFI/BOOT/grub.cfg ]; then
     root_part_uuid=$(blkid -o value -s PARTUUID ${rootfs1})
-    GRUBCFG="$EFIDIR/grub.cfg"
     cp /run/media/$1/EFI/BOOT/grub.cfg $GRUBCFG
     # Update grub config for the installed image
     # Delete the install entry
@@ -324,8 +324,13 @@ umount /tgt_root
 # Copy kernel artifacts. To add more artifacts just add to types
 # For now just support kernel types already being used by something in OE-core
 for types in bzImage zImage vmlinux vmlinuz fitImage; do
+    # MEL - SWUpdate - copy all kernel images as <image>A, this is our first copy
     for kernel in `find /run/media/$1/ -name $types*`; do
-        cp $kernel /boot
+        kernel_name=$(basename $kernel)
+        cp $kernel /boot/${kernel_name}A
+        if [ -e $GRUBCFG ]; then
+            sed -i "s/\/${kernel_name} /\/${kernel_name}A /" $GRUBCFG
+        fi
     done
 done
 
-- 
2.11.1