Resize system partion

Hi,
I m new in android building and I need to resize system partition in android nougat.
I have edited BOARD_SYSTEMIMAGE_PARTITION_SIZE in in BoardConfig.mk, the build is ok but I can’t boot.
I think I need to edit partition table but i don’t now how to do that ?

Thanks

What’s the size of your system image? You also need to change the size of system partition.

https://github.com/khadas/linux/blob/khadas-vims-nougat/arch/arm64/boot/dts/amlogic/partition_mbox.dtsi/#L59-L64

My sytem image is 3go so i have this config :

…/device/khadas/kvim2/BoardConfig.mk
BOARD_SYSTEMIMAGE_PARTITION_SIZE=3221225472


…/common/arch/arm64/boot/dts/amlogic/partition_mbox.dtsi
system:system
{
pname = “system”;
size = <0x0 0xC0000000>;
mask = <1>;
};

But when i can’t burn update.img, i’m get “Writting system partition [KO]”

You can try to flash your VIM2 on windows with USB Upgrade Tool. Also provide the printing log on console for me. Thanks!

I have try with windows. This is the log of USB Burning Tool , it is what you whant ?

[11:40:05 073][HUB1-3][Inf]-------------Download meson1.dtb-----------
[11:40:05 074][HUB1-3][Inf]–0-7-0-16
[11:40:05 074][HUB1-3][Inf]–Enc(0xadfc318c)
[11:40:05 078][HUB1-3][Inf]-- download mem dtb normal 46477
[11:40:05 078][HUB1-3][Inf]–Send download command success
[11:40:05 092][HUB1-3][Inf]–Read command status success
[11:40:05 103][HUB1-3][Inf]–Transfer complete
[11:40:05 104][HUB1-3][Inf]–Send download get_status command succeed
[11:40:05 108][HUB1-3][Inf]–get_status success
[11:40:05 619][HUB1-3][Inf]-------------ERASE FLASH-----------
[11:40:05 619][HUB1-3][Inf]–disk_initial 1
[11:40:05 620][HUB1-3][Inf]–Send command success
[11:40:06 441][HUB1-3][Inf]–Read command status success
[11:40:06 441][HUB1-3][Inf]-------------Download _aml_dtb.PARTITION-----------
[11:40:06 443][HUB1-3][Inf]–0-7-0-16
[11:40:06 443][HUB1-3][Inf]–download store _aml_dtb normal 46477
[11:40:06 443][HUB1-3][Inf]–Send download command success
[11:40:06 457][HUB1-3][Inf]–Read command status success
[11:40:06 579][HUB1-3][Inf]–Transfer complete
[11:40:06 580][HUB1-3][Inf]–Send download get_status command succeed
[11:40:06 584][HUB1-3][Inf]–get_status success
[11:40:06 584][HUB1-3][Inf]–verify sha1sum 2647b8b800e4250d60c36c1d2dd1fffe56f038ea
[11:40:06 585][HUB1-3][Inf]–Send verify cmd succeed
[11:40:06 610][HUB1-3][Inf]–Get verify status success
[11:40:07 125][HUB1-3][Inf]-------------Download boot.PARTITION-----------
[11:40:07 127][HUB1-3][Inf]–0-7-0-16
[11:40:07 127][HUB1-3][Inf]–download store boot normal 9312256
[11:40:07 128][HUB1-3][Inf]–Send download command success
[11:40:07 145][HUB1-3][Inf]–Read command status success
[11:40:08 209][HUB1-3][Inf]–Transfer complete
[11:40:08 209][HUB1-3][Inf]–Send download get_status command succeed
[11:40:08 214][HUB1-3][Inf]–get_status success
[11:40:08 214][HUB1-3][Inf]–verify sha1sum b1c6b24cda9a2eea0121b1b340974f1c889c083e
[11:40:08 215][HUB1-3][Inf]–Send verify cmd succeed
[11:40:08 631][HUB1-3][Inf]–Get verify status success
[11:40:09 144][HUB1-3][Inf]-------------Download logo.PARTITION-----------
[11:40:09 146][HUB1-3][Inf]–0-7-0-16
[11:40:09 146][HUB1-3][Inf]–download store logo normal 2456640
[11:40:09 147][HUB1-3][Inf]–Send download command success
[11:40:09 164][HUB1-3][Inf]–Read command status success
[11:40:09 443][HUB1-3][Inf]–Transfer complete
[11:40:09 443][HUB1-3][Inf]–Send download get_status command succeed
[11:40:09 448][HUB1-3][Inf]–get_status success
[11:40:09 448][HUB1-3][Inf]–verify sha1sum 9d20f63ecfd5c645612b48cfb6767b4237563d1a
[11:40:09 449][HUB1-3][Inf]–Send verify cmd succeed
[11:40:09 570][HUB1-3][Inf]–Get verify status success
[11:40:10 078][HUB1-3][Inf]-------------Download recovery.PARTITION-----------
[11:40:10 080][HUB1-3][Inf]–0-7-0-16
[11:40:10 080][HUB1-3][Inf]–download store recovery normal 13565952
[11:40:10 080][HUB1-3][Inf]–Send download command success
[11:40:10 098][HUB1-3][Inf]–Read command status success
[11:40:11 512][HUB1-3][Inf]–Transfer complete
[11:40:11 513][HUB1-3][Inf]–Send download get_status command succeed
[11:40:11 517][HUB1-3][Inf]–get_status success
[11:40:11 517][HUB1-3][Inf]–verify sha1sum ea9e14c709151b8c45b380c3481e5fc77f4b2c50
[11:40:11 518][HUB1-3][Inf]–Send verify cmd succeed
[11:40:12 117][HUB1-3][Inf]–Get verify status success
[11:40:12 618][HUB1-3][Inf]-------------Download system.PARTITION-----------
[11:40:12 619][HUB1-3][Inf]–0-7-0-16
[11:40:12 619][HUB1-3][Inf]–download store system sparse 1966197620
[11:40:12 620][HUB1-3][Inf]–Send download command success
[11:40:12 638][HUB1-3][Inf]–Read command status success
[11:43:34 073]UsbRomDll Return buffer=media error 1 at seq 458736

[11:43:34 086]UsbRomDll Return buffer=media error 1 at seq 458736, resend 1

[11:43:34 099]UsbRomDll Return buffer=media error 1 at seq 458736, resend 2

[11:43:34 111]UsbRomDll Return buffer=media error 1 at seq 458736, resend 3

[11:43:34 112][HUB1-3][Err]–Return buffer=media error 1 at seq 458736, resend 3

[11:43:34 112][HUB1-3][Err]–Download file failed, sequence 28671
[11:43:34 112][HUB1-3][Inf]–Failure : 1, FailureMax : 3
[11:43:34 625]UsbRomDll Return buffer=media error 1 at seq 458736, resend 0

[11:43:34 638]UsbRomDll Return buffer=media error 1 at seq 458736, resend 1

[11:43:34 651]UsbRomDll Return buffer=media error 1 at seq 458736, resend 2

[11:43:34 663]UsbRomDll Return buffer=media error 1 at seq 458736, resend 3

[11:43:34 663][HUB1-3][Err]–Return buffer=media error 1 at seq 458736, resend 3

[11:43:34 664][HUB1-3][Err]–Download file failed, sequence 28671
[11:43:34 664][HUB1-3][Inf]–Failure : 2, FailureMax : 3
[11:43:35 182]UsbRomDll Return buffer=media error 1 at seq 458736, resend 0

[11:43:35 195]UsbRomDll Return buffer=media error 1 at seq 458736, resend 1

[11:43:35 208]UsbRomDll Return buffer=media error 1 at seq 458736, resend 2

[11:43:35 221]UsbRomDll Return buffer=media error 1 at seq 458736, resend 3

[11:43:35 221][HUB1-3][Err]–Return buffer=media error 1 at seq 458736, resend 3

[11:43:35 221][HUB1-3][Err]–Download file failed, sequence 28671
[11:43:35 221][HUB1-3][Inf]–Failure : 3, FailureMax : 3
[11:43:35 234][HUB1-3][Err]–[0x30403003]UBOOT/Partition system/Download buffer/Data tranfer error
[11:43:35 234][HUB1-3][Inf]–Close device handle 0x00000b0c

Can you provide the printing log on console with VIM2 and not burn tool log for me? Did you flash your VIM2 with official ROM successfully?

Yes I can flash official rom and with my rom with original size. The log of vim2 console when flah :

Connecting to /dev/ttyUSB0, speed 115200
Escape character: Ctrl-\ (ASCII 28, FS): enabled
Type the escape character followed by C to get back,
or followed by ? to see other options.


ID[16]

ID[16]
BULKcmd[ echo 12345]
12345
[MSG]ret = 0
[info]success
BULKcmd[ bootloader_is_old]
[info]success
BULKcmd[ erase_bootloader]
[info]success
BULKcmd[ reset]
reboot mode: normal
bl31 reboot reason: 0x100d
bl31 reboot reason: 0x1001
system cmd 1.

GXM:BL1:dc8b51:76f1a5;FEAT:ADFC318C:0;POC:3;RCY:0;EMMC:0;READ:0;0.0;CHK:0;
TE: 170021

BL2 Built : 16:32:58, Nov 3 2017.
gxl gb5491d8 - xiaobo.gu@droid12

set vdd cpu_a to 1120 mv
set vdd cpu_b to 1050 mv
set vddee to 1000 mv
Board ID = 6
CPU clk: 1200MHz
Skip usb!
0.0;
TE: 20418349

BL2 Built : 16:32:58, Nov 3 2017.
gxl gb5491d8 - xiaobo.gu@droid12

set vdd cpu_a to 1120 mv
set vdd cpu_b to 1050 mv
set vddee to 1000 mv
Board ID = 6
CPU clk: 1200MHz
BL2 USB
DQS-corr enabled
DDR scramble enabled
DDR4 chl: Rank0+1 @ 1008MHz
Rank0: 1024MB(auto)-2T-18
Rank1: 1024MB(auto)-2T-18
0.0;
TE: 34061917

BL2 Built : 16:32:58, Nov 3 2017.
gxl gb5491d8 - xiaobo.gu@droid12

set vdd cpu_a to 1120 mv
set vdd cpu_b to 1050 mv
set vddee to 1000 mv
Board ID = 6
CPU clk: 1200MHz
BL2 USB
Load fip header from USB, src: 0x0000c000, des: 0x01400000, size: 0x00004000
New fip structure!
Load bl30 from USB, src: 0x00010000, des: 0x01100000, size: 0x0000d600
Load bl31 from USB, src: 0x00020000, des: 0x05100000, size: 0x0002c600
Load bl33 from USB, src: 0x00050000, des: 0x01000000, size: 0x00056200
NOTICE: BL3-1: v1.0(release):35dd647
NOTICE: BL3-1: Built : 15:20:30, Feb 7 2018
NOTICE: BL31: BL33 decompress pass
mpu_config_enable:ok

[Image: gxl_v1.1.3243-377db0f 2017-09-07 11:28:58 qiufang.dai@droid07]

OPS=0x82

wdt: reset registers!

43 9b 96 83 ce e1 62 9b cb d 55 6 [34.306559 Inits done]

secure task start!
high task start!
low task start!
ERROR: Error initializing runtime service opteed_fast

U-Boot 2015.01-g69eb192 (Jul 12 2018 - 09:46:02)

DRAM: 2 GiB
Relocation Offset is: 76ece000
[MSG]MMC init in usb
aml_priv->desc_buf = 0x0000000073ece640
aml_priv->desc_buf = 0x0000000073ed0960
SDIO Port B: 0, SDIO Port C: 1
InUsbBurn
[MSG]sof
Set Addr 22
Get DT cfg
Get DT cfg
set CFG
tplcmd[download mem dtb normal 0xb58d]
[MSG]Down(mem) part(dtb) sz(0xb58d) fmt(normal)
[MSG]totalSlotNum = 0, nextWriteBackSlot 1
[info]success
[MSG]Burn Start…
[MSG]load dt.img to 0x0000000001000000, sz=0xb58d
[MSG]Burn complete
BULKcmd[download get_status]
[info]success
BULKcmd[ disk_initial 1]
dtb magic edfe0dd0
start dts,buffer=0000000001000000,dt_addr=0000000001000000
parts: 10
00: logo 0000000002000000 1
01: recovery 0000000002000000 1
02: rsv 0000000000800000 1
03: tee 0000000000800000 1
04: crypt 0000000002000000 1
05: misc 0000000002000000 1
06: boot 0000000002000000 1
07: system 00000000c0000000 1
08: cache 0000000020000000 2
09: data ffffffffffffffff 4
emmc/sd response timeout, cmd8, status=0x3ff2800
emmc/sd response timeout, cmd55, status=0x3ff2800
init_part() 293: PART_TYPE_AML
[mmc_init] mmc init success
init_part() 293: PART_TYPE_AML
eMMC/TSD partition table have been checked OK!
check pattern success
switch to partitions #0, OK
mmc1(part 0) is current device
Device: SDIO Port C
Manufacturer ID: 15
OEM: 100
Name: AJNB4
Tran Speed: 52000000
Rd Block Len: 512
MMC version 5.1
High Capacity: Yes
Capacity: 14.6 GiB
mmc clock: 40000000
Bus Width: 8-bit
[store]amlmmc erase 1emmckey_is_protected : protect
start = 0,end = 57343

Caution! Your devices Erase group is 0x400
The erase range would be change to 0x36000~0x1d1efff

start = 221184,end = 30535678
[MSG]usb producing env_relocate
mmc env offset: 0x27400000
*** Warning - bad CRC, using default environment

Saving Environment to aml-storage…
mmc env offset: 0x27400000
Writing to MMC(1)… done
[info]success
tplcmd[download store _aml_dtb normal 0xb58d]
[MSG]Down(store) part(_aml_dtb) sz(0xb58d) fmt(normal)
[MSG]totalSlotNum = 0, nextWriteBackSlot 1
[info]success
[MSG]Burn Start…
[MSG]optimus_download_dtb_image:dataSzReceived=0xb58d
start erase dtb…
start = 81920,end = 82943
dev # 1, , several blocks erased OK
[store]To run cmd[emmc dtb_write 0x0000000007700000 0x40000]
dtb_write()-1140: valid 0
dtb_write()-1160: new stamp 0, checksum 0x82ab1957, version 1, magic A~D
dtb magic edfe0dd0
start dts,buffer=0000000007700000,dt_addr=0000000007700000
dtb magic edfe0dd0
start dts,buffer=0000000007700000,dt_addr=0000000007700000
parts: 10
00: logo 0000000002000000 1
01: recovery 0000000002000000 1
02: rsv 0000000000800000 1
03: tee 0000000000800000 1
04: crypt 0000000002000000 1
05: misc 0000000002000000 1
06: boot 0000000002000000 1
07: system 00000000c0000000 1
08: cache 0000000020000000 2
09: data ffffffffffffffff 4
init_part() 293: PART_TYPE_AML
partition table success
[MSG]Burn complete
BULKcmd[download get_status]
[info]success
tplcmd[download store bootloader normal 0xa8000]
[MSG]Down(store) part(bootloader) sz(0xa8000) fmt(normal)
[MSG]totalSlotNum = 0, nextWriteBackSlot 11
[info]success
[MSG]Burn Start…
mmc switch to boot0 success
mmc switch to boot1 success
mmc switch to user success
[MSG]Burn complete
BULKcmd[download get_status]
[info]success
BULKcmd[ setenv upgrade_step 1]
[MSG]ret = 0
[info]success
BULKcmd[ save]
Saving Environment to aml-storage…
mmc env offset: 0x27400000
Writing to MMC(1)… done
[MSG]ret = 0
[info]success
BULKcmd[ setenv firstboot 1]
[MSG]ret = 0
[info]success
BULKcmd[ save]
Saving Environment to aml-storage…
mmc env offset: 0x27400000
Writing to MMC(1)… done
[MSG]ret = 0
[info]success
BULKcmd[ rpmb_reset]
Unknown command ‘rpmb_reset’ - try ‘help’
[MSG]ret = 1
[info]failed:
BULKcmd[ amlmmc erase data]
emmckey_is_protected : protect
start = 8101888,end = 30535679
[MSG]ret = 0
[info]success
BULKcmd[ nand erase.part data]
Unknown command ‘nand’ - try ‘help’
[MSG]ret = 1
[info]failed:
BULKcmd[ amlmmc erase cache]
emmckey_is_protected : protect
start = 221184,end = 1269759
[MSG]ret = 0
[info]success
BULKcmd[ nand erase.part cache]
Unknown command ‘nand’ - try ‘help’
[MSG]ret = 1
[info]failed:
tplcmd[download store boot normal 0x8e3000]
[MSG]flash LOGIC partCap 0x2000000B
[MSG]Down(store) part(boot) sz(0x8e3000) fmt(normal)
[MSG]totalSlotNum = 0, nextWriteBackSlot 1
[info]success
[MSG]Burn Start…
Downloading %45
Downloading %90
[MSG]Burn complete
BULKcmd[download get_status]
[info]success
tplcmd[download store logo normal 0x29e140]
[MSG]flash LOGIC partCap 0x2000000B
[MSG]Down(store) part(logo) sz(0x29e140) fmt(normal)
[MSG]totalSlotNum = 0, nextWriteBackSlot 1
[info]success
[MSG]Burn Start…
[MSG]Burn complete
BULKcmd[download get_status]
[info]success
tplcmd[download store recovery normal 0xcf1800]
[MSG]flash LOGIC partCap 0x2000000B
[MSG]Down(store) part(recovery) sz(0xcf1800) fmt(normal)
[MSG]totalSlotNum = 0, nextWriteBackSlot 1
[info]success
[MSG]Burn Start…
Downloading %30
Downloading %61
Downloading %92
[MSG]Burn complete
BULKcmd[download get_status]
[info]success
tplcmd[download store system sparse 0x67ca0898]
[MSG]flash LOGIC partCap 0xc0000000B
[MSG]Down(store) part(system) sz(0x67ca0898) fmt(sparse)
[MSG]totalSlotNum = 0, nextWriteBackSlot 1024
[info]success
Downloading %1
Downloading %2
Downloading %3
[MSG]Burn Start…
Downloading %4
Downloading %5
Downloading %6
Downloading %7
Downloading %8
Downloading %9
Downloading %10
Downloading %11
Downloading %12
Downloading %13
Downloading %14
Downloading %15
Downloading %16
Downloading %17
Downloading %18
Downloading %19
Downloading %20
Downloading %21
Downloading %22
Downloading %23
Downloading %24
Downloading %25
Downloading %26
Downloading %27
Downloading %28
Downloading %29
Downloading %30
Downloading %31
Downloading %32
Downloading %33
Downloading %34
Downloading %35
Downloading %36
Downloading %37
Downloading %38
Downloading %39
Downloading %40
Downloading %41
Downloading %42
Downloading %43
Downloading %44
Downloading %45
Downloading %46
Downloading %47
Downloading %48
Downloading %49
Downloading %50
Downloading %51
Downloading %52
Downloading %53
Downloading %54
Downloading %55
Downloading %56
Downloading %57
Downloading %58
Downloading %59
Downloading %60
Downloading %61
Downloading %62
Downloading %63
Downloading %64
Downloading %65
Downloading %66
Downloading %67
Downloading %68
Downloading %69
Downloading %70
Downloading %71
Downloading %72
Downloading %73
Downloading %74
Downloading %75
Downloading %76
Downloading %77
Downloading %78
Downloading %79
Downloading %80
Downloading %81
Downloading %82
Downloading %83
Downloading %84
Downloading %85
Downloading %86
Downloading %87
Downloading %88
Downloading %89
Downloading %90
Downloading %91
Downloading %92
Downloading %93
Downloading %94
Downloading %95
Downloading %96
MMC: block number 0x1d36010 exceeds max(0x1d1f000)
amlmmc cmd failed

store - STORE sub-system

Usage:
store store init flag
store read name addr off|partition size
read ‘size’ bytes starting at offset ‘off’
to/from memory address ‘addr’, skipping bad blocks.
store write name addr off|partition size
write ‘size’ bytes starting at offset ‘off’
to/from memory address ‘addr’, skipping bad blocks.
store rom_write add off size.
write uboot to the boot device
store erase boot/data:
erase the area which is uboot or data
store erase partition <partition_name>:
erase the area which partition in u-boot
store erase dtb
store erase key
store disprotect key
store rom_protect on/off
store scrub off|partition size
scrub the area from offset and size
store dtb iread/read/write addr
read/write dtb, size is optional
store key read/write addr
read/write key, size is optional
store mbr addr
update mbr/partition table by dtb

[burnup]Err:store_write_ops,L110:cmd [store write system 0x78df638 0x370000000 0x2000] failed ERR(…/drivers/usb/gadget/v2_burning/v2_common/optimus_download.c)L239:Fail to write to media, ret = -1
ERR(…/drivers/usb/gadget/v2_burning/v2_common/optimus_simg2img.c)L187:Fail to write to flash, want to write 8192B, but 0B
ERR(…/drivers/usb/gadget/v2_burning/v2_common/optimus_download.c)L256:Fail in parse simg. src 0x00000000076fa260, size 0x4005da0, unParsedDataLen 0x0, ret -188
ERR(…/drivers/usb/gadget/v2_burning/v2_common/optimus_download.c)L575:Fail in optimus_storage_write, data 0x00000000076fa260, wantSz 0x4005da0
ERR(…/drivers/usb/gadget/v2_burning/v2_common/optimus_buffer_manager.c)L242:this burn size 0 <= last left size 23968, data 0x00000000076fa260
ERR(…/drivers/usb/gadget/v2_burning/v2_usb_tool/usb_pcd.c)L821:media error 1 at seq 409584
ERR(…/drivers/usb/gadget/v2_burning/v2_usb_tool/usb_pcd.c)L797:media error 1 at seq 409584, resend 1
ERR(…/drivers/usb/gadget/v2_burning/v2_usb_tool/usb_pcd.c)L797:media error 1 at seq 409584, resend 2

The size of system image is only 0x67ca0898(1.62G). Why did you allocate 3G memory for system partition?

I make some tests and my system partition will grow up and she is sometime biggest than the default partition size. So i need to understand how resize sytem partition and how does it work ! I take 3G to have rounded value highest than the default partition size.

I think you can try to allocate 2.5G memory for system partition. :grinning:

Thanks, work fine with 2.5g with config :

…/device/khadas/kvim2/BoardConfig.mk
BOARD_SYSTEMIMAGE_PARTITION_SIZE=2684354560

…/common/arch/arm64/boot/dts/amlogic/partition_mbox.dtsi
system:system
{
pname = “system”;
size = <0x0 0xA0000000>;
mask = <1>;
};

Do you know what is the probleme with 3g ?