# [DUAL BOOT SCHEME] For anyone working on porting android to the touchpad![Disscusion]



## samcripp (Jul 17, 2011)

This thread is for the disscussion of the android for touchpad partition scheme, and disscussion and research over best dual booting method.

I first design this when i began working on #touchdroid channel in freenode, I'm a free agent i dont affiliate with any group in particular and anyone that have any questions is always welcome to ask. Currently my Scheme is use in touchdroid but im hoping it is used else where.

(please be aware im currently moving, and my internet is not yet running at my new place, so if i dont answer questions is not that im ignoring anyone, i simply dont have the internet)

Using LVM it is possible to partition the internal storage. Anything above the 14th partition is friendly to LVM and wont brick the device. The best way to utilize this is by partition the internal storage side of things to add android.

My main goal was to keep android 100% apart from webOS as to not limit either OS from modification, like custom kernels and roms.

scheme:
8mb /recovery
8mb /kernel
32mb /persist
320mb /system
320mb /cache
1.5gb /data

My perspective:
As I read about the device I came to the understanding, that you could chain boot. So by means of modifying bootie launch either OS. Thus keeping both system completely independent of each other allowing full Custom Roms and kernels. Even creating a third option to launch CWM.

Tho Ive been told you cant modify bootie config scripts as it causes a brick.

The touchdroid way:
As far as I understand, they use my scheme differently. They have frankenstein a kernel, to have both webos and android bits. During boot depending on a key selection the kernel will launch either android or webos.

Personally i think this could be a lot more elegant, and believe chain booting should be possible on the device.

If anyone wants to share ideas on the dual booting dilema, this is the place to do it. anyways with that said, like always.

Move forward at your own risk. PARTITIONING OR MODIFYING ANY FILES ON YOUR TOUCHPAD COULD LEAD TO A BRICK.

RULES:
#1 NO FLAMING ON THIS THREAD

#2 SHARE SHARE SHARE


----------



## Athorax (Jul 20, 2011)

I had no idea virtual space was measured in milligrams


----------



## calris (Aug 22, 2011)

> As I read about the device I came to the understanding, that you could chain boot. So by means of modifying bootie launch either OS. Thus keeping both system completely independent of each other allowing full Custom Roms and kernels. Even creating a third option to launch CWM.
> 
> Tho Ive been told you cant modify bootie config scripts as it causes a brick


For dual boot, I am still thinking along the lines of getting Bootie to load and execute U-Boot instead of the WebOS kernel. I haven't looked too deeply yet, but I wonder if we could rename the WebOS kernel image and put a copy of U-Boot in with the same name as the old WebOS kernel image name (i.e. trick Bootie without changing any of it's scripts)


----------



## LimitBreak (Sep 3, 2011)

calris said:


> For dual boot, I am still thinking along the lines of getting Bootie to load and execute U-Boot instead of the WebOS kernel. I haven't looked too deeply yet, but I wonder if we could rename the WebOS kernel image and put a copy of U-Boot in with the same name as the old WebOS kernel image name (i.e. trick Bootie without changing any of it's scripts)


 That's what I did with my GPS that runs windows CE (swapped boatloader names of the original to another that opens a screen to choose which OS to boot from)


----------



## calris (Aug 22, 2011)

I'll have a bit more of a dig around the boot process when I get a chance - looks promising


----------



## AllThumb (Sep 1, 2011)

I like this open discussion idea! 
I've been working on Android porting by myself and currently using uboot method through bootie and I couldn't come up with good idea bout dual booting other than similar to TouchDroid.
calris idea is certainly doable. Boot up with Android kernel using uImage with ramdisk and mount root device to a folder then we can modify webos's root directory. 
Since we don't touch bootie, if something wrong we can always recover using WebOS doctor.


----------



## calris (Aug 22, 2011)

AllThumb said:


> I like this open discussion idea!


Ditto


AllThumb said:


> I've been working on Android porting by myself and currently using uboot method through bootie


OK, I'm seeing 'uboot' cropping up again and again - Can you *please* clarify what you mean by 'uboot method'. Are you booting into bootie and then using novacom to launch custom built kernels or are you *really and truly* loading U-Boot (U-Boot git repository) onto the TouchPad somehow? If you are loading U-Boot, can you please provide some details (I know for a fact that mainline U-Boot has no support for the TouchPad or the Snapdragon SoC so if you are using U-Boot, you have patched it)

If you are not using U-Boot, can we all please stop refering to it

And bootie != U-Boot as per the following email conversation I had with the Palm Open Source Team:


> Hello,
> 
> As you are probably well aware by now, there is a concerted effort to
> port Android to the Touchpad. People involved in this effort have
> ...





> Thank you for your interest in the Touchpad. The bootloader in webOS is proprietary, and as such is not released as source.
> 
> Regards,
> 
> Palm Open Source Team.


----------



## scifan (Aug 22, 2011)

Was going to say... the palm opensource site for the touchpad includes uboot source + a uboot patch...

Look here: http://opensource.palm.com/3.0.2/index.html


----------



## calris (Aug 22, 2011)

scifan said:


> Was going to say... the palm opensource site for the touchpad includes uboot source + a uboot patch...
> 
> Look here: http://opensource.palm.com/3.0.2/index.html


Have a closer look, the patches are trivial and do not expand U-Boot to support the Snapdragon SoC. I think the U-Boot is only included in order to create the mkimage program needed to make image files for bootie to load


----------



## scifan (Aug 22, 2011)

hmmm... that could be... Nuts


----------



## calris (Aug 22, 2011)

P.S. I am currently investigating the validity of Palm/HP's claim that bootie is not open source - the similarities to U-Boot disturb me, although bootie seems to be too trivial to have used to U-Boot codebase. That being said, U-Boot 1.1.2 is very old and it has become far more sophisticated since then...

It would be very interesting indeed of a GPL violation cropped up.


----------



## scifan (Aug 22, 2011)

It would appear that they've created 14 partitions (or is it 13... think it's 14) and they've made one bootable... (/dev/mmcblk0p13) and the rest are bound together in a LVM array... which is then configured however they want to do it... it seems somewhat convoluted... though I guess it could be a way to achieve faster access off of the flash media...

The question is why would messing with those other partitions cause the unit to be "bricked"... in theory, as long as p13 isn't impacted, everything should be ok...

(and no, I'm not about to putz with mine...)


----------



## calris (Aug 22, 2011)

scifan said:


> and no, I'm not about to putz with mine...


Chicken :tongue2:

I'm also trying to track down data sheets & manuals for the Snapdragon and iNAND flash - I _think_ it might be possible to access the iNAND directly via the solder pads next to it. I'd love to get my hands on a 1GHz, 16-channel logic analyzer to see what happens on those pins as the device boots up. If I could get that info, I think I could work out how to debrick a TouchPad


----------



## scifan (Aug 22, 2011)

calris said:


> Chicken :tongue2:


Yeah, and...


----------



## AllThumb (Sep 1, 2011)

> If you are not using U-Boot, can we all please stop refering to it
> 
> And bootie != U-Boot as per the following email conversation I had with the Palm Open Source Team:


You're right and I'm sorry for using wrong term. I meant to use uImage and screwed up.


----------



## Zaphod-Beeblebrox (Jun 21, 2011)

Some of you might find this interesting:

http://dl.dropbox.com/u/9669866/topaz.xml

It's a file inside the webosdr file that describes the partition structure.


----------



## calris (Aug 22, 2011)

calris said:


> P.S. I am currently investigating the validity of Palm/HP's claim that bootie is not open source - the similarities to U-Boot disturb me, although bootie seems to be too trivial to have used to U-Boot codebase. That being said, U-Boot 1.1.2 is very old and it has become far more sophisticated since then...
> 
> It would be very interesting indeed of a GPL violation cropped up.


Wolfgang and I have had a look at bootie and agree that there is *NO* evidence that U-Boot code has been copied into bootie


----------



## cursordroid (Aug 24, 2011)

Zaphod-Beeblebrox said:


> Some of you might find this interesting:
> 
> http://dl.dropbox.com/u/9669866/topaz.xml
> 
> It's a file inside the webosdr file that describes the partition structure.





> <Entry type="bootloader" partition="0x48" size="10240KB" reformat="false"/>


Interesting to see this 10MB partition for bootloader. I'm assuming this is where bootie sits right now. Very risky, but has anyone thought of replacing this with a U-Boot img or another similar bootloader?
Correct me if I'm way off base here...


----------



## calris (Aug 22, 2011)

cursordroid said:


> Interesting to see this 10MB partition for bootloader. I'm assuming this is where bootie sits right now. Very risky, but has anyone thought of replacing this with a U-Boot img or another similar bootloader?
> Correct me if I'm way off base here...


Hmm, I don't know if this is where bootie lives, or if that is where the second stage boot loader lives. As far as I can tell, there are three boot stages - IPL (reset vector, first page of iNAND), SPL (???), TPL (bootie) - This 10MB partition might me the SPL

Either way, bootie lives in /boot (as boot.bin) as well as the boot splash images (hp, USB, charging logo's etc) and a kernel uImage (interestingly they simlink uImage to the actual kernel image which includes the version number in the file name). My suggestion would be to redirect the simlink. If this bricks the board, WebOS doctor _should_ be able to bring it back. It's a real pity bootie does not have any file system commands 

I think I might start dd'ing the iNAND partitions and see what pops up


----------



## tinnmann420 (Aug 22, 2011)

I love boot.bin cause if your bored just changed out all the boot images for other stuff, like mine boots to my monogrammed initials (classy I know  )


----------



## jelle (Sep 8, 2011)

Maybe kexec would be a nice way to switch kernels on the fly?

http://www.ibm.com/developerworks/linux/library/l-kexec/index.html


----------



## calris (Aug 22, 2011)

Please also have a look at this thread


----------



## TecKnight (Aug 28, 2011)

calris said:


> For dual boot, I am still thinking along the lines of getting Bootie to load and execute U-Boot instead of the WebOS kernel. I haven't looked too deeply yet, but I wonder if we could rename the WebOS kernel image and put a copy of U-Boot in with the same name as the old WebOS kernel image name (i.e. trick Bootie without changing any of it's scripts)


Samcripp, Calris,

This makes alot of sense and seems like a more elegant solution than what has been used so far.

I think many of us believe that some form of dual / conditional boot will end up being the most practical solution for the TouchPad in the long run.

For maximum recoverability, I also recommend that we mount any USB flash drives prior to our boot decision point and look for a particular filename on the USB drive. 
If this file is found, we would instead boot the image on the USB drive.
This would give us the ability to recover if something went wrong with plan A (whatever dual boot method we decide to employ).or even create a USB based flash/utility image or the like.

TecKnight


----------



## calris (Aug 22, 2011)

TecKnight said:


> This makes alot of sense and seems like a more elegant solution than what has been used so far.


Correct me if I am wrong, but assume what has been done so far is either:

a) Single boot - You get WebOS or Android on your device, not both - Reflash to switch OSs)
b) Dual Boot using bootie/novacom - You need to be connected via USB to a host PC to get into Android - Reboot lands you in WebOS
c) Dual Boot using one Linux kernel - I don't understand how it selects between WebOS and Android though



TecKnight said:


> For maximum recoverability, I also recommend that we mount any USB flash drives prior to our boot decision point and look for a particular filename on the USB drive.
> If this file is found, we would instead boot the image on the USB drive.
> This would give us the ability to recover if something went wrong with plan A (whatever dual boot method we decide to employ).or even create a USB based flash/utility image or the like.
> TecKnight


I like this idea a lot

Now the trick would be to get a U-Boot build that will work on the TouchPad - Ideally this build would need to include rudimentary screen drivers (to print a boot-menu on the screen) and touch screen driver (single-touch so you could select a menu item - no need for mock keyboard)

The biggest problem in getting U-Boot running is that for the most part, you will be running completely blind - the TouchPad has no serial port, so until you get U-Boot to talk over the USB port or display something on the LCD screen, you'll have no idea if it is doing what you want it to.

I'm majorly busy with a few other proects (work, family, house, yard, the list goes on) and I don't have an ARM cross-compiler tool chain installed so my input is going to be limited to advisory for a little while - Sorry guys


----------



## TecKnight (Aug 28, 2011)

Zaphod-Beeblebrox said:


> Some of you might find this interesting:
> 
> http://dl.dropbox.com/u/9669866/topaz.xml
> 
> It's a file inside the webosdr file that describes the partition structure.


*Now we are getting somewhere !!*

Your posted xml file has the following element:

*<PostInstall file="/sbin/tcpostflash.sh"/>*

The file */sbin/tcpostflash.sh* is a symlink to the file */sbin/mkbootfs.sh*

I have posted the file here:

*[url]http://hp-kryptonite.info/docs/mkbootfs.sh*[/URL]

This script appears to be being called once per partition after the partition has been created with a parameter of the partition number just created.
It looks to me like this script is mounting and populating the filesystem for the just created partition.
What do you guys make of this ?

TecKnight

*-----BEGIN mkbootfs.sh*
*BROOT=/tmp/flash/boot
REALROOT=/tmp/flash/root
BOOTDEV=/dev/mmcblk0p2
if [ -e /usr/bin/ldd ]; then
alias ldd="sh /usr/bin/ldd"
else
alias ldd='LD_TRACE_LOADED_OBJECTS=1 LD_WARN=yes '
fi

while [ $# -ge 1 ]
do
case "$1" in
-b) shift; BOOTDEV="/dev/mmcblk0p$1";;
*) break;;
esac
shift
done

cat /proc/mounts | grep "/dev/mapper/.*-root" | grep -q " / "
if [ "x$?" != "x0" ]; then
lvm.static vgscan
lvm.static vgchange -ay

mkdir -p $BROOT $REALROOT

echo mount $BOOTDEV as $BROOT
mount $BOOTDEV $BROOT
ROOTDEV=`ls /dev/mapper/*-root`
mount $ROOTDEV $REALROOT
else
REALROOT=/
BROOT=/boot
fi

# Given an executable name, find the libraries it requires. Ignore
# the ones starting with '/usr'
find_libs() {
if ldd "$1" >/dev/null; then
ldd "$1" 2>/dev/null | \
grep -v '/usr/lib' | \
sed -e 's/ =>.*//' -e 's/ (.*//'
fi
}

# Given a list of binaries in BINS, return the list of all libraries
# they require.
find_all_libs() {
libs=''
for i in $BINS; do libs="$libs `find_libs $i`"; done
libs=`echo $libs | tr ' ' '\n' | sort -u`
libs2=''
# Find the symlink targets and normalize names to "/lib/x"
for lib in $libs; do
case $lib in /*);; *) lib=/lib/$lib;; esac
libs2="$libs2 $lib"
if [ -h $lib ]; then
link=`readlink $lib`
case $link in /*);; *) link=/lib/$link;; esac
libs2="$libs2 $link"
fi
done
echo $libs2
}

BINS="/bin/busybox /usr/sbin/lvm.static /sbin/pivot_root"
LIBS=`find_all_libs`
CFGS="/etc/lvm/lvm.conf"

BBLINKS="mknod mkdir mount sh umount date"

USEFULINKS="ls umount"
USEFULBINS="/usr/bin/strace"

mkdir -p $BROOT/proc
mkdir -p $BROOT/sys
mkdir -p $BROOT/dev

mkdir -p $BROOT/bin
mkdir -p $BROOT/sbin
mkdir -p $BROOT/usr/lib
mkdir -p $BROOT/usr/bin
mkdir -p $BROOT/usr/sbin
mkdir -p $BROOT/lib
mkdir -p $BROOT/etc/lvm

for i in $LIBS; do cp -f -a "$REALROOT/$i" "$BROOT/$i"; done
for i in $BINS; do cp -f -a "$REALROOT/$i" "$BROOT/$i"; done
for i in $CFGS; do cp -f -a "$REALROOT/$i" "$BROOT/$i"; done
for i in $BBLINKS; do ln -sf busybox "$BROOT/bin/$i"; done

cp -f /sbin/boot-init $BROOT/sbin/init
chmod 755 $BROOT/sbin/init

mkdir -p $BROOT/realroot

[ ! -e $BROOT/dev/console ] && mknod $BROOT/dev/console c 5 1

cat /proc/mounts | grep "/dev/mapper/.*-root" | grep -q " / "
if [ "x$?" != "x0" ]; then
umount $BROOT
umount $REALROOT
lvm.static vgchange -an
fi*
*-----END mkbootfs.sh*


----------



## TecKnight (Aug 28, 2011)

AllThumb said:


> I like this open discussion idea!
> I've been working on Android porting by myself and currently using uboot method through bootie and I couldn't come up with good idea bout dual booting other than similar to TouchDroid.
> calris idea is certainly doable. Boot up with Android kernel using uImage with ramdisk and mount root device to a folder then we can modify webos's root directory.
> Since we don't touch bootie, if something wrong we can always recover using WebOS doctor.


Agreed AllThumb.
Open discussion of this is a GREAT idea and I believe this is the logical first item that we should be nailing down.

and SamCripp, I definitely respect your skills and knowlege in this area.

In my opinion you were:
1. The driving force behind the progress WHEN touchdroid was making real progress.
and
2. Not involved at all in the CF that brought about their demise.

Sorry, I don't intend to mention TD any more, I just didn't want anyone making any false assumptions.

TecKnight


----------



## TecKnight (Aug 28, 2011)

I just completed running the WebOS Doctor jar file through a java decompiler to restore the original source.

There appears to be alot of useful stuff in there, especially relevant for multiboot functionality !!!

Barely glancing at it, I found this class that appears to enumerate connected USB filesystems and other devices as well:

*http://hp-kryptonite.info/docs/KT/W...rytool/runner/DeviceDiscoveryRunner.class.txt*

A bunch of BOOTIE utilities here:

*http://hp-kryptonite.info/docs/KT/W...nova/installer/core/BootieUtilities.class.txt*

A Flasher class here to create partitions is here:

*http://hp-kryptonite.info/docs/KT/W...m/nova/installer/core/FlasherThread.class.txt*

I also saw classes that communicate directly with the Touchscreen controller, retrieving the firmware version.

Complete Source is available here:

*http://hp-kryptonite.info/docs/KT/WebOSDrDecompiled/*


----------



## Noiofnine (Aug 21, 2011)

Tecknight, Dalingrin,

You guys may have already read this, or some one may have forwarded this info to you guys, but just in case. 
It is a dual boot of webos and SHR. However it is for the palm pre. Just maybe, MAYBE, the same method could be implimented to dual boot Android.
This was found on pre-central. 
Whats great is that IT DOES NOT DUAL BOOT VIA USB. Looks like its a Boot menu via the device.

http://www.precentral.net/webos-and-shr-dual-booted-pre










And the video: It is s lengthy boot time for the webos. After you start the video, you will see the palm booting webos, forward to 2:59 on the video track, it will boot webOS.
From there, just watch the rest of the video. It goes faster. The user restarts the palm, boot menu comes up again, then he chooses SHR, and you see the kernel being injected, and bam! fast boot for the SHR.






Since I am a fan of CM, I will post there too.


----------



## scifan (Aug 22, 2011)

Looks very interesting... some of the implementation commands look very similar... seems like it could be worth a try.

Would be interesting to download the github code and take a closer look at what they're doing to implement their dual boot loader...

http://shr-project.org/trac/wiki/Devices/PalmPre/InstallGuide


----------



## Noiofnine (Aug 21, 2011)

scifan said:


> Looks very interesting... some of the implementation commands look very similar... seems like it could be worth a try.
> 
> Would be interesting to download the github code and take a closer look at what they're doing to implement their dual boot loader...
> 
> http://shr-project.org/trac/wiki/Devices/PalmPre/InstallGuide


Right!? I came across this a couple weeks back... but was thinking the dev team would come up with something similar or better. But since so far all I have seen mention is USB dualboot, I figured I would post to see if a similar install could be implemented. Having to boot via USB sounds a lot like (dare i say it) tethered-Jailbreak.


----------



## scifan (Aug 22, 2011)

The makefile referenced for the "installation" demonstrates how to effectively use novacom to rsh commands off to the phone (I'm assuming most of this will easily/readily translate to the Touchpad)

Pretty interesting stuff... I think it would need to be tweaked... shows how to effectively DD partitions as well as effectively tar.gz file systems as well... This could be used to do a full mirror of the touchpad the other guy had with 2.2.1 loaded on it... though I'm unsure if that would mirror the LVM partitions right... I'm certain you could do that though...

(yeah, it's off-track from the original discussion, but intriguing...)


----------



## fgdn17 (Aug 28, 2011)

scifan said:


> The makefile referenced for the "installation" demonstrates how to effectively use novacom to rsh commands off to the phone (I'm assuming most of this will easily/readily translate to the Touchpad)
> 
> Pretty interesting stuff... I think it would need to be tweaked... shows how to effectively DD partitions as well as effectively tar.gz file systems as well... This could be used to do a full mirror of the touchpad the other guy had with 2.2.1 loaded on it... though I'm unsure if that would mirror the LVM partitions right... I'm certain you could do that though...
> 
> (yeah, it's off-track from the original discussion, but intriguing...)


that kid from MIT (trsohmers) already did the mirror of the 2.2.1 image and had it dual booting as I recall...video was around aug. 28th timeframe..

He was one of the one's who started TD team as I recall but left right in the begining because of who knows...LOL

any check for that video...

also about a week ago saw this vid....very interesting...get him an image please...


----------



## kilokahn (Aug 23, 2011)

That is very nice indeed. I always liked a graphical bootloader instead of a "hold this button" type loader. This way you know what you selected. Interface should be easy enough to do with the volume buttons and the main button as the selection.


----------



## Dave01568 (Aug 27, 2011)

Did you see that story about the guy who brought nexus s and it has ice cream sandwich on it. Here is the story http://www.engadget.com/2011/09/28/ice-cream-sandwich-gets-a-two-minute-tour-courtesy-of-a-lucky-e/


----------



## I Am Marino (Jul 14, 2011)

"Dave01568 said:


> Did you see that story about the guy who brought nexus s and it has ice cream sandwich on it. Here is the story http://www.engadget.com/2011/09/28/ice-cream-sandwich-gets-a-two-minute-tour-courtesy-of-a-lucky-e/


I hear it got wiped.


----------

