PDA

View Full Version : [release] Linux ROM Kitchen


pof
22-07-2008, 06:57 AM
Linux ROM kitchen is a tool that allows you to cook your own Windows Mobile ROMs for HTC Windows Mobile devices. This means you can extract the contents of a Shipped or Dumped ROM, and add/remove files or Packages into the ROM.

It consists of several tools, most of them can be run separately from command line, altough they are all nicely put together in a GUI.

Basic knowledge of ROM cooking is expected, it helps if you have played with similar kitchens available for windows before, and know a bit of the internals of WinCE OS.

Use it with CARE. If you don't know what you're doing you can brick your device. USE IT AT YOUR OWN RISK.

Screenshot
http://pof.eslack.org/HTC/HTCFlasher/Screenshot-LRK1.png

Screencast

To show the basic usage of LRK, I have created a SWF video showing how to cook a ROM, it is available here:

http://www.eslack.org/pof/LRK/

Download
Linux ROM Kitchen is part of HTCFlasher (http://htc-flasher.googlecode.com), you can download it from the HTCFlasher download page.
Full source code as well as Ubuntu packages are available for download :)

Enjoy! ;)

pof
22-07-2008, 06:57 AM
++ reserved ++

knownboyofno
22-07-2008, 07:12 AM
MANNNNNNNNNNNNNN you are making it looking better to move over to ubuntu (I love it anyway just a few programs I need to find for it) anyway thanks for this programs.

aguas
22-07-2008, 09:49 AM
haha i read the title pretty quickly and got all excited; i thought it was for actual cooking of Linux ROMs. but looks great, will most likely make things a lot easier when i switch to ubuntu in about a month. soo done with windows. thanks a ton :D

sp3dev
22-07-2008, 10:19 AM
Hey, pof, it looks very nice. Though i'm not going to use it (at least now), thanks a lot.

jcespi2005
22-07-2008, 11:06 AM
Linux ROM kitchen is a tool that allows you to cook your own Windows Mobile ROMs for HTC Windows Mobile devices. This means you can extract the contents of a Shipped or Dumped ROM, and add/remove files or Packages into the ROM.

It consists of several tools, most of them can be run separately from command line, altough they are all nicely put together in a GUI.

Basic knowledge of ROM cooking is expected, it helps if you have played with similar kitchens available for windows before, and know a bit of the internals of WinCE OS.



Reallly nice work, mate ;)

Congratulations

badaas
22-07-2008, 11:58 AM
mmmm, time to install 32bit ubuntu, running 64bit kubuntu atm.. thx pof :D

F_R_I_T_Z
22-07-2008, 03:04 PM
dude, is this work to universal, iam to pay you a lot of coffees... so much you will be asleep for ages... :-)

timn2087
24-07-2008, 03:30 PM
dude, is this work to universal, iam to pay you a lot of coffees... so much you will be asleep for ages... :-)

you mean the coffees will keep him awake:p

mbarvian
24-07-2008, 05:30 PM
thanks pof!

i have one question:
does this have as much functionality as, for example, _alex_'s?

now all i need to do is figure out how to sync my kaiser with evolution...

arterio66
24-07-2008, 11:27 PM
Help me pof:

i have installed ubuntu 8.04 for install the linux kitchen but i have a problem because when i try to do that return me an error:

is impossible to install one component because not exist and that is a "wine".

why pof

thank and great for a good job

pof
24-07-2008, 11:43 PM
If you are using Ubuntu, you can now install Wine by clicking this link (apt://wine). Alternatively, you can install by going to Applications->Add/Remove and searching for Wine.

pof
24-07-2008, 11:44 PM
does this have as much functionality as, for example, _alex_'s?
yes, almost the same functionality as other windows kitchens. It's compatible with exisiting OEM packages from other kitchens too.

brazen1445
25-07-2008, 12:53 AM
FYI this does work on Ubuntu 8.04 64bit.
Just install with sudo dpkg -i --force-all name.of.deb
It gripes about some dependencys but they can all be found with apt-get.

Great job pof, you have made my day. No more more borrowing my gf laptop top just to flash my phone.

opgadgets
25-07-2008, 04:42 AM
yes, almost the same functionality as other windows kitchens. It's compatible with exisiting OEM packages from other kitchens too.

awesome, thanks again man :D

N3xt2N0N3
25-07-2008, 05:10 AM
wow this is great now make something like activesync for linux...lol but seriously keep up the good work

pof
25-07-2008, 05:12 AM
now make something like activesync for linux...

We already have synce, which works like a charm :)
http://www.synce.org/

mbarvian
25-07-2008, 05:13 AM
We already have synce, which works like a charm :)
http://www.synce.org/

btw pof, do you have some instructions for setting synce up to work with ubuntu and the kaiser? I can't find any :(

pof
25-07-2008, 05:14 AM
@mbarvian: Read here:
http://www.synce.org/moin/SynceWithUbuntu

mbarvian
25-07-2008, 05:17 AM
@mbarvian: Read here:
http://www.synce.org/moin/SynceWithUbuntu

thanks, I"ll give that a go as soon as I can :)

arterio66
25-07-2008, 10:26 AM
If you are using Ubuntu, you can now install Wine by clicking this link (apt://wine). Alternatively, you can install by going to Applications->Add/Remove and searching for Wine.

Thanks pof, i try it soon!!

Good job:)

arterio66
25-07-2008, 03:39 PM
Thanks pof, i try it soon!!

Good job:)


Hello pof,
nothing, i try it bat i have the error in image.

other solution ?

Thanks

pof
25-07-2008, 03:51 PM
other solution ?
You're trying to download an old version of the package which has already been deleted from the repository. Run the ubuntu update manager, and do all the updates, after that it should work.

ivanmmj
25-07-2008, 10:53 PM
Can you release the make ready package? I run Mandriva, and I've never had much luck converting deb's into RPM's.

lpsi2000
25-07-2008, 11:59 PM
Pof,
May be I missed something on the Windows side, but I have not seen any kitchen where everything is included in one interface and as simple as this. If I did, please point to at least one or more.

Great job on this man, this kitchen reminds the days of the Wallaby and Himalaya (old school with the future in mind).

Appreciate the efforts.

fzzyrn
26-07-2008, 12:14 AM
i too thought this was a kitchen to build linux roms for ppc. oh well.

its good to have the choice.

farukb
26-07-2008, 12:25 AM
thanks,i'm ubuntu user too;)

XL3N7
26-07-2008, 03:12 AM
For some reason I can't connect
[] Using device '/dev/ttyUSB0'
[] Getting device info...
/dev/ttyUSB0: No such file or directory
[!!] Can't connect to /dev/ttyUSB0

pof
29-07-2008, 12:11 PM
For some reason I can't connect

Make sure your device is in bootloader mode, and you have module "ipaq" loaded (lsmod |grep ipaq), also check your 'dmesg' when connecting the device.

cr2
29-07-2008, 12:41 PM
i too thought this was a kitchen to build linux roms for ppc. oh well.


It's called OpenEmbedded http://wiki.openembedded.net/index.php/Main_Page
but does dot have a nice gui.

demacus
30-07-2008, 03:03 AM
Sers,

thank you very much for this great tool pof, now I'm near to say my last windoze goodbye!! :D


But I got some problems, maybe someone can help here.

1. I can't connect my device in bootloader mode, I tryed several ways (with / without ipaq loaded; via virtualbox... ) but my device never gets attached to ttyUSB0... ever get the same error:
[33173.065643] usb 7-2: new full speed USB device using uhci_hcd and address 7
[33175.818492] usb 7-2: new full speed USB device using uhci_hcd and address 8
[33175.978587] usb 7-2: configuration #1 chosen from 1 choice
[33262.744364] /build/buildd/linux-2.6.24/drivers/usb/serial/usb-serial.c: USB Serial support registered for PocketPC PDA
[33262.744369] /build/buildd/linux-2.6.24/drivers/usb/serial/ipaq.c: USB PocketPC PDA driver v0.5
[33262.744402] ipaq 7-2:1.0: PocketPC PDA converter detected
[33267.740921] ipaq: probe of 7-2:1.0 failed with error -5
[33267.740935] usbcore: registered new interface driver ipaq
root@demacus-c2q:~#

In ActiveSync and "HDD" mode everything works fine. Please give me a hint what I can try out.

2. I get an error while trying to create os-new.nb with LRK with this log:
Adding custom packages to dump folder...
NBSplit 2.1rc2
Using data chunk size = 0x800 and extra chunk size = 0x8
on file ./OS.nb
Done.
wine: Unhandled page fault on read access to 0x00000000 at address 0x407b6a (thread 0009), starting debugger...
Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x00407b6a).
Register dump:
CS:0073 SS:007b DS:007b ES:007b FS:0033 GS:003b
EIP:00407b6a ESP:0032f0ac EBP:0032f0b4 EFLAGS:00090212( - 00 - RIA1)
EAX:00001000 EBX:00001000 ECX:00000400 EDX:00000000
ESI:00000000 EDI:00df1d68
Stack dump:
0x0032f0ac: 00000000 00df1d28 00ddfc10 00401a69
0x0032f0bc: 00df1d68 00000000 00001000 0032fac8
0x0032f0cc: 0032f96f 0032feb8 001118c8 ffffffff
0x0032f0dc: 00df1d28 00000000 004a1d40 001570b0
0x0032f0ec: 00111160 00000000 ffffffff 00950050
0x0032f0fc: 00ddfc10 0000003c 0032fab0 706d7564
Backtrace:
=>1 0x00407b6a in imgfsfromdump (+0x7b6a) (0x0032f0b4)
2 0x00401a69 in imgfsfromdump (+0x1a69) (0x00ddfc10)
0x00407b6a: repe movsl (%esi),%es:(%edi)
Modules:
Module Address Debug info Name (21 modules)
PE 400000- 612000 Export imgfsfromdump
PE 10000000-1000c000 Deferred cecompr_nt
ELF 7b800000-7b92d000 Deferred kernel32<elf>
\-PE 7b820000-7b92d000 \ kernel32
ELF 7bc00000-7bca4000 Deferred ntdll<elf>
\-PE 7bc10000-7bca4000 \ ntdll
ELF 7bf00000-7bf03000 Deferred <wine-loader>
ELF 7edf8000-7ee62000 Deferred msvcrt<elf>
\-PE 7ee10000-7ee62000 \ msvcrt
ELF 7ee62000-7ee80000 Deferred msvcr71<elf>
\-PE 7ee70000-7ee80000 \ msvcr71
ELF 7efa0000-7efab000 Deferred libnss_files.so.2
ELF 7efab000-7efb5000 Deferred libnss_nis.so.2
ELF 7efb5000-7efcd000 Deferred libnsl.so.1
ELF 7efcd000-7eff2000 Deferred libm.so.6
ELF 7eff7000-7f000000 Deferred libnss_compat.so.2
ELF b7c83000-b7c87000 Deferred libdl.so.2
ELF b7c87000-b7dd6000 Deferred libc.so.6
ELF b7dd7000-b7def000 Deferred libpthread.so.0
ELF b7dfd000-b7f33000 Deferred libwine.so.1
ELF b7f35000-b7f51000 Deferred ld-linux.so.2
Threads:
process tid prio (all id:s are in hex)
00000008 (D) Z:\usr\share\LinuxRomKitchen\ImgfsFromDump.exe
00000009 0 <==
0000000c
00000014 0
00000013 0
00000012 0
0000000e 0
0000000d 0
0000000f
00000016 0
00000015 0
00000011 0
00000010 0
Backtrace:
=>1 0x00407b6a in imgfsfromdump (+0x7b6a) (0x0032f0b4)
2 0x00401a69 in imgfsfromdump (+0x1a69) (0x00ddfc10)
Cleaning up...
mv: Aufruf von stat für „os-new.nb“ nicht möglich: No such file or directory
ERROR: Can't create os-new.nb


OS: Ubuntu 8.04 Kernel 2.6.24-19

Please somebody help me, I'm going nutty here with this.


best regards

cr2
30-07-2008, 03:22 AM
2. I get an error while trying to create os-new.nb with LRK with this log:
Adding custom packages to dump folder...
NBSplit 2.1rc2
Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x00407b6a).
Register dump:

OS: Ubuntu 8.04 Kernel 2.6.24-19


This is a kernel bug, you should report it to ubuntu.

pof
30-07-2008, 03:40 AM
@demacus:

1. Which device is it?? I've heard that HTC Diamond has problems connecting to USB-serial in Linux.

2. As cr2 said, looks like a kernel bug, but I haven't had this problems using an up-to-date Ubuntu 8.04, same kernel version as yours (2.6.24-19).

3. You can try to install this in wine, see if it helps:

$ wget http://kegel.com/wine/winetricks
$ sh winetricks corefonts dotnet20 vcrun2005

demacus
30-07-2008, 03:56 AM
Oh, that was pretty quick!

Itried with this wine version but still got the same error...

Also I tried to create os at my laptop with kernel 2.6.24-20 and there is the same problem.

My Device is Diamond, sorry I forgot to say.


Thank you for your replies!

best regards

veda_sticks
30-07-2008, 03:25 PM
This is a great little utility, managed to get it installed under 64 bit ubuntu studio :)

Does this support wizard rom files, any rom packages i have tried only seem to have nbf files and i cant extract anything.

Sayuuk
30-07-2008, 03:40 PM
Thanks for this hot application! :)

Stefan

mdneilson
31-07-2008, 10:59 AM
When trying to extract ROM packages from OS.nb I get the following error:

Preparing...
NBSplit 2.1rc2
Using data chunk size = 0x800 and extra chunk size = 0x8
on file ./OS.nb
Done.
mv: cannot stat `dump': No such file or directory
ERROR: can't create imgfs dump

Looking at the source, I found the code related to the error and it seems to be a problem with the LRKtools.

wine $TOOLS/ImgfsToDump.exe imgfs.bin >> log.dump
mv dump dump_imgfs

if [ $? != 0 ]; then
echo "ERROR: can't create imgfs dump"
exit 1
fi

Can you please help me solve this problem?

pof
31-07-2008, 12:43 PM
Does this support wizard rom files, any rom packages i have tried only seem to have nbf files and i cant extract anything.

It should support wizard ROMs, but NBF support has not been implemented yet. You can extract & repack NBF files using itsme perl scripts (alpinenbfdecode.pl, decodenbf.pl, typhoonnbfdecode.pl, etc...) to deal with NBF files, however this is not integrated in the kitchen yet.

When trying to extract ROM packages from OS.nb I get the following error [...]

Make sure the LRKtools are in /usr/share/LinuxRomKitchen and you have all the dependencies installed (wine, lcab, etc.) There's a script that should help you find it out (lrk-preload).

cr2
31-07-2008, 03:02 PM
pof, are you using wine because of the cecompr_nt ?
I think it should be possible to use lzmadec_* and the XPR
algorithm is also documented by microsoft recently.
Hehe, then we can finally fix compression for the 'dumprom.cpp' too :)

mdneilson
31-07-2008, 09:10 PM
Make sure the LRKtools are in /usr/share/LinuxRomKitchen and you have all the dependencies installed (wine, lcab, etc.) There's a script that should help you find it out (lrk-preload).

It looks like I have all the required tools installed, because the script gave me an error that a path doesn't exist, which is tested near the end of the script.

ls: cannot access /home/mdneilson/LRK/SYS/OEM_Lang_*/initflashfiles.dat: No such file or directory

The LRK folder in my home directory is empty until I extract a file, then it creates a NBH folder, but not the SYS one specified in the error. What component should be creating the path?

Thanks again!

lpsi2000
31-07-2008, 10:24 PM
Pof, I am also getting the below error when I tried to an Athena ROM Preparing... NBSplit 2.1rc2 Using data chunk size = 0x800 and extra chunk size = 0x8 on file ./OS.nb Done. mv: cannot stat `dump': No such file or directory ERROR: can't create imgfs dump

pof
01-08-2008, 03:02 PM
@cr2: Yes! That would be really good, so we no longer need to depend on wine. Do you have more info or any links?

@mdneilson: Make sure in File -> Preferences you select the right nsplit switch for the device you're trying to extract the ROM; if that doesn't help, check the contents of the file ~/.lrk/Temp/log.dump to see if it gives any hint about the problem.

@lpsi2000: Make sure in File -> Preferences you select "-athena" switch for nbsplit options.

mdneilson
02-08-2008, 09:12 AM
@mdneilson: Make sure in File -> Preferences you select the right nsplit switch for the device you're trying to extract the ROM; if that doesn't help, check the contents of the file ~/.lrk/Temp/log.dump to see if it gives any hint about the problem.-athena" switch for nbsplit options.

What should I use for a Wing (herald)? I tried all three with the same results.

I don't see anything that sticks out in the log. I have attached it if you want to take a look.

I am working on an install on an old laptop and will try this on there too.

pof
02-08-2008, 11:09 AM
What should I use for a Wing (herald)?

You should use "-athena" too, is the default setting for devices that don't need to run nbsplit.

I don't see anything that sticks out in the log. I have attached it if you want to take a look.
Guess you forgot the attachment.

You can try the commands directly from the shell, for a Herald that should be:


cp OS.nb OS.nb.payload
ImgfsFromNb OS.nb.payload imgfs.bin
wine /usr/share/LinuxRomKitchen/ImgfsToDump.exe imgfs.bin


See if those give you any problem.

pof
02-08-2008, 11:48 AM
@mdneilson: I've extracted a herald ROM and saw what the problem was. Should be fixed in the SVN version, if not please report.

mdneilson
02-08-2008, 11:02 PM
@mdneilson: I've extracted a herald ROM and saw what the problem was. Should be fixed in the SVN version, if not please report.

I ran the program from the SVN updated this morning.

Still no dice. The manual commands in shell worked fine, but the pretty version did not.

Should the program load the ROM packages since the shell commands worked and the dump folder is present?

(I also triple-checked for the dependencies as well)

I attached the log this time, sorry. (it is the most recent one)

PS. I am running Hardy, fully updated, on an old PIII.

pof
03-08-2008, 04:41 AM
I ran the program from the SVN updated this morning.
[...]
I attached the log this time, sorry. (it is the most recent one)


The log shows it's using NBSplit, most probably because you forgot to change the "-athena" switch in File -> Preferences, please double check that.

mdneilson
03-08-2008, 08:43 AM
The log shows it's using NBSplit, most probably because you forgot to change the "-athena" switch in File -> Preferences, please double check that.

Good call. But still just short of a mile. New error:

Preparing...
[Info] It is a common ROM.
[Error] File is damaged, end address small than start address.
[Error] File is damaged, end address small than start address.
xip.bin: No such file or directory
mv: cannot stat `dump': No such file or directory
ERROR: can't create XIP dump

I get this error with all 3 ROMs that I have (Open, Touch-it, and the stock Wing ROMs)

pof
03-08-2008, 04:06 PM
Good call. But still just short of a mile. New error:
[...]
I get this error with all 3 ROMs that I have (Open, Touch-it, and the stock Wing ROMs)

Are you sure this is SVN version? This should be fixed in SVN r92, please check again.

demacus
07-08-2008, 01:30 PM
@demacus:

1. Which device is it?? I've heard that HTC Diamond has problems connecting to USB-serial in Linux.

2. As cr2 said, looks like a kernel bug, but I haven't had this problems using an up-to-date Ubuntu 8.04, same kernel version as yours (2.6.24-19).

3. You can try to install this in wine, see if it helps:

$ wget http://kegel.com/wine/winetricks
$ sh winetricks corefonts dotnet20 vcrun2005


Sers,

just a little update: with kernel 2.6.26-5-generic everything is working fine!


Thank you, best regards

demacus

mdneilson
08-08-2008, 10:44 AM
Sorry, I was too busy for the last few days to work on this.

Are you sure this is SVN version? This should be fixed in SVN r92, please check again.

I uninstalled and updated from the latest SVN (r104). It worked except I get this error with every ROM:

[Error] File is damaged, end address small than start address.

And a few other errors that are different with each ROM. It seems to me that the program is working now, so I attached a log for you to look at and a link to ROM that I used for testing.

ROM: http://www.megaupload.com/?d=1OTD3E3M

Thanks.

lpsi2000
14-08-2008, 06:49 AM
How do I get the SVN version(s)?

mdneilson
14-08-2008, 09:40 AM
How do I get the SVN version(s)?

Open a terminal and download the svn client:

sudo apt-get install subversion

After it installs, cd to your desired download directory (i just use home for ease).
Then download the latest svn source:

svn checkout http://htc-flasher.googlecode.com/svn/trunk/ htc-flasher-read-only

This will create a folder in the current directory called "htc-flasher-read-only."
The svn is only the source so you must run make to compile the program.

Enjoy.

PS. Prof, is the error that I stated in the last post a result of the ROM file, or is the program still not agreeing with my herald/wing ROMs?

Soul_Est
08-09-2008, 08:18 AM
Thanks so much for the this great piece of software pof. Unfortunately I'm having a bit of trouble with it. I've followed the entire thread and resolved every possible dependancy problem but I cannot get it to work. When I try the extract the packages from OS*.nb, I have two processes of ImgfstoDump.exe running and it won't continue from there. I'll post more later.

cr2
23-09-2008, 11:44 AM
@cr2: Yes! That would be really good, so we no longer need to depend on wine. Do you have more info or any links?


Here is the link for liblzma (LZX*)
http://tukaani.org/lzma/lzma-4.999.5alpha.tar.gz
I've saved the .pdf file with XPR description somewhere on my HDD :)

poly_poly-man
29-09-2008, 11:32 PM
I'm on gentoo...

is there anything I must set up to use this properly?

doesn't seem to work (even after playing with dependencies for a while..)

$ lrk
which: no gtkdialog3 in (/usr/kde/3.5/bin:/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/x86_64-pc-linux-gnu/mingw32/gcc-bin/4.3.1:/usr/x86_64-pc-linux-gnu/gcc-bin/4.2.4:/opt/ICAClient:/opt/blackdown-jdk-1.4.2.03/bin:/opt/blackdown-jdk-1.4.2.03/jre/bin:/usr/qt/3/bin:/usr/lib/subversion/bin:/usr/games/bin)
ls: cannot access /home/mkern/LRK/SYS/OEM_Lang_*/initflashfiles.dat: No such file or directory
gtkdialog: unrecognized option '--center'

any tips?

cr2
02-10-2008, 12:59 AM
I've saved the .pdf file with XPR description somewhere on my HDD :)

The XPR implementation in C
http://www.msuiche.net/codes/xpress.c.txt

aguichor
27-11-2008, 11:14 PM
Hi Pau!

First things first, many many thanks for your wonderful tool. :)

I'm using svn rev 104 on ubuntu 8.10, it works like a charm...except a minor thing i guess:

I tried to extract SYS/XIP from 2 different rom files (french ones, one for Artemis, the other one for BlackStone), everything is right after extracting os.nb but it can't load content of "Default" and "User" in the registry viewer ("Boot" is ok).

It's strange because I can see the 3 files on ~/.lrk/reg/, and they're not empty at all.

And I have the same problem for editing the Initflashfiles, it appears empty, even if the file is here (and not empty!) in ~/.lrk

(i saw on the terminal that it can't find ~/LRK/SYS/OEM_Lang_*/initflashfiles.dat)

maybe some paths are wrong ? I don't really understand

Thank in advance, if you or someone have an answer... :)


(and excuse my english!)