Skip to content

Commit

Permalink
adding swap partition
Browse files Browse the repository at this point in the history
Signed-off-by: rajucm <[email protected]>
  • Loading branch information
rajucm2007 committed Aug 22, 2023
1 parent 0c668d0 commit 5df8c90
Show file tree
Hide file tree
Showing 3 changed files with 194 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
From 024a373cac2c360b32ecd094ccb6b85c5fe55516 Mon Sep 17 00:00:00 2001
From: rajucm <[email protected]>
Date: Tue, 22 Aug 2023 04:38:28 +0000
Subject: [PATCH] gpt_image: add swap partition

Signed-off-by: rajucm <[email protected]>
---
create_gpt_image.py | 3 +++
1 file changed, 3 insertions(+)

diff --git a/create_gpt_image.py b/create_gpt_image.py
index 16ad850..95fd8dc 100755
--- a/create_gpt_image.py
+++ b/create_gpt_image.py
@@ -517,6 +517,8 @@ class TableEntryInfos(object):
'3d69d8477de4'),
'config': ('0fc63daf-8483-4772-8e79-'
'3d69d8477de4'),
+ 'swap': ('0fc63daf-8483-4772-8e79-'
+ '3d69d8477de4'),
'mfos':'4f33cfe4-a0c1-448b-aec4-40f10a0cef3f',
'teedata': '0fc63daf-8483-4772-8e79-3d69d8477de4',
'super': '0fc63daf-8483-4772-8e79-3d69d8477de4',
@@ -872,6 +874,7 @@ class GPTImage(object):
'persistent',
'factory',
'config',
+ 'swap',
'tos',
'mfos',
'teedata',
--
2.39.2

133 changes: 133 additions & 0 deletions bsp_diff/caas/device/intel/mixins/0001-adding-swap-partition.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
From 58a9312fa5e95de4b6b77c7aef4c8b538b6eaafb Mon Sep 17 00:00:00 2001
From: rajucm <[email protected]>
Date: Tue, 22 Aug 2023 03:48:52 +0000
Subject: [PATCH] adding: swap-partition

Signed-off-by: rajucm <[email protected]>
---
groups/swap-partition/default | 1 +
groups/swap-partition/doc.spec | 22 ++++++++++++++++++++++
groups/swap-partition/false/empty_dir | 0
groups/swap-partition/mixinfo.spec | 2 ++
groups/swap-partition/true/flashfiles.ini | 3 +++
groups/swap-partition/true/fstab | 1 +
groups/swap-partition/true/fstab.recovery | 1 +
groups/swap-partition/true/gpt.ini | 7 +++++++
groups/swap-partition/true/init.rc | 13 +++++++++++++
9 files changed, 50 insertions(+)
create mode 120000 groups/swap-partition/default
create mode 100644 groups/swap-partition/doc.spec
create mode 100644 groups/swap-partition/false/empty_dir
create mode 100644 groups/swap-partition/mixinfo.spec
create mode 100644 groups/swap-partition/true/flashfiles.ini
create mode 100644 groups/swap-partition/true/fstab
create mode 120000 groups/swap-partition/true/fstab.recovery
create mode 100644 groups/swap-partition/true/gpt.ini
create mode 100755 groups/swap-partition/true/init.rc

diff --git a/groups/swap-partition/default b/groups/swap-partition/default
new file mode 120000
index 0000000..02e4a84
--- /dev/null
+++ b/groups/swap-partition/default
@@ -0,0 +1 @@
+false
\ No newline at end of file
diff --git a/groups/swap-partition/doc.spec b/groups/swap-partition/doc.spec
new file mode 100644
index 0000000..d8cb8f4
--- /dev/null
+++ b/groups/swap-partition/doc.spec
@@ -0,0 +1,22 @@
+=== Overview
+
+config-partition is used to configure config partition
+
+==== Options
+
+--- true
+this option is used to configure of adding config partition
+
+ --- parameters
+
+ --- code dir
+
+--- false
+this option is used to configure of no need config partition
+
+ --- parameters
+
+ --- code dir
+
+--- default
+when not explicitly selected in mixin spec file, the default option will be used.
diff --git a/groups/swap-partition/false/empty_dir b/groups/swap-partition/false/empty_dir
new file mode 100644
index 0000000..e69de29
diff --git a/groups/swap-partition/mixinfo.spec b/groups/swap-partition/mixinfo.spec
new file mode 100644
index 0000000..849b953
--- /dev/null
+++ b/groups/swap-partition/mixinfo.spec
@@ -0,0 +1,2 @@
+[mixinfo]
+deps = slot-ab vendor-partition
diff --git a/groups/swap-partition/true/flashfiles.ini b/groups/swap-partition/true/flashfiles.ini
new file mode 100644
index 0000000..d8dbf3a
--- /dev/null
+++ b/groups/swap-partition/true/flashfiles.ini
@@ -0,0 +1,3 @@
+[base]
+partitions += swap
+
diff --git a/groups/swap-partition/true/fstab b/groups/swap-partition/true/fstab
new file mode 100644
index 0000000..247de00
--- /dev/null
+++ b/groups/swap-partition/true/fstab
@@ -0,0 +1 @@
+/dev/block/by-name/swap none swap defaults
diff --git a/groups/swap-partition/true/fstab.recovery b/groups/swap-partition/true/fstab.recovery
new file mode 120000
index 0000000..3d46f8d
--- /dev/null
+++ b/groups/swap-partition/true/fstab.recovery
@@ -0,0 +1 @@
+fstab
\ No newline at end of file
diff --git a/groups/swap-partition/true/gpt.ini b/groups/swap-partition/true/gpt.ini
new file mode 100644
index 0000000..51d437f
--- /dev/null
+++ b/groups/swap-partition/true/gpt.ini
@@ -0,0 +1,7 @@
+[base]
+partitions += swap
+
+[partition.swap]
+label = swap
+len = 511
+type = linux-swap
diff --git a/groups/swap-partition/true/init.rc b/groups/swap-partition/true/init.rc
new file mode 100755
index 0000000..f8c5dbe
--- /dev/null
+++ b/groups/swap-partition/true/init.rc
@@ -0,0 +1,13 @@
+# Enable swap partion
+# on boot
+ # Read one page at a time for swap (default is 8)
+# write /proc/sys/vm/page-cluster 0
+
+ # Avoid evicting pages and use zram disk
+# write /proc/sys/vm/swappiness 100
+
+ # Enable disk_based_swap on Chromium kernels
+# write /proc/sys/vm/disk_based_swap 1
+
+# swapon_all /vendor/etc/fstab.${ro.hardware}
+
--
2.39.2

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
From 3d7dc267505e8db7a6fba9b08f73fa6c6b65eeff Mon Sep 17 00:00:00 2001
From: rajucm <[email protected]>
Date: Tue, 22 Aug 2023 04:28:42 +0000
Subject: [PATCH] mixinspec: enable swap-partition

Signed-off-by: rajucm <[email protected]>
---
caas/mixins.spec | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/caas/mixins.spec b/caas/mixins.spec
index 564a542..db9923a 100755
--- a/caas/mixins.spec
+++ b/caas/mixins.spec
@@ -70,7 +70,8 @@ public-libraries: true
device-specific: caas
hdcpd: true
treble: true
-swap: zram_auto(size=1073741824,swappiness=true,hardware=gordon_peak,disk_based_swap=true)
+#swap: zram(size=1073741824,swappiness=true,hardware=caas)
+swap-partition: true
art-config: true
debugfs: true
disk-encryption: true
--
2.39.2

0 comments on commit 5df8c90

Please sign in to comment.