integ/ostree/initramfs-ostree/debian/patches/0002-debian-Add-CentOS-compatible-initial-AIO-partitionin.patch
Jim Somerville 5ca75b073f debian: Make /boot/efi mount as rw
Currently the mount is set to ro in fstab.  This changes
the entry in fstab to be "defaults" which will
make it mount rw on the subsequent reboot.

Why do we need it mounted rw?  Because the grub.cfg file
lives on that filesystem, and we need to change it for
things such as kernel bootargs.

Verification
- install on a virtual machine, check the resulting
fstab entry for otaefi being "defaults"
- ensure that /boot/efi is now mounted rw on the
subsequent reboot

Story: 2009964
Task: 45001

Change-Id: I9bf51b1004dc254b8f33d8fd160e546717e7c9f8
Signed-off-by: Jim Somerville <jim.somerville@windriver.com>
2022-04-08 14:13:25 -04:00

198 lines
7.1 KiB
Diff

From: Robert Church <robert.church@windriver.com>
Date: Sun, 20 Feb 2022 14:50:05 +0800
Subject: debian: Add CentOS compatible initial AIO partitioning/formatting
Add support for initial AIO partitioning and LVM formatting for AIO
hosts.
- Creates platform-backup partition
- Creates default cgts-vg volume group and physical volume
- Creates initial logical volumes for scratch-lv and log-lv
Signed-off-by: Robert Church <robert.church@windriver.com>
Rebase to meta-lat 20220220
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
init-ostree-install.sh | 119 ++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 117 insertions(+), 2 deletions(-)
diff --git a/init-ostree-install.sh b/init-ostree-install.sh
index 5f16ba9..2988ba2 100644
--- a/init-ostree-install.sh
+++ b/init-ostree-install.sh
@@ -85,7 +85,9 @@ OPTIONAL:
BSZ=# - MB size of boot partition
RSZ=# - MB size of root partition
VSZ=# - MB size of var partition (0 for auto expand)
-
+ StarlingX
+ inststx=0 - install StarlingX partitioning
+ personality=aio - StarlingX install personality (aio,con,wor,sto)
EOF
}
@@ -107,7 +109,7 @@ conflict_label() {
local op=$1
local 'label' 'd' 'devs' 'conflict' 'i' 'fstype'
conflict=1
- for label in otaefi otaboot otaboot_b otaroot otaroot_b fluxdata; do
+ for label in otaefi otaboot otaboot_b otaroot otaroot_b fluxdata platform_backup platform_pv; do
devs=$(blkid -t LABEL=$label -o device |grep -v $INSTDEV)
if [ "$devs" != "" ] ; then
i=0
@@ -546,6 +548,8 @@ IP=""
MAX_TIMEOUT_FOR_WAITING_LOWSPEED_DEVICE=60
OSTREE_KERNEL_ARGS=${OSTREE_KERNEL_ARGS=%OSTREE_KERNEL_ARGS%}
KS=""
+INSTSTX=${INSTSTX=""}
+PERSONALITY=${PERSONALITY=""}
if [ "$OSTREE_KERNEL_ARGS" = "%OSTREE_KERNEL_ARGS%" ] ; then
OSTREE_KERNEL_ARGS="ro rootwait"
@@ -642,6 +646,10 @@ read_args() {
RSZ=$optarg ;;
VSZ=*)
VSZ=$optarg ;;
+ inststx=*)
+ INSTSTX=$optarg ;;
+ personality=*)
+ PERSONALITY=$optarg ;;
esac
done
# defaults if not set
@@ -654,6 +662,9 @@ read_args() {
if [ "$INSTGPG" = "" ] ; then INSTGPG=1 ; fi
if [ "$INSTFLUX" = "" ] ; then INSTFLUX=1 ; fi
if [ "$INSTSBD" = "" ] ; then INSTSBD=2 ; fi
+ if [ "$INSTSTX" = "" ] ; then INSTSTX=0 ; fi
+ if [ "$PERSONALITY" = "" ] ; then PERSONALITY=aio ; fi
+
}
shell_start() {
@@ -778,6 +789,40 @@ grub_partition() {
fi
fi
+ ############################################
+ # StarlingX: Temp partitioning compatability
+ if [ "$INSTSTX" = 1 ] ; then
+ if [ "$VSZ" = 0 ] ; then
+ # /var using up the remainder of the disk
+ echo "WARNING WARNING - Can't allocate StarlingX partitions, /var will use the remainder of the disk"
+ else
+ case $PERSONALITY in
+ aio)
+ echo "Allocating StarlingX AIO host partitioning"
+ CGCS_PV_SIZE=183296
+ PLATFORM_BACKUP_SIZE=30000
+
+ grub_pt_update
+ end=$(($first+($PLATFORM_BACKUP_SIZE*1024*1024/$lsz)-1))
+ a="$a -n $p:$first:$end -c $p:platform_backup"
+ grub_pt_update
+ end=$(($first+($CGCS_PV_SIZE*1024*1024/$lsz)-1))
+ a="$a -n $p:$first:$end -c $p:platform_pv -t $p:8E00"
+ ;;
+ con)
+ echo "WARNING WARNING: StarlingX standard controller host partitioning not supported"
+ ;;
+ wor)
+ echo "WARNING WARNING: StarlingX worker host partitioning not supported"
+ ;;
+ sto)
+ echo "WARNING WARNING: StarlingX storage host partitioning not supported"
+ ;;
+ esac
+ fi
+ fi
+ ############################################
+
sgdisk $a -p ${dev}
}
@@ -958,6 +1003,40 @@ if [ -n "${KS}" ]; then
fi
fi
+############################################
+# StarlingX: Clean up the volume group
+if [ "$INSTSTX" = 1 ] ; then
+ if [ "$VSZ" = 0 ] ; then
+ # /var using up the remainder of the disk
+ echo "WARNING WARNING - No volume group info to clean up, /var will use the remainder of the disk"
+ else
+ case $PERSONALITY in
+ aio)
+ echo "AIO: Clean up the volume group so that the disk can be re-partitioned"
+ vgremove -f cgts-vg
+
+ # Find and wipe any existing PVs
+ partitions=$(pvs -o pv_name --noheading | grep -v '\[unknown\]')
+ for p in $partitions
+ do
+ echo "Pre-wiping $p (pvs present)"
+ dd if=/dev/zero of=$p bs=512 count=34
+ dd if=/dev/zero of=$p bs=512 count=34 seek=$((`blockdev --getsz $p` - 34))
+ pvremove -f $p
+ wipefs -a $p
+ done
+ ;;
+ con)
+ ;;
+ wor)
+ ;;
+ sto)
+ ;;
+ esac
+ fi
+fi
+############################################
+
# Early curl exec
if [ "${ECURL}" != "" -a "${ECURL}" != "none" ] ; then
@@ -1161,6 +1240,42 @@ if [ "$BL" = "grub" -a "$INSTFMT" != "0" ] ; then
mkfs.ext4 -F -L fluxdata ${fs_dev}${FLUXPART}
fi
fi
+ ########################################
+ # StarlingX: Temp VG/PV/LV/FS formatting
+ if [ "$INSTSTX" = 1 ] ; then
+ if [ "$VSZ" = 0 ] ; then
+ echo "WARNING WARNING - Skipping StarlingX default LVM storage, /var will use the remainder of the disk"
+ else
+ case $PERSONALITY in
+ aio)
+ echo "Creating StarlingX AIO host default LVM storage"
+ LOG_VOL_SIZE=8000
+ SCRATCH_VOL_SIZE=16000
+
+ pi=$((pi+1))
+ mkfs.ext4 -F -L platform_backup ${fs_dev}${pi}
+
+ pi=$((pi+1))
+ vgcreate --yes --force cgts-vg ${fs_dev}${pi}
+ lvcreate --yes -n log-lv --size "${LOG_VOL_SIZE}MB" cgts-vg
+ mkfs.ext4 -F /dev/cgts-vg/log-lv
+ lvcreate -n scratch-lv --size "${SCRATCH_VOL_SIZE}MB" cgts-vg
+ mkfs.ext4 -F /dev/cgts-vg/scratch-lv
+
+ ;;
+ con)
+ echo "WARNING WARNING: StarlingX standard controller host default LVM storage not supported"
+ ;;
+ wor)
+ echo "WARNING WARNING: StarlingX worker host default LVM storage not supported"
+ ;;
+ sto)
+ echo "WARNING WARNING: StarlingX storage host default LVM storage not supported"
+ ;;
+ esac
+ fi
+ fi
+ ########################################
elif [ "$INSTFMT" != 0 ] ; then
if [ $INSTSF = 1 ] ; then
dosfslabel ${fs_dev}${p1} boot