Skip to content

Commit e3aeecc

Browse files
authored
Merge pull request #2896 from OSInside/allow_setting_oem_systemsize_on_cmdline
Add rd.kiwi.install.systemsize kernel boot option
2 parents 203da3d + da84c2e commit e3aeecc

File tree

2 files changed

+30
-9
lines changed

2 files changed

+30
-9
lines changed

doc/source/building_images/build_expandable_disk.rst

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -379,15 +379,19 @@ oemconfig.oem-swapsize
379379
This value is represented by the ``kiwi_oemswapMB`` variable in the initrd.
380380

381381
oemconfig.oem-systemsize
382-
Specifies the size the operating system is allowed to occupy on the target
382+
Specifies the MB size the operating system is allowed to occupy on the target
383383
disk. The size limit does not include any swap space or recovery partition
384384
considerations. In a setup *without* the systemdisk element, this value
385385
specifies the size of the root partition. In a setup that *includes* the
386-
systemdisk element, this value specifies the size of the LVM partition that
387-
contains all specified volumes. This means that the sum of all specified
388-
volume sizes plus the sum of the specified freespace for each volume must be
389-
smaller than or equal to the size specified with the `oem-systemsize` element. This
390-
value is represented by the variable ``kiwi_oemrootMB`` in the initrd.
386+
systemdisk element when using LVM, this value specifies the size of the LVM
387+
partition that contains all specified volumes. This means that the sum of all
388+
specified volume sizes plus the sum of the specified freespace for each volume
389+
must be smaller than or equal to the size specified with the `oem-systemsize`
390+
element. This value is represented by the variable ``kiwi_oemrootMB`` in the
391+
initrd. The specified value can be dynamically overwritten via the
392+
`rd.kiwi.install.systemsize` kernel boot option. If `rd.kiwi.install.systemsize`
393+
is set to `all` this will unset the size limit and the maximum possible
394+
size applies.
391395

392396
oemconfig.oem-unattended
393397
The installation of the image to the target system occurs

dracut/modules.d/55kiwi-repart/kiwi-repart-disk.sh

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,20 @@ function finalize_disk_repart {
8080
"$(get_partition_node_name "${disk}" "${kiwi_RootPart}")"
8181
}
8282

83+
function get_target_rootpart_size {
84+
declare kiwi_oemrootMB=${kiwi_oemrootMB}
85+
local oemrootMB
86+
oemrootMB=$(getarg rd.kiwi.install.install.systemsize=)
87+
if [ -n "${oemrootMB}" ]; then
88+
if [ "${oemrootMB}" = "all" ];then
89+
kiwi_oemrootMB=""
90+
else
91+
kiwi_oemrootMB="${oemrootMB}"
92+
fi
93+
fi
94+
echo "${kiwi_oemrootMB}"
95+
}
96+
8397
function repart_standard_disk {
8498
# """
8599
# repartition disk with read/write root filesystem
@@ -89,8 +103,9 @@ function repart_standard_disk {
89103
# pX+1: ( root ) [+luks +raid]
90104
# -------------------------------------
91105
# """
92-
declare kiwi_oemrootMB=${kiwi_oemrootMB}
93106
declare kiwi_RootPart=${kiwi_RootPart}
107+
local kiwi_oemrootMB
108+
kiwi_oemrootMB=$(get_target_rootpart_size)
94109
if [ -z "${kiwi_oemrootMB}" ];then
95110
local disk_have_root_system_mbytes=$((
96111
disk_root_mbytes + disk_free_mbytes
@@ -150,8 +165,9 @@ function repart_lvm_disk {
150165
# pX+1: ( LVM ) [+luks +raid]
151166
# -------------------------------------
152167
# """
153-
declare kiwi_oemrootMB=${kiwi_oemrootMB}
154168
declare kiwi_RootPart=${kiwi_RootPart}
169+
local kiwi_oemrootMB
170+
kiwi_oemrootMB=$(get_target_rootpart_size)
155171
if [ -z "${kiwi_oemrootMB}" ];then
156172
local disk_have_root_system_mbytes=$((
157173
disk_root_mbytes + disk_free_mbytes
@@ -198,10 +214,11 @@ function repart_lvm_disk {
198214
}
199215

200216
function check_repart_possible {
201-
declare kiwi_oemrootMB=${kiwi_oemrootMB}
202217
local disk_root_mbytes=$1
203218
local disk_free_mbytes=$2
204219
local min_additional_mbytes=$3
220+
local kiwi_oemrootMB
221+
kiwi_oemrootMB=$(get_target_rootpart_size)
205222
if [ -n "${kiwi_oemrootMB}" ];then
206223
if [ "${kiwi_oemrootMB}" -lt "${disk_root_mbytes}" ];then
207224
# specified oem-systemsize is smaller than root partition

0 commit comments

Comments
 (0)