making a nook-bootable SD card (in general) on Linux - Nook Color Android Development

It took me a while to figure out why verygreen's image worked, but I was not able to reproduce the result by creating my own partitions and copying his files over. Looking more closely at verygreen's image and my own, I noticed that the first partitions started at different positions. I was able to get my homebrew SD card working just by making the first partition start at the 63rd sector:
Code:
$ sudo fdisk -l /dev/sdb
Disk /dev/sdb: 15.9 GB, 15931539456 bytes
64 heads, 32 sectors/track, 15193 cylinders, total 31116288 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000e525a
Device Boot Start End Blocks Id System
/dev/sdb1 * 63 329790 164864 e W95 FAT16 (LBA)
/dev/sdb2 329791 1312830 491520 83 Linux
/dev/sdb3 1312831 3409982 1048576 83 Linux
/dev/sdb4 3409983 31116287 13853152+ c W95 FAT32 (LBA)
How do you do this using fdisk? After you create the first partition, type 'x' for extra functionality (experts only). From there, you could then type 'b', then '1', then '63' to make your first partition start at the right place. Press 'r' to return to the main menu, and make the rest of your partitions from there. Note that this operation breaks whatever filesystem was originally on the first partition, so it would need to be reformatted. MAKE BACKUPS. Don't forget to write changes!
FatTire and nemith confirmed that the first partition needed to be special, and pointed to this informational page. It even contains a nifty script. I didn't need most of that, since tweaking the beginning-of-data worked for me every time, but give it a read anyway.

You know, I'm sure this was something very simple for the ones that knew. But I too struggled with creating a bootable sdcard from scratch. I would set up all the correct partitions with the correct flags and still nogo. Who would've thought it would be something as simple as that. Thanks for this!
-Racks

Now I can create my own "Verygreen" installer img, muah ha hah... It was that whole formatting the uSD thing with those special considerations that has been tripping me up the whole time.

This didnt work for me, anyone have a script that could format a boot partition and an ext 3 partition with it? one with custom boot size like 4Gb fat or 3GB fat or 5GB fat prefferably 4.5GB but if you know how to customise the script below to create 4.5 GB fat partiton right now this creates only a 73 Mb fat partition the rest ext3
#! /bin/sh
# mkcard.sh v0.5
# (c) Copyright 2009 Graeme Gregory <[email protected]>
# Licensed under terms of GPLv2
#
# Parts of the procudure base on the work of Denys Dmytriyenko
# http://wiki.omap.com/index.php/MMC_Boot_Format
export LC_ALL=C
if [ $# -ne 1 ]; then
echo "Usage: $0 <drive>"
exit 1;
fi
DRIVE=$1
dd if=/dev/zero of=$DRIVE bs=1024 count=1024
SIZE=`fdisk -l $DRIVE | grep Disk | grep bytes | awk '{print $5}'`
echo DISK SIZE - $SIZE bytes
CYLINDERS=`echo $SIZE/255/63/512 | bc`
echo CYLINDERS - $CYLINDERS
{
echo ,9,0x0C,*
echo ,,,-
} | sfdisk -D -H 255 -S 63 -C $CYLINDERS $DRIVE
sleep 1
if [ -x `which kpartx` ]; then
kpartx -a ${DRIVE}
fi
# handle various device names.
# note something like fdisk -l /dev/loop0 | egrep -E '^/dev' | cut -d' ' -f1
# won't work due to https://bugzilla.redhat.com/show_bug.cgi?id=649572
PARTITION1=${DRIVE}1
if [ ! -b ${PARTITION1} ]; then
PARTITION1=${DRIVE}p1
fi
DRIVE_NAME=`basename $DRIVE`
DEV_DIR=`dirname $DRIVE`
if [ ! -b ${PARTITION1} ]; then
PARTITION1=$DEV_DIR/mapper/${DRIVE_NAME}p1
fi
PARTITION2=${DRIVE}2
if [ ! -b ${PARTITION2} ]; then
PARTITION2=${DRIVE}p2
fi
if [ ! -b ${PARTITION2} ]; then
PARTITION2=$DEV_DIR/mapper/${DRIVE_NAME}p2
fi
# now make partitions.
if [ -b ${PARTITION1} ]; then
umount ${PARTITION1}
mkfs.vfat -F 32 -n "boot" ${PARTITION1}
else
echo "Cant find boot partition in /dev"
fi
if [ -b ${PARITION2} ]; then
umount ${PARTITION2}
mke2fs -j -L "Angstrom" ${PARTITION2}
else
echo "Cant find rootfs partition in /dev"
fi

DroidisLINUX said:
This didnt work for me, anyone have a script that could format a boot partition and an ext 3 partition with it? one with custom boot size like 4Gb fat or 3GB fat or 5GB fat prefferably 4.5GB but if you know how to customise the script below to create 4.5 GB fat partiton right now this creates only a 73 Mb fat partition the rest ext3
#! /bin/sh
# mkcard.sh v0.5
# (c) Copyright 2009 Graeme Gregory <[email protected]>
# Licensed under terms of GPLv2
#
# Parts of the procudure base on the work of Denys Dmytriyenko
# http://wiki.omap.com/index.php/MMC_Boot_Format
export LC_ALL=C
if [ $# -ne 1 ]; then
echo "Usage: $0 <drive>"
exit 1;
fi
DRIVE=$1
dd if=/dev/zero of=$DRIVE bs=1024 count=1024
SIZE=`fdisk -l $DRIVE | grep Disk | grep bytes | awk '{print $5}'`
echo DISK SIZE - $SIZE bytes
CYLINDERS=`echo $SIZE/255/63/512 | bc`
echo CYLINDERS - $CYLINDERS
{
echo ,9,0x0C,*
echo ,,,-
} | sfdisk -D -H 255 -S 63 -C $CYLINDERS $DRIVE
sleep 1
if [ -x `which kpartx` ]; then
kpartx -a ${DRIVE}
fi
# handle various device names.
# note something like fdisk -l /dev/loop0 | egrep -E '^/dev' | cut -d' ' -f1
# won't work due to https://bugzilla.redhat.com/show_bug.cgi?id=649572
PARTITION1=${DRIVE}1
if [ ! -b ${PARTITION1} ]; then
PARTITION1=${DRIVE}p1
fi
DRIVE_NAME=`basename $DRIVE`
DEV_DIR=`dirname $DRIVE`
if [ ! -b ${PARTITION1} ]; then
PARTITION1=$DEV_DIR/mapper/${DRIVE_NAME}p1
fi
PARTITION2=${DRIVE}2
if [ ! -b ${PARTITION2} ]; then
PARTITION2=${DRIVE}p2
fi
if [ ! -b ${PARTITION2} ]; then
PARTITION2=$DEV_DIR/mapper/${DRIVE_NAME}p2
fi
# now make partitions.
if [ -b ${PARTITION1} ]; then
umount ${PARTITION1}
mkfs.vfat -F 32 -n "boot" ${PARTITION1}
else
echo "Cant find boot partition in /dev"
fi
if [ -b ${PARITION2} ]; then
umount ${PARTITION2}
mke2fs -j -L "Angstrom" ${PARTITION2}
else
echo "Cant find rootfs partition in /dev"
fi
Click to expand...
Click to collapse
Code:
# fdisk /dev/sdb
Command (m for help): o
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Print card info:
Command (m for help): p
Disk /dev/sdb: 128 MB, 128450560 bytes
....
Note card size in bytes. Needed later below.
Then go into "Expert mode":
Command (m for help): x
Now we want to set the geometry to 255 heads, 63 sectors and calculate the number of cylinders required for the particular SD/MMC card:
Expert command (m for help): h
Number of heads (1-256, default 4): 255
Expert command (m for help): s
Number of sectors (1-63, default 62): 63
Warning: setting sector offset for DOS compatiblity
Expert command (m for help): c
Number of cylinders (1-1048576, default 1011): 15
In this case 128MB card is used (reported as 128450560 bytes by fdisk above), thus 128450560 / 255 / 63 / 512 = 15.6 rounded down to 15 cylinders. Numbers there are 255 heads, 63 sectors, 512 bytes per sector.
Now, return to main mode and create a new partition:
Expert command (m for help): r
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-15, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-15, default 15): 15
Mark it bootable:
Command (m for help): a
Partition number (1-4): 1
And change its type to FAT32:
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): c
Changed system type of partition 1 to c (W95 FAT32 (LBA))
The result is:
Command (m for help): p
Disk /dev/sdb: 128 MB, 128450560 bytes
255 heads, 63 sectors/track, 15 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 15 120456 c W95 FAT32 (LBA)
Now, really write configuration to card (until here, card is not changed):
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.
Done! What's left is to format our partition as FAT32 to be mounted and populated:
# mkfs.vfat -F 32 /dev/sdb1
mkfs.vfat 2.11 (12 Mar 2005)
Note: before running mkfs.vfat (included in the dosfstools package in Debian) make sure /dev/sdb is not mounted.
# mount /dev/sdb1 /mnt/tmp
Note: If you use additional mkfs.vfat parameter -n you can give the card a name, e.g. for easier identification (i.e. mkfs.vfat -n omap3 -F 32 /dev/sdb1)
The SD/MMC card is now ready to be used to boot OMAP3 boards.
sfdisk
In order to format same card using sfdisk, one needs to do the following:
# sfdisk -H 255 -S 63 -C 15 /dev/sdb << EOF
> ,,b,*
> EOF
This worked for me, once I used mkcard.sh I deleted the partitions then created a new partition following these steps and now I have a 4.5 Gb boot partition and a 3.0 ext3 Angstrom partition and a 500 Mb swap partition I found that the angstrom only needed about 2.7 to 2.8 Gb or space so that was why I wanted it this way so I could still have a large sdcard when I boot normaly.
I did have to do some math as my sdcard is a 8 GB sdcard not a 128 megs but once i did the math the cyclenders came out to be 966 and then I did everything else like it said make sure to add bootable flag and edit first sector at 63 on the first partition then it works, if you have problems try to change id to option e worked (W95 FAT16 (LBA)) and use mkfs.vfat -F 16 /dev/sdb1 other wise try option c mkfs.vfat -F 32 /dev/sdb1. I got the fat 32 to work so I am happy

Related

[Q] MKFS.EXT4 Compiled for Android

I'm trying to make an auto install script within the initramfs. I've got everything working, including automatic fdisk, but I cannot get mkfs.ext4 to work on the Android kernel, and there is no version of Busybox with the ext4 applet. Does anyone have a mkfs.ext4 that runs successfully on Android? When I run it from a terminal the output is
Code:
mkfs.ext4: 1: Syntax error: word unexpected (expecting ")")
Here's my code if you want to see what I'm doing.
Code:
mount /dev/mmcblk1p1 /tmp/mnt
if [ -f /tmp/mnt/mysticfw.tar.gz ]; then
$FDISK /dev/mmcblk0 < /home/fdisk.input
$MKFS_EXT4 -O ^huge_file /dev/mmcblk0p2
mount /dev/mmcblk1p2 /tmp/tmproot
mkdir /tmp/tmproot/itworks
tar -xzvf /tmp/mnt/mysticfw.tar.gz -C /tmp/tmproot/
sync
#rm /tmp/mnt/mysticfw.tar.gz
umount /tmp/tmproot
fi
sync
umount /tmp/mnt
It automatically partitions the stock Android block and installs a tar.gz from the internal storage to simplify my unsquashed 2.1.4 filesystem install, and the only part I can't get working is mkfs.ext4.
Found one! It's 3 MBs though, so if anyone has a smaller one, it would be very nice.
msticninja said:
I'm trying to make an auto install script within the initramfs. I've got everything working, including automatic fdisk, but I cannot get mkfs.ext4 to work on the Android kernel, and there is no version of Busybox with the ext4 applet. Does anyone have a mkfs.ext4 that runs successfully on Android? When I run it from a terminal the output is
Code:
mkfs.ext4: 1: Syntax error: word unexpected (expecting ")")
Click to expand...
Click to collapse
Why do you don't use the mke2fs from Uruk for example (the easiest way) asking $auron if it's ok for him. His size is only 49KB.
Find it like the following on Uruk installation:
Code:
[COLOR="DarkRed"]
# mkfs.ext4 -V
mke2fs 1.41.3 (12-Oct-2008)
Using EXT2FS Library version 1.41.3
# find / -name mke2fs | xargs ls -l
-rwxr-xr-x 1 root root 30584 Dec 15 03:46 /system/bin/mke2fs
[B]-rwxr-xr-x 5 root root 49248 4 Jan 15 13:14 /usr/local/sbin/mke2fs[/B]
#/usr/local/sbin/mke2fs -V
mke2fs 1.41.3 (12-Oct-2008)
Using EXT2FS Library version 1.41.3
[/COLOR]
Here's my code if you want to see what I'm doing.
Code:
mount /dev/mmcblk1p1 /tmp/mnt
if [ -f /tmp/mnt/mysticfw.tar.gz ]; then
$FDISK /dev/mmcblk0 < /home/fdisk.input
$MKFS_EXT4 -O ^huge_file /dev/mmcblk0p2
mount /dev/mmcblk1p2 /tmp/tmproot
mkdir /tmp/tmproot/itworks
tar -xzvf /tmp/mnt/mysticfw.tar.gz -C /tmp/tmproot/
sync
#rm /tmp/mnt/mysticfw.tar.gz
umount /tmp/tmproot
fi
sync
umount /tmp/mnt
It automatically partitions the stock Android block and installs a tar.gz from the internal storage to simplify my unsquashed 2.1.4 filesystem install, and the only part I can't get working is mkfs.ext4.
Click to expand...
Click to collapse
and don't forget to add "-l" on FDISK command and change the device mmcblk0 with mmcblk1 on the lines:
Code:
$FDISK /dev/mmcblk0 < /home/fdisk.input
$MKFS_EXT4 -O ^huge_file /dev/mmcblk0p2
Cheers,
shklifo said:
Why do you don't use the mke2fs from Uruk for example (the easiest way) asking $auron if it's ok for him. His size is only 49KB.
Find it like the following on Uruk installation:
Code:
[COLOR="DarkRed"]
# mkfs.ext4 -V
mke2fs 1.41.3 (12-Oct-2008)
Using EXT2FS Library version 1.41.3
# find / -name mke2fs | xargs ls -l
-rwxr-xr-x 1 root root 30584 Dec 15 03:46 /system/bin/mke2fs
[B]-rwxr-xr-x 5 root root 49248 4 Jan 15 13:14 /usr/local/sbin/mke2fs[/B]
#/usr/local/sbin/mke2fs -V
mke2fs 1.41.3 (12-Oct-2008)
Using EXT2FS Library version 1.41.3
[/COLOR]
and don't forget to add "-l" on FDISK command and change the device mmcblk0 with mmcblk1 on the lines:
Code:
$FDISK /dev/mmcblk0 < /home/fdisk.input
$MKFS_EXT4 -O ^huge_file /dev/mmcblk0p2
Cheers,
Click to expand...
Click to collapse
Why didn't I think of that? Thanks.
But regarding mmcblk0/1, I'm replacing the stock Android, so the fdisk.input file contains the commands to delete mmcblk0p2 and p3, and make a new partition in the unused space. I hate using space on my Internal Storage, so I'm using Archos' space.
msticninja said:
Why didn't I think of that? Thanks.
But regarding mmcblk0/1, I'm replacing the stock Android, so the fdisk.input file contains the commands to delete mmcblk0p2 and p3, and make a new partition in the unused space. I hate using space on my Internal Storage, so I'm using Archos' space.
Click to expand...
Click to collapse
If you are using the mmcblk0p2 as rootfs as you say (and you are expanded tar archive on mmcblk1p2), than you have to change the line:
mount /dev/mmcblk1p2 /tmp/tmproot
Click to expand...
Click to collapse
with
mount /dev/mmcblk0p2 /tmp/tmproot
Click to expand...
Click to collapse
shklifo said:
If you are using the mmcblk0p2 as rootfs as you say (and you are expanded tar archive on mmcblk1p2), than you have to change the line:
with
Click to expand...
Click to collapse
I know, that's my current data partition, I'll change it once I'm done testing. The tar file just has a test file in it, so when I boot back into block1, I can see if the IF statement was executed by seeing if it was extracted to block1. I'll also have to change etc/mountpoints once testing is actually finished.
One more question since you're so quick. I think I have everything working, except it needs a reboot in between the fdisk and mke2fs commands to reload the partition table. I'm trying to use partprobe instead of rebooting, but it hasn't been cross compiled to work on Android, AFAIK. Have you seen a way to reload the MBR without rebooting?
msticninja said:
I know, that's my current data partition, I'll change it once I'm done testing. The tar file just has a test file in it, so when I boot back into block1, I can see if the IF statement was executed by seeing if it was extracted to block1. I'll also have to change etc/mountpoints once testing is actually finished.
One more question since you're so quick. I think I have everything working, except it needs a reboot in between the fdisk and mke2fs commands to reload the partition table. I'm trying to use partprobe instead of rebooting, but it hasn't been cross compiled to work on Android, AFAIK. Have you seen a way to reload the MBR without rebooting?
Click to expand...
Click to collapse
I'v been looking at the recovery_lib.sh in the recovery boot image and can't find anything special to re-read the partition table. And yes they also use fdisk to repartition. So I suspect the driver for the block device does not cache the MBR and you can just mke2fs after the partition table is created.
I can't remember from what firmware that recovery boot image was but I think it's from the 2.1.04 and they do some repartitioning there for the swap space.
I'll check it again and get back to you.
wdl1908 said:
I'v been looking at the recovery_lib.sh in the recovery boot image and can't find anything special to re-read the partition table. And yes they also use fdisk to repartition. So I suspect the driver for the block device does not cache the MBR and you can just mke2fs after the partition table is created.
I can't remember from what firmware that recovery boot image was but I think it's from the 2.1.04 and they do some repartitioning there for the swap space.
I'll check it again and get back to you.
Click to expand...
Click to collapse
I just checked the recovery image from 2.1.04 and after the fdisk commands there is nothing to re-read the MBR the next commands executed are mount commands to check if the fs is present I suggest you look at the /etc/scripts/recovery_lib.sh yourself it could give some clues on how to do things.
wdl1908 said:
I just checked the recovery image from 2.1.04 and after the fdisk commands there is nothing to re-read the MBR the next commands executed are mount commands to check if the fs is present I suggest you look at the /etc/scripts/recovery_lib.sh yourself it could give some clues on how to do things.
Click to expand...
Click to collapse
For me too, it have nothing to do with a reboot to load partitions table and access partition to format them with the choised filesystem.
You can delete any partition on linux (except rootfs one ), recreate them and directly format them as you like, reboot isn't necesary.
Thanks for all the replies, very helpful, but I'm stuck. Fdisk seems to use ioctl to reload the partition table, so you don't need a reboot if everything on the device is unmounted before writing the partition table, but I'm having very strange issues with mke2fs now. I've had the whole thing work twice now, but when I flash back to stock, then retry the script, it usually does everything except the formatting. Here's the code:
Code:
mount /dev/mmcblk1p1 /tmp/mnt
if [ -f /tmp/mnt/mysticfw.tar.gz ]; then
umount /dev/mmcblk0p1
umount /dev/mmcblk0p2
umount /dev/mmcblk0p3
umount /dev/mmcblk0p4
fdisk /dev/mmcblk0 < /home/fdisk.input
mv /tmp/mnt/mysticfw.tar.gz /tmp/mnt/mysticf.tar.gz
sync
umount /tmp/mnt
log_and_reboot
fi
if [ -f /tmp/mnt/mysticf.tar.gz ]; then
rm /etc/mtab
touch /etc/mtab
mke2fs -T ext4 -O ^huge_file /dev/mmcblk0p2
mount /dev/mmcblk0p2 /tmp/tmproot
tar -xzf /tmp/mnt/mysticf.tar.gz -C /tmp/tmproot/
sync
mv /tmp/mnt/mysticf.tar.gz /tmp/mnt/mysticdone.tar.gz
umount /tmp/tmproot
rm /etc/mtab
ln -s /proc/mounts /etc/mtab
fi
sync
umount /tmp/mnt
I have it reboot after the fdisk just in case, and the fdisk works perfectly, so the second IF/THEN is the issue. I had to retouch the mtab just to make sure it's empty, as mke2fs fails if mtab doesn't exist(at least in terminal), then I relink it to /proc/mounts as they do in the stock firmware. Here's my mke2fs.conf:
Code:
[defaults]
base_features = sparse_super,filetype,resize_inode,dir_index,ext_attr
blocksize = 4096
inode_size = 256
inode_ratio = 16384
[fs_types]
ext3 = {
features = has_journal
}
ext4 = {
features = has_journal,extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize
inode_size = 256
}
ext4dev = {
features = has_journal,extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize
inode_size = 256
options = test_fs=1
}
small = {
blocksize = 1024
inode_size = 128
inode_ratio = 4096
}
floppy = {
blocksize = 1024
inode_size = 128
inode_ratio = 8192
}
news = {
inode_ratio = 4096
}
largefile = {
inode_ratio = 1048576
blocksize = -1
}
largefile4 = {
inode_ratio = 4194304
blocksize = -1
}
hurd = {
blocksize = 4096
inode_size = 128
}
Is there a way to echo the output from my script to a file like dontpanic so I can see what the error is?
msticninja said:
Is there a way to echo the output from my script to a file like dontpanic so I can see what the error is?
Click to expand...
Click to collapse
Simple append (">>") and "echo" doesn't work to a redirected logfile?
I've only learned what I've needed to learn over the years, usually with endless google searches and reading through man pages, so I've never tried to log outputs, because I could always see the output in a terminal or onscreen during boot. Android is the first time I haven't been able to actually see the boot process.
Once again, thanks for your help. I probably could've googled this, but I kind of asked as an afterthought. I didn't even think about redirecting. So if the mke2fs line is the one I want to log, I just add "2&>> /tmp/mnt/logfile" to the end of it, right?
Also, thanks for your original thread about booting from Internal Storage, I never got around to developing on Android until you posted that, and I realized just how similar Android is to L/unix(e.g. exactly the same).
msticninja said:
I didn't even think about redirecting. So if the mke2fs line is the one I want to log, I just add "2&>> /tmp/mnt/logfile" to the end of it, right?
Click to expand...
Click to collapse
ehm, no.
In your case must be like the following:
Code:
"your command" >> /tmp/mnt/logfile 2>&1
That means redirect all messages from STDERR (2 - standard error) to STDOUT (1 - standard output) and all messaged collected on STDOUT to the redirected log file /tmp/mnt/logfile, or more comprensible redirect all mesage including error ones to the log file.
I'm working in Unix environments and use them often
And a good practice in developing is to use "echo" to the same log file, so you know the exact place the script is running, like:
Code:
echo "I'm just before the formatting step of the ..." >> /tmp/mnt/logfile
shklifo said:
ehm, no.
In your case must be like the following:
Code:
"your command" >> /tmp/mnt/logfile 2>&1
That means redirect all messages from STDERR (2 - standard error) to STDOUT (1 - standard output) and all messaged collected on STDOUT to the redirected log file /tmp/mnt/logfile, or more comprensible redirect all mesage including error ones to the log file.
I'm working in Unix environments and use them often
And a good practice in developing is to use "echo" to the same log file, so you know the exact place the script is running, like:
Code:
echo "I'm just before the formatting step of the ..." >> /tmp/mnt/logfile
Click to expand...
Click to collapse
Strange. The google searching lead me to believe the "2>&1" was before the location, and replaced ">>". Once again, thanks for the help.
any chance of you getting this uploaded? iterested in this since I'm not that good with linux
TjaXanK said:
any chance of you getting this uploaded? iterested in this since I'm not that good with linux
Click to expand...
Click to collapse
I could probably finish it, but I'm waiting for a new version of Uruk first, as his install script already gets rid of the linux steps, it just doesn't give you the choice to install to the internal memory yet. Once he does that, I'll add my changes to make it install to the Archos partition. The latest Uruk is also a bit too big for the archos partition. I had to cut my data partition down to ~150 megs.
msticninja said:
I could probably finish it, but I'm waiting for a new version of Uruk first, as his install script already gets rid of the linux steps, it just doesn't give you the choice to install to the internal memory yet. Once he does that, I'll add my changes to make it install to the Archos partition. The latest Uruk is also a bit too big for the archos partition. I had to cut my data partition down to ~150 megs.
Click to expand...
Click to collapse
ok, I'm currently running urk with the new install system and it's brillant but it would be perfect if we could run it without cutting down on our storage space

[HOWTO] fix your partitions on your nook tablet 16GB (UNBRICK)

Hello!
The partitions on my nook got messy, and when i tried to use the repart.img i got a red X.
i found this guide by so****e whice didn't work for me, but defenetly helped me and everything that is written here is based on it.
Download the files from so****e thread and put them where it says. When you get to the part of the commands- come back here. (in the last link, one file (scrips) is down from the server. you can get this file here.)
This should work for the nook tablet 16GB, i don't know about the 8GB.
This method worked for me, i'm not sure it will work for you, but it should.
I am not responsible for any damage; anyhow this should fix the damage. DO NOT try this if you don't have any experience. Before you do enything, read everything and make sure you understand.
After you have all the files in the right place, and you are in CWM recovery, let's get started.
In CWM, get into mounts and storage, and then get into mount SDcard.
Open the CMD in your computer, connect your nook to your computer and let's start the work
After you write "adb devices", make sure you see the serial number and recovery:
Code:
$ adb start-server
$ adb devices
This will backup your rom partition, which holds important information, like serial no. and MAC address- When i tried to save it i got an error, maybe this will work for you, this is pretty important:
Code:
$ adb shell
~ # mount sdcard
~ # dd if=/dev/block/mmcblk0p5 of=/sdcard/blk/mmcblk0p5
Then:
Code:
~ # cd sdcard
/sdcard # ./sgdisk -Z /dev/block/mmcblk0
/sdcard # ./sgdisk /dev/block/mmcblk0 -a 256 -n 1:256:511 -n 0:0:1023 -n 0:0:31743 -n 0:0:65535 -n 0:0:163839 -n 0:0:262143 -n 0:0:1019903 -n 0:0:2273279 -n 0:0:3145727 -n 0:0:+12G -n 0:0:0
/sdcard # ./sgdisk -c 1:xloader -c 2:bootloader -c 3:recovery -c 4:boot -c 5:rom -c 6:bootdata -c 7:factory -c 8:system -c 9:cache -c 10:media -c 11:userdata /dev/block/mmcblk0
/sdcard # ./sgdisk -p /dev/block/mmcblk0
Then:
Code:
/sdcard # cd /sdcard/sbin
/sdcard # ./genptable /tmp/genptable
Then:
Code:
/sdcard # mv /tmp/genptable /sdcard/blk
~ # dd if=/sdcard/blk/genptable of=/dev/block/mmcblk0
Then:
Code:
/sdcard # cd sbin
/sdcard/sbin # ./mkdosfs -F 32 /dev/block/mmcblk0p5
/sdcard/sbin # ./mkdosfs -F 32 /dev/block/mmcblk0p6
/sdcard/sbin # ./mkdosfs -F 32 /dev/block/mmcblk0p10
Then:
Code:
/sdcard/sbin # cd ../../
~ # dd if=/sdcard/blk/mmcblk0p1 of=/dev/block/mmcblk0p1
~ # dd if=/sdcard/blk/mmcblk0p2 of=/dev/block/mmcblk0p2
~ # dd if=/sdcard/blk/mmcblk0p3 of=/dev/block/mmcblk0p3
~ # dd if=/sdcard/blk/mmcblk0p4 of=/dev/block/mmcblk0p4
~ # dd if=/sdcard/blk/mmcblk0p5 of=/dev/block/mmcblk0p5
Then:
Code:
~ # parted /dev/block/mmcblk0
(parted) mkpartfs primary ext2 134MB 522MB
(parted) mkpartfs primary ext2 522MB 1164MB
(parted) mkpartfs primary ext2 1164MB 1611MB
(parted) mkpartfs primary ext2 2684MB 15.9GB
Then:
Code:
(parted) quit
~ # tune2fs -j /dev/block/mmcblk0p7
~ # e2fsck -fDp /dev/block/mmcblk0p7
~ # tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p7
~ # e2fsck -fDp /dev/block/mmcblk0p7
~
~ # tune2fs -j /dev/block/mmcblk0p11
~ # e2fsck -fDp /dev/block/mmcblk0p11
~ # tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p11
~ # e2fsck -fDp /dev/block/mmcblk0p11
Then:
Code:
~ # parted /dev/block/mmcblk0
(parted) name 1 xloader
(parted) name 2 bootloader
(parted) name 3 recovery
(parted) name 4 boot
(parted) name 5 rom
(parted) name 6 bootdata
(parted) name 7 factory
(parted) name 8 system
(parted) name 9 cache
(parted) name 10 media
(parted) name 11 userdata
To make sure that everything is OK, do this:
Code:
(parted) print
If you did everything right, you should get something like this:
Code:
Number Start End Size File system Name Flags
1 131kB 262kB 131kB xloader
2 262kB 524kB 262kB bootloader
3 524kB 16.3MB 15.7MB recovery
4 16.3MB 33.6MB 17.3MB boot
5 33.6MB 83.9MB 50.3MB fat32 rom
6 83.9MB 134MB 50.3MB fat32 bootdata
7 134MB 522MB 388MB ext4 factory
8 522MB 1164MB 642MB system
9 1164MB 1611MB 447MB cache
10 1611MB 14.5GB 12.9GB fat32 media
11 14.5GB 15.9GB 1430MB ext4 userdata
###As you can see the "File system" in 8&9 are missing. After a rom installtion it will fix itself###
From here, just go to CWM, install your favorite rom and you are good to go.
[notice]If you have bootloader problem like me, just download "CyanoBoot" (Universal Bootloader).
Sorry if I had any spelling mistake,
and Goodluck!

Multi-Boot RPi from Command Line [31 Oct 2013]

I wrote a shell script to multi-boot my RPi from a terminal. Script can be executed remotely via SSH or VNC.
Features:
Automatically detect all ext4 partitions of all storage devices attached to RPi (ext4 is the default partition type for hosting an RPi-compatible OS)
Reconstruct boot device names (root=/dev/*) from partition editor output. No changes are made to storage devices
Generate table of boot options and prompt user for option
Include option to shutdown
Reboot to selected rootfs, e.g. /dev/sda2 according to user-selected boot option
Script uses partition editor (parted) to identify the storage device paths. I did have to install parted on Raspbmc:
Code:
sudo apt-get install parted
Presently I have triple boot:
Raspbian #1 on SD (/dev/mmcblk0p2)
Raspbian #2 on USB HD (/dev/sda2)
Raspbmc on USB HD (/dev/sda4)
Partition Info:
PNY 16GB SD
[email protected]:/boot# parted /dev/mmcblk0 print
Model: SD SD16G (sd/mmc)
Disk /dev/mmcblk0: 16.0GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 4194kB 62.9MB 58.7MB primary fat16 lba
2 62.9MB 16.0GB 15.9GB primary ext4
Western Digital 160GB HD 7200 RPM
[email protected]:/boot# parted /dev/sda print
Model: WDC WD1600BJKT-75F4T (scsi)
Disk /dev/sda: 160GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 4194kB 62.9MB 58.7MB primary fat16 lba
2 77.6MB 21.5GB 21.5GB primary ext4
3 21.5GB 25.8GB 4295MB primary linux-swap(v1)
4 25.8GB 160GB 134GB primary ext4
And here's the boot script (/boot/rpiboot.sh):
Code:
#!/bin/sh
echo
echo "Reboot RPi to rootfs... "
cd /boot
ftxt="cmdline.txt"
fbak="cmdline.bak"
fnew="cmdline.new"
if [ -f $fnew ]
then
rm $fnew
fi
echo
rootfs=$(awk '{for (i=1; i<NF; i++) if (match($i,"root=")) {sub("root=", "", $i); print $i} }' $ftxt)
echo "Current rootfs: $rootfs"
#Reconstructing device names from partition editor output
parted /dev/mmcblk0 print > parted.txt
mmcname=$(awk '/\/dev\// {printf "%s", substr($2,1,length($2)-1) }' parted.txt)
awk -v mmcname=$mmcname '/ext4/ {printf "%sp%d\n", mmcname, $1 > "ext4.txt" }' parted.txt
parted /dev/sda print > parted.txt
mmcname=$(awk '/\/dev\// {printf "%s", substr($2,1,length($2)-1) }' parted.txt)
awk -v mmcname=$mmcname '/ext4/ {printf "%s%d\n", mmcname, $1 >> "ext4.txt" }' parted.txt
echo
echo "Boot options for rootfs:"
cat -n ext4.txt > ext4_enum.txt
more ext4_enum.txt
echo
printf "Enter boot option (press ENTER to shutdown or CNTL-z to exit):"
read -r ext4_index
if test -z "$ext4_index"
then
echo
echo "Shutting down in 3 seconds..."
sleep 3
shutdown -h now
exit 0
fi
#Determine rootfs corresponding to boot option
rootfs=$(awk -v ext4_index=$ext4_index '{if (match($1,ext4_index)) print $2}' ext4_enum.txt)
if test -z "$rootfs"
then
echo
echo "Invalid boot option or other error. Exiting..."
exit 1
fi
awk -v rootfs=$rootfs -v fnew=$fnew '{
for (i=1; i<NF; i++) if (match($i,"root=")) {$i = "root=" rootfs; print $0 > fnew} }' $ftxt
if [ -f $fnew ]
then
printf "Press ENTER to reboot to $rootfs, or CNTL-z to exit."
read -r text
mv $ftxt $fbak
mv $fnew $ftxt
fi
echo
echo "/boot/cmdline.txt:"
more $ftxt
echo "Rebooting to $rootfs in 3 seconds..."
sleep 3
reboot
exit 0
Launching rpiboot.sh as root, here are my own results of a boot switch from /dev/sda2 (Raspbian) to /dev/sda4 (Raspbmc):
Code:
[email protected] ~ $ sudo sh /boot/rpiboot.sh
Reboot RPi to rootfs...
Current rootfs: /dev/sda2
Boot options for rootfs:
1 /dev/mmcblk0p2
2 /dev/sda2
3 /dev/sda4
Enter boot option (press ENTER to shutdown or CNTL-z to exit):3
Press ENTER to reboot to /dev/sda4, or CNTL-z to exit.
/boot/cmdline.txt:
dwc_otg.lpm_enable=0 root=/dev/sda4 rootfstype=ext4 noatime quiet rootwait loglevel=1 sdhci-bcm2708.enable_l
lm=1 dwc_otg.microframe_schedule=1 dwc_otg.fiq_fix_enable=0 dwc_otg.fiq_split_enable=0 dwc_otg.trans_backoff
=3000
Rebooting to /dev/sda4 in 3 seconds...
Broadcast message from [email protected] (pts/0) (Thu Oct 31 15:28:20 2013):
The system is going down for reboot NOW!
[email protected] ~ $ Connection to 10.0.0.16 closed by remote host.
Connection to 10.0.0.16 closed.
[email protected]:~#
And voila, Raspbmc comes up. I now SSH in from my Ubuntu laptop:
Code:
[email protected]:~# ssh [email protected]
[email protected]'s password:
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
[email protected]:~$
Of course VNC renders the elegant desktop experience, and setting up VNC is fairly straightforward:
http://learn.adafruit.com/adafruit-...control-with-vnc/running-vncserver-at-startup
However VNC does not work on Raspbmc since VNC relies on the X11 window system, while Raspbmc’s XBMC implementation is rendered in the framebuffer only. Thus VNC cannot be used as there is no X-session available for connection. See:
http://www.raspbmc.com/wiki/user/frequently-asked-questions/
But SSH works well.
Blessings. Enjoy!
tanks!
hello is verry good
please tuto create multiboot for noobs lol
And Raspbmc is EOL.
help
[email protected]:~ $ df -h
Sys. de fichiers Taille Utilis▒ Dispo Uti% Mont▒ sur
/dev/root 7,2G 4,5G 2,5G 65% /
devtmpfs 364M 0 364M 0% /dev
tmpfs 368M 0 368M 0% /dev/shm
tmpfs 368M 5,3M 363M 2% /run
tmpfs 5,0M 4,0K 5,0M 1% /run/lock
tmpfs 368M 0 368M 0% /sys/fs/cgroup
tmpfs 1,0M 4,0K 1020K 1% /var/pipeyelog
/dev/mmcblk0p1 60M 20M 41M 34% /boot
tmpfs 74M 0 74M 0% /run/user/1000
/dev/sda3 6,3G 15M 6,0G 1% /media/pi/e836e8e0-22be-4f6e-8836-1f4 039a627e8
/dev/sda2 7,2G 4,5G 2,5G 65% /media/pi/ad6203a1-ec50-4f44-a1c0-e6c 3dd4c9202
/dev/sda1 60M 20M 41M 34% /media/pi/boot
[email protected]:~ $ sudo sh /boot/rpiboot.sh
Reboot RPi to rootfs...
Current rootfs: /dev/mmcblk0p2
Boot options for rootfs:
1 /dev/mmcblk0p2
Enter boot option (press ENTER to shutdown or CNTL-z to exit):^Z
[1]+ Stopp▒ sudo sh /boot/rpiboot.sh
[email protected]:~ $
why not see my sda2 and sda3 partition ( Raspbian and raspbmc ) ??

Resize Partitions

Hello,
my phone is an E2303. The only problem for me with this phone is the limited memory.
I have rooted the phone the way explained in http://forum.xda-developers.com/m4-a.../root-t3421932
With Root Explorer, i removed a lot of stuff in /system. Now 1,66 GB are used and 810 MB are free.
usderdata and system partitions ( sgdisk --print /dev/block/mmcblk0 )
Nr Name Start Stop Size type
29 userdata 1449984 10043391 4.1 GIB 8300
30 system 10043392 15269375 2.5 GIB 8300
My idea:
- use TWRP to backup userdata and system partions
- delete both partitions
- create userdata with 4.6 GIB
- create system with 2 GIB
- format both partitions with make_extfs4
- restore both partitions with TWRP
I know that as a consequence, i'm not able to flash updates.
Do you think, that this would work ?
===[ Update 5.12.2016 ]===
Yes !
I've attatched my scripts to this initial post. Howto follows ...
i can tell you that something similar worked on lg g2 mini (d610/d618)
that phone have a cache partition with 1gb of unused storage, so a developer resized to reduce this to 100mb, you can find this on L90 or g2 mini forum
did you try it yet?
try and give info
resize partitions Script
Hello,
i've startet coding a shell script:
------------------------------------------------------------
#!/bin/bash
MMC=/dev/block/mmcblk0
NEW_FREE_SEC=65536 # 32 mbyte in sectors
if [ $(id -u) -ne 0 ]; then
echo "Only root is allowed"
exit
fi
mount | grep "$MMC" > /dev/null
RC=$?
if [ $RC -eq 1 ]; then
echo "system not mounted. mounting now"
mount /system
RC=$?
echo $RC
fi
FREE_MB=$(df -P -m /system/ | grep 'mmcblk0p30' | awk '{print $4}')
FREE_KB=$(df -Pk /system/ | grep 'mmcblk0p30' | awk '{print $4}')
FREE_SEC=$(df -P -B 512 /system/ | grep 'mmcblk0p30' | awk '{print $4}')
echo "Your system partion has $FREE_MB mbyte free ( kbyte = $FREE_KB ; sectors = $FREE_SEC)"
DATA_FS=$(sgdisk --print $MMC | awk ' $1 == "29" { print $2}')
DATA_LS=$(sgdisk --print $MMC | awk ' $1 == "29" { print $3}')
SYS_FS=$(sgdisk --print $MMC | awk ' $1 == "30" { print $2}')
SYS_LS=$(sgdisk --print $MMC | awk ' $1 == "30" { print $3}')
echo "Data partition first sector: $DATA_FS"
echo "Data partition last sector: $DATA_LS"
echo "System partition first sector: $SYS_FS"
echo "System partition last sector: $SYS_LS"
let NEW_DATA_LS=$DATA_LS+$FREE_SEC-$NEW_FREE_SEC
let NEW_SYS_FS=$NEW_DATA_LS+1
echo "Data partion NEW last sector: $NEW_DATA_LS"
echo "System partion NEW first sector: $NEW_SYS_FS"
-------------------------------
Output:
/external_sd # . resize_partions
Your system partion has 839 mbyte free ( kbyte = 859392 ; sectors = 1718784)
Data partition first sector: 1449984
Data partition last sector: 10043391
System partition first sector: 10043392
System partition last sector: 15269375
Data partion NEW last sector: 11696639
System partion NEW first sector: 11696640
-------------------------------
Next things to code would be:
- Backup both partitions to SD-card using "tar" ( tar cpf ...)
- unmount partitions
- delete partitions ( sdisk $MMC --delete 30 )
- create partitions with new sector boundaries ( sgdisk $MMC --new 30:11696640:15269375 )
- change partition type ( sgdisk $MMC -t 30:8300)
- change name ( sgdisk $MMC --change-name 30:"system")
- create ext4 partion ( make_ext4fs -L system /dev/block/mmcblk0p30)
- mount
- restore partions ( tar xpf ..)
Do i need special options for make_ext4fs ?
But the question is: would this work ??? What, if i bootloop my device ?
klarseher said:
Hello,
i've startet coding a shell script:
------------------------------------------------------------
#!/bin/bash
MMC=/dev/block/mmcblk0
NEW_FREE_SEC=65536 # 32 mbyte in sectors
if [ $(id -u) -ne 0 ]; then
echo "Only root is allowed"
exit
fi
mount | grep "$MMC" > /dev/null
RC=$?
if [ $RC -eq 1 ]; then
echo "system not mounted. mounting now"
mount /system
RC=$?
echo $RC
fi
FREE_MB=$(df -P -m /system/ | grep 'mmcblk0p30' | awk '{print $4}')
FREE_KB=$(df -Pk /system/ | grep 'mmcblk0p30' | awk '{print $4}')
FREE_SEC=$(df -P -B 512 /system/ | grep 'mmcblk0p30' | awk '{print $4}')
echo "Your system partion has $FREE_MB mbyte free ( kbyte = $FREE_KB ; sectors = $FREE_SEC)"
DATA_FS=$(sgdisk --print $MMC | awk ' $1 == "29" { print $2}')
DATA_LS=$(sgdisk --print $MMC | awk ' $1 == "29" { print $3}')
SYS_FS=$(sgdisk --print $MMC | awk ' $1 == "30" { print $2}')
SYS_LS=$(sgdisk --print $MMC | awk ' $1 == "30" { print $3}')
echo "Data partition first sector: $DATA_FS"
echo "Data partition last sector: $DATA_LS"
echo "System partition first sector: $SYS_FS"
echo "System partition last sector: $SYS_LS"
let NEW_DATA_LS=$DATA_LS+$FREE_SEC-$NEW_FREE_SEC
let NEW_SYS_FS=$NEW_DATA_LS+1
echo "Data partion NEW last sector: $NEW_DATA_LS"
echo "System partion NEW first sector: $NEW_SYS_FS"
-------------------------------
Output:
/external_sd # . resize_partions
Your system partion has 839 mbyte free ( kbyte = 859392 ; sectors = 1718784)
Data partition first sector: 1449984
Data partition last sector: 10043391
System partition first sector: 10043392
System partition last sector: 15269375
Data partion NEW last sector: 11696639
System partion NEW first sector: 11696640
-------------------------------
Next things to code would be:
- Backup both partitions to SD-card using "tar" ( tar cpf ...)
- unmount partitions
- delete partitions ( sdisk $MMC --delete 30 )
- create partitions with new sector boundaries ( sgdisk $MMC --new 30:11696640:15269375 )
- change partition type ( sgdisk $MMC -t 30:8300)
- change name ( sgdisk $MMC --change-name 30:"system")
- create ext4 partion ( make_ext4fs -L system /dev/block/mmcblk0p30)
- mount
- restore partions ( tar xpf ..)
Do i need special options for make_ext4fs ?
But the question is: would this work ??? What, if i bootloop my device ?
Click to expand...
Click to collapse
try and give info
Flashing stock with Flashtool should restore official partition table.
bootloop now ...
ch3mn3y said:
Flashing stock with Flashtool should restore official partition table.
Click to expand...
Click to collapse
As a first step, I have only risized the system partition. The files were backuped with "tar cpf" and restored with "tar xpf" in the recreated partition.
I could see the files in the partion, but the phone does not startup "normal".
I had to use the hidden off button near the SD-slot to power off the phone. Flashing didn't resolved the problem. There is an error while writing system.sin - probably because the partition is to small.
Maybe i have to downgrade flashtool, as mentioned in http://forum.xda-developers.com/showpost.php?p=62751375&postcount=3 ???
Next step would be to "unbrick" my phone. With original system partition, i will only backup and restore the content, to see, if "tar" is able to do the job. Second try with TWRP Backup.
Hello,
I could be wrong, but I think your bootloop problem would probably comes from some sort of SONY extra protection layer.
This additional security system is called RIC and prevents you from freely modifying the system partition at runtime by blocking r/w mount of the system partition.
There is also a default Android security that checks the system partition against a hardcoded hash on boot, to prevent system partition modification (maybe partition size is part of the check operation...).
So you may try to disable the first protection (look at Z5 tutorial) and/or look for a way to bypass the boot check (not sure if possible).
Regards.
system parttion successfull shrinked
Okay, i finally shrinked my system partition and the phone will boot up normal.
The process is a little bit complicated.
You have to create a TWRP backup of your debloated system partition.
Check, if this backup is working ! So rm -rf everything in system and restore from backup.
Next, delete partition with sgdisk and create smaler one ( my script from 1st post will do the calculation for 1st sector )
Change name of partion to "system".
Create ext4 fileystem on parttion ( TWRP will also format - don't know if realy needed )
Reboot into TWRP an try to restore - maybe reboot some times into TWRP and check parttions
To recover with flashtool in case you didn't manage to get it to work - delete system partition and flash "partition.sin" and "system.sin"
In the next step, i will increase data partition
Code:
/system # df -h .
Filesystem Size Used Available Use% Mounted on
/dev/block/mmcblk0p30
1.6G 1.6G 4.9M 100% /system
/system # sgdisk --print /dev/block/mmcblk0 | tail -10
21 393216 475135 40.0 MiB FFFF FOTAKernel
22 475136 475151 8.0 KiB FFFF ssd
23 475152 475215 32.0 KiB FFFF DDR
24 475216 476239 512.0 KiB FFFF config
25 476240 509007 16.0 MiB 8300 LTALabel
26 516096 532479 8.0 MiB 8300 apps_log
27 532480 1040383 248.0 MiB 8300 oem
28 1040384 1449983 200.0 MiB 8300 cache
29 1449984 10043391 4.1 GiB 8300 userdata
30 11702880 15269375 1.7 GiB 8300 system
/system #
klarseher said:
Okay, i finally shrinked my system partition and the phone will boot up normal.
The process is a little bit complicated.
You have to create a TWRP backup of your debloated system partition.
Check, if this backup is working ! So rm -rf everything in system and restore from backup.
Next, delete partition with sgdisk and create smaler one ( my script from 1st post will do the calculation for 1st sector )
Change name of partion to "system".
Create ext4 fileystem on parttion ( TWRP will also format - don't know if realy needed )
Reboot into TWRP an try to restore - maybe reboot some times into TWRP and check parttions
To recover with flashtool in case you didn't manage to get it to work - delete system partition and flash "partition.sin" and "system.sin"
In the next step, i will increase data partition
Code:
/system # df -h .
Filesystem Size Used Available Use% Mounted on
/dev/block/mmcblk0p30
1.6G 1.6G 4.9M 100% /system
/system # sgdisk --print /dev/block/mmcblk0 | tail -10
21 393216 475135 40.0 MiB FFFF FOTAKernel
22 475136 475151 8.0 KiB FFFF ssd
23 475152 475215 32.0 KiB FFFF DDR
24 475216 476239 512.0 KiB FFFF config
25 476240 509007 16.0 MiB 8300 LTALabel
26 516096 532479 8.0 MiB 8300 apps_log
27 532480 1040383 248.0 MiB 8300 oem
28 1040384 1449983 200.0 MiB 8300 cache
29 1449984 10043391 4.1 GiB 8300 userdata
30 11702880 15269375 1.7 GiB 8300 system
/system #
Click to expand...
Click to collapse
give flashable zip
Increasing userdata worked the same way. Backup userdata with TWRP, delete partition 29, create partition 29 with new last sector. Restore with TWRP.
( I've lost adoptive storage in this step - but this is okay, because adoptive storage is to slow for me )
Now userdata on my phone has 4.9 GIB.
To do the same, you have to read and understand.
There is no flashable zip - you will resize your partitions after removing unused stuff from system partition. You have to deal with sgdisk on the TWRP cmdline ( adb shell)
klarseher said:
Hello,
my phone is an E2303. The only problem for me with this phone is the limited memory.
I have rooted the phone the way explained in http://forum.xda-developers.com/m4-a.../root-t3421932
With Root Explorer, i removed a lot of stuff in /system. Now 1,66 GB are used and 810 MB are free.
usderdata and system partitions ( sgdisk --print /dev/block/mmcblk0 )
Nr Name Start Stop Size type
29 userdata 1449984 10043391 4.1 GIB 8300
30 system 10043392 15269375 2.5 GIB 8300
My idea:
- use TWRP to backup userdata and system partions
- delete both partitions
- create userdata with 4.6 GIB
- create system with 2 GIB
- format both partitions with make_extfs4
- restore both partitions with TWRP
I know that as a consequence, i'm not able to flash updates.
Do you think, that this would work ?
Click to expand...
Click to collapse
When you remove or delete any system app the folder & ink may get deleted but odex file of original stock rom remains in odex folder as squashed this way you can free up at least 200 to 300 mb.
I have tested it on LP.
& As per my assumption the squashed odexes got nothing to do with selinux as it only load images from squashed folder.
rebuild odex.system.sqsh
Hello,
I rebuild odex.system.sqsh - the size has been reduced from 275MByte to 151MByte.
but, my current linux distribution does not support selinux
So, i have to repeat with another linux distribution and replace odex.system.sqsh in /system folder.
maybe next weekend ...
howto
klarseher said:
Hello,
I rebuild odex.system.sqsh - the size has been reduced from 275MByte to 151MByte.
but, my current linux distribution does not support selinux
So, i have to repeat with another linux distribution and replace odex.system.sqsh in /system folder.
maybe next weekend ...
Click to expand...
Click to collapse
The solution:
- install CentOS 7 in VirtualBox
Get odex.system.sqsh from phone ( Phone in TWRP Mode):
adb pull /system/odex.system.sqsh .
Copy odex.system.sqsh to CentOS ( via shared folder)
As root:
- yum install squashfs-tools
- unsquashfs odex.system.sqsh # you got a lot of warnings, because unsquashfs is not allowed to access selinux attributes
- rm -rf squashfs-root # remove for next try
- grep unsquashfs /var/log/audit/audit.log | audit2allow -M mypol
- semodule -i mypol.pp
- unsquashfs odex.system.sqsh
Now, remove unused stuff inside squashfs-root folder
mksquashfs squashfs-root/ odex.system-new.sqsh -comp xz -noI -noF -noX -no-fragments -no-duplicates
---
In TWRP -adb shell:
cd /system
touch dummy
chcon --reference=system.odex.sqsh dummy
rm system.odex.sqsh
# Copy from pc with
adb put odex.system-new.sqh /system/
Back in adb shell:
mv odex.system-new.sqh odex.system.sqh
chcon --reference=dummy system.odex.sqsh
---
The cleanaup in squashfs-root depends on you debloating. I have build my delete script on file lists from /system before and after removing unwanted apps. ( diff before/after | grep '\.odex$')
As a final step, i shrinked my system partion to 1.5 GB ( from original 2.5) and increased /data to 5.1 GB.
Very cool and great job! Maybe try making a step by step tutorial during your free time? Could benefit us all
partitions in DiskInfo
See layout of /data and /system partitions on my phone
klarseher said:
See layout of /data and /system partitions on my phone
Click to expand...
Click to collapse
Very cool and great job!
Please making a step by step tutorial for all !!! Thanks !
manhquyet90 said:
Very cool and great job!
Please making a step by step tutorial for all !!! Thanks !
Click to expand...
Click to collapse
Thanks !
Boot phone into TWRP
1. create a backup of your system partition with TWRP
2. "adb shell" to your phone (still booted in TWRP) and create a filelist from system partion on your SD card ( "mount /system ; find /system -type f > /external_sd/system_filelist.lst" - unsure about path to your SD-card )
( we need filelist later for odex "cleanup" )
3. "debloat" your system partition - there are some threads in this forum about removing stuff from /system - i could not help you with this task !
Boot phone into TWRP
4. "adb shell" to your phone. Come back with the output of "mount /system ; df -k /system" and "sgdisk --print /dev/block/mmcblk0"
( I will calculate the new first sector for the system partition depending on your free space )
Then, we do the next step together !
Kind regards
klarseher said:
Thanks !
Boot phone into TWRP
1. create a backup of your system partition with TWRP
2. "adb shell" to your phone (still booted in TWRP) and create a filelist from system partion on your SD card ( "mount /system ; find /system -type f > /external_sd/system_filelist.lst" - unsure about path to your SD-card )
( we need filelist later for odex "cleanup" )
3. "debloat" your system partition - there are some threads in this forum about removing stuff from /system - i could not help you with this task !
Boot phone into TWRP
4. "adb shell" to your phone. Come back with the output of "mount /system ; df -k /system" and "sgdisk --print /dev/block/mmcblk0"
( I will calculate the new first sector for the system partition depending on your free space )
Then, we do the next step together !
Kind regards
Click to expand...
Click to collapse
Code:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\MQ>adb devices
List of devices attached
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
YT911B19A1 recovery
C:\Users\MQ>adb shell
~ # ←[6nmount /system
~ # ←[6nfind /system -type f > /external_sd/system_filelist.lst
~ # ←[6nmount /system
mount: mounting /dev/block/mmcblk0p30 on /system failed: Device or resource busy
~ # ←[6ndf -k /system
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/block/mmcblk0p30
2531076 2448068 66624 97% /system
~ # ←[6nsgdisk --print /dev/block/mmcblk0
CANNOT LINK EXECUTABLE: cannot locate symbol "__register_atfork" referenced by "
sgdisk"...
page record for 0x7f91ab0010 was not found (block_size=64)
~ # ←[6n

The most Powerful Feature of the HP Touchpad (LVM)

Flash files are available here to automatically create the swap partition:
https://forum.xda-developers.com/hp-touchpad/general/how-to-create-swap-partition-size-t3892060#post78939182
How to configure the Hp Touchpad internal storage
The most important feature that was ahead of its time and still until today is the use of LVM (Logical Volume Manager) for managing the internal storage.
To the regular user it will be insignificant but it can provide great benefits if deploy properly.
I could be wrong, but the TP could be the first and only mobile device ever shipped with LVM even now. (someone can correct me on this)
What is LVM?
https://en.wikipedia.org/wiki/Logical_Volume_Manager_(Linux)
I am a regular user and not an expert on LVM in Linux, the only device that I have to play with LVM is the TP and will show you the basics usage and it may not even have the full potential settings.
In webOS there is a program (app) call Tailor ( Formerly Known as Resizah ), a graphical interface to manage LVM.
http://preware.pivotce.com/package/org.webosinternals.tailor
https://www.webos-internals.org/wiki/Application:Tailor
https://forums.webosnation.com/webos-internals/304871-tailor-device-live-partition-filesystem-editor-beta-testing.html
https://github.com/rwhitby/tailor
The last alpha version 0.3.1 allows for creating a LuneOS partition.
Also you can create all Android partitions inside WebOS, create and resize all partitions while running WebOS.The magic of LVM!
Attached is a screen shot of my TP running Taylor.
Think of it as creating, deleting , moving, expanding or reducing (files and folders) with your file manager. Instead it will be the actual storage card, partitions, volumes. All done withing the OS no need to reboot or enter any commands. Resizing the android system, cache or data partition live inside android with just touch input.! That is how easy it could have been, but Android does not use LVM and the TP had to follow the rest of the herd. The reason that WebOS, Android, LuneOS (and more OS) can be install together is due to the flexibility of LVM.
The ToolBox by jcsullins provides scripts to create webOS and Android volumes and resize system, cache and data. But is not a live system and limited to pre-configure settings.
All the flexibility and easy to use comes with a risk of data lost as we know not everything in the computer world works as intended, due to the endless configuration and uses of each user.
Code:
This is a 32G Touchpad with WebOS, Android and LuneOS install and perfectly running.
Factory install WebOS (original)
Used ToolBox to create Android system, cache and data
Used Taylor to create luneos-root
List of physical volumes
/dev/store/root [ 568.00 MB]
/dev/store/var [ 64.00 MB]
/dev/store/update [ 16.00 MB]
/dev/store/log [ 24.00 MB]
/dev/store/mojodb [ 256.00 MB]
/dev/store/filecache [ 136.00 MB]
/dev/store/media [ 19.44 GB]
/dev/store/swap [ 400.00 MB]
/dev/store/cm-cache [ 200.00 MB]
/dev/store/cm-data [ 4.88 GB]
/dev/store/cm-system [ 1.17 GB]
/dev/store/luneos-root [ 1.95 GB]
12 disks
0 partitions
0 LVM physical volume whole disks
0 LVM physical volumes
LVM is reporting to each OS its own disks and each OS mounts its own Disk using f stabs. In reality there is only one storage, not 12 ( the magic of LVM !
This is a 32G Touchpad that was completely reset using the Toolbox.
/dev/block/mmcblk0p8 [ 10.00 MiB]
/dev/block/mmcblk0p9 [ 1.46 MiB]
/dev/block/mmcblk0p1 [ 100.00 MiB]
/dev/block/mmcblk0p10 [ 3.00 MiB]
/dev/block/mmcblk0p11 [ 3.00 MiB]
/dev/block/mmcblk0p3 [ 1.46 MiB]
/dev/block/mmcblk0p12 [ 4.00 MiB]
/dev/block/mmcblk0p13 [ 32.00 MiB]
/dev/block/mmcblk0p14 [ 29.09 GiB] LVM physical volume
/dev/block/mmcblk0p6 [ 750.00 KiB]
/dev/store/media [ 29.09 GiB]
/dev/block/mmcblk0p7 [ 2.44 MiB]
1 disk
10 partitions
0 LVM physical volume whole disks
1 LVM physical volume
/dev/block/mmcblk0p13 ( is the boot partition ) 32 MB where all the uImages are boot it from.
This is the physical volume the real internal storage.
PV VG Fmt Attr PSize PFree
/dev/block/mmcblk0p14 store lvm2 a- 29.09g 0
This is the logical volume of the physical volume which is part of the volume group "store"
The media USB storage in Android. This is the logical volume to resize and create other logical volume.
--- Logical volume ---
LV Name /dev/store/media
VG Name store
LV UUID WhFWig-xwTY-0SK3-OnrS-32mq-gADG-7mLY7c
LV Write Access read/write
LV Status available
# open 1
LV Size 29.09 GiB
Current LE 3723
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 4096
Persistent major 254
Persistent minor 6
Block device 253:6
This is all done loading TWRP mounting /boot and adb shell.
The working directory for lvm.static is:
/boot/usr/sbin
to execute ./lvm.static plus command.
Resizing Logical volume /dev/store/media to 1GB
./lvm.static lvresize --size 1G /dev/store/media
PV VG Fmt Attr PSize PFree
/dev/block/mmcblk0p14 store lvm2 a- 29.09g 28.09g
Now there is 28.09g free to be allocated to any volume (disk) we want to create
Keep in mind the Persistent minor is 6 of the major 254 ( the next disk can be from 0 to 5 and 7 to 254 ) but 6 is already taken.
Creating Android volume cm-system
./lvm.static lvcreate -L 1.3G -M y --major 254 --minor 0 -n /dev/store/cm-system
Creating Android volume cm-cache
./lvm.static lvcreate -L 200M -M y --major 254 --minor 1 -n /dev/store/cm-cache
Creating Android volume cm-data (4GB)
./lvm.static lvcreate -L 4G -M y --major 254 --minor 2 -n /dev/store/cm-data
Activating the new logical volume
/boot/usr/sbin # ./lvm.static vgchange -ay
4 logical volume(s) in volume group "store" now active
/boot/usr/sbin # ./lvm.static pvs
PV VG Fmt Attr PSize PFree
/dev/block/mmcblk0p14 store lvm2 a- 29.09g 22.59g
There is 22.59GB free to create more volume or disk!
Let's create volumes to install Linux as chroot
./lvm.static lvcreate -L 2G -M y --major 254 --minor 5 -n /dev/store/Linux-root
Another chroot as Debian!
./lvm.static lvcreate -L 2G -M y --major 254 --minor 7 -n /dev/store/debian-root
Create LuneOS volume
./lvm.static lvcreate -L 2G -M y --major 254 --minor 4 -n /dev/store/luneos-root
There is 16.59GB free
/boot/usr/sbin # ./lvm.static pvs
PV VG Fmt Attr PSize PFree
/dev/block/mmcblk0p14 store lvm2 a- 29.09g 16.59g
Let's create another Android installation ( completely independent )
Android PIE system
./lvm.static lvcreate -L 1.3G -M y --major 254 --minor 8 -n /dev/store/A_PIE-system
Android PIE cache
./lvm.static lvcreate -L 200M -M y --major 254 --minor 9 -n /dev/store/A_PIE-cache
Android PIE Data (4GB)
./lvm.static lvcreate -L 4G -M y --major 254 --minor 10 -n /dev/store/A_PIE-data
There is 11.09GB free
/boot/usr/sbin # ./lvm.static pvs
PV VG Fmt Attr PSize PFree
/dev/block/mmcblk0p14 store lvm2 a- 29.09g 11.09g
Let's create SailFishOS!
./lvm.static lvcreate -L 2G -M y --major 254 --minor 11 -n /dev/store/Sailfish_OS
Another Installation Android 10 Queso!
A_Queso-system
./lvm.static lvcreate -L 1.3G -M y --major 254 --minor 12 -n /dev/store/A_Queso-system
A_Queso-cache
./lvm.static lvcreate -L 200M -M y --major 254 --minor 13 -n /dev/store/A_Queso-cache
A_Queso_data
./lvm.static lvcreate -L 2G -M y --major 254 --minor 14 -n /dev/store/A_Queso_data
There is 5.59GB free
PV VG Fmt Attr PSize PFree
/dev/block/mmcblk0p14 store lvm2 a- 29.09g 5.59g
What about a swap volume!
./lvm.static lvcreate -L 1G -C y -M y --major 254 --minor 15 -n /dev/store/swap
Now we can give the command to LVM to extend media to use the 4.59GB available and use it all.
/lvm.static lvresize -l 100%FREE /dev/store/media
15 logical volume(s) in volume group "store" now active
Here is the summary of all the disks available:
/boot/usr/sbin # ./lvm.static lvmdiskscan
/dev/block/mmcblk0p8 [ 10.00 MiB]
/dev/store/cm-system [ 1.30 GiB]
/dev/block/mmcblk0p9 [ 1.46 MiB]
/dev/block/mmcblk0p1 [ 100.00 MiB]
/dev/store/cm-cache [ 200.00 MiB]
/dev/block/mmcblk0p10 [ 3.00 MiB]
/dev/store/cm-data [ 4.00 GiB]
/dev/block/mmcblk0p11 [ 3.00 MiB]
/dev/block/mmcblk0p3 [ 1.46 MiB]
/dev/block/mmcblk0p12 [ 4.00 MiB]
/dev/store/luneos-root [ 2.00 GiB]
/dev/block/mmcblk0p13 [ 32.00 MiB]
/dev/store/Linux-root [ 2.00 GiB]
/dev/block/mmcblk0p14 [ 29.09 GiB] LVM physical volume
/dev/block/mmcblk0p6 [ 750.00 KiB]
/dev/store/media [ 4.59 GiB]
/dev/block/mmcblk0p7 [ 2.44 MiB]
/dev/store/debian-root [ 2.00 GiB]
/dev/store/A_PIE-system [ 1.30 GiB]
/dev/store/A_PIE-cache [ 200.00 MiB]
/dev/store/A_PIE-data [ 4.00 GiB]
/dev/store/Sailfish_OS [ 2.00 GiB]
/dev/store/A_Queso-system [ 1.30 GiB]
/dev/store/A_Queso-cache [ 200.00 MiB]
/dev/store/A_Queso_data [ 2.00 GiB]
/dev/store/swap [ 1.00 GiB]
15 disks
10 partitions
0 LVM physical volume whole disks
1 LVM physical volume
Now we can format every disk with ext2, ext3, ext4 and vfat
Example to format Android system volumen
mke2fs -E lazy_itable_init=0 -t ext4 /dev/store/cm-system
mke2fs -E lazy_itable_init=0 -t ext4 /dev/store/cm-cache
mke2fs -E lazy_itable_init=0 -t ext4 /dev/store/cm-data
To make swap
mkswap /dev/store/swap
This is very easy to create, and quick there is no waitting time is done as soon as you press enter.
We have create it a Touchpad that is capable of running the following OS independently.
Current Version of Android
A version of Android PIE 9
A version of Android Queso 10
LuneOS
SailfishOS
Linux-root (to run as chroot or native)
debian-root (to run as chroot or native)
A 1GB swap file
The volume size of the disk created are minimum or below requirement but this is to show how powerful and simple LVM is to set up.
Hi @HP_TOUCHPAD !
Good to see someone with your structured approach sharing tutorials and hints! Cheers for that!
I stumbled upon my 16GB and 32GB Touchpads on the weekend and I want to give them a new spin.
Especially LuneOS was not known to me before your post!
Any chance of you sharing your current setup and how you managed to set it up?
I am curious to factory reset my Touchpads (at least the 32GB one) and set them up with webOS + LuneOS + Android (which ROM do you use?)...
You being the knowledgable 'tutor' around here - would you share your 'webOS + LuneOS + Android' experience and how to set it up?
Cheers!
Curious greetings, raimerik
Thank you for your comments!
As of right now I am working on just that, a simple way for anyone just to flash a zip file and have everything that you need to have the Tablet set up. There is a lot of steps to do and gets confusing, hopefully the new process will work for everyone.
I will post when done!
HP_TOUCHPAD said:
Thank you for your comments!
As of right now I am working on just that, a simple way for anyone just to flash a zip file and have everything that you need to have the Tablet set up. There is a lot of steps to do and gets confusing, hopefully the new process will work for everyone.
I will post when done!
Click to expand...
Click to collapse
Wow - cheers! - looking forward to testing it once it's done! :] raimerik
I will try it and test it out too. My Touchpad is afraid of nothing.

Categories

Resources