[elbe-devel] [PATCH v2 7/8] init preseed.cfg.mako: support swap partition

Torben Hohn torben.hohn at linutronix.de
Tue May 8 17:10:45 CEST 2018


big qt pbuilder builds need swap, because they need more than 3GB of memory.

obey new swap-size field, and make partman generate a swap partition.
infos on partman-auto/expert_recipe syntax obtained from:
https://www.bishnet.net/tim/blog/2015/01/29/understanding-partman-autoexpert_recipe/

we want to specify the minimum size of the swap paritition. the rest of
the HD is allocated to the RFS. Use size_to_int() and divide by (1024 * 1024)
because values are specified in MiB.

Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
---
 elbepack/init/preseed.cfg.mako | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/elbepack/init/preseed.cfg.mako b/elbepack/init/preseed.cfg.mako
index 1751fc1f..0a8bfc8c 100644
--- a/elbepack/init/preseed.cfg.mako
+++ b/elbepack/init/preseed.cfg.mako
@@ -5,6 +5,10 @@
 ##
 ## SPDX-License-Identifier: GPL-3.0-or-later
 ##
+<%
+  from elbepack.filesystem import size_to_int
+  swap = size_to_int(prj.text('swap-size', default=defs, key='swap-size')) / 1024 / 1024
+%>
 d-i keyboard-configuration/layoutcode string us
 d-i keyboard-configuration/xkb-keymap select us
 
@@ -30,7 +34,11 @@ d-i clock-setup/utc boolean true
 d-i partman-auto/method string regular
 d-i partman-auto/choose_recipe select buildenv
 d-i partman-auto/disk string /dev/vda
-d-i partman-auto/expert_recipe string buildenv :: 256 1000000 -1 ext3 $primary{ } $bootable{ } method{ format } format{ } use_filesystem{ } filesystem{ ext3 } mountpoint{ / } .
+d-i partman-auto/expert_recipe string buildenv :: \
+%if swap != 0:
+  ${swap} ${swap} ${swap} linux-swap $primary{ } method{ swap } format{ } . \
+%endif
+256 1000000 -1 ext3 $primary{ } $bootable{ } method{ format } format{ } use_filesystem{ } filesystem{ ext3 } mountpoint{ / } .
 d-i partman/partitioning/confirm_write_new_label boolean true
 d-i partman/confirm_write_new_label boolean true
 d-i partman/choose_partition select Finish partitioning and write changes to disk
-- 
2.11.0




More information about the elbe-devel mailing list