Compare commits

...

5 Commits

Author SHA1 Message Date
Ettore Di Giacinto
a871cfc0c1 Merge pull request #26 from kairos-io/mudler-patch-1
⬆️ Bump livecd configs
2023-03-07 12:45:17 +01:00
Ettore Di Giacinto
a4bad24fa2 ⬆️ Bump livecd configs
Signed-off-by: Ettore Di Giacinto <mudler@users.noreply.github.com>
2023-03-07 12:40:14 +01:00
Venkat Srinivasan
95dd24d549 Merge pull request #25 from kairos-io/lvm-support-for-arm-images
Added optional support to build arm images with oem and recovery partitions as part of LVM
2023-02-27 08:06:48 -08:00
venkatnsrinivasan
8938adbcb9 Added optional support to build arm images with oem and recovery partitions as LVM
Signed-off-by: venkatnsrinivasan <venkat@spectrocloud.com>
2023-02-19 13:33:57 -08:00
mudler
9f5b4e7049 Build also efi.img 2023-02-18 16:10:03 +01:00
3 changed files with 41 additions and 4 deletions

View File

@@ -10,8 +10,8 @@ FROM quay.io/luet/base:$LUET_VERSION AS luet
### 2) populate folders accordingly
## amd64 Live CD artifacts
FROM quay.io/kairos/packages:grub2-livecd-0.0.4 AS grub2
FROM quay.io/kairos/packages:grub2-efi-image-livecd-0.0.4 AS efi
FROM quay.io/kairos/packages:grub2-livecd-0.0.6 AS grub2
FROM quay.io/kairos/packages:grub2-efi-image-livecd-0.0.6 AS efi
## RPI64

View File

@@ -7,12 +7,13 @@ set -ex
load_vars() {
model=${MODEL:-odroid_c2}
use_lvm=${USE_LVM:-false}
directory=${DIRECTORY:-}
output_image="${OUTPUT_IMAGE:-arm.img}"
# Img creation options. Size is in MB for all of the vars below
size="${SIZE:-7544}"
size="${SIZE:-7608}"
state_size="${STATE_SIZE:-4992}"
oem_size="${OEM_SIZE:-64}"
recovery_size="${RECOVERY_SIZE:-2192}"
default_active_size="${DEFAULT_ACTIVE_SIZE:-2400}"
@@ -101,6 +102,7 @@ usage()
echo " --directory: (optional) A directory which will be used for active/passive/recovery system"
echo " --model: (optional) The board model"
echo " --efi-dir: (optional) A directory with files which will be added to the efi partition"
echo " --use-lvm: (optional- no arguments) LVM will be used for the recovery and oem partitions and COS_OEM is enabled"
exit 1
}
@@ -187,6 +189,9 @@ while [ "$#" -gt 0 ]; do
shift 1
repo_type=$1
;;
--use-lvm)
use_lvm=true
;;
-h)
usage
;;
@@ -331,7 +336,11 @@ else
sgdisk -n 1:8192:+16M -c 1:EFI -t 1:0700 ${output_image}
fi
sgdisk -n 2:0:+${state_size}M -c 2:state -t 2:8300 ${output_image}
if [ "$use_lvm" == 'false' ]; then
sgdisk -n 3:0:+${recovery_size}M -c 3:recovery -t 3:8300 ${output_image}
else
sgdisk -n 3:0:+$(( ${recovery_size} + ${oem_size} ))M -c 3:lvm -t 3:8e00 ${output_image}
fi
sgdisk -n 4:0:+64M -c 4:persistent -t 4:8300 ${output_image}
sgdisk -m 1:2:3:4 ${output_image}
@@ -366,12 +375,25 @@ efi=${device}p1
state=${device}p2
recovery=${device}p3
persistent=${device}p4
oem_lv=/dev/mapper/KairosVG-oem
recovery_lv=/dev/mapper/KairosVG-recovery
# Create partitions (RECOVERY, STATE, COS_PERSISTENT)
mkfs.vfat -F 32 ${efi}
fatlabel ${efi} COS_GRUB
if [ "$use_lvm" == 'false' ]; then
mkfs.ext4 -F -L ${RECOVERY_LABEL} $recovery
else
pvcreate $recovery
vgcreate KairosVG $recovery
lvcreate -Z n -n oem -L ${oem_size} KairosVG
lvcreate -Z n -n recovery -l 100%FREE KairosVG
vgchange -ay
vgmknodes
mkfs.ext4 -F -L ${OEM_LABEL} $oem_lv
mkfs.ext4 -F -L ${RECOVERY_LABEL} $recovery_lv
fi
mkfs.ext4 -F -L ${STATE_LABEL} $state
mkfs.ext4 -F -L ${PERSISTENT_LABEL} $persistent
@@ -379,7 +401,11 @@ mkdir $WORKDIR/state
mkdir $WORKDIR/recovery
mkdir $WORKDIR/efi
if [ "$use_lvm" == 'false' ]; then
mount $recovery $WORKDIR/recovery
else
mount $recovery_lv $WORKDIR/recovery
fi
mount $state $WORKDIR/state
mount $efi $WORKDIR/efi
@@ -407,6 +433,9 @@ umount $WORKDIR/recovery
umount $WORKDIR/state
umount $WORKDIR/efi
if [ "$use_lvm" == 'true' ]; then
vgchange -an
fi
sync
# Flash uboot and vendor-specific bits

View File

@@ -33,6 +33,14 @@ ensure_dir_structure() {
done
}
mkdir -p $WORKDIR/tmpefi
# Create the EFI partition FAT16 and include the EFI image and a basic grub.cfg
truncate -s $((20*1024*1024)) bootloader/efi.img
cp -rfv /arm/grub/efi/* $WORKDIR/tmpefi
mkfs.fat -F16 -n COS_GRUB bootloader/efi.img
mcopy -s -i bootloader/efi.img $WORKDIR/tmpefi/EFI ::EFI
mkdir -p ${STATEDIR}/cOS
dd if=/dev/zero of=${STATEDIR}/cOS/active.img bs=1M count=$default_active_size