aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/gemini/image
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2020-07-17 17:01:00 +0200
committerChristian Lamparter <chunkeey@gmail.com>2020-07-31 18:34:40 +0200
commit9e02580d52ef6f2ee1eb38ae4e5977bb6002a552 (patch)
tree7e083971c7d81a5a28736e0c2c4c8eccba494c1a /target/linux/gemini/image
parentcaa6ada969ddf63eb753840fe9fa2acc726e5d57 (diff)
downloadupstream-9e02580d52ef6f2ee1eb38ae4e5977bb6002a552.tar.gz
upstream-9e02580d52ef6f2ee1eb38ae4e5977bb6002a552.tar.bz2
upstream-9e02580d52ef6f2ee1eb38ae4e5977bb6002a552.zip
gemini: Add swap partition to DNS-313
Sometimes when using the DNS-313 memory usage can peak and with a simple swap partition we can avoid running into the roof and invoking the OOM killer. Set this partition to 128MB (twice the size of the memory of the DNS-313). Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'target/linux/gemini/image')
-rwxr-xr-xtarget/linux/gemini/image/dns313_gen_hdd_img.sh20
1 files changed, 13 insertions, 7 deletions
diff --git a/target/linux/gemini/image/dns313_gen_hdd_img.sh b/target/linux/gemini/image/dns313_gen_hdd_img.sh
index 813852232f..d302ca6348 100755
--- a/target/linux/gemini/image/dns313_gen_hdd_img.sh
+++ b/target/linux/gemini/image/dns313_gen_hdd_img.sh
@@ -15,14 +15,20 @@ ROOTFSSIZE="$5"
head=4
sect=63
-# Create two empty partitions followed by the boot partition with
-# the ./boot/zImage and then the rootfs partition.
-set $(ptgen -o $OUTPUT -h $head -s $sect -t 83 -n -p 0 -p 0 -p ${BOOTFSSIZE}M -p ${ROOTFSSIZE}M)
+# Create one empty partitions followed by the swap partition, then the
+# boot partition with the ./boot/zImage and then the rootfs partition.
+# The swap partition with type 82 is 128 MB since the DNS-313 has 64 MB of
+# memory so we assign twice of that as swap.
+# The boot partition must always be the third partition.
+# The user should use the first (blank) partition for user data storage,
+# this will typically be named /dev/sda1
+set $(ptgen -o $OUTPUT -h $head -s $sect -n -t 83 -p 0 -t 82 -p 128M -t 83 -p ${BOOTFSSIZE}M -t 83 -p ${ROOTFSSIZE}M)
-BOOTOFFSET="$(($1 / 512))"
-BOOTSIZE="$(($2 / 512))"
-ROOTFSOFFSET="$(($3 / 512))"
-ROOTFSSIZE="$(($4 / 512))"
+# Swapoffset and swapsize will be $1 and $2
+BOOTOFFSET="$(($3 / 512))"
+BOOTSIZE="$(($4 / 512))"
+ROOTFSOFFSET="$(($5 / 512))"
+ROOTFSSIZE="$(($6 / 512))"
dd bs=512 if="$BOOTFS" of="$OUTPUT" seek="$BOOTOFFSET" conv=notrunc
dd bs=512 if="$ROOTFS" of="$OUTPUT" seek="$ROOTFSOFFSET" conv=notrunc