yashsingh1/xdaforums huggingface dataset:
[Motorola Photon 4G] tdhite:
Ok, folks, have a block (and some pointers):

The block:

make -C dts/

make[1]: Entering directory `/home/tdhite/uboot-tegra/dts'

make[1]: Leaving directory `/home/tdhite/uboot-tegra/dts'

make[1]: Entering directory `/home/tdhite/uboot-tegra/dts'

dtc -R 4 -p 0x1000 -O dtb -o dt.dtb /home/tdhite/uboot-tegra/board/nvidia/ventana/tegra2-ventana.dts

make[1]: dtc: Command not found

make[1]: *** [dt.dtb] Error 127

make[1]: Leaving directory `/home/tdhite/uboot-tegra/dts'

make: *** [dts/libdts.o] Error 2

We need 'dtc' whatever that is. I'm not familiar with the tool, but let's hunt the darned thing.

The hints:

You can use the newer tool chain from the Linaro folks. I'm using the tool chain "android-toolchain-eabi-linaro-4.6-2012.07-1-2012-07-16_08-54-46-linux-x86.tar.bz2" (which is the latest android toolchain form Linaro's site (see links in earlier posts). I just unpack that to /opt/toolchain/...

Then, setup .bashrc like this:

ARMTOOLCHAIN="/opt/toolchains/android-toolchain-eabi/bin/"

export CROSS_COMPILE="arm-linux-androideabi-"

export PATH=$PATH:${ARMTOOLCHAIN}

Finally, in the file: <uboot-sources-dir>/arch/arm/cpu/armv7/config.mk, comment this out at line 29:

#PLATFORM_CPPFLAGS += -Werror

If you don't comment that out, you'll get errors from unused variable warnings (that flag used to work because older tool chains didn't warn on unused local variables). We can fix the code later (it's not bad, just need to insert some conditional compiles (#ifdefs) as appropriate, but that's for later.

Right now, we need 'dtc' -- hunt!

---------- Post added at 01:36 PM ---------- Previous post was at 01:27 PM ----------

Ok, I'm blushing since I could easily have hunted first:

dtc == device-tree-compiler

on Ubuntu: sudo apt-get install device-tree-compiler

and there ya go.

Now we have it -- all the needs. However, I'm gonna need a little help from some ARM experts. It's all compiled, and is ready to create an executable, however:

arm-linux-androideabi-ld: error: u-boot.lds:35:24: OVERLAY section type is unsupported

arm-linux-androideabi-ld: internal error in create_interp, at /mnt/jenkins/workspace/linaro-android_toolchain-4.6-2012.07/build/objdir/../build/../binutils/binutils-2.22.52.0.4/gold/layout.cc:4241

make: *** [u-boot] Error 1

So the new toolchain tries to load (link) it all, alas, I'm not familiar with how to control sections of the ARM regarding the link loader. Any one have clues for me?

---------- Post added at 01:52 PM ---------- Previous post was at 01:36 PM ----------

GOT IT!!!!

Switched to the 4.4 toolchain, setup as I mentioned (though pointing at that toolchain) and GOOD!

arm-none-eabi-objcopy -O srec u-boot u-boot.srec

arm-none-eabi-objcopy --gap-fill=0xff -O binary u-boot u-boot.bin

Ok, folks, we hvae u-boot. Where do you want it?

heh heh -- told you we'd get this. :)
[Motorola Photon 4G] R2DeeTard:
Fantastic! Now what?...

Sent from my MoPho
[Motorola Photon 4G] tdhite:
LOL -- y'all might throw some 'thanks' out there -- this !@#!@# ain't easy, but one way or another, we'll be getting the MoPho useful for more than GB.

:)
[Motorola Photon 4G] JDField:
Thanks

Thanks to all of you who are working on this. It's good to see not everyone abandoned the Photon. I would love to be able to unlock my bootloader at least just so that I could flash CWM.
[Motorola Photon 4G] Productzer01:
So if I get this straight you guys figured out how to get a custom ROM over the locked bootloader?

So should that mean 4g would still work or no since the custom ROM probably won't support it?

Also I'm going to get a little something together for this team don't get excited though it will be Pennies when compared to all the time you guys have put in but I have no problem paying for a software upgrade.
[Motorola Photon 4G] nickman529:
Okay sweet. We have uboot. Now we can load it (and our kernel) from the SD. Td can you post the compiled uboot files?

Sent from my ICSish MoPho

using xda-developers app
[Motorola Photon 4G] nickman529:
And thanks td you expedited this endeavour far more than I could have ever asked. Totally. Awesome.

Sent from my ICSish MoPho

using xda-developers app
[Motorola Photon 4G] nickman529:
4g should work (given the rom and kernel support it.) Getting kernel and rom support is tricky however cm 10 should boot perfectly if we load uboot with the kernel that supports it. Ooohh this is awesome

Sent from my ICSish MoPho

using xda-developers app
[Motorola Photon 4G] R2DeeTard:
This is awesome! Nothing better than a late Christmas present.

Sent from my MoPho
[Motorola Photon 4G] LightingZ:
Awesomeee!!!! finally custom roms !
[Motorola Photon 4G] R2DeeTard:
Would the same driver issues be present like in current cm10 roms?

Sent from my MoPho
[Motorola Photon 4G] nickman529:
There aren't "issues" persay but the kernel just doesn't fully support some things

Sent from my ICSish MoPho

using xda-developers app
[Motorola Photon 4G] LightingZ:
When do we start seeing U-Boot roms?
[Motorola Photon 4G] Indirect:
You guys could use the uboot to flash using fastboot from sd
[Motorola Photon 4G] nickman529:
Patience. We only just got this.
[Motorola Photon 4G] :
Amazing.
[Motorola Photon 4G] InsanePostman:
I knew some basasses would eventually work something out. Thanks a million for all your time and hard work!
[Motorola Photon 4G] dakshinasd:
This is just great guys... Just amazing how you guys are tackling the problem. My thanks goes to everyone out there. Now for sure, I can have a comfy sleep thinking my Photon would get ICS or JB soon....:D
[Motorola Photon 4G] Indirect:
I'm not even bothered by this. I was stating a suggestion that we could patch uboot...not that you all need to do it. Merely that its the next logical step.
[Motorola Photon 4G] bullfrog527:
Where can we get the uboot file? So we burn a sd card with u boot, expand the partition to accept the rom, put rom and gapps onto the card, boot into the cards cwm, flash rom and gapps, and we should be good to go?

Very similar to the nook color?
[Motorola Photon 4G] nickman529:
Exactly im gonna compile my own build. You can do the same or wait for either me or tdhite to post our Uboot build
[Motorola Photon 4G] tdhite:
Agreed, patience will do well for a bit. I'm not a u-boot savvy person, so there's

surely more builds and debugging to do. All I can say is it compiles. :)

I'll post the binary to my Dropbox in just bit. Lol, I honestly have no clue, yet, how to set it up or execute it.
[Motorola Photon 4G] bullfrog527:
I'm fairly familiar with running ROMS off of the sd card, I've messed with my wife's nook color for 2 yrs now. I'd be willing to try to burning a spare sd card and trying it out on my photon. It's unlocked but if it works on mine it should on a locked I would think
[Motorola Photon 4G] nickman529:
YESYESYES!!! Please do this asap(whenever td uploads :P ) THANK YOU!!
[Motorola Photon 4G] R2DeeTard:
So I'm entirely unfamiliar with this process. Would someone give me a run down of what we will be doing with our devices?

Sent from my MoPho
[Motorola Photon 4G] tdhite:
Thanks for the help -- I've seen you around lurking these forums so I know you know how to help.

I uploaded the u-boot binary here:

https://www.dropbox.com/s/t6e4yldwig2vxb8/u-boot

Running it directly from terminal (as non-su user) segfaults, but I suspect that could never work in any event. I can't risk su level access right now -- the phone is a need at the moment.

If we need a debug version, let me know and I'll compile that down and upload it.

-- Tom
[Motorola Photon 4G] nickman529:
Thank you very much td. Bullfrog lets see if you can get this up
[Motorola Photon 4G] nickman529:
We need a uimage and a .uimg kernel file for it i think
[Motorola Photon 4G] kdog350:
Thank you guys so much for working on this, this is awesome so far (:
[Motorola Photon 4G] tdhite:
Hmmm... not seeing those in the build, but there's a u-boot.img and whatnot. For Bullfrog's testing, I put all the output files here:

u-boot-photon-r1.tgz

Likely superfluous files in there, but I'm happy to defer to Bullfrog.
[Motorola Photon 4G] bullfrog527:
yea, none of those files has a u-boot image file, thats what is needed to write a bootable sd i think

---------- Post added at 08:34 PM ---------- Previous post was at 08:28 PM ----------

what they are trying to do is set up a sd card to run an OS from. bypassing the bootloader and the OS on the phone. The only thing I just thought of is will our phones boot the sd before looking internally?
[Motorola Photon 4G] tdhite:
I think mkimage is the toy you need. What os are using? My build is on Ubuntu 12.04. I'll tar up the tools.

---------- Post added at 08:56 PM ---------- Previous post was at 08:42 PM ----------

My Dropbox folder with all the uploads is here:

https://www.dropbox.com/sh/ql09yqrmu8ffall/qrxSVOU7dt

look for tools.tgz -- that has mkimage (among others) for creating the uImage.
[Motorola Photon 4G] bullfrog527:
Sorry I'm on win xp. I'm using win image. I don't know Linux, I have unbutu installed on my netbook but I don't have any wireless drivers to use it. I'm kinda lost with that whole is :(

sent from my Liquid Smooth Jellybean MoPho
[Motorola Photon 4G] tdhite:
Ok, tell you what, tomorrow I'll image up a set of you can get me a kernel, initrd and anything you w as my packed in. Time for me to learn this anyway.
[Motorola Photon 4G] bullfrog527:
I have to work tomorrow, I'll be able to mess with this again tomorrow night after 7 central time.

sent from my Liquid Smooth Jellybean MoPho
[Motorola Photon 4G] nickman529:
This is getting nicer
[Motorola Photon 4G] anthony062991:
Woah! Did you managed to compile the U-Boot?

Sorry guys.. I couldn't help much..

I was wiith my grandma in ER..

Anyways great job on makng some more progress.. I will try to come on tomorrow to see what's going on.
[Motorola Photon 4G] Neva Eva Forget 1984:
Been ghosting the thread... Good Job Guys!! Can't wait to dust off the Photon... and give moto a lil kick in the...
[Motorola Photon 4G] antipasto:
I googled around some and tried to piece together what I could remember from my nook color exploits.

I have the following tooks:

mkimage

abootimg*

repack-bootimg.pl

unpack-bootimg.pl

i've been playing around with various image files and zips and the "nooter" root sdcard images from the nook color stuff i have.

are you saying tho that u-boot could just be executed in userland somehow and it would just restart the init process?

i read around some rumblings about just running it during fastboot, or perhaps using the command mode in the recovery stuff somewhere

most boot partitions i'm seeing are like this:

./mlo

./u-boot.bin

./uimage

./uramdisk

so what's mio? is uimage the same as a kernel?
[Motorola Photon 4G] tdhite:
Yip, all built, just dunno it works yet. That's today -- I will learn how to generate the boot artifacts.

In any event, take care of family, that's far more important than this. I hope all is well.

---------- Post added at 07:39 AM ---------- Previous post was at 07:37 AM ----------

No clue, yet ... working on this today.
[Motorola Photon 4G] nickman529:
Awesome. I got your files and I'm looking at it as well. Keep me updated
[Motorola Photon 4G] LightingZ:
I think this might be usefull :)

http://bill.station51.net/index.php?post/2010/01/30/HOWTO:-Booting-from-SD-card-using-U-Boot
[Motorola Photon 4G] anthony062991:
Thanks..

As far as you uImage you can get the source from one of the cm10 roms and you need to edit a few thing. Check out the bottom of this where it says "Patch"

https://patchwork.kernel.org/patch/1133461/

You have to edit a couple of files in the kernel to compile the source into a uImage instead of a zImage..

Here is some more info on Panda How to MLO & u-boot:

http://elinux.org/Panda_How_to_MLO_&_u-boot
[Motorola Photon 4G] tdhite:
Sorry guys -- terrible day, no work at all on this (I'll get to it, just have to clear my head). My wife's truck (nice one, actually) came home with the oil pressure gauge at zero. That ought to cost about 7-8G according the dealer. Cripes, obviously my head went elsewhere for the day. :(

No worries -- reality already sank in, so I'll get back on it. The docs are well formed at DULG. The quote is right, so we have a bit of image work to do. Plans:

1) I'll build down a Windows version of the tools (mkimage.exe, et al) for folks to play with in sync with the rest of us;

2) I'll dig into stealing some stuff from the links provided above to build some images.

Might be slower since I'm so pi__ed at Dodge for making a stupid engine in their RAM trucks, but that's life for now.

-- Tom
[Motorola Photon 4G] anthony062991:
Sorry to here that.. Hope you get everything worked out..

Your link is not workng for denx?

I will try to compile a uImage as well. I just can't seem to get a working toolchain though? I used to be able to compile these things without problems, but I'm not sure what is going on? What toolchain are you using?
[Motorola Photon 4G] tdhite:
I uploaded the toolchain I'm using here: https://www.dropbox.com/sh/ql09yqrmu8ffall/qrxSVOU7dt

you'll see the arm bz2 file there.

Unpack that in /opt/toolchain (which you need to make), then set this in your .bashrc:

ARMTOOLCHAIN="/opt/toolchains/arm-2010q1/bin"
export CROSS_COMPILE=arm-none-eabi-
export PATH=$PATH:${ARMTOOLCHAIN}

Then either resource your .bashrc ( . ~/.bashrc ) or logout/login to get those vars set.

After that: make mrproper; make ventana_config; make

That should work for you. I'll check to see if you get probs.
[Motorola Photon 4G] nickman529:
Take care of it first if you need. Priority is your family life. Appreciate it man

Sent from my ICSish MoPho

using xda-developers app
[Motorola Photon 4G] anthony062991:
I'll be home in about an hour or so.. I will download the toolchain in a little bit. Thanks for the link and path.. Will I be able to compile ICS kernel with that toolchain as well? Also I looked at one of the kernels for aokp and I saw in one of the make files u Image.. Maybe we can just say yes in the config menu.. Not sure yet?

Edit:

It's going by to take me longer than normal so I will probably take a look at it tomorrow..
[Motorola Photon 4G] tdhite:
All they do is muck the kernel build to append the dtb file to the zImage. For now, I will try to extract the stock kernel and initrd, compress the kernel into a zImage, then mkimage all that to a u-boot uImage. That should, if we have u-bot working, boot exactly as if nothing changed.

But, I need the correct hex addresses for the photon -- anyone know those? We need the "entry point address" and the "load address" -- see the mkimage -e and -a parameters.

??
[Motorola Photon 4G] LightingZ:
http://stackoverflow.com/questions/4468248/unique-id-of-android-device ?
[Motorola Photon 4G] tdhite:
Boot is /dev/mmcblkp

---------- Post added at 01:34 PM ---------- Previous post was at 01:14 PM ----------

The stock image is binary copied over the boot partition, you can't mount it, rather must dd it off and then split it from the appended initrd. I will get it all in a bit. How did you extract the data from your kernel?
[Motorola Photon 4G] anthony062991:
I couldn't pull the boot.img I might be doing the command wrong..

Whats the command to pull the boot.img again?

Download android kitchen from here:

https://github.com/dsixda/Android-Kitchen

extract and cd to the directory

and then pull a rom from the frorums

put it in "original_update" but leave it at as zip file

./menu in command line

press "1"

press "enter"

It will show the rom you put into "original_update"

press "1" to extract it and go through the defaults

(let it extract itself..)

press "enter" to continue

at the "main menu" press "0" and "enter" for advanced options

press "12" for 12 - Tools for boot image (unpack/re-pack/etc.)

than press "s" for s = Show boot.img information

and you will have your values from there :)

If you get stuck just let me know..

EDIT:

major minor #blocks name

7 0 5229 loop0

179 0 15541760 mmcblk0

179 1 3584 mmcblk0p1

179 2 512 mmcblk0p2

179 3 2048 mmcblk0p3

179 4 1 mmcblk0p4

179 5 1024 mmcblk0p5

179 6 512 mmcblk0p6

179 7 512 mmcblk0p7

179 8 1024 mmcblk0p8

179 9 2048 mmcblk0p9

179 10 8192 mmcblk0p10

179 11 8192 mmcblk0p11

179 12 491520 mmcblk0p12

179 13 1364992 mmcblk0p13

179 14 122880 mmcblk0p14

179 15 663552 mmcblk0p15

179 16 3145728 mmcblk0p16

179 17 353280 mmcblk0p17

179 18 9359872 mmcblk0p18

179 19 512 mmcblk0p19

179 32 15645696 mmcblk1

179 33 15644672 mmcblk1p1

254 0 5229 dm-0

There is no mmcblkp?
[Motorola Photon 4G] tw1ztidmopho:
Damn wish I could understand what the hell y'all are talking about in here and help out.
[Motorola Photon 4G] nickman529:
Lol. Learn computer terms and programming junk and you will

Sent from my ICSish MoPho

using xda-developers app
[Motorola Photon 4G] tdhite:
Hi guys,

I pulled and split my kernel and initrd. I will send instructions for that in a bit. I will also upload the split_image.pl perl script that splits the image apart.

Now I just need to figure out where to load it (what physical address) and I can then rum the mkimage to create a test uImage.
[Motorola Photon 4G] tdhite:
I uploaded split_bootimg.pl here (the rest of the files also exist there):

So, to nab your existing kernel from the phone, hook it up to your USB port (debugging on, charge only, bla bla bla):

Get the kernel and initrd to your sdcard:

adb shell
su
dd if=/dev/block/mmcblk0p11 of=/sdcard/boot.img
exit

Copy it it to your pc and split it (assuming split_bootimg.pl is on the path)

adb pull /sdcard/boot.img
split_bootimg.pl boot.img

After split_image.pl, you'll have your kernel and ramdisk -- check the kernel out:

file boot.img-kernel

results in: boot.img-kernel: Linux kernel ARM boot executable zImage (little-endian)

From here, we (now) know that:

"The entry point for an ARM kernel image is always at an offset of 0." See Re: [U-Boot] zImage on ARM.

Now, I just have to finally find the load address and we'll have our uImage. I'm not an ARM genius, but we're getting there.
[Motorola Photon 4G] anthony062991:
Thanks for the info..

That is one huge boot.img lol

I will check the load address and upload it for you

EDIT:

Kernel Size : 3272392 bytes

Kernel Base Address : 0x10000000

Ramdisk Size : 155759 bytes

Ramdisk Load Address : 0x11000000

Second Stage Size : 0 bytes

Second Stage Load Address : 0x10f00000

Page Size : 2048 bytes

ASCIIZ Product Name : (None)

All Stock Values :)

EDIT:

android kitchen extracts it a little different than split_bootimg.pl method.. anyways..

I extracted my boot.img with android kitchen and Here is the init.rc, zImage ect.. (check attach files if you need a copy)
[Motorola Photon 4G] tdhite:
So, looks like load address is 0x10000000, agreed?
[Motorola Photon 4G] tdhite:
While waiting for a VM to spin up at work (have to do that too), I made a u-boot image as follows (presuming the values provided in the prior post by anthony:

tdhite@cto-node4:~$ uboot-tegra/tools/mkimage -A arm -O linux -T multi -C none -a 00000000 -e 1000000 -d mmcblk0p11.img-kernel:mmcblk0p11.img-ramdisk.gz photon4-uboot.img

Image Name:

Created: Mon Jan 7 10:27:12 2013

Image Type: ARM Linux Multi-File Image (uncompressed)

Data Size: 3428163 Bytes = 3347.82 kB = 3.27 MB

Load Address: 00000000

Entry Point: 01000000

Contents:

Image 0: 3272392 Bytes = 3195.70 kB = 3.12 MB

Image 1: 155759 Bytes = 152.11 kB = 0.15 MB

I posted that u-boot image on my dropbox.

Will it work? NO WAY! LOL ;) -- It's the first shot and first shots never seem to go anywhere useful other than to teach about tools and images.

So if someone has a way to load it, read this first:

DON'T LOAD IF YOU CAN'T SPARE YOUR DEVICE, AS I HAVE (AS WELL AS ANYONE ELSE HAS) ABSOLUTELY NO CLUE IF IT'LL WORK, BRICK YOUR DEVICE, OR WORSE, CAUSE SOME OTHER CONSEQUENTIAL DAMAGES. WE (ME INCLUDED) ACCEPT NO RESPONSIBILITY AND YOU TAKE THIS AT YOUR OWN RISK).

Then play to your hearts content and post anything you learn.
[Motorola Photon 4G] anthony062991:
My queston is how would be wrtie this to the sdcard? I mean we have several files now what do we need on the sdcard for it to boot up? I will risk my device becuase it should affect anything interanl wise... Everything looks about right let me me see if I write this img to an sdcard and see what happens??

Edit:

We are missing the main part..

x-loader binary image e.g. "MLO" file

Edit:

On the nook hd we have these files:

MLO

kernel

ramdisk.cwm

u-boot.bin

uImage
[Motorola Photon 4G] nickman529:
Once its on the SD card how do we tell the system to boot from SD?

Sent from my ICSish MoPho

using xda-developers app
[Motorola Photon 4G] anthony062991:
So I have some interesting news..

I talked with someone about the u-boot and they said:

"Assuming your device uses u-boot as default bootloader and it's not required to be signed, you just use u-boot.bin file and place it instead of the one you have on your device."

Now my question is does the photon even use u-boot as the default bootloader?

Also our bootloader is locked and signed so I'm assuming that if it does use u-boot as default then we need to sign our u-boot?

If not then we are back to where we started.. :/
[Motorola Photon 4G] nickman529:
Uboot can be flashed

Sent from my ICSish MoPho

using xda-developers app
[Motorola Photon 4G] tdhite:
Lol I only promised to get stuff built. We will have to learn more as u-boot is not a knowledge set fully baked in my head .... yet.
[Motorola Photon 4G] tdhite:
Looking at kernel exploits again, so as to run u-boot. Good read: http://ugcs.net/~keegan/talks/kernel-exploit/talk.pdf. Points to my module exploit idea from pages back.
[Motorola Photon 4G] cmbinf:
Noticed the renewed attempts to do something for this nice piece of hardware. I have an extra MB853 laying about, so count me in on testing. Don't know how much I can contribute but willing to monitor and help as much as possible. Hope we can exploit some vulnerability, and open this thing up. Just outta shear spite to Motorola of course! ;)
[Motorola Photon 4G] anthony062991:
Do you think it might be an easier way if we just try to compile a module explicit? Would we be able to use the explicits in the pdf? Will the explicit help us downgrade or bypass the bootloader? We can try to compile stock with a module to see if the modules will work...
[Motorola Photon 4G] LightingZ:
Wait so uboot is possible or not?
[Motorola Photon 4G] tdhite:
With enough time and money, pretty much anything is possible. We have to get u-boot started, though, so that's why the exploit is (seemingly) neessary. That was true in any event, though, so don't fret quite yet. No one says this whole thing will work at all, we are just running down a path that appears plausible.

---------- Post added at 06:36 AM ---------- Previous post was at 06:33 AM ----------

We likely have to compile our own module, and that's definitely supported by our kernel. Good thing is they are on the system partition, not in the initrd, so we can swap them at will.
[Motorola Photon 4G] xNiiCADEMUS:
Count me in to help out guys. I'm going to start messing around with things on my own as well but if you need anything let me know. I have 3 photon's. Two are 2.3.5 locked and on is 2.3.4 unlocked. I use linux and I am syncing the complete aosp repo as we speak. Oh and I'm motivated since I have 3 of these phones that got crapped on.
[Motorola Photon 4G] Laxdude:
I am not a dev but I'm happy to be a tester of some sort. I have bricked my phone many times so I got pretty good at fixing it if it dies on me.
[Motorola Photon 4G] anthony062991:
Do we need to compile the whole kernel or can we just make a module and through it in the system?
[Motorola Photon 4G] tdhite:
We can, likely anyway, add modules to the existing kernel. Only issue is the module versioning, since the stock kernel does not have the 'force' flag set for unloading and loading.

I'm looking at things, folks, just kinda busy this week. Hang in with me.
[Motorola Photon 4G] bullfrog527:
I re locked my bootloader so I can test whatever. Testing out the 4g at work. I'm not Perma locked so I'll be ok