diff mbox series

[1/2] generate_ptable.sh add swap-8g (aosp + 1.5GB of swap)

Message ID 1502928911-3220-1-git-send-email-john.stultz@linaro.org
State New
Headers show
Series [1/2] generate_ptable.sh add swap-8g (aosp + 1.5GB of swap) | expand

Commit Message

John Stultz Aug. 17, 2017, 12:15 a.m. UTC
From: Mark Salyzyn <salyzyn@google.com>


Partition Name  Block Device  Size blocks & bytes  Start block
vrl         /dev/block/mmcblk0p1     2048 1MB        2048
vrl_backup  /dev/block/mmcblk0p2     2048 1MB        4096
mcuimage    /dev/block/mmcblk0p3     2048 1MB        6144
fastboot    /dev/block/mmcblk0p4    16384 8MB        8192
nvme        /dev/block/mmcblk0p5     4096 2MB       24576
---- below differs from aosp-8g ----
boot        /dev/block/mmcblk0p6   131072 64MB      28672
cache       /dev/block/mmcblk0p7   524288 256MB    159744
swap        /dev/block/mmcblk0p8  3145728 1.5GB    684032
system      /dev/block/mmcblk0p9 3145728 1.5GB   3829760
userdata    /dev/block/mmcblk0p10 8294367 4.0GB   6975488

If flashing over from aosp-8g with flashall, make sure cache is
flashed first since it changed location and would otherwise be
untouched. userdata image is constructed correctly for the smaller
with: make TARGET_WITH_SWAP=true.

Test: manual flash ptable and flashall -w, hikey boots.
Bug: 38446744
Change-Id: Ib27f4d8ab9c756f220bc7da049e550e6c7d46dfc
---
 hikey/BoardConfig.mk        |  6 +++++-
 l-loader/Makefile           |  2 +-
 l-loader/generate_ptable.sh | 27 ++++++++++++++++++++++++++-
 3 files changed, 32 insertions(+), 3 deletions(-)

-- 
2.7.4
diff mbox series

Patch

diff --git a/hikey/BoardConfig.mk b/hikey/BoardConfig.mk
index 7844ecb..b490a1f 100644
--- a/hikey/BoardConfig.mk
+++ b/hikey/BoardConfig.mk
@@ -17,10 +17,14 @@  BOARD_KERNEL_CMDLINE += printk.devkmsg=on
 TARGET_NO_DTIMAGE := true
 
 BOARD_SYSTEMIMAGE_PARTITION_SIZE := 1610612736
-ifeq ($(TARGET_USERDATAIMAGE_4GB), true)
+ifeq ($(TARGET_USERDATAIMAGE_4GB), true) # to build for aosp-4g partition table
 BOARD_USERDATAIMAGE_PARTITION_SIZE := 1595915776
 else
+ifeq ($(TARGET_WITH_SWAP), true) # to build for swap-8g partition table
+BOARD_USERDATAIMAGE_PARTITION_SIZE := 4246715904
+else
 BOARD_USERDATAIMAGE_PARTITION_SIZE := 5588893184
 endif
+endif
 BOARD_CACHEIMAGE_PARTITION_SIZE := 268435456
 BOARD_FLASH_BLOCK_SIZE := 131072
diff --git a/l-loader/Makefile b/l-loader/Makefile
index 93afcd1..692cd82 100644
--- a/l-loader/Makefile
+++ b/l-loader/Makefile
@@ -4,7 +4,7 @@  CFLAGS=-march=armv7-a
 LD=$(CROSS_COMPILE)ld
 OBJCOPY=$(CROSS_COMPILE)objcopy
 BL1=bl1.bin
-PTABLE_LST:=aosp-4g aosp-8g linux-4g linux-8g
+PTABLE_LST:=aosp-4g aosp-8g linux-4g linux-8g swap-8g
 
 all: l-loader.bin ptable.img
 
diff --git a/l-loader/generate_ptable.sh b/l-loader/generate_ptable.sh
index 3bc232e..80254f8 100755
--- a/l-loader/generate_ptable.sh
+++ b/l-loader/generate_ptable.sh
@@ -4,6 +4,7 @@ 
 # tiny: for testing purpose.
 # aosp: 10 entries (same as linux with userdata).
 # linux: 9 entries (same as aosp without userdata).
+# swap: 10 entries (similar to aosp, drop reserved, 1.5G of swap).
 
 PTABLE=${PTABLE:-aosp}
 SECTOR_SIZE=512
@@ -16,7 +17,7 @@  case ${PTABLE} in
   aosp-4g|linux-4g)
     SECTOR_NUMBER=7471104
     ;;
-  aosp-8g|linux-8g)
+  aosp-8g|linux-8g|swap-8g)
     SECTOR_NUMBER=15269888
     ;;
 esac
@@ -78,6 +79,30 @@  case ${PTABLE} in
     #[9: system: 590M-End]
     sgdisk -n -E -t 9:8300 -u 9:FC56E345-2E8E-49AE-B2F8-5B9D263FE377 -c 9:"system" ${TEMP_FILE}
     ;;
+  swap*)
+    dd if=/dev/zero of=${TEMP_FILE} bs=${SECTOR_SIZE} count=${SECTOR_NUMBER}
+    sgdisk -U 2CB85345-6A91-4043-8203-723F0D28FBE8 -v ${TEMP_FILE}
+    #[1: vrl: 1M-2M]
+    sgdisk -n 1:0:+1M -t 1:0700 -u 1:496847AB-56A1-4CD5-A1AD-47F4ACF055C9 -c 1:"vrl" ${TEMP_FILE}
+    #[2: vrl_backup: 2M-3M]
+    sgdisk -n 2:0:+1M -t 2:0700 -u 2:61A36FC1-8EFB-4899-84D8-B61642EFA723 -c 2:"vrl_backup" ${TEMP_FILE}
+    #[3: mcuimage: 3M-4M]
+    sgdisk -n 3:0:+1M -t 3:0700 -u 3:65007411-962D-4781-9B2C-51DD7DF22CC3 -c 3:"mcuimage" ${TEMP_FILE}
+    #[4: fastboot: 4M-12M]
+    sgdisk -n 4:0:+8M -t 4:EF02 -u 4:496847AB-56A1-4CD5-A1AD-47F4ACF055C9 -c 4:"fastboot" ${TEMP_FILE}
+    #[5: nvme: 12M-14M]
+    sgdisk -n 5:0:+2M -t 5:0700 -u 5:00354BCD-BBCB-4CB3-B5AE-CDEFCB5DAC43 -c 5:"nvme" ${TEMP_FILE}
+    #[6: boot: 14M-78M]
+    sgdisk -n 6:0:+64M -t 6:EF00 -u 6:5C0F213C-17E1-4149-88C8-8B50FB4EC70E -c 6:"boot" ${TEMP_FILE}
+    #[7: cache: 78M-384M]
+    sgdisk -n 7:0:+256M -t 7:8301 -u 7:A092C620-D178-4CA7-B540-C4E26BD6D2E2 -c 7:"cache" ${TEMP_FILE}
+    #[8: swap: 384M-1920M]
+    sgdisk -n 8:0:+1536M -t 8:8200 -u 8:FC56E344-2E8E-49AE-B2F8-5B9D263FE377 -c 8:"swap" ${TEMP_FILE}
+    #[9: system: 1920M-3556M]
+    sgdisk -n 9:0:+1536M -t 9:8300 -u 9:FC56E345-2E8E-49AE-B2F8-5B9D263FE377 -c 9:"system" ${TEMP_FILE}
+    #[10: userdata: 3556M-End]
+    sgdisk -n -E -t 10:8300 -u 10:064111F6-463B-4CE1-876B-13F3684CE164 -c 10:"userdata" -p ${TEMP_FILE}
+    ;;
 esac
 
 # get the main and the backup parts of the partition table