[yocto] [meta-raspberrypi][PATCH] wic: add swap partition and set /root and /swap size

Hongxu Jia hongxu.jia at windriver.com
Wed Nov 13 22:04:10 PST 2019


- Add swap partition to workaround memory limitation

- Support to set /root and /swap size, 4G /root and 1G /swap by default

Signed-off-by: Hongxu Jia <hongxu.jia at windriver.com>
---
 conf/machine/include/rpi-base.inc                           | 5 ++++-
 wic/{sdimage-raspberrypi.wks => sdimage-raspberrypi.wks.in} | 3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)
 rename wic/{sdimage-raspberrypi.wks => sdimage-raspberrypi.wks.in} (75%)

diff --git a/conf/machine/include/rpi-base.inc b/conf/machine/include/rpi-base.inc
index 36a8daf..de2f366 100644
--- a/conf/machine/include/rpi-base.inc
+++ b/conf/machine/include/rpi-base.inc
@@ -6,7 +6,10 @@ SOC_FAMILY = "rpi"
 include conf/machine/include/soc-family.inc
 
 IMAGE_FSTYPES ?= "tar.bz2 ext3 rpi-sdimg"
-WKS_FILE ?= "sdimage-raspberrypi.wks"
+
+PI_WKS_ROOT_SIZE ?= "--size=4096M --overhead-factor 1"
+PI_WKS_SWAP_SIZE ?= "--size=1024M --overhead-factor 1"
+WKS_FILE ?= "sdimage-raspberrypi.wks.in"
 
 XSERVER = " \
     xserver-xorg \
diff --git a/wic/sdimage-raspberrypi.wks b/wic/sdimage-raspberrypi.wks.in
similarity index 75%
rename from wic/sdimage-raspberrypi.wks
rename to wic/sdimage-raspberrypi.wks.in
index 01fbaea..81707c7 100644
--- a/wic/sdimage-raspberrypi.wks
+++ b/wic/sdimage-raspberrypi.wks.in
@@ -3,4 +3,5 @@
 # Raspberry Pi. Boot files are located in the first vfat partition.
 
 part /boot --source bootimg-partition --ondisk mmcblk0 --fstype=vfat --label boot --active --align 4096 --size 20
-part / --source rootfs --ondisk mmcblk0 --fstype=ext4 --label root --align 4096
+part / --source rootfs --ondisk mmcblk0 --fstype=ext4 --label root --align 4096 ${PI_WKS_ROOT_SIZE}
+part swap --ondisk mmcblk0 --size 44 --label swap --fstype=swap ${PI_WKS_SWAP_SIZE}
-- 
2.17.1



More information about the yocto mailing list