[Dev] Research on native ext4 partition - Gen9 Android Development

* Update * - 02/28/2012
I had a little chat with one of Archos dev, he told me that mmcblk0p3 was his gift for us!
So, what does it mean:
1) Archos is very developer friendly. We've known that already, but having them leaving us such entries in their tablet is very nice to see!
2) He told me that mmcblk0p3 isn't and won't be used by Archos firmware, we're completely free to use it like we want with SDE
3) With this partition, we can do very nice things, see below
Here is what can be done:
1) delete p3 and p4
2) recreate p3 as extended with any size we want
3) recreate p4 with what remains.
4) on extended p3, we can create p5, p6, ...
I did that on mine, I now have a 8 MB p5 for cwmod, a 380M p6 for rootfs+system, without any interference with stock firmware!
If someone wants to experiment with that, few advices:
- Be careful when you re-create p3 and p4, there is an empty space that should remain empty in the partition table (it contains bootloader). So when you recreate p3, you have to use the same start sector as before, not the one proposed by default.
- When you re-create p4, make sure that you use end of p3 + 1 as start for the same reason.
- Don't do fdisk if you have partition mounted, it would confuse kernel and could be dangerous. You need a specific initramfs to be able to do that.
- This is still very dangerous, be warned! invalid partition table and your tablet is toaster. Only change it if you know exactly what you're doing
As a sample, here is my current partition table:
Code:
Disk /dev/block/mmcblk0: 7457 MB, 7457472512 bytes
4 heads, 16 sectors/track, 227584 cylinders
Units = cylinders of 64 * 512 = 32768 bytes
Device Boot Start End Blocks Id System
/dev/block/mmcblk0p1 5 1605 51200+ 83 Linux
/dev/block/mmcblk0p2 1605 10760 292969+ 83 Linux
/dev/block/mmcblk0p3 10760 22967 390625+ 5 Extended
/dev/block/mmcblk0p4 22967 227584 6547764 83 Linux
/dev/block/mmcblk0p5 10760 11004 7813 83 Linux
/dev/block/mmcblk0p6 11004 22967 382796+ 83 Linux
------------
Previous text:
Hello All,
As I saw some interest in running firmware directly from ext4 partition, I'd like to share what I found out while I was toying with my tablet:
Having ext4 on gen9 is not as easy as gen8: gen8 has two virtual mmcs on top of a single physical mmc with a split managed at kernel level. So what was done was to reduce storage partition to add ext4 system and/or data partition. More, on gen8, SDE exports storage mmc as a disk to the host allowing resizing partitions in linux for instance.
We can't do that on Gen9: Gen9 has a single physical mmc, part 1 is rawfs, part 2 is system and too short to have unpacked system, part 3 is a very small unused small one, part 4 is data.
On top of part 4, there is an Archos specific trick that remaps /data/media to /storage, explaining why we don't have the same limit on data partition and that /data and /storage are sharing same space. And SDE doesn't export disk.
BIG WARNING BEFORE TRYING ANYTHING: DON'T TOUCH PARTITION 1, NEVER. If partition 1 is trashed or damaged, device is bricked definitively.
So, what is possible is to trash part 2, 3, 4 and re-create a different layout or trash part 4, create two or three extended partitions instead.
If you go option 1, it would have to be done completely from an initrd as you would kill the os you're running on . Option two could be done from adb if Android is properly stopped, but I didn't test it and don't know if kernel and/or Android are behaving well with extended partitions.
Personally, I did it a third way, I modified archos recovery: recovery has a special code that repartition disk if things goes very bad. I changed partition layout builded there, then trashed my partitions and go to recovery to have it re-created. This method has advantages, the partition layout is permanent, meaning that if for some reason I trash one partition it will be re-created with the right size.
However, it has many disadvantages: You have to be able to flash rawfs to be able to flash a recovery, and it's a bit hectic and dangerous to force the partition re-creation. That's why I didn't share it and probably won't as you really need to know what you're doing if you don't want a big brick.
Last thing, I didn't see that much improvement in speed compared to other methods like having a loopback on internal storage, not sure it's really worth the effort and the risks. I did it because I don't like loopbacks, but frankly, having it done safely is much efforts.

Good post.
Thanks for the information

it is great

Hi letama,
interesting thread again
letama said:
Having ext4 on gen9 is not as easy as gen8: gen8 has two virtual mmcs on top of a single physical mmc with a split managed at kernel level. So what was done was to reduce storage partition to add ext4 system and/or data partition. More, on gen8, SDE exports storage mmc as a disk to the host allowing resizing partitions in linux for instance.
Click to expand...
Click to collapse
Nothing to add...
I found out that a second mbr is placed at the beginning of the "virtual" mmc block device 1. So the internal eMMC chip of the Gen8 devices additionally requires a special layout.
letama said:
We can't do that on Gen9: Gen9 has a single physical mmc, part 1 is rawfs, part 2 is system and too short to have unpacked system, part 3 is a very small unused small one, part 4 is data.
Click to expand...
Click to collapse
Going down to hardware level, it seems that Archos went back to use raw NAND flashes instead of eMMC for the Gen9 devices.
I found a FCC document of the Archos 80 G9 showing one 8GByte NAND flash device placed on the mainboard.
Could be a prototype as well...
Additionally it could be possible, that the mtd block layout is already handled inside bootcode.
Anyway, what does a cat /proc/partitions print out?
Regards,
scholbert

/proc/partitions:
Code:
major minor #blocks name
7 0 159412 loop0
179 0 7282688 mmcblk0
179 1 51200 mmcblk0p1
179 2 195359 mmcblk0p2
179 3 7840 mmcblk0p3
179 4 7028160 mmcblk0p4

Hi Scholbert,
scholbert said:
interesting thread again
Click to expand...
Click to collapse
Thanks!
scholbert said:
Nothing to add...
I found out that a second mbr is placed at the beginning of the "virtual" mmc block device 1. So the internal eMMC chip of the Gen8 devices additionally requires a special layout.
Click to expand...
Click to collapse
Well, kind of, it's not really a special layout. From userspace linux point of view, the two virtual mmcs are regular disks, they could be formatted, partitioned, etc.
The mmc driver is doing all the "magic" (mmc_block.split kernel command line parameter):
- for virtual mmc0, virtual sector is mapped to physical sector 0 - split
- for virtual mmc1, virtual sector is mapped to physical sector split - end.
So, the second mbr is coming from a regular disk initialization, nothing special.
scholbert said:
Going down to hardware level, it seems that Archos went back to use raw NAND flashes instead of eMMC for the Gen9 devices.
Click to expand...
Click to collapse
We're still eMMC afaik.
scholbert said:
Additionally it could be possible, that the mtd block layout is already handled inside bootcode.
Click to expand...
Click to collapse
No, gen9 has regular partition scheme, I was able to repartition it without problem... The only difficulty is to do it without killing the device by accident as if you want to keep the 4 partitions layout, you have to kill system and data (and data means also internal storage) partitions, be sure that you don't kill rawfs partition in the process then rebuild them.
Nothing very complicated per se, I would do a ram only initrd with backup of system/data/storage via adb or on microsd. However, as microsd slot is not completely stable for me, the fullly automated option is a bit risky.
My /proc/partitions is this now
Code:
major minor #blocks name
179 0 7282688 mmcblk0
179 1 51200 mmcblk0p1
179 2 439487 mmcblk0p2
179 3 7840 mmcblk0p3
179 4 6784032 mmcblk0p4

Hi Letama,
I see you have modify your part scheme but mmcblk0p2 is your android root part (like loop img) ?
You have rewrite your bootloader ? or just android kernel/initramfs (not SDE kernel/initramfs) ?
Have a nice day !
Thaolia

Hi Tha0lia,
Yes, my p2 is now rootfs+system, it's the content of the img, but directly on the partition, formatted as ext4.
No, it's not the bootloader, bootloader doesn't know anything about partition layout.
Like I explained, I did it by patching the recovery as it will recreate partitions if it detects if a partition is missing. Then, I deleted my system and data partition, rebooted in recovery to have it recreate the whole disk. Last was to modify SDE/Main kernel initrd to mount this partition instead of the loopback device.
You can't do this if you don't have a tool to flash recovery/main kernel. I wrote one, but as it's very dangerous for the tablet, I'm reluctant to let it out.
Back on the subject, this is something that could be done with sde only with a properly written initrd. The only downside is that if for some reason recovery detects a partition problem, it will revert to the old layout, but it should work. The other downside is that "stock boot" on main kernel will only work if you dedicate enough space to hold both the squashfs and the rootfs files. Mine doesn't have too as I modified also stock boot, but again, to do that, you need to flash rawfs init file and special flasher.
I don't have enough time (and energy, enough formats these days ) to do the SDE initrd right now, we'll see if someone takes the baby and if it's really worth it.

Woaw ! Good work ! Thanks for the complementary informations.
So my hack ("abcbox reboot_into -s sde" at boot) is more secure than flash rawfs if i have understood well.
Last question (sry ^^"), but do you have made a serial connection with your tablet for debugging or dev your rawfs flasher ?

letama said:
Well, kind of, it's not really a special layout. From userspace linux point of view, the two virtual mmcs are regular disks, they could be formatted, partitioned, etc.
The mmc driver is doing all the "magic" (mmc_block.split kernel command line parameter):
- for virtual mmc0, virtual sector is mapped to physical sector 0 - split
- for virtual mmc1, virtual sector is mapped to physical sector split - end.
So, the second mbr is coming from a regular disk initialization, nothing special.
Click to expand...
Click to collapse
Yeah sure, i just wanted to point at that mbr...
letama said:
We're still eMMC afaik.
Click to expand...
Click to collapse
Considering the device names it seems eMMC is used, makes sense as this is newer/better technology.
Maybe the FCC doc is of interested.
See attachment... on this device a NAND flash (H27UCG8UDA) is used.
This is definitely raw NAND.
So maybe this is a pre-series model...
letama said:
No, gen9 has regular partition scheme, I was able to repartition it without problem... The only difficulty is to do it without killing the device by accident as if you want to keep the 4 partitions layout, you have to kill system and data (and data means also internal storage) partitions, be sure that you don't kill rawfs partition in the process then rebuild them.
Nothing very complicated per se, I would do a ram only initrd with backup of system/data/storage via adb or on microsd. However, as microsd slot is not completely stable for me, the fullly automated option is a bit risky.
Click to expand...
Click to collapse
Your power supply should be fail-safe at this point
letama said:
My /proc/partitions is this now
Code:
major minor #blocks name
179 0 7282688 mmcblk0
179 1 51200 mmcblk0p1
179 2 439487 mmcblk0p2
179 3 7840 mmcblk0p3
179 4 6784032 mmcblk0p4
Click to expand...
Click to collapse
Yeah cool stuff... still on my Gen8 though.
Keep on hackin'
scholbert

So my hack ("abcbox reboot_into -s sde" at boot) is more secure than flash rawfs if i have understood well.
Last question (sry ^^"), but do you have made a serial connection with your tablet for debugging or dev your rawfs flasher ?
Click to expand...
Click to collapse
Yes, the reboot_into -s sde is a good solution to keep booting on sde...
Unfortunately, no, I don't have serial connection. I'd love to have one, not really for rawfs flashing, it's not that difficult, but more for kernel dev, it would help a lot. But opening stuff and soldering things is not my best skill, I'm a bit reluctant to do it yet, at least without a backup device handy

Hi Scholbert!
scholbert said:
See attachment... on this device a NAND flash (H27UCG8UDA) is used.
This is definitely raw NAND.
So maybe this is a pre-series model...
Click to expand...
Click to collapse
Yes, maybe... Someday I'll get the courage to open up this thing, I'm sure
scholbert said:
Your power supply should be fail-safe at this point
Click to expand...
Click to collapse
Better be!
Well, in fact, it's not such a big deal if it crashes in the middle, recovery will handle partition rebuild, but oups, reformat, flash again stock, re-root, re-enable sde, reflash sde initrd, retry, .... better be.
Yeah cool stuff... still on my Gen8 though.
Click to expand...
Click to collapse
Good news coming from this front

A little up, I updated first post with some news...

Nice
So what are default (safe) offsets?

gen_scheisskopf said:
Nice
So what are default (safe) offsets?
Click to expand...
Click to collapse
Well, don't do anything before end of mmcblk0p2 end block (10760 if you stay in default fdisk mode). Check your partition table before to get the proper value, mine is not a good example as it has been resized before to 300M, normal is 200M.
Basically, get your current mmcblk0p3 start and reuse this number (you may need +1, but fdisk will adjust)

Hey letama,
i'm in with my new A80 G9.
Quite nice device, but also suffering a little on this display issue.
Don't care much because... you may guess it already... i'm going to look inside the next days.
I'm a bit afraid though, because everything is held together with these plastic clamps. Hopefully i'm not gonna break anything.
Anyway a new thread will be born soon and i'll report my findings (boot_mode signals & other stuff ).
Enough small talk...
As you pointed out you are using a real ext4 partition already.
This might be my plan as well, because i don't like this loop mounting on real devices as well.
Yesterday i installed the latest ICS ext4 image file from surdu_petru.
So if i understand it correct this attempt is basically pretty similar to SDE image on Gen8.
If i got it right stock (unrooted squashfs image) and custom (rooted ext4 image) share the same data partition in this case.
What if we reduce size of mmcblk0p4 to increase mmcblk0p3, put our custom rootfs in it as a real filesystem.
Why did you increase mmcblk0p2 instead... in this case we'll have to wipe the stock image completely, right?
So no dual boot anymore...
Could you leave some thoughts on this?
Best regards,
scholbert

Hi Scholbert,
scholbert said:
i'm in with my new A80 G9.
Quite nice device, but also suffering a little on this display issue.
Don't care much because... you may guess it already... i'm going to look inside the next days.
Click to expand...
Click to collapse
Cool! Nice to have you onboard with g9!
Yesterday i installed the latest ICS ext4 image file from surdu_petru.
So if i understand it correct this attempt is basically pretty similar to SDE image on Gen8.
If i got it right stock (unrooted squashfs image) and custom (rooted ext4 image) share the same data partition in this case.
Click to expand...
Click to collapse
You purchased SD or HD model ?
Anyway, no, on both models, squashfs.secure is on p2 system partition, rooted ext4 is on data on p4 (internal storage is also on data for SD model) .
What if we reduce size of mmcblk0p4 to increase mmcblk0p3, put our custom rootfs in it as a real filesystem.
Click to expand...
Click to collapse
Yes, that's what I did. You can use p3 as ext4 directly, or you can use p3 as extended and create 3 partitions into this extended partition like I did. Check first post at the top, you'll see that, p3 extended, with p5, p6, p7 (p8 doesn't work). Benefit is that you dual boot on two custom rom and I needed a separate cache partition for clockworkmod recovery.
Why did you increase mmcblk0p2 instead... in this case we'll have to wipe the stock image completely, right?
So no dual boot anymore...
Click to expand...
Click to collapse
This was my first tentative, it was before Archos told me that p3 is for us and that we can do whatever we want with it. As I didn't know that, I didn't touch p3, extended p2, and put both squashfs.secure and my unpacked rooted build on it. Dual boot was working, but it's less elegant than what I currently have.
PS: if you do that, be careful when you reformat p4, you have to leave unused blocks at the end for drm I guess. Check recovery, it has the math.
If you want, I can give you my script to do it. I can even give you my ram only initrd with adb+cwm, you can then umount everything from adb then re-partition and format properly. Without ram only, you won't be able to umount and kernel will not refresh partition table.
PPS: careful with empty space for bootloader

Hey letama!
letama said:
You purchased SD or HD model ?
Click to expand...
Click to collapse
SD model, don't like moving parts in mobile devices.
letama said:
Anyway, no, on both models, squashfs.secure is on p2 system partition, rooted ext4 is on data on p4 (internal storage is also on data for SD model) .
Click to expand...
Click to collapse
Yeah sure... i refered to the loop mount of an ext4 file.
I knew it got stored on p4, so this partition is used for different purpose then and no fat anymore.
letama said:
Yes, that's what I did. You can use p3 as ext4 directly, or you can use p3 as extended and create 3 partitions into this extended partition like I did. Check first post at the top, you'll see that, p3 extended, with p5, p6, p7 (p8 doesn't work). Benefit is that you dual boot on two custom rom and I needed a separate cache partition for clockworkmod recovery.
Click to expand...
Click to collapse
Mmmh o.k. tweaking p3 and p4 would be sufficient i guess.
After shrinking p4, it would be a nice idea to use:
p3 = extended
p5 = system
p6 = data (seperated for the custom system)
Some mountpoints will have to be tweaked then...
letama said:
This was my first tentative, it was before Archos told me that p3 is for us and that we can do whatever we want with it. As I didn't know that, I didn't touch p3, extended p2, and put both squashfs.secure and my unpacked rooted build on it. Dual boot was working, but it's less elegant than what I currently have.
Click to expand...
Click to collapse
O.k. got it. I agree that p3 is a gift.
letama said:
PS: if you do that, be careful when you reformat p4, you have to leave unused blocks at the end for drm I guess. Check recovery, it has the math.
Click to expand...
Click to collapse
Thanks for the hint, i'll step through the scripts first
letama said:
If you want, I can give you my script to do it. I can even give you my ram only initrd with adb+cwm, you can then umount everything from adb then re-partition and format properly. Without ram only, you won't be able to umount and kernel will not refresh partition table.
Click to expand...
Click to collapse
Would be helpful indeed, thanks a lot for offering need my mail address.
May send you a PM.
letama said:
PPS: careful with empty space for bootloader
Click to expand...
Click to collapse
Thanks for the warning but i'm aware of this Archos specialty.
Best regards,
scholbert

scholbert said:
Mmmh o.k. tweaking p3 and p4 would be sufficient i guess.
After shrinking p4, it would be a nice idea to use:
p3 = extended
p5 = system
p6 = data (seperated for the custom system)
Click to expand...
Click to collapse
Don't forget about /cache- CWM needs it.
Or /cache as ramdisk?
scholbert said:
Some mountpoints will have to be tweaked then...
Click to expand...
Click to collapse
Only in kernel init, stock recovery won't touch p3 and p5-7 unless partition table would have to be rebuild (BTW- in ICS p2 size is increased from 200 to 300 MB)

gen_scheisskopf said:
Don't forget about /cache- CWM needs it.
Or /cache as ramdisk?
Click to expand...
Click to collapse
Yeah maybe better preserve some additional bytes.
Tough i won't use CWM for now.
gen_scheisskopf said:
Only in kernel init, stock recovery won't touch p3 and p5-7 unless partition table would have to be rebuild (BTW- in ICS p2 size is increased from 200 to 300 MB)
Click to expand...
Click to collapse
O.K. i see...
Interesting fact about p2.
To my surprise i'm still on ~200MB for p2 while running ICS on my pad.
The console gives me disk usage of 94% for p2 though.
Did it like this:
- my device came with HC installed
- used the temp root
- activated SDE by flashing letama's kernel and initramfs
- removed temp root
- rebooted into recovery
- removed stock HC, by wiping all related partitions
- installed stock ICS from recovery
- booted into stock ICS
- transfered rooted ICS ext4 image to p4
- rebooted to recovery
- used developer edition menu to reflashed the related kernel and initramfs
In the end i got dual-boot via recovery... stock and custom rooted
Something to be afraid of?
Regards,
scholbert

Related

Installing tremers Froyo on ext2 partition

I found tutorial how to use ext2 partition on SDCARD for haret.
http://android-devs.org/forum/viewtopic.php?f=56&t=194
I created this
2 GB Fat32
1 GB ext2
1 GB ext2
so i have 4 GB disk and 3 partition just as its on tutorial
But after launching haret it should asked me
Press VolDn to launch Installer (to use ext2)
just after the
Checking for partitions
but in my case it just continue with installing without asking me and its uning only fat32
Any suggestion???
our rootfs doesn't have the install function, someone must edit the rootfs to boot into EXT partitions first!
I just copy rootfs to the / of the ext2 and system to /system, and then edit the init script so it remounts properly.
When I start doing partitioned releases I'll try and make it easy, probably by distributing prebuilt images by card size (4G, 8G etc.)
Tremere said:
When I start doing partitioned releases I'll try and make it easy, probably by distributing prebuilt images by card size (4G, 8G etc.)
Click to expand...
Click to collapse
I talked to phh yesterday.. he said ext2 and NAND booting have no effect on stability, performance and battery life. (rhod nand booting has been working for one month)
Performance could change but it would be less than 20%.
So I pray that someone will find the standby killer
So i need only one ext2 partition
Tremere said:
and then edit the init script so it remounts properly.
Click to expand...
Click to collapse
if i knew how and what to edit. Nevermind its not that important. You just focus on your work.
Matzemink said:
I talked to phh yesterday.. he said ext2 and NAND booting have no effect on stability, performance and battery life. (rhod nand booting has been working for one month)
Performance could change but it would be less than 20%.
So I pray that someone will find the standby killer
Click to expand...
Click to collapse
True. I think they also had an incorrect mount option on the rootfs until recently that slowed loopback performance. I think my last (unstable) release contained the fix for that.
For my own AOSP device tree I'm determined to start fresh without the rootfs and loopback crap. Maybe not a big performance gain but easier to 'get around' system wise.
if i knew how and what to edit. Nevermind its not that important. You just focus on your work.
Click to expand...
Click to collapse
off the top of my head, init.etc/init.froyo.rc and there is a line which tries to mount root as yaffs (flash). Not too hard to find.
You might want to have another ext2 for /data though.
How do I partition my micro sd card?
please excuse my bad English
I use translator
The easyest way for me. Download a release of Ubuntu from ubuntu.com and burn it to cd or make bootable USB. Boot live cd and partition from there.
wouldn't it be easier to download a live CD of gparted?
Jonny4911 said:
wouldn't it be easier to download a live CD of gparted?
Click to expand...
Click to collapse
System Rescue CD is my favorite for partitioning tasks. Should work on your sdcard.
Over in the raph forum, e334 posted a guide on partitioning ext2 from Windows

Is there a way to dualboot?

Is there a way to dualboot roms?
Sent from my GT540 using Tapatalk
I really know nothing about dualbooting but i don't think the optimus swift has the guts for it
No.
someone correct me if i
am wrong, but our phones can't dualboot.
It could be possible by creating new partitions. For example, have two system partitions and two data partitions. We can flash one boot.img to the boot partition for the ROM to automatically boot, and flash another to the recovery partition. So when you hold home, it will boot into the second boot.img instead.(recovery images are exactly the same as boot images but with a modified ramdisk that runs the recovery program)
Where in the second boot.img, we can modify the init.rc file to mount a different partition as /system (a data2system rom works sort of like this, init.rc is modified so the data partition is mounted as /system, and system is mounted to /data, this is how you get more space as data is stored on /system, but Android thinks its acessing the data partition, where it is really accessing system) We can use this principle to dual boot.
Now, how will this work. Somehow split the system and data partitions into two bits (2 system partitions and 2 data) If we have the 1st ROM on the original system partition, and use its original boot.img, and then have the 2nd rom on the different system partition, and modify the ramdisk to use the different partitions as /system and /data, we could have a working dual boot.
However, there are some problems.
1. Our device has a NAND that is 512MB in size. It is split into:
Boot
Recovery
System
Userdata
Cache
and some other miscellaneous partitions. System is 250MB in size, and data is 134MB (under stock partition sizes) These split would barely fit any rom on it and hardly any data either. Maybe if the device had 1GB ROM, it may be different.
2. It may require some bootloader tweaking to create these new partitions, and for the device to recognise them.
Also, why would you want to dual boot your phone anyway? You have a computer for that
App
There is this app named BootManager
I've tried it out but this can't backup the boot partition. It's currently not supported. Maybe someone could try it out.
Keep in mind that it needs to be purchased for 'LEGAL' use.
jhonnyx1000 said:
There is this app named BootManager
I've tried it out but this can't backup the boot partition. It's currently not supported. Maybe someone could try it out.
Keep in mind that it needs to be purchased for 'LEGAL' use.
Click to expand...
Click to collapse
I tried that! Gives an error when backing up boot image!
Sent from my GT540 using Tapatalk
effortless. said:
Also, why would you want to dual boot your phone anyway? You have a computer for that
Click to expand...
Click to collapse
Actually I don't
Sent from my GT540 using Tapatalk
It is possible to dualboot. A russian guy already made it for us. It was meant to dualboot 2.1 and 2.2 but that rom has never made it to beta stadium.
The idea is that a second rom is stored on the sd card. I've tried to get it working but i didnt succed. But it should work.
It was on 4pda.ru. when i am on my computer, i will post a link.
Joost
Sent from my GT540 using Tapatalk
Couldn't we use the same principal as running Ubuntu chroot? As I thought chroot and loop devices where originally for HTC to test builds? Correct me if I'm wrong here
But I always thought if you had say a 32gb SD you could have 2 or 3 roms plus a couple Linux distros running on the device through chroot not same time obviously device would handle 2 max?
Also I was looking at a article to run native Linux on the eee pad transformer it looked like all they did was swap the boot.img or some kind of script so it ran off the SD card straight away. So my question would be could you add a feature to recovery that would allow you to change boot.img or script for each rom/distro then reboot straight into it making the device multi boot?
Sent from my GT540RR using XDA App
This is the topic about the dualboot, with download links to the 'dualboot' boot, and some explanation about the partitions on the sdcard.
http://4pda.ru/forum/index.php?showtopic=200838
Joost
liamwilli said:
Is there a way to dualboot roms?
Sent from my GT540 using Tapatalk
Click to expand...
Click to collapse
This should be possible. But, would require customizing boot.img and boot loader.
ErnuB said:
I really know nothing about dualbooting but i don't think the optimus swift has the guts for it
Click to expand...
Click to collapse
effortless. said:
It could be possible by creating new partitions. For example, have two system partitions and two data partitions. We can flash one boot.img to the boot partition for the ROM to automatically boot, and flash another to the recovery partition. So when you hold home, it will boot into the second boot.img instead.(recovery images are exactly the same as boot images but with a modified ramdisk that runs the recovery program)
Where in the second boot.img, we can modify the init.rc file to mount a different partition as /system (a data2system rom works sort of like this, init.rc is modified so the data partition is mounted as /system, and system is mounted to /data, this is how you get more space as data is stored on /system, but Android thinks its acessing the data partition, where it is really accessing system) We can use this principle to dual boot.
Now, how will this work. Somehow split the system and data partitions into two bits (2 system partitions and 2 data) If we have the 1st ROM on the original system partition, and use its original boot.img, and then have the 2nd rom on the different system partition, and modify the ramdisk to use the different partitions as /system and /data, we could have a working dual boot.
However, there are some problems.
1. Our device has a NAND that is 512MB in size. It is split into:
Boot
Recovery
System
Userdata
Cache
and some other miscellaneous partitions. System is 250MB in size, and data is 134MB (under stock partition sizes) These split would barely fit any rom on it and hardly any data either. Maybe if the device had 1GB ROM, it may be different.
2. It may require some bootloader tweaking to create these new partitions, and for the device to recognise them.
Also, why would you want to dual boot your phone anyway? You have a computer for that
Click to expand...
Click to collapse
Your idea is right and would work but we can't afford to loose the recovery. It's important when modding. Unlike fastboot or KDZ modes, using recovery leaves one partition untouched. ie, when using recovery, the recovery partition is never modified. It doesn't touch boot loader either. It's almost impossible to brick a phone using recovery. And, if something goes wrong with other partitions, you can always boot into recovery and have stuff restored or fixed with an update.
jhonnyx1000 said:
There is this app named BootManager
I've tried it out but this can't backup the boot partition. It's currently not supported. Maybe someone could try it out.
Keep in mind that it needs to be purchased for 'LEGAL' use.
Click to expand...
Click to collapse
It's an HTC only app. It's an xda project. You can get it for free. Hit on to http://forum.xda-developers.com/showthread.php?t=1184173
joostvhoek said:
It is possible to dualboot. A russian guy already made it for us. It was meant to dualboot 2.1 and 2.2 but that rom has never made it to beta stadium.
The idea is that a second rom is stored on the sd card. I've tried to get it working but i didnt succed. But it should work.
It was on 4pda.ru. when i am on my computer, i will post a link.
Joost
Sent from my GT540 using Tapatalk
Click to expand...
Click to collapse
Thanks. Would love to try it out.
Danzano said:
Couldn't we use the same principal as running Ubuntu chroot? As I thought chroot and loop devices where originally for HTC to test builds? Correct me if I'm wrong here
But I always thought if you had say a 32gb SD you could have 2 or 3 roms plus a couple Linux distros running on the device through chroot not same time obviously device would handle 2 max?
Also I was looking at a article to run native Linux on the eee pad transformer it looked like all they did was swap the boot.img or some kind of script so it ran off the SD card straight away. So my question would be could you add a feature to recovery that would allow you to change boot.img or script for each rom/distro then reboot straight into it making the device multi boot?
Sent from my GT540RR using XDA App
Click to expand...
Click to collapse
chroot is not a real dual boot solution. It's based on the idea of virtualization and so it has performance issues on a low end phone like GT540. When using chroot, parts of the Android OS as well as the other OS is run at the same time. This would be idea only in faster devices with more RAM.
And, yes, if you can modify the boot.img or recovery.img to boot into other partitions, it would be awesome. The beauty of linux is that you can directly mount images as a disk unlike in Windows where you need a separate software. Due to this, mounting a different partition would be easy but modifying the boot.img or bootloader is the risky part. If you do it wrong, your phone may get permanently bricked.
joostvhoek said:
This is the topic about the dualboot, with download links to the 'dualboot' boot, and some explanation about the partitions on the sdcard.
http://4pda.ru/forum/index.php?showtopic=200838
Joost
Click to expand...
Click to collapse
Thanks
joostvhoek said:
This is the topic about the dualboot, with download links to the 'dualboot' boot, and some explanation about the partitions on the sdcard.
http://4pda.ru/forum/index.php?showtopic=200838
Joost
Click to expand...
Click to collapse
I don't understand or talk Russian. Would anybody be kind enough to find out what modifications did he do to the boot.img and/or bootloader? If we do the same modifications, we might be able to dualboot.
But, there's one problem, the boot.img is not same for all versions. Maybe that is why you can't dual boot.
It wouldn't work on the gt540. We have a dual boot for the defy which has only 90mb of ram left Max when running dual system. Usually I'm running 190mb ram on stock and 240mb on miui. Major slow down on dual boot. So no point
Sent from my MB525 using xda premium
keewanchoapsss said:
It wouldn't work on the gt540. We have a dual boot for the defy which has only 90mb of ram left Max when running dual system. Usually I'm running 190mb ram on stock and 240mb on miui. Major slow down on dual boot. So no point
Sent from my MB525 using xda premium
Click to expand...
Click to collapse
You are talking about chroot. In real dual boot, only one OS is loaded.
nibras_reeza said:
I don't understand or talk Russian. Would anybody be kind enough to find out what modifications did he do to the boot.img and/or bootloader? If we do the same modifications, we might be able to dualboot.
But, there's one problem, the boot.img is not same for all versions. Maybe that is why you can't dual boot.
Click to expand...
Click to collapse
Oh I'll be looking into this one tomorrow, I'd like to be able to have a dual boot... this would enable me to store testing roms onto sdcard and boot into them "safely" without forever having to go through backup & restore each time...
If I can crack it... I'll post it!!
Edit: I don't read Russian either... but I can reverse engineer things like this! -- Just had a brief look at it... I should be able to port his modifications over to another image, but as you said... it'll only work if both OS's are compatible with the one boot.img ... and this could take some trial and error.
Second Addition: Not to mention... it could cause issues for some people that use ext partition on sdcard for apps.... hmmz, will have to keep that in mind. (People like me ya'see lol)
olite said:
Oh I'll be looking into this one tomorrow, I'd like to be able to have a dual boot... this would enable me to store testing roms onto sdcard and boot into them "safely" without forever having to go through backup & restore each time...
If I can crack it... I'll post it!!
Edit: I don't read Russian either... but I can reverse engineer things like this! -- Just had a brief look at it... I should be able to port his modifications over to another image, but as you said... it'll only work if both OS's are compatible with the one boot.img ... and this could take some trial and error.
Second Addition: Not to mention... it could cause issues for some people that use ext partition on sdcard for apps.... hmmz, will have to keep that in mind. (People like me ya'see lol)
Click to expand...
Click to collapse
People who use ext for moving apps shouldn't face problems. Android is not Windows. =P It can handle unlimited number of partitions. Looking at the guide, I could understand that the method uses multiple ext partitions. People using sd-ext for apps would only need to increase the mtdblockn(where n is a number) by 1 or 2 if using swap as well.
Yup. Both OSs will work only if the boot.imgs are compatible. That means we might not be able to run 1.6 and 2.3. However, this wouldn't be applicable if you can loop the boot.imgs as well.
ie a setup likes.
BOOT has a GRUB like boot loader which is compatible with Android is SYSTEM.
SYSTEM partition has one OS.
Then, there will be different BOOT and SYSTEM is each of the sd-ext partition or they will be stored as imgs in SD.
When device boots, it will enter BOOT. Then, this will present a menu which will allow you to select OS. If you choose, default, it will load SYSTEM from phone. If you choose another, it will loop to a BOOT from the SD-ext which will loads its relevant SYSTEM from SD/SDEXT.
That's just my idea though. Basically, if you can get an idea of the modifications that need to be made to BOOT.img to loop mount another partition as BOOT or SYSTEM, then the problem is 80% solved.
nibras_reeza said:
People who use ext for moving apps shouldn't face problems. Android is not Windows. =P It can handle unlimited number of partitions. Looking at the guide, I could understand that the method uses multiple ext partitions. People using sd-ext for apps would only need to increase the mtdblockn(where n is a number) by 1 or 2 if using swap as well.
Click to expand...
Click to collapse
lol, yer I worded that wrong... I meant it *could* be a problem if they just followed his guide steps (since it doesn't account for existing use of ext on sdcard), but you'r right this isn't really a problem... it just requires an additional partition. Also, I'd probably change the partition layout instead so that applications such as Link2SD would still be able to "automatically" (it only checks partition #1) locate the ext partition intended for apps.
Something like this...
Partition #0: FAT32
Partition #1: EXT2/3 <-- sd-ext2
Partition #2: EXT2/3 <-- data
Partition #3: EXT2/3 <-- system
Partition #4: SWAP
This would allow most internal OS's to continue to function as per normal without any script modifications.
(Most swap mount scripts are just blind scripts, they simply try mounting each partition from #1 to #9 as swap... so swap location shouldn't be an issue)
#!/system/bin/sh
#
# find and enable swap
#
echo 30 > /proc/sys/vm/swappiness
# find swap partition
for PART in `seq 0 9`;
do
swapon /dev/block/mmcblk0p$PART
if [ $? = 0 ]; then
break
fi
done
Click to expand...
Click to collapse
nibras_reeza said:
That's just my idea though. Basically, if you can get an idea of the modifications that need to be made to BOOT.img to loop mount another partition as BOOT or SYSTEM, then the problem is 80% solved.
Click to expand...
Click to collapse
And a damn good one at that... sadly I think this might just be a lil bit out of my reach... for now! While I should be able to get it to work for 2.1-2.3 (Since they essentially use the same boot), I honestly don't know where to begin with boot looping (I understand the concept yes, just not sure how to implement it... wonder if I can bake a grub version for this...)
This idea is really exciting. I wish i could help but as it stands, based on my extreme lack of know-how, i'd be as much help as a sack of potatoes XD
Sent from my GT540 using XDA App
olite said:
lol, yer I worded that wrong... I meant it *could* be a problem if they just followed his guide steps (since it doesn't account for existing use of ext on sdcard), but you'r right this isn't really a problem... it just requires an additional partition. Also, I'd probably change the partition layout instead so that applications such as Link2SD would still be able to "automatically" (it only checks partition #1) locate the ext partition intended for apps.
Something like this...
Partition #0: FAT32
Partition #1: EXT2/3 <-- sd-ext2
Partition #2: EXT2/3 <-- data
Partition #3: EXT2/3 <-- system
Partition #4: SWAP
This would allow most internal OS's to continue to function as per normal without any script modifications.
(Most swap mount scripts are just blind scripts, they simply try mounting each partition from #1 to #9 as swap... so swap location shouldn't be an issue)
And a damn good one at that... sadly I think this might just be a lil bit out of my reach... for now! While I should be able to get it to work for 2.1-2.3 (Since they essentially use the same boot), I honestly don't know where to begin with boot looping (I understand the concept yes, just not sure how to implement it... wonder if I can bake a grub version for this...)
Click to expand...
Click to collapse
Porting grub eh? Hmm. I believe there should be an ARM version for grub but we might have trouble with the drivers and kernel. It might be a better idea to copy the menu layout from CWM recovery. The menu need not be intelligent.
As for me, I also don't know how to loop the boot images.
daggerxXxsin said:
This idea is really exciting. I wish i could help but as it stands, based on my extreme lack of know-how, i'd be as much help as a sack of potatoes XD
Sent from my GT540 using XDA App
Click to expand...
Click to collapse
You could always risk your phone for others by using the pre-alpha. xD
Porting grub eh? Hmm. I believe there should be an ARM version for grub but we might have trouble with the drivers and kernel.
Click to expand...
Click to collapse
We wouldn't need a kernel for GRUB, as GRUB loads the kernel. We would have to modify the bootloader (or MBR) to use GRUB.

[Q] SWAP PArtition

1st question :I have created a swap partition according to one of the tutorials here. But when i do the swapon command it says No such device or adress any solutions ?
http://forum.xda-developers.com/showthread.php?p=21718735
2nd question: After i rebooted the phone i use alfs kernel and gingerdx25 , the telephone is stuck jsut after i input my pin it enters the gingerdx amd thamn its stuck it becoems really laggy and than i reboots... this happens every time i boot it since my last restart it cant boot sometimes it stucks at infinity boot loop even if i delete the cache . Like there is 100% cpu usage so much lag... i cant even open the menu and than i t reboots
Hi there, it seem like you activate Comp-cache with swap right?
if you do that, you'll likely need to remove the swap partition OR Wipe your data & disable comp-cache
one more question mate . I reisntalled the android but due to some reason when i try to instlal an application the phone restarts any ideas ? :S
it mean that the app you tried to install is existed but only the data....
so, when u try to install it again, it will lead to reboot...
try clear out the data or do full-wipe
CKKnot said:
it mean that the app you tried to install is existed but only the data....
so, when u try to install it again, it will lead to reboot...
try clear out the data or do full-wipe
Click to expand...
Click to collapse
once again i hit the thanks button really thank you. But something now screwed up. When i inert my 8gb sd card it doesnt recognise taht i have even put in a card.Nothing happens like there is no sdcard.I tried to format it but it says taht there is nosd card and when i put my opther one which i do not use 2gb card it recognises it i think my 8gb card is bugged :S
nah, if you had't partition it well, it will buggy. Try copy all ur data to pc & wipe disk & copy back. Hope that solve ur problem
CKKnot said:
nah, if you had't partition it well, it will buggy. Try copy all ur data to pc & wipe disk & copy back. Hope that solve ur problem
Click to expand...
Click to collapse
i think my 8gbSanDisc is bricked forever. Its not recognised either on pc or on the telephone.Like there is no card i cant format it ....
if at partition wizard display it as a bad disk, i afraid that your sdcard is utterly damaged
be sure to own a lifetime warranty sdcard if using swap.(well, lifetime doesn't mean it last forever also.) you can instead use comp-cache as substitute method
CKKnot said:
if at partition wizard display it as a bad disk, i afraid that your sdcard is utterly damaged
be sure to own a lifetime warranty sdcard if using swap.(well, lifetime doesn't mean it last forever also.) you can instead use comp-cache as substitute method
Click to expand...
Click to collapse
Tried several partition wizards and they dont regognise the card like there is no card...
it is damaged
CKKnot said:
if at partition wizard display it as a bad disk, i afraid that your sdcard is utterly damaged
be sure to own a lifetime warranty sdcard if using swap.(well, lifetime doesn't mean it last forever also.) you can instead use comp-cache as substitute method
Click to expand...
Click to collapse
1st question :I have created a swap partition according to one of the tutorials here. But when i do the swapon command it says No such device or adress any solutions ?
have you tried:
swapon /dev/mmcblk0p3
mmcblk0p3
blk0 mean block 0
p3 mean partition 3
Edited ----- My Bad
CKKnot said:
have you tried:
swapon /dev/mmcblock0p3
mmcblock0p3
block0 mean block 0
p3 mean partition 3
Click to expand...
Click to collapse
new problem now sd cardi s accessed and formatted by the phone but when i put hte usb cable it says it must be formatted (windwos says this) and if i format it in fat32 its unreadable by the phone anymore...And yes the problem was mispartitioning the sd card wasnt fried
okay first of all, most user wanna configure his sdcard partition in this way.
[FAT32][EXT2][SWAP] - (This is what i configured now.)
[FAT32] is for normal sdcard file system which you can access it from your pc also
[EXT2] is where the partition of sdcard store your app (.apk) and dalvik-cache (Depend on the rom.)
[SWAP] is where the partition is assigned as swap memory.
all of those partition must be primary and in order. [FAT32] can have a drive letter where other's can't have it.
CKKnot said:
okay first of all, most user wanna configure his sdcard partition in this way.
[FAT32][EXT2][SWAP] - (This is what i configured now.)
[FAT32] is for normal sdcard file system which you can access it from your pc also
[EXT2] is where the partition of sdcard store your app (.apk) and dalvik-cache (Depend on the rom.)
[SWAP] is where the partition is assigned as swap memory.
all of those partition must be primary and in order. [FAT32] can have a drive letter where other's can't have it.
Click to expand...
Click to collapse
cant i make swap memory by making swap file because it doesnt work with swap partition
can, but it will reduce it's performance.
C:\Program Files (x86)\Android\android-sdk\platform-tools>adb shell
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
~ # fdisk -l dev/block/mmcblk0
fdisk -l dev/block/mmcblk0
Disk dev/block/mmcblk0: 7948 MB, 7948206080 bytes
255 heads, 63 sectors/track, 966 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
dev/block/mmcblk0p1 * 1 777 6240228+ c Win95 FAT32 (
)
dev/block/mmcblk0p2 778 833 449820 82 Linux swap
dev/block/mmcblk0p3 834 966 1068322+ 83 Linux
~ # swapon /dev/block/mmcblk0p2
swapon /dev/block/mmcblk0p2
swapon: /dev/block/mmcblk0p2: No such device or address
~ # swapon /dev/mmcblk0p2
swapon /dev/mmcblk0p2
swapon: can't stat '/dev/mmcblk0p2': No such file or directory
Click to expand...
Click to collapse
here is my output
recreate your partition into
[FAT32] [EXT2] [SWAP]
most rom will search the third partition as their swap partition. i recommend you to use partition wizard to do it
CKKnot said:
recreate your partition into
[FAT32] [EXT2] [SWAP]
most rom will search the third partition as their swap partition. i recommend you to use partition wizard to do it
Click to expand...
Click to collapse
i did it i have 3 partitions fat , ext2,swap
You need to mount the partition before using swapon.If you add this line to system/etc/fstab the rom will mount it for you at boot.
Code:
/dev/block/mmcblk0p3 /swap swap rw

Can we repartition to make swap?

I've been thinking about this for a few days now. Then, today, xda posted an article on repartitioning the Xperia to gain some advantage. So it seems like a good time to pose this question for us HD+ owners.
This a "feasibility study" question. I'm not a developer. I can hardly hack my way though Mint, let alone the HD+. I'm asking if the following possible?
(If yes, maybe a nice developer will do it for us? )
Can we shrink and repartition the /factory partition in the HD+ (as they shrink partitions in the Xperia) and use the leftover space as /swap?
Background
I've been reading leapinlar's excellent treatises on the partition structure in the HD+ (see Item 16) and how the /factory partition, meant for automatic disaster recovery, doesn't do us much good if you've installed a custom ROM and a custom recovery. (See all of Item A12.)
Among other things, the /factory partition contains an image of the stock B&N ROM. Which will cause bootloops if triggered when you're running CM.
But, if I understand it correctly, the /factory partition isn't a total waste. It duplicates some important data from the /rom partition (devconf), which could come in handy IF you put the stock recovery back on in an attempt to fix your HD+. (Then it could rebuild the /rom partition if it had become corrupted.)
So, as it stands now, /factory is 448 MB that's mostly useless to us. Can't we put it to good use? Like /swap? Or direct zRAM to it?
Leapinlar has already created some repartitioning tools, as has the Xperia dev now. So I'm hoping a lot of the hard work has been done already.
Proposal
(I apologize in advance is my terminology isn't exactly correct.)
Is it possible to:
1) remove the factory.zip from the /factory partition and then shrink the partition to accommodate only the /rom backup files. (I'm thinking that all factory zips are the same size, so once the new smaller partition is calculated, it ought to be the same for everyone's HD+);
2) create a new partition from the left over space, calling it (new) partition #11;
3) format partition #11 as swap
4) easily tell CM 10 or CM 11 to use the /swap? I'm hoping this can be done with just a init.d script. (Maybe an fstab tweak too?)
5) Or perhaps dedicate #11 for zRAM, as a kernel developer has done with useless space in the Galaxy Tab 2. In essence, we'd have almost 1.5GB of RAM.
Feasible? Yes/No? I realize that dinking with partitions can damage my HD+. It's a risk I'm willing to take.
I'm not going to get involved with this, I'm just going to add a warning. The partition structure for the HD/HD+ is different than the Nook Color and most other devices. The NC and other devices like SDs use DOS partitioning. The HD/HD+ is like the Nook Tablet that uses GPT partitioning. The two partitioning schemes are not compatible. So don't try to use my tools in the NC forum. If you want to know more about GPT partitioning on the Nook Tablet and get some tools, search the Nook Tablet forum.
Sent from my BN NookHD+ using XDA Premium HD app
leapinlar said:
The partition structure for the HD/HD+ is different than the Nook Color and most other devices. The NC and other devices like SDs use DOS partitioning. The HD/HD+ is like the Nook Tablet that uses GPT partitioning. The two partitioning schemes are not compatible.
Click to expand...
Click to collapse
Good to know! Now we have more data than we had before.
Looks like a lot of the work has been done already
So, I found this thread in the xda forums all about nook tablet partitions. They even talk about resizing! (Or at least, about making a different size /userdata partition.)
There is also this here about repartitioning Nook partitions.
Looks like parted would be easier for what I'm looking to do, shrink the /factory partition and create a new partition.
I read here that I can use a live Linux CD to mount the factory.img. From there, I presume I can delete the factory.zip and create a new image?
I'm not a linux geek, but I presume I need to be on a live Mint CD to use parted in ADB? (Update: Apparently I am to use the Android SDK for ADB in Windows. Downloaded already. Am climbing the steep learning curve.)
First half of Step 1, Done
Well, it took longer than it should have, but I made a new, smaller factory7.partition.img file. It's 1 MB.
I started by booting a Mint 16 Live CD.
Then I mounted the OEM factory partition image I made beforehand using the dd command, per leapinlar's instructions. (See his Item 16.)
Code:
sudo mount -o loop partition7.factory.img {some.folder}
That image contained 4 zips: factory,zip; fsck.zip; rombackup.zip; romrestore.zip.
Dummy me, I tried deleting the factory.zip inside the mounted image. It occurred to me later that that would be like trying to delete a file from a mounted CDROM's iso image. Can't be done.
So I copied the 4 zips to a new folder. Then I could deleted factory zip, which was 433.3 MB.
That left less than 1MB for the other 3 zips.
If there's an elegant way of modifying an .img and resaving it, I couldn't find it. (I spent a lot of time with mkfs.yaffs2. But this .img was not a yaffs.(Didn't pass a "sanity check" when I tried to mount the new .img I had made with mkfs.yaffs2.)
So I brute forced an imaging solution by copying the 3 copied zips to a 1MB ext4 partiton on a USB stick. (I made the partition with gparted and used chmod 777 to clear permissions in the partition.)
Then I made an image of the new 1MB partition using the dd command. In my case
Code:
sudo dd if=/dev/sdd2 of=new.partition7.factory.img
(I probably don't have the leading /'s right here. Am truly hacking my way through all this. I'm sure most of you could do this whole project in a few minutes.)
So now I have a shiny new 1MB custom factory image just wating to be used.
Update: I think I'll redo this, and leave 4 zips, in case the recovery mechanism is looking for a "factory.zip" I'll made a dummy file and archive it, calling it "factory.zip."
The next task is to get ADB working, delete the original large partition7 in the HD+, create a new 1MB partition7 in its place, and then restore my new image to partition 7 using the dd command in reverse.
After that, then to create partition11 out of the unallocated 432MB and format that as swap.
Update: It occurs to me that I will have to backup partitions 8, 9, and 10 with dd. Then I'll have to destroy them, recreate them in new locations, and then restore them. Fortunately, an xda developer has already written the instructions on how to do all this.
I see that CM 10 supports swapon, so I'm hoping it will be downhill after the partition work. I'm hoping CM will automagically find the new swap partition, once I enable swap.
If you know different, I'd appreciate hearing from you. Will using swap in this memory burn the memory out quickly?
Better yet, swap file instead of swap partition
So, I was thinking more about this idea and how I'd have to destroy and recreate p8, p9 and p10 to make a new swap partition at p11. Aside from that being a lot of work and more prone to errors with all those operations, a new p11 would never get TRIM'd by the OS.
So now the plan is to reduce /factory (p7) to 1MB and increase /system (p8) by 443 MB. Then I'll put a swap file in /system.
Only have to work on two partitions that way and /system gets TRIM'd. (Or at least Lagfix will trim it.)
Whatdaya think?
I suppose it's easy enough to put a swap file in /data to get a feel if there's any performance gain from swap in eMMC. Someone wanna show me the code to do this? (I've read about how to create a swap file. Not sure how to mount it at emmcblk10.) Never mind, Found it on xda! Am currently running 500MB swap on /data to see what it's like.
PMikeP said:
So, I was thinking more about this idea and how I'd have to destroy and recreate p8, p9 and p10 to make a new swap partition at p11. Aside from that being a lot of work and more prone to errors with all those operations, a new p11 would never get TRIM'd by the OS.
So now the plan is to reduce /factory (p7) to 1MB and increase /system (p8) by 443 MB. Then I'll put a swap file in /system.
Only have to work on two partitions that way and /system gets TRIM'd. (Or at least Lagfix will trim it.)
Whatdaya think?
I suppose it's easy enough to put a swap file in /data to get a feel if there's any performance gain from swap in eMMC. Someone wanna show me the code to do this? (I've read about how to create a swap file. Not sure how to mount it at emmcblk10.) Never mind, Found it on xda! Am currently running 500MB swap on /data to see what it's like.
Click to expand...
Click to collapse
I guess this is a dumb question, but if you can put a swap file in /system and /data, why can't you delete the factory.zip from /factory and put the swap there? Why create a new partition?
Sent from my BN NookHD+ using XDA Premium HD app
leapinlar said:
I guess this is a dumb question, but if you can put a swap file in /system and /data, why can't you delete the factory.zip from /factory and put the swap there? Why create a new partition?
Click to expand...
Click to collapse
First, I'm abandoning my bright idea. Turns out that swap is slow (even on eMMC) and possibly destructive to the eMMC with all the writes. (Hmmm . . . I wonder how many writes /cache gets compared to a swap file? (IOW, would a swap file be any more destructive than cache is?))
There were 1 second pauses every now and then, presumably while swapping when I had a swap file mounted in /data. Even tho I could get more free memory with a swap file than with zRAM, zRAM is much faster. And since zRAM is supported by the OS, it's the path of least resistance for me.
But to answer your question, it's not a dumb question. I'm a dumb user.
First, I don't know how to mount the /swap on the /factory partition. Can it be done? I don't see /factory in root explorer when running. Whereas I can see /system and /data. (So, to use Windows talk, it seems like /factory is "hidden" when running the OS?) By the same token, I don't know if I can delete the factory.zip from /factory in situ. If it can be done, it probably requires ADB and fastboot (?). But I haven't learned about those yet. So I'd have to use my new image trick, from my post above, to "delete" factory.zip from /factory.
Second, even if I could mount a swap in /factory, I don't think I'd want to. (Although I agree it's be a lot easier (and less dangerous) than deleting and recreating partitions.) I don't think /factory gets TRIM' by the OS. And I presume I would want it TRIM'd every now and then or else the swap would get slower over time than it already is.
I notice that Lagfix offers to trim /system and /data (and /cache). But not /factory. As above, if /factory is not visible during operation of the OS, that would be one reason why Lagfix doesn't trim it.
Or it could simply be that Lagfix doesn't see the need to trim /factory. Since /factory is supposed to be static, there wouldn't be any reason for Lagfix (or CM) to trim it.
Whether /factory can be trimmed with the fstrim command while running, I don't know.
Anyway, my idea for swap wasn't such a good idea. So I've abandoned the idea.
It still bugs me, as an engineer who compulsively tries to optimize everything, to carry that wasted 443 MB around in /factory.
I don't think we need an extra 443 MB in /system or /data. (Or /cache.) But if we ever do, we know where to find it.
/factory is not automatically mounted in stock or CM. So to get access to it you would need to mount it with a script command. And I would assume you need script commands to set up /swap so that should not be a problem. But /factory is formatted fat32 and /data and /system are ext4 so that might interfere too.
And manual trim commands can be run to trim the mounted /factory. You don't need the app lagfix to do it.
But I agree, I'm not really sure you gain anything with swap on this device.
Edit: as PMikeP pointed out to me in a PM, I was mistaken. /factory is ext4, not fat 32. Thanks for the correction. That should make it easier.
Sent from my BN NookHD+ using XDA Premium HD app

[Q] dead mmc -- ideas?

I've been having a grand old time tinkering with my new TF701t. I unlocked the bootloader, tried a few ROMs, went back to stock, and I've been busily playing with it. Earlier this evening, it spontaneously shut down. I booted it back up and it shut down again after 5 minutes. I went into recovery and flashed the xposed disabler zip just in case xposed was to blame, but it shut down from recovery. Now it won't boot at all.
I can connect via ADB in recovery, and when I run dmesg, I see all sorts of nasty mmc0-related timeouts and errors. I can't even mount /system anymore. It's pretty clearly either an issue with the internal memory card or with the bus.
Does anyone have any idea how I can fix this or get it fixed? Of course, with an unlocked bootloader, I'm sure ASUS is going to give me all manner of grief and probably refuse to repair/replace what is clearly a hardware failure. Does anyone know if there's any way at all of replacing this kind of mmc card, or is it just part of the SoC? How screwed am I?
EDIT: Not screwed at all! See my post on page 2 for a fairly simple procedure to boot and run the tf701t (and quite probably many other devices) completely off of the SD card.
lexelby said:
I've been having a grand old time tinkering with my new TF701t. I unlocked the bootloader, tried a few ROMs, went back to stock, and I've been busily playing with it. Earlier this evening, it spontaneously shut down. I booted it back up and it shut down again after 5 minutes. I went into recovery and flashed the xposed disabler zip just in case xposed was to blame, but it shut down from recovery. Now it won't boot at all.
I can connect via ADB in recovery, and when I run dmesg, I see all sorts of nasty mmc0-related timeouts and errors. I can't even mount /system anymore. It's pretty clearly either an issue with the internal memory card or with the bus.
Does anyone have any idea how I can fix this or get it fixed? Of course, with an unlocked bootloader, I'm sure ASUS is going to give me all manner of grief and probably refuse to repair/replace what is clearly a hardware failure. Does anyone know if there's any way at all of replacing this kind of mmc card, or is it just part of the SoC? How screwed am I?
Click to expand...
Click to collapse
See if you can mount /cache or /data. If you cannot then you have royally messed up your tablet. If you have replaced the recovery to something other than the original asus recovery then your best bet is to buy a logic board from ebay and replace it manually yourself.
I took mine to asus repair center and they said they will charge 200$ and 3 days to replace the logic board. I managed to buy the part for 70$ and do it myself. Just a side note, I bought and item that was AS-IS, so I am glad mine worked.
devbro said:
See if you can mount /cache or /data. If you cannot then you have royally messed up your tablet. If you have replaced the recovery to something other than the original asus recovery then your best bet is to buy a logic board from ebay and replace it manually yourself.
I took mine to asus repair center and they said they will charge 200$ and 3 days to replace the logic board. I managed to buy the part for 70$ and do it myself. Just a side note, I bought and item that was AS-IS, so I am glad mine worked.
Click to expand...
Click to collapse
Thanks for the tips!
It's quite weird. I booted it into recovery, and via adb I was able to mount /data fine and poke around. I unmounted, then mounted /system, and that worked fine too. Unmounted, rebooted, no dice; shutdown during reboot. Now I've booted back into recovery, and it locked up even trying to get into recovery, and I can't mount /data or /system (all result in long pauses and kernel errors).
You say I messed up my tablet... what do you think caused this? And yes, I've got CWM on here, although I could just fastboot the original recovery on if that would help...
Is there any way to boot this thing off of the external SD?
What was wrong with yours that required replacing the logic board?
lexelby said:
Thanks for the tips!
It's quite weird. I booted it into recovery, and via adb I was able to mount /data fine and poke around. I unmounted, then mounted /system, and that worked fine too. Unmounted, rebooted, no dice; shutdown during reboot. Now I've booted back into recovery, and it locked up even trying to get into recovery, and I can't mount /data or /system (all result in long pauses and kernel errors).
You say I messed up my tablet... what do you think caused this? And yes, I've got CWM on here, although I could just fastboot the original recovery on if that would help...
Is there any way to boot this thing off of the external SD?
What was wrong with yours that required replacing the logic board?
Click to expand...
Click to collapse
It sounds like your boot is corrupted. There may be a way for ASUS to recover it without replacing the board.
My problem was that I messed up my boot and I could no longer flash anything or even modify files on the filesystems.
devbro said:
It sounds like your boot is corrupted. There may be a way for ASUS to recover it without replacing the board.
My problem was that I messed up my boot and I could no longer flash anything or even modify files on the filesystems.
Click to expand...
Click to collapse
Powering off completely seems to restore the device's ability to mount /system. I think touching a certain place on the emmc puts the controller in a bad state. I'm going to see if I can narrow down the bad blocks and partition around them or similar.
Barring that, where did you find a logic board for so cheap?
lexelby said:
Powering off completely seems to restore the device's ability to mount /system. I think touching a certain place on the emmc puts the controller in a bad state. I'm going to see if I can narrow down the bad blocks and partition around them or similar.
Barring that, where did you find a logic board for so cheap?
Click to expand...
Click to collapse
If you can access it in adb, the first thing I would do is adb pull my data off the tablet.
Then you could run fsck on your partitions in an adb shell.
Maybe just a simple format of/system and /data would clear corruption already....
I don't know the correct fsck command for this tablet top of my head, but you have to unmount the partition you want to run it on and then something similar to this (this is for the /data partition of the TF700):
Code:
e2fsck -fvyD /dev/block/mmcblk0p8
You seem to know your way around, I'm sure you can find it.
Good luck!
berndblb said:
If you can access it in adb, the first thing I would is adb pull my data off the tablet.
Then you could run fsck on your partitions in an adb shell.
Maybe just a simple format of/system and /data would clear corruption already....
I don't know the correct fsck command for this tablet top of my head, but you have to unmount the partition you want to run it on and then
Code:
fsck /dev/target_partition_name
You seem to know your way around, I'm sure you can find it.
Good luck!
Click to expand...
Click to collapse
Nah, it's not simple fs corruption -- first thing I checked, but thanks for the suggestion Been poking at it for a few hours, and it seems like the actual mmc bus/chip is screwed, not just a bad block. I think replacing the logic board is the way to go. Anyone want to let a tf701t with a dead screen go for cheap?
And yeah, I know my way around a bit, but really only enough to sound like I know what I'm doing I recognized the problem because I lost my sgh-i777 to a very similar issue, a failing internal sd. Seems like the Achilles' heel of android devices.
lexelby said:
Seems like the Achilles' heel of android devices.
Click to expand...
Click to collapse
I've owned close to a dozen Android devices. The SD still has to fail on me...
Maybe it's not the hardware, maybe it's - you [emoji33][emoji12]
Anyway, good luck with this. Oh, and devbro found the logic board on ebay..
berndblb said:
If you can access it in adb, the first thing I would do is adb pull my data off the tablet.
Then you could run fsck on your partitions in an adb shell.
Maybe just a simple format of/system and /data would clear corruption already....
I don't know the correct fsck command for this tablet top of my head, but you have to unmount the partition you want to run it on and then something similar to this (this is for the /data partition of the TF700):
Code:
e2fsck -fvyD /dev/block/mmcblk0p8
You seem to know your way around, I'm sure you can find it.
Good luck!
Click to expand...
Click to collapse
lexelby said:
Nah, it's not simple fs corruption -- first thing I checked, but thanks for the suggestion Been poking at it for a few hours, and it seems like the actual mmc bus/chip is screwed, not just a bad block. I think replacing the logic board is the way to go. Anyone want to let a tf701t with a dead screen go for cheap?
And yeah, I know my way around a bit, but really only enough to sound like I know what I'm doing I recognized the problem because I lost my sgh-i777 to a very similar issue, a failing internal sd. Seems like the Achilles' heel of android devices.
Click to expand...
Click to collapse
berndblb said:
I've owned close to a dozen Android devices. The SD still has to fail on me...
Maybe it's not the hardware, maybe it's - you [emoji33][emoji12]
Anyway, good luck with this. Oh, and devbro found the logic board on ebay..
Click to expand...
Click to collapse
Be careful mmcblk0p8 is /data on the TF700, on the TF701 it is mmcblk0p14
Code:
name device mountpoint fs description
/dev/block/platform/sdhci-tegra.3/ADF /dev/block/mmcblk0p7 /ADF ext4 ?
/dev/block/platform/sdhci-tegra.3/APD /dev/block/mmcblk0p6 /APD ext4 ASUS Product Demo
/dev/block/platform/sdhci-tegra.3/APP /dev/block/mmcblk0p4 /system ext4 Android OS
/dev/block/platform/sdhci-tegra.3/CAC /dev/block/mmcblk0p5 /cache ext4 recovery logs
/dev/block/platform/sdhci-tegra.3/CRA /dev/block/mmcblk0p11 ?
/dev/block/platform/sdhci-tegra.3/DTB /dev/block/mmcblk0p2 ?
/dev/block/platform/sdhci-tegra.3/EKS /dev/block/mmcblk0p13 NVEKSP
/dev/block/platform/sdhci-tegra.3/LNX /dev/block/mmcblk0p3 Linux kernel (8388608 b)
/dev/block/platform/sdhci-tegra.3/MDA /dev/block/mmcblk0p12 ?
/dev/block/platform/sdhci-tegra.3/MSC /dev/block/mmcblk0p8 empty (misc, bootloader etc.)
/dev/block/platform/sdhci-tegra.3/PER /dev/block/mmcblk0p10 /persist ext4 config/calibration data
/dev/block/platform/sdhci-tegra.3/SOS /dev/block/mmcblk0p1 Recovery kernel (8388608 b)
/dev/block/platform/sdhci-tegra.3/UDA /dev/block/mmcblk0p14 /data ext4 Android user data
/dev/block/platform/sdhci-tegra.3/USP /dev/block/mmcblk0p9 Staging (blob)
sbdags said:
Be careful mmcblk0p8 is /data on the TF700, on the TF701 it is mmcblk0p14
Code:
name device mountpoint fs description
/dev/block/platform/sdhci-tegra.3/ADF /dev/block/mmcblk0p7 /ADF ext4 ?
/dev/block/platform/sdhci-tegra.3/APD /dev/block/mmcblk0p6 /APD ext4 ASUS Product Demo
/dev/block/platform/sdhci-tegra.3/APP /dev/block/mmcblk0p4 /system ext4 Android OS
/dev/block/platform/sdhci-tegra.3/CAC /dev/block/mmcblk0p5 /cache ext4 recovery logs
/dev/block/platform/sdhci-tegra.3/CRA /dev/block/mmcblk0p11 ?
/dev/block/platform/sdhci-tegra.3/DTB /dev/block/mmcblk0p2 ?
/dev/block/platform/sdhci-tegra.3/EKS /dev/block/mmcblk0p13 NVEKSP
/dev/block/platform/sdhci-tegra.3/LNX /dev/block/mmcblk0p3 Linux kernel (8388608 b)
/dev/block/platform/sdhci-tegra.3/MDA /dev/block/mmcblk0p12 ?
/dev/block/platform/sdhci-tegra.3/MSC /dev/block/mmcblk0p8 empty (misc, bootloader etc.)
/dev/block/platform/sdhci-tegra.3/PER /dev/block/mmcblk0p10 /persist ext4 config/calibration data
/dev/block/platform/sdhci-tegra.3/SOS /dev/block/mmcblk0p1 Recovery kernel (8388608 b)
/dev/block/platform/sdhci-tegra.3/UDA /dev/block/mmcblk0p14 /data ext4 Android user data
/dev/block/platform/sdhci-tegra.3/USP /dev/block/mmcblk0p9 Staging (blob)
Click to expand...
Click to collapse
Thanks sdbags, nice catch. Btw, having developed ROMs for this tablet, do you think it's possible at all to boot android off of the external sd? It'd be helpful to know if I shouldn't even bother trying to figure out how.
lexelby said:
Thanks sdbags, nice catch. Btw, having developed ROMs for this tablet, do you think it's possible at all to boot android off of the external sd? It'd be helpful to know if I shouldn't even bother trying to figure out how.
Click to expand...
Click to collapse
Yes I have it working But haven't released it maybe after CROMi-X 7 is finished I will release the flash files that allow you to run one ROM internally and one rom off the card as ROM2SD
It's just an awful lot of work to maintain that doing it for the 300, 201 and 700 transformer crowd has kind of put me off doing for the 701. Also the internal mmc is faster than most fast sdcards so we won't see the benefits that especially the 700 users get.
sbdags said:
Yes I have it working But haven't released it maybe after CROMi-X 7 is finished I will release the flash files that allow you to run one ROM internally and one rom off the card as ROM2SD
It's just an awful lot of work to maintain that doing it for the 300, 201 and 700 transformer crowd has kind of put me off doing for the 701. Also the internal mmc is faster than most fast sdcards so we won't see the benefits that especially the 700 users get.
Click to expand...
Click to collapse
Dude, that totally just made my day, knowing that this is possible Any way you'd be willing to share your development version with me? I'd be your best beta tester every -- hell, I'd be maintainer for the rom2sd part for tf701t if you'd let me. I'm rather motivated at this point, and I have years of professional Linux experience... probably about time I took up android ROM development
lexelby said:
Dude, that totally just made my day, knowing that this is possible Any way you'd be willing to share your development version with me? I'd be your best beta tester every -- hell, I'd be maintainer for the rom2sd part for tf701t if you'd let me. I'm rather motivated at this point, and I have years of professional Linux experience... probably about time I took up android ROM development
Click to expand...
Click to collapse
Hmmm Ok let me sort out the main CROMi-X release and I might take you up on that. I warn you that it is rather a lot to get ROM2SD working though! But if you are up for it ....
sbdags said:
Hmmm Ok let me sort out the main CROMi-X release and I might take you up on that. I warn you that it is rather a lot to get ROM2SD working though! But if you are up for it ....
Click to expand...
Click to collapse
I am totally up for it -- it's that or shelve my tablet until I can afford a logic board I'll be trying to port a ROM to sd from scratch anyway, so having your ROM to start from would be a huge leg up.
lexelby said:
I am totally up for it -- it's that or shelve my tablet until I can afford a logic board I'll be trying to port a ROM to sd from scratch anyway, so having your ROM to start from would be a huge leg up.
Click to expand...
Click to collapse
If your internal sd is completely dead then rom2sd won't work I'm afraid - it relies on the kernel being able to at least read some files from internal to allow it to switch to external....
sbdags said:
If your internal sd is completely dead then rom2sd won't work I'm afraid - it relies on the kernel being able to at least read some files from internal to allow it to switch to external....
Click to expand...
Click to collapse
That's the thing, it works enough to get it into recovery. My plan was to try to kexec from recovery into a modified ROM.
Victory!
I took sdbags's stock zip (4.3) and extracted it on my computer. I used unmkbootimg to extract the initramfs.gz and kernel.gz from the boot.img in the ROM. I unzipped the initramfs and un-cpio'd it, then modified macallan.fstab to refer to /dev/block/mmcblk1p1 for /data, p2 for /system, and p3 for /cache. I also modified init.macallan.rc to avoid having it try to make filesystems on the EMMC -- I want it not to try touching the EMMC at all.
Next I rebuilt the initramfs.gz. I bought a good quality class 10 microsd and partitioned it on my computer with 3 primary partitions, one for /data, one for /system, and one for /cache (about 2GB and 1GB for /system and /cache). I made ext4 filesystems on all 3 partitions, mounted p2, and copied the rom over and installed it by hand using the updater-script as a guide. Then I unmounted and popped the SD card into my TF701t.
To boot it, I put my tablet into fastboot mode. I booted the kernel and ramdisk using 'fastboot boot' -- no need for kexec from recovery. I can do this without any reliance whatsoever on the internal EMMC. It took awhile to boot up, but it booted first try. The app drawer was a bit slow to come up, but I'm pretty happy I get to use my tablet at all! This whole process turned out to be MUCH easier than I expected it would be, and I'm quite confident I could do this to boot any ROM I wanted. I only use stock because of driver issues with my bluetooth keyboard.
Still willing to try my hand at maintaining cromi's ROM2SD branch though
Thanks everyone for all of your help!
Now that it's finished booting, it's really not sluggish at all. Hooray for class 10 sd cards.
Just to make this whole thing even a bit easier, I grabbed an arm-compiled version of the fastboot tool (search for fastbootarm) and put the kernel and ramdisk on my phone, so I can jump-start the tablet using my phone (via USB OTG cable) even when I'm not near my computer.
Will this be usable only from OTG pendrive?(Moto G no sdcard slot)
I had a similar issue with my Nexus 5 and 7 (2013) where I could no longer mount or read the /data or /system partitions but I could still boot into recovery and thought I scored two brand new drink coasters, but then came across this thread where it repaired corrupted partitions and I could now read and mount all partitions normally.
Being a Transformer tablet and not a Nexus device i'm assuming one or two of the adb commands might be a bit different for the disk partitions like someone mentioned in a previous post though..?
Might not be useful to you but thought I'd post it here anyway incase it might help somehow

Categories

Resources