Site Tools


repartitioninternalstorage

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
repartitioninternalstorage [2012/10/05 12:40] fly-awayrepartitioninternalstorage [2012/10/05 16:03] fly-away
Line 1: Line 1:
-DELETEME 
- 
 ====== Repartition Internal Storage ====== ====== Repartition Internal Storage ======
  
 +<HTML>
 +<span style="color:red;font-size:120%;">Warning! Use this instruction at you own risk! <br/>
 +You should definitly know what are you doing <br/>
 +All data on you internal mmc will be lost if you follow this instruction! <br/>
 +Also you cannot install Android on the new layout.
 +</span>
 +</HTML>
 +==== Backup ====
 +[[backups|First backup everything]] if you care.
  
-In the latest kernel the tegra partition tables are supported. No need to alter the table the complicated way. +====Default partition layout:==== 
- +^ part # ^ name ^ size ^ description ^ remarks | 
- +^ 2 | BCT | 3 145 728 (3 MB| boot config table |   | 
-[[backups|BACKUP EVERY PARTITION AND THE PARTITION TABLE]] +^ 3 | PT | 524 288 (512 kB) | partition table |   | 
- +^ 4 | EBT | 2 097 152 (2 MB) | bootloader |   | 
-Altering the layout of the storage is a really intrusive thing and might lead to point of no return. If you are not sure what to do or how to do it in detail go on and ask before you flash it or let it be. +^ 5 | SOS | 5 242 880 (5 MB| recovery partition |   | 
-All values from files and in commands are specific to my device and actions, which is also true for generalized values. +^ 6 | LNX | 8 388 608 (8 MB| linux kernel and initrd | kernel starts at 0x800 initrd starts at 0x20E800 | 
- +^ 7 | MBR | 1 048 576 (1 MB| master boot record |   | 
- +^ 8 | APP | 314 572 800 (300 MB) | applications (/system) |   | 
-IF ANYTHING GOES WRONG: +^ 9 | CAC | 419 430 400 (400 MB) | cache (/cache) |   | 
-<code> +^ 10 | MSC | 2 097 152 (2 MB) | misc (/misc) |   | 
-nvflash --bct orginal.bct --setbct --configfile cfg/real.cfg --bl fastboot.bin --go +^ 11 | EM1 | 524 288 (512 kB) |     | 
-nvflash --resume ... +^ 12 | UBA | 1 294 991 360 (1235 MB| user data (/data) |   | 
-</code> +^ 13 | EM2 | 524 288 (512 kB) |     | 
- +^ 14 | UDB | 5 950 144 512 (5674.5 MB) depends on model | user data (/storage) |
-Note that you need the orginal.bct and real.cfg therefor +
- +
-==== Step 1Prepare the files ==== +
- +
-real.cfg (attached, see links below) +
-IMPORTANT you need it for resetting partition table to factory but if you have the partition table you can create it afterwards +
- +
-retrieve the partition table with nvflash +
-you can use my real.cfg as a sample for AC100-10V +
-alter the section size in bytes according to your layout and size +
- +
-altered.cfg (attached), layout recommendations +
-change real.cfg according to your needs and save it under a new name +
-I would highly recommendto keep the partitions BCT, PT, EBT in size and start point since at least EBT seems to be the hardcoded bootloader section and cannot be altered at the moment +
-if you experience something different let everyone know +
-in my case I sacrificed SOS as a place for my new MBR (see my altered.cfgbe aware that you cannot "dual boot" with this layout +
-another fixed point is the position of LNX although you can alter its size +
-as you can see in my altered.cfg I chose to name my big partition RT and kept it as last you can add partitions as you like here +
-be aware that the sizes are multiples of 2048 +
- +
-change type of partition 4 (EBTin altered.cfg +
-[partition] +
-name=EBT +
-id=4 +
-type=data +
-... +
- +
-be warnedthis part may seem strange since you expect a valid layout to contain a bootloader but with a bootloader section nvflash will fail hence you will never be able to write a layout with a type=bootloader section to the device +
- +
-copy fastboot.stock.bin from the directory prebuilt to nvflash und ther new name fastboot.bin that it can be send with the --create command wheere it is needed for the filename=fastboot.bin part of EBT +
-since in every sample file of L4T I found this part I decided to keep it in my aswell +
-TODO test if it is possible to send other backup files directly with --create to be more efficient and have a proper verification +
- +
- +
-fastboot.bin +
-nvflash will require fastboot.bin in current folder, so copy it from linux4tegra/prebuid like that: +
-<code> +
-[root@pc nvflash]# ln -s../prebuilt/fastboot.stock.bin ./fastboot.bin +
-orginal.bct +
-the orginal bct file is the first 4080bytes of Partition 2 +
-dd if=backup_part-2.img bs=1 count=4080 of=orginal.bct +
-<code>+
  
-I noticed that with hexdump -C original.bct everytime the second line ( offset 0x20 ) has to star like '01 00 02 00' which seems a good point of verification+==== Repartitioning ==== 
 +Download partition table [[http://ac100.wikispaces.com/file/view/part.cfg|part.cfg]]
  
-==== Step 2: creating the new partition ====+and command file in same dir 
 +<file bash repartition.sh> 
 +#!/bin/bash
  
-IMPORTANT since this alters the partition table it could really mess everything up so be warned +# Change this paths to you own 
-make sure you have backups of every partition AND a partition table+nvflash=~/ac100/ldk/bootloader/nvflash 
 +fastboot=~/ac100/ldk/bootloader/harmony/fastboot.bini
  
-double check and execute +$nvflash --bl $fastboot --sync || exit 1
-<code>./nvflash --bct orginal.bct --setbct --bl fastboot.bin --configfile altered.cfg --create --verifypart ---go</code>+
  
-OUTPUT is like that:+mkdir work 
 +cd work 
 +echo -n "Making a backup .." 
 +for i in $(seq 2 6) 
 +do 
 +    $nvflash -r -q --read $i part$i.img || exit 1 
 +done 
 +echo " Done"
  
-<code> +read -p "Press [Enter] key when device rebooted to new recovery mode ..." 
-Nvflash started +echo -n "Creating new layout .." 
-rcm version 0X20001 +dd if=part2.img bs=count=4080 of=original.bct 
-System Information: +ln -s $fastboot fastboot.bin 
-chip name: t20 +$nvflash --bl $fastboot --bct original.bct --setbct --configfile ../part.cfg --create --verifypart -1 --go|| exit 
-chip id: 0x20 major: minor: 2 +echo " Done"
-chip sku: 0x8 +
-chip uid: 0x161c10c4432132d7 +
-macrovision: disabled +
-hdcp: enabled +
-sbk burned: false +
-dk burned: false +
-boot device: emmc +
-operating mode: 3 +
-device config strap: +
-device config fuse: 0 +
-sdram config strap: 1+
  
-sending file: orginal.bct +read -p "Press [Enter] key when device rebooted to new recovery mode ..." 
-- 4080/4080 bytes sent +echo "Restoring backup .." 
-orginal.bct sent successfully +$nvflash --bl $fastboot --sync || exit 1 
-downloading bootloader -- load address: 0x108000 entry point: 0x108000 +$nvflash -r -q --rawdevicewrite 0 1536 part2.img 
-sending file: fastboot.bin +$nvflash -r -q --rawdevicewrite 1792 1024 part4.img 
-931920/931920 bytes sent +$nvflash -r -q --download 5 part5.img 
-fastboot.bin sent successfully +$nvflash -r -q --download part6.img --go 
-waiting for bootloader to initialize +echo " Done" 
-bootloader downloaded successfully +</file>
-setting device: 2 3 +
-creating partition: BCT +
-creating partition: PT +
-creating partition: EBT +
-creating partition: MBR +
-creating partition: LNX +
-creating partition: RT +
-Formatting partition 2 BCT please wait.. done! +
-Formatting partition 3 PT please wait.. done! +
-Formatting partition 4 EBT please wait.. done! +
-Formatting partition 7 MBR please wait.. done! +
-Formatting partition LNX please wait.. done! +
-Formatting partition 8 RT please wait.. done! +
-done! +
-Enabling verification for partition ID = 4... +
-sending file: fastboot.bin +
-| 931920/931920 bytes sent +
-fastboot.bin sent successfully +
-Verifying partition ID = 4...Please wait!! +
-Verification successful!! +
-VERIFICATION COMPLETE.... +
-</code> +
-==== Step 3: I altered it and now? ====+
  
-first I would get the new partition table with --getpartitiontable take a look at it and compare it to your original partition table 
-BCT, PT, EBT must not be altered and LNX should start at the same offset 
-after that back it up 
-the next step was always for me to restore partition-4 ( EBT ) back to the device 
  
-after that you can turn on your device it should show you the familiar Toshiba Logo +You should power on you device in recovery mode and connect it to the computer via USB.\\ 
-if it doesn't something is wrong with either your layout ( BCT, PT, EBT altered?) or the rewriting of the bootloader +Then run **repartition.sh**\\ 
-the worst experience I had was ./nvflash --bl fastboot.bin ..being rejected after a --create because of a faulty bootloader section ( see "If anything goes wrong" ) +While repartion you also need to reboot ac100 in recovery mode twice when script ask you for this.\\
-install a distro but keep in mind: +
-you have to alter the kernel image you write to LNX: +
-Alter the commandline +
-my original was '... tegrapart=recovery:300:a00:800,boot:d00:1000:800,mbr:1d00:200:800,system:1f00:10032964:800' +
-I altered to the following 'tegrapart=mbr:300:a00:800,boot:d00:8000,system:8d00:3b0b00' +
-scheme explained name:offset:length:blocksize +
-IMPORTANT: in linux you will only see everything after mbr imho if you choose a wrong location here I assume linux will just write there +
-as you can see my cmd line now starts with the mbr because it is the first partition for me after EBT ( I sacrificed SOS for it ) +
-the offset 0x300 is for the first partition after EBT I havn't changed that +
-I kept the size of 0xa00 for MBR that LNX can start at its good old position but as you can see I grew LNX to the size of 0x8000 +
-the last part is RT my big root partition with the calculated values ( boot offset + boot length == system offset ... ) +
-as you can see I have two devices after MBR (LNX==boot and RT==system) which will show up in linx as /dev/mmcblk0p1 and mmcblk0p2 +
-Alter the initrd +
-if something gets mounted e. g. in init you may have to change the device name +
-create a kernel image with those changes and hopefully+
  
 +====Resulting layout====
 +^ part # ^ name ^ size ^ description ^ remarks |
 +^ 2 | BCT | 3 145 728 (3 MB) | boot config table |   |
 +^ 3 | PT | 524 288 (512 kB) | partition table |   |
 +^ 4 | EBT | 2 097 152 (2 MB) | bootloader |   |
 +^ 5 | SOS | 5 242 880 (5 MB) | recovery partition |   |
 +^ 6 | LNX | 8 388 608 (8 MB) | linux kernel and initrd | kernel starts at 0x800 initrd starts at 0x20E800 |
 +^ 7 | MBR | 1 048 576 (1 MB) | master boot record |   |
 +^ 8 | APP | ALL AVAILABLE | / |   |
  
repartitioninternalstorage.txt · Last modified: 2012/10/05 16:07 by fly-away