Related
Hi there,
Here is a command line tool that can extract and rebuild a flash.bin file for the LG KS20.
First, the options available :
Code:
LGFlashMuncher.exe [options] path [output]
EXTRACT Options ---(at least one option required)-----------------------------
-r : extract Raw data
-h : extract header
-m : extract MBR
-p : extract partitions
-t : trim extracted partitions
-l : output layout informations to file 'flash.xml'
-o : output OS.nb compatible file
output : path to output directory (must exists)
CREATE Options ---(all options required)-------------------------------------
-c file : create new flash.bin outputed to 'file'
(MBR and fat partition are taken from original flash.bin)
-e file : use 'file' for header
-0 file : use 'file' for partition 0 (boot)
-1 file : use 'file' for partition 1 (rawfs)
-2 file : use 'file' for partition 2 (imgfs)
COMMON Option ---------------------------------------------------------------
path : path to flash.bin file
Next, how to extract data from a flash.bin to a directory named output :
Code:
LGFlashMuncher.exe -htmlp FLASH.bin output
How to rebuild a new flash.bin :
Code:
LGFlashMuncher.exe -c newflash.bin -e header.bin -0 part_0_BOOT.bin -1 part_1_RAWFS.bin -2 part_2_IMGFS.bin FLASH.bin
(This rebuild process requires an existing flash.bin file)
At the moment, this tool use the partition layout and the empty fat32 (last partition) found in the original flash.bin file. The next step will be rebuild the partition layout.
I've made some test with this tool, but I cannot be sure it will work in all situations. Spocky had a preview of this tool a couple of days ago, and he successfully built a french 10G and a french 10A : I'm sure he will soon share his knowledge...
Very Nice job !
Thank.
Très bon travail MisterJP.
Merci.
Does this mean we can flash the files we extract with pdocread? (part00.raw, etc)
I think that for the moment only part02.raw
@+
dorik2k said:
Does this mean we can flash the files we extract with pdocread? (part00.raw, etc)
Click to expand...
Click to collapse
If the generated files are image of your phone partitions, then I guess it's possible if you respect the partitions order.
Hi, misterjp
In your LGFlashMuncher.exe there is an option:
-o : output OS.nb compatible file
I am just wondering is it FLASH.bin to OS.nb?
And is there any way to convert OS.nb back to FLASH.bin?
The reason that i want to do that is because in that case, i can convert a OS.nb which hv a larger partition table to Flash.bin for cooking
Thx in advance
Hi raykisi,
Sorry, but this tool is not able at this time to re-build an Flash.bin from an OS.nb file. It was just a test option while I was testing my code.
I'm planning on updating this tool, but it takes time and I don't have many these days.
JP.
o...gd to hear that you are going to update this tool, we would wait, take you time. And thx for your great work
Hey, sorry about the question.. i know i'm such a noob, but i'm brazilian and my "english understanding" is kind of weak sometimes.. So...
Is there any way to extract the Flash.bin and others of my current ROM? I mean, the actual ROM of my phone?
I'm asking this because here in Brazil we have the MS25/MS20.. A kind of KS20 without 3G, wifi, and front camera devices.. but same processor and same everithing else.. so, I think LG BRASIL will not provide the roms so early, but the v10a are full of bugs! Also i can`t flash with a KS20 rom, because that missing devices and because my operator phone frequency is 850 MHz (VIVO).
well, someone have an idea? Or a link? Or a read recomendation?
Brazilian people are really needing help with this, and we are getting tired to search with no answers..
Thank`s a lot!
In an other thread in this section I've read that the kernel and ramdisk of the SGS can be extracted from /dev/block/bml7. Unexpectedly I can't split the Android bootimage with a Script I've found on the net (android-dls[dot]com/wiki/index.php?title=HOWTO:_Unpack%2C_Edit%2C_and_Re-Pack_Boot_Images).
I would be glad if someone could tell me how to split the zImage to the kernel and the initramfs and to merge these two things together again.
To the best of my knowledge:
zImage is not the same as android boot image:
* zImage used by samsung in the firware files is regular Linux kernel zImage with compiled-in initramfs
* boot.img usually used in other android phones is a packed kernel + initramfs
Looking around the web I found this regarding zImage: http://en.gentoo-wiki.com/wiki/Initramfs#Extracting_the_cpio_archive
(was interested in this myself to be able to modify init.rc and maybe change the partition types to YAFFS2 instead of RFS)
With that Gentoo Wiki entry I could unpack the kernel image:
Code:
grep -a -b --only-matching `perl -e'print "\x1F\x8B\x08"'` zImage
13348
I extracted the image with
Code:
dd if=zImage bs=1 skip=13348 | gunzip > Image
In the kernel image I found a zip header
Code:
grep -a -b --only-matching `perl -e'print "PK\x03\x04"'` Image
and extracted that one. But I can't unzip the extracted file. What did I do wrong?
gshklover said:
(was interested in this myself to be able to modify init.rc and maybe change the partition types to YAFFS2 instead of RFS)
Click to expand...
Click to collapse
I was looking at doing exactly the same thing. Maybe mimocan can help us with the procedure to edit the init.rc file because he created a new kernel which could be flashed using ODIN.
I don't know how to find the initramfs image from the "Image"... It doesn't seem to be compressed though.
But it is definitely there. Just try "strings Image | grep "mount rfs" - it appears to have the contents of the /init.rc file as-is... Now just need to find where the initramfs starts and how to extract and re-pack it...
I guess, when building a new kernel (like others do) this shouldn't be an issue - you can probably extract the files by copying / with "samefs" flag and then building a new kernel with initramfs path set to the directory with the contents.
Here the idea was to "patch" official Samsung's firmware... Maybe not such a bright idea after all as it would be easier just to build a new kernel.
Thanks for your reply gshklover. Are there any guides on how to build a new kernel for the SGS? I would really like to edit that init.rc file.
Go to opensource.samsung.com -> Mobile -> GT-I9000 and download the sources.
It has build-kernel.sh script now. (haven't tried that myself, but there are other threads about this on this forum).
BTW: it appears that unlike other architectures, ARM's ./linux-2.6.29/arch/arm/kernel/vmlinux.lds.S doesn't define a section for the initramfs - only two symbols that get exported into the kernel (start and end). On x86 for example, the whole thing is also marked as a ".init.ramfs" section.
gshklover said:
Go to opensource.samsung.com -> Mobile -> GT-I9000 and download the sources.
It has build-kernel.sh script now. (haven't tried that myself, but there are other threads about this on this forum).
BTW: it appears that unlike other architectures, ARM's ./linux-2.6.29/arch/arm/kernel/vmlinux.lds.S doesn't define a section for the initramfs - only two symbols that get exported into the kernel (start and end). On x86 for example, the whole thing is also marked as a ".init.ramfs" section.
Click to expand...
Click to collapse
Thanks for the tip. I'm downloading the kernel now. The transfer speed is really slow. I'm sort of new to kernel hacking. Is there a place where I should look to edit the init.rc script before compiling it?
As far as I know the new Samsung kernel sources are configured to not include an initrd directory. In the old sources that configuration option was enabled but now its gone.
shelldude said:
With that Gentoo Wiki entry I could unpack the kernel image:
Code:
grep -a -b --only-matching `perl -e'print "\x1F\x8B\x08"'` zImage
13348
I extracted the image with
Code:
dd if=zImage bs=1 skip=13348 | gunzip > Image
In the kernel image I found a zip header
Code:
grep -a -b --only-matching `perl -e'print "PK\x03\x04"'` Image
and extracted that one. But I can't unzip the extracted file. What did I do wrong?
Click to expand...
Click to collapse
On my captivate model I had no luck finding the PK header. Instead I followed the gentoo wiki link and searched again for another gz header within Image.
Code:
grep -a -b --only-matching `perl -e'print "\x1F\x8B\x08"'` Image
157408:‹
I extracted the compressed Image and piped it to gzip then finally cpio:
Code:
dd if=Image bs=1 skip=157408 | gzip -d -c | cpio -t
/system.prop
/init.smdkc110.sh
/tmp
/tmp/s3c-keypad.kcm.bin
/tmp/bootchart
/tmp/bootchart/stgloc
/tmp/s3c-keypad.kl
/fota.rc
/dev
/dev/stgloc
/lpm.rc
/proc
/proc/stgloc
/init.smdkc110.rc
/init
/system
/system/etc
/system/etc/ld.so.cache
/.info
/.info/rootfs.info
/sys
/sys/stgloc
/etc
/mnt
/mnt/.lfs
/mnt/.lfs/test
/lib
/lib/modules
/lib/modules/s3c_lcd.ko
/lib/modules/fsr_stl.ko
/lib/modules/drop_caches.ko
/lib/modules/fsr.ko
/lib/modules/scsi_wait_scan.ko
/lib/modules/pvrsrvkm.ko
/lib/modules/s3c_bc.ko
/lib/modules/stgloc
/lib/modules/rfs_fat.ko
/lib/modules/dhd.ko
/lib/modules/Si4709_driver.ko
/lib/modules/vibrator.ko
/lib/modules/param.ko
/lib/modules/multipdp.ko
/lib/modules/j4fs.ko
/lib/modules/rfs_glue.ko
/lib/modules/dpram.ko
/sbin
/sbin/ffdisk
/sbin/dfta
/sbin/adbd
/sbin/fdump
/sbin/init
/sbin/devmgr
/sbin/recovery
/sbin/ferase
/sbin/redbend_ua
/sbin/fat.format
/sbin/dfta.sh
/sbin/images
/sbin/images/icon.png
/sbin/dprw
/res
/res/images
/res/images/indeterminate1.png
/res/images/indeterminate2.png
/res/images/icon_installing.png
/res/images/icon_firmware_error.png
/res/images/indeterminate6.png
/res/images/progress_bar_empty.png
/res/images/indeterminate5.png
/res/images/icon_firmware_install.png
/res/images/icon_error.png
/res/images/progress_bar_left_round.png
/res/images/progress_bar_empty_right_round.png
/res/images/indeterminate3.png
/res/images/progress_bar_empty_left_round.png
/res/images/progress_bar_right_round.png
/res/images/progress_bar_fill.png
/res/images/indeterminate4.png
/init.rc
/recovery.rc
/default.prop
gzip: stdin: decompression OK, trailing garbage ignored
13304 blocks
It appears that different firmwares are built with different options.
JM2 that I'm currently using has the initramfs uncompressed.
I uploaded the script that extracts the initramfs from such an image here: http://forum.xda-developers.com/wiki/index.php?title=Extract_initramfs_from_zImage
Feel free to extend the page with more info / scripts for different firmwares (personally, I find that Forums are not ideal for organizing information... WIKI seems like a better place).
I've just tried many time to dump the bml7 from my offical ZSJPE/JPD.
However, I have no luck that none of the below pattern match in my bml7.img
Code:
grep -a -b --only-matching $'\x1F\x8B\x08' bml7.img
grep -a -b --only-matching $'PK\x03\x04' bml7.img
grep -a -b --only-matching '070701' bml7.img
I've also tried few script on xda and cpio with no success.
I must miss something otherwise my device use some other encoding.
0x1F8B08 zip header can be found at offset 0x4794 After decompressing you can find a cpio header at offset 0x286C0. Basically...with only a hex editor and 7zip you'll get an extracted initramfs image.
hkdennis2k said:
I've just tried many time to dump the bml7 from my offical ZSJPE/JPD.
However, I have no luck that none of the below pattern match in my bml7.img
Code:
grep -a -b --only-matching $'\x1F\x8B\x08' bml7.img
grep -a -b --only-matching $'PK\x03\x04' bml7.img
grep -a -b --only-matching '070701' bml7.img
I've also tried few script on xda and cpio with no success.
I must miss something otherwise my device use some other encoding.
Click to expand...
Click to collapse
That's one interesting zImage.. I'm guessing it's bzip2 compressed. Will check it out.
vM00 said:
0x1F8B08 zip header can be found at offset 0x4794 After decompressing you can find a cpio header at offset 0x286C0. Basically...with only a hex editor and 7zip you'll get an extracted initramfs image.
Click to expand...
Click to collapse
Oh, thanks. I can now extract them manually. Just wondering why all the script and why my "grep" does not work as expected.
BTW, I use archlinux. I am not sure does it matter.
For SHW-M110s development/discussion. (Korean Anycall SGS ONLY yes for any who don't know, we are officially part of the I9000 forum.
Koe1974 suggested this thread and will I think act as a co-OP on this discussion. Look for front page updates, links, whatever from him 3 posts down, (below the lost guy from China) in the future too.
Version 4 released
Version 4.0r1 released to fix Odin flashing problem
link to kernel
with tegrak_voodoo sound (v2) module, tegrak ext4 module, root (superuser.apk) and busybox 1.17.1 optional, safe mount option overides by default, auto detect lag fixed partitions (improves upgradeability and interchageability) [/B][/size] Compatible with previously z4modded ext2 setups. All ROM versions, SK05 through TA13 tested and released (link is below).
안녕하세요 to any of the Korean developers who find this. Please update us in English about what you are doing. Your English is probably MUCH better than my korean, and I live in Korea.. There are some people in China, Iran, Philippines, etc using this device who might be helped.
-------------------------------------------------------------------------------------------------------------------------
Ext4 (tegrak modules) z4build rooted voodoo sounds kernel link
A stock z4moded kernel with added ext4 support ( presently by "stealing" tegrak kernel modules.) and many tweaks to make it actually work.
This is now working with z4control to get an easy to apply ext4 lag fix!
------------------------------------------------------------------------------------------------------------------------------------
Bug discussion here please, usage discussion (how do get the file into odin?) .. maybe the general thread is better.
For now, our rooting guide is linked from my sig also, although the above linked kernel can also be made to provide root with no effort.
This type of initramfs modification can be done by unpacking a stock kernel making customizations and then applying z4build to it. But I used a z4modded kernel and then applied customizations and repacked. I did this because I set up to repack by hand anyway before knowing I wanted to use z4mod and even then, when I thought I needed to pack into a tegrak kernel (which z4build can't do). It turned out to cause complications, but also taught me a good bit about the process and about z4mod, and probably helped me find bugs.
Some other related useful links for Reference:
kernel extraction (commented by me specifically for tegrak lzma compressed initramfs and z4build split initramfs)
http://forum.xda-developers.com/wiki/index.php?title=Extract_initramfs_from_zImage
kernel repacking
http://forum.xda-developers.com/showthread.php?t=789712
It needs the initramfs to be cpio'd already something like this:
Code:
cd $initram
find ./ | cpio -H newc -o > $repackdir/newramfs.cpio
It also needs the editor.sh script modified to point to the cross-compiler.
By default it can only pack you initramfs into an image which previously had an uncompressed initramfs. This can be modified though easily.
kernel compiling
This old thread probably isn't too useful now..
http://forum.xda-developers.com/showthread.php?t=740740&page=2
We have much better info 3 posts down by koe1974.
Kernel sources here:
http://opensource.samsung.com/
search SHW-M110S.
The first froyo update has a nice readme with a link to the compiler (I don't have the link right this moment)
Not sure if we need to figure/find .configs, or if the ones included are ok to start. Just need to compile one once and see.
I got my compiler toolchain here:
http://www.codesourcery.com/sgpp/li...1-188-arm-none-eabi-i686-pc-linux-gnu.tar.bz2
I thought it's the one recommended is the original froyo source from samsung, but Koe says they point to 2009 version, so I don't know now.
............
I flashed the korean voodoo sk22 kernel just to boot it into recovery. It has CW mod recovery. Might be useful. (BTW I don't recommend flashing unfamiliar kernels haphazardly, ex: this one injected a file into my ROM that interefered with z4mod until I realized it ) Mine BTW injects only one empty directory (/etc/init.d) and nothing else. Remove the kernel and all other changes dissappear. (z4control adds a tad more, but very little, most of its additions self destruct after use.)
Post reserved.
Post Removed, as requested.
Sent from my GT-I9000 using XDA App
Links:
Korea's equivalent to XDA
Lilinser's GitHub - kernel repack, deodexer, etc.
Project-Voodoo - initramfs (SK05)
Just for hobbies - Voodoo for SL28
Tegrak Kernel
SHW-M110S intramfs Requires further research.
Older M110S from someone at MIT working on the M110S potential resource
bml7 & initramfs possible resource
more initramfs
initramfs SK05 Tested .. OK
How-Tos:
Basic How-To Build Environment with built kernel test
First this diff is from a z4modded stock SL28 image to the custom kernel image. It's not against stock. So it includes tegrak files and scripts I changed. Also note the -N option. It pretends like files that don't exist do.. Any binary files that "differ" are actually added from tegrak.
Code:
diff -rbpN z4mod_sl28/initramfs/init.rc z4grak-construction-sl28/initramfs/init.rc
*** z4mod_sl28/initramfs/init.rc 2011-01-13 02:20:12.000000000 -0500
--- z4grak-construction-sl28/initramfs/init.rc 2011-01-11 07:43:34.000000000 -0500
*************** loglevel 3
*** 58,63 ****
--- 58,72 ----
mount j4fs /dev/block/stl6 /mnt/.lfs
insmod /lib/modules/param.ko
+ #ext4 modules by woo
+ insmod /tegrak/lib/modules/mbcache.ko
+ insmod /tegrak/lib/modules/jbd2.ko
+ insmod /tegrak/lib/modules/ext4.ko
+
+ # tegrak system lagfix by woo
+ #
+ insmod /tegrak/lib/modules/tegrak_module.ko
+
# Backwards Compat - XXX: Going away in G*
symlink /mnt/sdcard /sdcard
*************** service vt /system/bin/vtserver
*** 728,734 ****
#user system
#group system
-
service dumpstate /system/bin/dumpstate -s
socket dumpstate stream 0660 shell log
disabled
--- 737,742 ----
*************** service dumpstate /system/bin/dumpstate
*** 739,747 ****
# oneshot
-
# Added by z4mod
service z4postinit /init
oneshot
--- 747,761 ----
# oneshot
# Added by z4mod
service z4postinit /init
oneshot
+ #install root ingore the mount type, it doesn't matter
+ # syntax looks a little strange to me.. we'll see if it works
+ mount rfs /dev/block/stl9 /system rw remount
+ cat /sbin/su > /system/bin/su
+ chown root /system/bin/su
+ chmod 4755 /system/bin/su
+ mount rfs /dev/block/stl9 /system ro remount
\ No newline at end of file
diff -rbpN z4mod_sl28/initramfs/lpm.rc z4grak-construction-sl28/initramfs/lpm.rc
*** z4mod_sl28/initramfs/lpm.rc 2011-01-13 02:20:12.000000000 -0500
--- z4grak-construction-sl28/initramfs/lpm.rc 2011-01-11 06:37:28.000000000 -0500
*************** on init
*** 16,21 ****
--- 16,26 ----
insmod /lib/modules/param.ko
insmod /lib/modules/vibrator.ko
+ #ext4 modules by woo
+ insmod /tegrak/lib/modules/mbcache.ko
+ insmod /tegrak/lib/modules/jbd2.ko
+ insmod /tegrak/lib/modules/ext4.ko
+
mount rfs /dev/block/stl9 /system check=no
mount rfs /dev/block/mmcblk0p2 /data nosuid nodev check=no
Binary files z4mod_sl28/initramfs/sbin/sslvpn and z4grak-construction-sl28/initramfs/sbin/sslvpn differ
Binary files z4mod_sl28/initramfs/tegrak/bin/mkfs.ext4 and z4grak-construction-sl28/initramfs/tegrak/bin/mkfs.ext4 differ
Binary files z4mod_sl28/initramfs/tegrak/bin/tune2fs and z4grak-construction-sl28/initramfs/tegrak/bin/tune2fs differ
Binary files z4mod_sl28/initramfs/tegrak/lib/modules/ext4.ko and z4grak-construction-sl28/initramfs/tegrak/lib/modules/ext4.ko differ
Binary files z4mod_sl28/initramfs/tegrak/lib/modules/jbd2.ko and z4grak-construction-sl28/initramfs/tegrak/lib/modules/jbd2.ko differ
Binary files z4mod_sl28/initramfs/tegrak/lib/modules/mbcache.ko and z4grak-construction-sl28/initramfs/tegrak/lib/modules/mbcache.ko differ
Binary files z4mod_sl28/initramfs/tegrak/lib/modules/tegrak_module.ko and z4grak-construction-sl28/initramfs/tegrak/lib/modules/tegrak_module.ko differ
I'm a bit confused about sslvpn It's in my SL28 , it's not in my z4moded SL28. everything else diff as expected. Maybe I just lost it, maybe z4mod removed it. It's a small unimportant mystery.
BTW it looks like what I believe are the recovery keys have changed from SK22 to SL28, so maybe using the wrong kernel breaks something.
and my slightly modified version of the extraction script with commented lines to deal with lzma.
it's much faster (well.. why not), and it handles direcories a little better. It need a "/" somewhere in the file name though so use "./zImage".
Code:
#!/bin/bash
#MUCH faster than dd bs=1 skip=blah
#
# syntas is fastdd file skip <length_in_bytes_optional>
# skip is NOT optional and should be set to 0 read from begining.
#
fastdd () {
#dd with a skip is crazy slower cause it forces bs=1
#credit goes to somebody on the internet.
local bs=1024
local file=$1
local skip=$2
local count=$3
(
dd bs=1 skip=$skip count=0 2>/dev/null
if [[ "$count" != "" ]]; then
dd bs=$bs count=$(($count / $bs))
dd bs=$(($count % $bs)) count=1
else
dd bs=1024 2> /dev/null
fi
) < "$file"
}
zImage=$1
basedir=${1%/*}
echo working directory $basedir
mkdir $basedir/initramfs
outdir=$basedir/initramfs/
#========================================================
# find start of gziped kernel object in the zImage file:
#========================================================
pos=`grep -P -a -b -m 1 --only-matching $'\x1F\x8B\x08' $zImage | cut -f 1 -d :`
echo "-I- Extracting kernel image from $zImage (start = $pos)"
echo
echo "*** Start of compressed kernel image:" $pos
#========================================================================
# the cpio archive might be gzipped too, so two gunzips could be needed:
#========================================================================
fastdd $zImage $pos | gunzip > /tmp/kernel.img
pos=`grep -P -a -b -m 1 --only-matching $'\x1F\x8B\x08' /tmp/kernel.img | cut -f 1 -d :`
#
# Use next one for tegrak secuere 11 SL28
# It's an lzma header
# It's found by looking for 5D 00 in the exact same place as cpio (070701) is found in stock.
# The long string of FF's is the real give away since 5D 00 is too vague.
# pos=`grep -P -a -b -m 1 --only-matching '\x{5D}\x{00}\x..\x{FF}\x{FF}\x{FF}\x{FF}\x{FF}\x{FF}' /tmp/kernel.img| cut -f 1 -d :`
echo
echo "*** gzip position in kernel.img :" $pos "(start of gzipped cpio)"
#===========================================================================
# find start and end of the "cpio" initramfs image inside the kernel object:
# ASCII cpio header starts with '070701'
# The end of the cpio archive is marked with an empty file named TRAILER!!!
#===========================================================================
if [ ! $pos = "" ]; then
echo "-I- Extracting compressed cpio image from kernel image (start = $pos)"
# use either one of the next two lines for gzip
# dd if=/tmp/kernel.img bs=1 skip=$pos | gunzip > /tmp/cpio.img
fastdd /tmp/kernel.img $pos |gunzip > /tmp/cpio.img
# comment above and uncomment one of next two lines for lzma, if decompressing tegrak image.
# dd if=/tmp/kernel.img bs=1 skip=$pos | unlzma > /tmp/cpio.img
# fastdd /tmp/kernel.img $pos | unlzma > /tmp/cpio.img
start=`grep -a -b -m 1 --only-matching '070701' /tmp/cpio.img | head -1 | cut -f 1 -d :`
end=`grep -a -b -m 1 --only-matching 'TRAILER!!!' /tmp/cpio.img | head -1 | cut -f 1 -d :`
inputfile=/tmp/cpio.img
else
echo "-I- Already uncompressed cpio.img, not decompressing"
start=`grep -a -b -m 1 --only-matching '070701' /tmp/kernel.img | head -1 | cut -f 1 -d :`
echo start $start
end=`grep -a -b -m 1 --only-matching 'TRAILER!!!' /tmp/kernel.img | head -1 | cut -f 1 -d :`
echo end $end
inputfile=/tmp/kernel.img
fi
end=$((end + 10))
count=$((end - start))
if (($count < 0)); then
echo "-E- Couldn't match start/end of the initramfs image."
exit
fi
echo "-I- Extracting initramfs image from $inputfile (start = $start, end = $end)"
echo inputfile: $inputfile
echo start $start
echo count $count
echo outdir $outdir
# dd if=$inputfile bs=1 skip=$start count=$count > $outdir/initramfs.cpio
fastdd $inputfile $start $count > $basedir/initramfs.cpio
cd $basedir
basedir=`pwd`
cd $outdir; cpio -v -i --no-absolute-filenames < $basedir/initramfs.cpio
cp /tmp/kernel.img $basedir/
More to come.
I like the way this is going, appagom, please put [MOD] in the title.
GL on the new thread, if you hope to have Koreans stumbled upon the thread it might be good to add more phrases like:
루팅
갤럭시s
안드로이드
프로요
업그레이드
업데이트
I never really fully utilized it myself. I hope you get more done here or I'll just take the move personally. Actually, now that you guys were moving into compiling and building I thought this would come. Also, you should look to get some Soju out of this with some donate links or something, even if you aren't looking to take in any cash perhaps you could use it as a seed pot for bounties.
Most importantly, I need to know what "the lost guy from China" said...ㅋㅋㅋ
@Koe, don't waste your time on Gingerbread, get us Honeycomb
Compile a Kernel in 13 Lucky Steps
If you are not familiar with Linux, you might have a hard time following this. Just as I am writing how to do get setup to compile a kernel and compile Android apps, others have written how to setup VirtualBox, Ubuntu, AndroidSDK, etc. Please see documentation provided by Oracle, Google, Ubuntu, etc. before you ask for help about VirtualBox, Ubuntu and the SDK. Thanks.
This is written for people who have used Linux but have not compiled much. Or for the brave at heart who are looking for a nice weekend project. This will tell/guide you through getting a system setup that will not destroy your existing OS.
My host OS is Ubuntu 10.10 64-bit. I wanted had to make an Ubuntu 10.04 32-bit 64-bit system for development because I didn't want to deal with 64-bit vs. 32-bit issues but since Gingerbread requires a 64-bit compiler, I had to. Might as well just use my host system, but since we're here let's keep going!
So you're about to begin. Let's just get one thing straight. No! This will not result in a kernel you can flash. “Then why do this?, you ask. Ask yourself that!
1. Install VirtualBox and the Oracle VM VirtualBox Extension Pack (Currently 4.0.0 r69151)
http://www.virtualbox.org/wiki/Downloads
2. Download an Ubuntu ISO (I suggest Ubuntu Desktop 10.04 64-bit)
http://www.ubuntu.com/desktop/get-ubuntu/download
3. Create a new VM in VirtualBox (You may/have to modify the settings)
Operating System: Linux
Version: Ubuntu64
Extended Features: IO APIC
Processors: 2
RAM: 2048MB
Video Mem: 128MB
HDD: 32GB
Enable PAE/NX
Shared Drive: (I use a shared folder, more detail later)
Click to expand...
Click to collapse
4. Install VirtualBox Guest Additions
5. Install Ubuntu and Update Ubuntu
TIP: Mount your Shared Folder with fstab (Optional but helpful)
If you chose to use a shared folder you can auto-mount it via /etc/fstab.
NOTE: I use a shared folder named andDEV and I mount it on my desktop (~/Desktop). Below is what I add to my /etc/fstab (You may/have to change it)
Code:
andDev /home/koe/Desktop/andDev vboxsf uid=1000,gid=1000 0 0
Click to expand...
Click to collapse
6. Enable multiverse and partner "Software Sources"
7. Install additional software: NOTE: I would also recommend installing preload, but it is not required.
Code:
sudo apt-get install qt3-dev-tools texinfo git-core gnupg flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev sun-java6-jdk eclipse ia32-libs
8. Get and Setup the AndroidSDK (Everything you need to know is there or just Google for help)
http://developer.android.com/sdk/index.html
NOTE: Ubuntu 10.04 does not have Java 5 in it's repositories. Follow this link to setup to Java 5
9. Get and Setup ADT Plugin for Eclipse (Everything you need to know is there or just Google for help)
http://developer.android.com/sdk/eclipse-adt.html#installing
TIP: At this point you might want to try Google's “Hello, Android” tutorial.
Click to expand...
Click to collapse
10. Download and Install the Sourcery G++ Lite for ARM EABI Toolchain (Currently arm-2010.09)
http://www.codesourcery.com/sgpp/lite/arm/portal/subscription3053
Look for and click the link for Recommended Release
Look for and click the link for IA32 GNU/Linux TAR
Extract the archive. You will have a folder named arm-2010.09
Make a directory in your home directory named CodeSourcery
Ex. mkdir ~/CodeSourcery
copy the entire arm-2010.09 folder into CodeSourcery
Click to expand...
Click to collapse
11. Update your $PATH
You should be familiar with this because you had to do it to setup the AndroidSDK
Append the following to your PATH in .bashrc
Code:
~/CodeSourcery/arm-2010.09/bin
12 Download and Prepare the Samsung Source Code (Currently SHW-M110S_Opensource_Froyo_update2.zip)
http://opensource.samsung.com/
Click Mobile - Mobile Phones
Look for and download SHW-M110S_Opensource_Froyo_update2.zip
Extract the archive. Inside the new folder are two more archives.
Extract SHW-M110S_Kernel.tar.gz Inside there is a new folder Kernel
You can copy this to a more convenient location. I copy it to my desktop.
In the Kernel folder is a file named Makefile. Open it with your editor of choice.
Go to line 184. You will see ...
CROSS_COMPILE ?= /opt/toolchains/arm-2009q3/bin/arm-none-linux-gnueabi-
You have to change it to something like below, but see the koe? That is my username so you have to change it to your username.
CROSS_COMPILE ?= /home/koe/CodeSourcery/arm-2010.09/bin/arm-none-eabi-
Save Makefile.
Click to expand...
Click to collapse
13. Compile a Kernel
NOTES:
1. Do not try to compile the code in your Shared Folder. It will fail.
2. When issuing these commands you will see lots of output during this part, most of which is not useful to you at this point.
3. The amount of time it takes for the final make command to run will depend on your computer.
Click to expand...
Click to collapse
Open a terminal window and move into the Kernel directory. Issue the following commands.
Code:
$ make shw-m110s_defconfig
$ make menuconfig
When the config editor opens do the following:
DOWN ARROW to Userspace binary formats and press ENTER
DOWN ARROW to Kernel support for a.out and ECOFF binaries and press SPACE
RIGHT ARROW to Exit and press ENTER
RIGHT ARROW to Exit and press ENTER
Press ENTER again and it will exit back to the command line
NOTE: If you have a powerful computer and you want to speed up the build time, make can be run as, make -j# The # represents how much it will try to do at once. $ make does 1 operation, make -j3 tries to do 3. I have a 2.66 Ghz dual-core CPU and I allow the VirtualBox guest OS access to both cores, so I use make -j3 The compile finishes in about 12 minutes and allows me to still use my host OS. For now, you might just want to run make without the -j option to get a full understanding of how long it takes. Later you can test with values.
Click to expand...
Click to collapse
WARNING: Time is relative. This will take some time ... go make a sandwich or maybe even watch a movie.
Code:
$ make
When you see $ again check the last couple of lines of output. You want to see …
OBJCOPY arch/arm/boot/zImage
Kernel: arch/arm/boot/zImage is ready
Click to expand...
Click to collapse
Congratulation! You just built a kernel for the m110s!
good write up.. Glad to see you hit the same a.out snag as me. Just makes me think it's not configured right and so I have low hopes. Will be fun to see what happens when you put an initramfs in it. I'd just unpack the stock one and try that first.
As for z4control.. I'm pretty interested in getting this working as something like this was the real reason I started messing with this. It seems there may be some issue with the z4mod's init wrapper not doing things it should but anyway.. just now seeing issues. flashed one kernel where I added some debug output added.. trying to understand it (not understanding it yet). I'm optimistic that I can track it down. edit:... definitely making progress, not quite there yet but getting closer.
appagom said:
good write up.. Glad to see you hit the same a.out snag as me. Just makes me think it's not configured right and so I have low hopes. Will be fun to see what happens when you put an initramfs in it. I'd just unpack the stock one and try that first.
Click to expand...
Click to collapse
Strictly to see if it would build completely and to get more info on how to do it, I did do an initramfs & kernel test build.
used the update2 kernel source
used the initramfs linked above (SHW-M110S intramfs Requires further research.)
ran find ./ | cpio -H newc -o > ~/Desktop/newramfs.cpio
added the cpio via menuconfig with no compression
It did build successfully and I ended up with a 7mb zImage vs. a 2.5mb.
There is no way in hell I am going to flash it because I do not know which initramfs (maybe from sk05) it is or what it contains but it did complete.
Now isn't this a kick in the nuts!
Since I got the toolchain all set I decided to focus on the Android source code. Following these directions .. http://source.android.com/source/download.html I got to "Building the code"
Code:
[email protected]:~/Desktop/myAnd$ source build/envsetup.sh
including device/htc/passion/vendorsetup.sh
including device/samsung/crespo/vendorsetup.sh
[email protected]:~/Desktop/myAnd$ lunch
You're building on Linux
Lunch menu... pick a combo:
1. full-eng
2. full_x86-eng
3. simulator
4. full_passion-userdebug
5. full_crespo-userdebug
Which would you like? [full-eng] 1
============================================
PLATFORM_VERSION_CODENAME=AOSP
PLATFORM_VERSION=AOSP
TARGET_PRODUCT=full
TARGET_BUILD_VARIANT=eng
TARGET_SIMULATOR=false
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv5te
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=OPENMASTER
============================================
[email protected]:~/Desktop/myAnd$ make
============================================
PLATFORM_VERSION_CODENAME=AOSP
PLATFORM_VERSION=AOSP
TARGET_PRODUCT=full
TARGET_BUILD_VARIANT=eng
TARGET_SIMULATOR=false
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv5te
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=OPENMASTER
============================================
Checking build tools versions...
build/core/main.mk:76: ************************************************************
build/core/main.mk:77: You are attempting to build on a 32-bit system.
build/core/main.mk:78: Only 64-bit build environments are supported beyond froyo/2.2.
build/core/main.mk:79: ************************************************************
build/core/main.mk:80: *** stop. Stop.
Well, 32-bit will do for now seeing how ::cough:: I'm not the one building gingerbread.
I guess my next how-to is going to be how to go out and buy a PC and setup a 64-bit development environment.
Well, 32-bit will do fro now see how ::cough:: I'm not the one building gingerbread.
I guess my next how-to is going to be how to go out and buy a PC and setup a 64-bit development environment.
Click to expand...
Click to collapse
Could try the gnu cross compiler I suppose maybe it's clever enough to work around it. Your computer really isn't 64 bit though? You could just install a 64 bit VM assuming it is.
koe1974 said:
added the cpio via menuconfig with no compression
Click to expand...
Click to collapse
Ok, that procedure is easier than it used to be, or than what I read it used to be. I'm not afraid to add one and flash it. Just busy with making one I like right now though.. then again.. sounds like a 10 minute interruption.. so.. we'll see... oh and I don't remember what was stopping xconfig from working, but something annoying.. it's quite a bit nicer than menuconfig. I need to learn how that works though.. cause really you should add modules from the compilation itself right.. so you cant have the initramfs already before you compile, unless make opens it and add the modules and re-cpio's it. Anyway.. I'll shoot first, ask later.
edit: just flashed.. it gave about 1 tenth of a blue bar and froze. Ok, that was fun, back to fixing and ext4 kernel up.
appagom said:
Could try the gnu cross compiler I suppose maybe it's clever enough to work around it. Your computer really isn't 64 bit though? You could just install a 64 bit VM assuming it is.
Click to expand...
Click to collapse
The VM I setup was 32bit, but it's 64bit now. I will just modify the How-To for a 64bit system.
4 bugs related z4control issues solved(ok 2 were probably the same as well as a fifth, so really 3)..
one, it's failing to create a directory it needs (/system/etc/init.d), reported, work around create by hand.
2) It's rfs formatting wrapper script which checked for voodoo, failed. Strange bug in sh actually.. workaround in script found and reported
bugs 3 and 4 details unimportant, were related to the mystery of where sslvpn went. z4build was splitting the initramfs by tacking it some of it brute force on to the end of the zImage. The init script found it again and unpacked the files before continuing. Oddly, it seems an uneeded because I fit the only big displaced file in just fine without splitting and I didn't even use heavy compression. Anyway, needed or not it caused two files to go missing, this one, and a small text file that reported the version of z4mod. this file prevented z4control from working.
I will not fix this tonight, but I mostly understand it (altough not in exact detail of precisely understanding some of the odd symptoms, but I think dealing with this will likely solve it all) My diffs could never find the version file, cuase I never unpacked it to know it even existed in the first place. Waaaah.. bug tracking is tiring. We should have this all running very shortly.
update: my first attempt at fixing the repacking bug.. resulted (I already feared this but hoped it would just go away) in a kernel that seems totaly complete, but where it seems something in the init wrapper isn't working... getting closer to finding it.
update: LAST BUG FIXED
The last bug(which I previously assumed was part of the repack bug) was actually aslo part of z4build, now documented here:
http://forum.xda-developers.com/showpost.php?p=10638535&postcount=1062
I'm pretty sure that one should really get it all going now. there are no lines of code left to break. I've tested almost every line now. I'll get a new kernel out, but will need to wait for an updated z4control. z4ziggy seems busy right now maybe (no complaint obviously).
I can fix this last bug in my roll out of the kernel. The other remaining ones can be worked around pretty easily, but not pretty for user instructions, better to wait probably.
SK05 Rebuild test (PASS)
We have doubts about if the shw-m110s_defconfig is what is used by samsung so I decided to try to make a working kernel from an initramfs and froyo_update source code.
General idea of what I did...
sk05 source code froyo_update (from samsung)
sk05 initramfs (link in post 4 "initramfs SK05 Tested .. OK")
cd initramfs_dir
find . -print0 | cpio -o0 -H newc | gzip -9 -f > some/path/initramfs.cpio.gz
cd kernel source code root directory
modify Makefile ln. 184
make aries_android_rfs_defconfig
make menuconfig
disable a.out
add path to initramfs archive
compression gzip
make
tar --format=ustar SK05rebuilt.tar zImage
Click to expand...
Click to collapse
Results in a zImage the same size (4.6mb) as samsung's, and it boots.
awesome..
I GOT IT
That was big fat B to solve. Debugging self destructing scripts that run in a startup environment with different mounts and different PATH variable is no fun and requires some imagination. I had to work around 2 more bugs in z4build but now I have user transparent workarounds to all of them.. plug and play. Unfortunately I have about 30 minutes more free time today so I probably wont post it today. I should clean up some comments and such in it first probably. We'll see.
appagom said:
awesome..
I GOT IT
Click to expand...
Click to collapse
Very nice!
Sent from my SHW-M110S using XDA App
the "awesome" comment was referring to you. Should be able to take the grak of z4grak with some compiling , but I'm happy with it in too.. doesn't matter.
Anyway.. I updated the kernel page (from the link on OP). The new kernel is there, but I pushed it out very fast. Didn't flash last repack myself yet after changing comments.. but I only changed comments. (I am running the posted copy now) It needs testing since my system has gotten a been used and non-pristine. Get z4control, you can use it to flash it if you want. the rest is all push button I hope.
Oh and default settings are less safe than Tegrak, not much if any better than ext2 actually. I think.. can't confirm right now. I recommend modifying etc/fstab to data=ordered,barrier=1 personally.. but that's what I like about z4.. you can decide for yourself.
Sent from my SHW-M110S using XDA App
Very basic guide to extract the initramfs from the zImage, as well as a dump of the initramfs inside I9100XEKDB firmware.
Q: Why? This is simple!
A: Might help someone out!
Linux Bash script follows (standard initramfs extract script) :
Code:
pos=`grep -F -a -b -m 1 --only-matching $'\x1F\x8B\x08' zImage | cut -f 1 -d :`
dd status=noxfer if=zImage bs=$pos skip=1 2>/dev/null| gunzip -q > kernel.img
start=`grep -F -a -b -m 1 --only-matching '070701' kernel.img | head -1 | cut -f 1 -d :`
dd status=noxfer if=kernel.img bs=$start skip=1 > initramfs.img 2>/dev/null
mkdir initramfshere
cd initramfshere
cpio -i --no-absolute-filenames < ../initramfs.img
ls -l
I9100XEKDB initramfs: http://www.sgscompilebox.dreamhosters.com/initramfs.tar.gz
Repacking should be easy as well, but I haven't tried to boot a kernel I have repacked myself yet. Since Chainfire has a root kernel posted, it should work without issue though -- and these are standard linux kernels after all.
Grab the kernel repacker from http://www.sgscompilebox.dreamhosters.com/repacker.tar.gz
Following bash script to use it:
Code:
end=`repacker/findcpio.pl kernel.img | cut -f 2`
(cd initramfshere/; find . | cpio --quiet -R 0:0 -H newc -o > ../newinitramfs.img)
gzip -f9c newinitramfs.img > newinitramfs.img.gz
repacker/kernel_repacker.sh zImage newinitramfs.img.gz
Might need some tweaking depending on your system, but this will hopefully get you started. You can use this to create your own root kernels as Chainfire has done, or modify as you want. Refer to the Q&A above!
Hi,
You can also find Samsung unmodified Galaxy S II initramfs on github, contributions welcome for missing ones:
https://github.com/GalaxySII/initramfs-galaxysii
Its repository collections is for every developer, and is not project/people specific: https://github.com/GalaxySII/
This is what Samsung should give us directly.
Related post, with reference Kernel source repository: http://forum.xda-developers.com/showthread.php?t=1054738
RyanZA said:
Very basic guide to extract the initramfs from the zImage, as well as a dump of the initramfs inside I9100XEKDB firmware.
Q: Why? This is simple!
A: Might help someone out!
Linux Bash script follows (standard initramfs extract script) :
Code:
pos=`grep -F -a -b -m 1 --only-matching $'\x1F\x8B\x08' zImage | cut -f 1 -d :`
dd status=noxfer if=zImage bs=$pos skip=1 2>/dev/null| gunzip -q > kernel.img
start=`grep -F -a -b -m 1 --only-matching '070701' kernel.img | head -1 | cut -f 1 -d :`
dd status=noxfer if=kernel.img bs=$start skip=1 > initramfs.img 2>/dev/null
mkdir initramfshere
cd initramfshere
cpio -i --no-absolute-filenames < ../initramfs.img
ls -l
I9100XEKDB initramfs: http://www.sgscompilebox.dreamhosters.com/initramfs.tar.gz
Repacking should be easy as well, but I haven't tried to boot a kernel I have repacked myself yet. Since Chainfire has a root kernel posted, it should work without issue though -- and these are standard linux kernels after all.
Grab the kernel repacker from http://www.sgscompilebox.dreamhosters.com/repacker.tar.gz
Following bash script to use it:
Code:
end=`repacker/findcpio.pl kernel.img | cut -f 2`
(cd initramfshere/; find . | cpio --quiet -R 0:0 -H newc -o > ../newinitramfs.img)
gzip -f9c newinitramfs.img > newinitramfs.img.gz
repacker/kernel_repacker.sh zImage newinitramfs.img.gz
Might need some tweaking depending on your system, but this will hopefully get you started. You can use this to create your own root kernels as Chainfire has done, or modify as you want. Refer to the Q&A above!
Click to expand...
Click to collapse
Hi..I notice there's an embedded kernel in the packer directory, but the path is an older version than the actual one in zimage. Is third just for pearl script purposes? Thanks
Sent from my GT-I9100
Hey RyanZA,
Following your script
> cpio -i --no-absolute-filenames < ../initramfs.img
extracts initramfs but gives me the error:
cpio: ../init: Cannot symlink to 'sbin-ueventd': Operation not permitted
Can you help a linux newbie here ? Do I need to be root?
EDIT: Ah! I think I know now... FAT does not support symlinks Going to ext...
Ok got the initramfs extracted from a zImage. Used repacker to create the zImage again. Did not change anything in initramfs. Filesize 5mb vs 8mb for the original. After a closer look I see that original contains lots of zeros. Ok appended zeros to match filesize and flashed the 'new' kernel. No go. Yellow triangle and no boot. Waited a long time.
Can anyone help? Maybe the repacker does something wrong? Maybe it should not compress?
Sent from my GT-I9100 using XDA Premium App
Anybody had any luck with this?
After said tweaking to get the repacker script running I got it to build a new zImage.
But mine was even only ~2MB small.... (seeing that the extracted initramfs summs up to about 3MB it makes at least a bit of sense, but still wondering).
Also the older kernel used (.29 against .35 that's actually running on my phone) makes me ....
Well, flashed it anyway but (as expected) it didn't work, phone showed the bootlogo and that's it, not even recovery worked.
So, is it the older kernel? Or is it forking up the initramfs image creation?
Or is there another way to rebuilt the kernel image with a new initramfs image?
I'd really like to get rebuilding the zImage working so I toy around with that a bit, try to make my own root kernel and all that funstuff
HellcatDroid said:
Anybody had any luck with this?
After said tweaking to get the repacker script running I got it to build a new zImage.
But mine was even only ~2MB small.... (seeing that the extracted initramfs summs up to about 3MB it makes at least a bit of sense, but still wondering).
Also the older kernel used (.29 against .35 that's actually running on my phone) makes me ....
Well, flashed it anyway but (as expected) it didn't work, phone showed the bootlogo and that's it, not even recovery worked.
So, is it the older kernel? Or is it forking up the initramfs image creation?
Or is there another way to rebuilt the kernel image with a new initramfs image?
I'd really like to get rebuilding the zImage working so I toy around with that a bit, try to make my own root kernel and all that funstuff
Click to expand...
Click to collapse
the fist script actually works good to pull initramfs. but I don't know about the repacker...better to build new
Yeah, trying to build a new kernel from sources at the moment (make is running as I type this).
Here's an idea why the rebuilder fails:
.29 kernel (that the rebuild script brings in and uses) but the initramfs has .35 version kernel modules (as it's for/from the .35 kernel)!
Not sure how delicate this version missmatch is, but there's a chance the one or the other important kernel module erroring out upon boot due to the version missmatch....
Well, let's see if a full build from sources works (as I know my luck, it won't....)....
that's because zImage has SFX code which tied very much to data (Image.gz). So you cannot just re-pack it back to existing zImage. You have to download source code of i9100 kernel and execute final part of kernel build where Image binary gets compressed and pre-pended by sfx header.
RyanZA said:
Following bash script to use it:
Code:
end=`repacker/findcpio.pl kernel.img | cut -f 2`
(cd initramfshere/; find . | cpio --quiet -R 0:0 -H newc -o > ../newinitramfs.img)
gzip -f9c newinitramfs.img > newinitramfs.img.gz
repacker/kernel_repacker.sh zImage newinitramfs.img.gz
Click to expand...
Click to collapse
err... the repacker/kernel_repacker.sh script only takes one argument.. how is it supposed to work???
sorg said:
that's because zImage has SFX code which tied very much to data (Image.gz). So you cannot just re-pack it back to existing zImage. You have to download source code of i9100 kernel and execute final part of kernel build where Image binary gets compressed and pre-pended by sfx header.
Click to expand...
Click to collapse
Yeah, that is actually what the repacker script does!
It has precomplied objects and compiles/links them together to the final (new) zImage.
saturn_de said:
err... the repacker/kernel_repacker.sh script only takes one argument.. how is it supposed to work???
Click to expand...
Click to collapse
You only pass the newinitramfs.img.gz that's created in the lines above, just drop the "zImage" from the commandline.
// EDIT
OK, I got as far as to compile my own kernel from the sources Samsung has released
I eventually end up with a nice and fresh, built from scratch zImage \o/
When I throw my selfmade zImage at the extractor script posted above, I get the proper (stock) initramfs filestructure I intended to put in (in other words, I managed to put my (as of now untouched) own initramfs.img into the zImage).
I create a nice .tar, flash with Odin and.... nothing
I get the bootsplash with the triangle and that's it, it doesn't get any further.
Anyone got a hint for me what I did wrong?
What I did:
(this all happened on a Linux machine)
extract Samy's kernel source
installed the codesourcery toolchain
set the CROSS_COMPILE var in ./kernel/Makefile to the proper path to the toolchain
ran
make c1_rev02_defconfig (according to readme.txt)
and then
make zImage CONFIG_INITRAMFS_SOURCE="/path/to/extracted/stock/initramfs/"
padded with 0x00s to the 8MiB size, tar'ed and Odin'ed
which brings me to the dead bootscreen....
Not even recovery works.
HellcatDroid said:
Yeah, that is actually what the repacker script does!
It has precomplied objects and compiles/links them together to the final (new) zImage.
Click to expand...
Click to collapse
I guess you've got repacker from first Galaxy?
It won't work. SFX header you're trying to compile is for first galaxy. It has hardcoded addresses and they are not compatible with Galaxy S II. Toolchain is also for SGS as well (not sure if it still suitable for SGSII).
Take kernel source code and toolchain for SGSII and it will work.
Yah, well, I got the kernel to compile fresh from sources now, no need for a repacker anymore, I just go make zImage and be happycat
Someone knows how to repack it?
Maybe Chainfire or Pulser?
Agreed, Can someone explain the process in full? modyfying and repacking zImage gets 2mb+ less in size, what we are missing?
Grooby said:
Agreed, Can someone explain the process in full? modyfying and repacking zImage gets 2mb+ less in size, what we are missing?
Click to expand...
Click to collapse
Necro much?
rawat said:
necro much?
Click to expand...
Click to collapse
zombie thread wants braaaaiiiiiiinnnnnnnnnnnnzzzzzzzzzzzzzz!!!!!!
Looks like i raised death searching for answer lool
A few tried to make repackers for the I9100 - and failed.
Even less know how to actually do it - and don't share the knownledge.
The thing is, that the initramfs is linked into the zImage during compile time, so it can't simply be "snipped out" and "new one pasted in".
That's why I eventually ended up compiling the whole thing from sources.
It would certainly nice if someone like ChainFire could share how to do it.... but he's too worried about others rebuilding his rootkernel with other nametags on it.
HellcatDroid said:
A few tried to make repackers for the I9100 - and failed.
Even less know how to actually do it - and don't share the knownledge.
The thing is, that the initramfs is linked into the zImage during compile time, so it can't simply be "snipped out" and "new one pasted in".
That's why I eventually ended up compiling the whole thing from sources.
It would certainly nice if someone like ChainFire could share how to do it.... but he's too worried about others rebuilding his rootkernel with other nametags on it.
Click to expand...
Click to collapse
GitHub.com/xiaolu
Sent from my GT-I9100 using xda premium
GUIDE
Post 1: nbhTool
Post 2: nbTools
Post 3: binTools
----------------------------------------------------------------
nbhTool 0.2 beta with SOURCE
AKA: Old nbh tools does not support new WP7 HTC device any more, so i made a new tool - nbhTool.
UPDATE 0.2 beta: 11.10.05
fixed some bugs
open source!!!!!
maybe someone can make a GUI one!
==================================================
UPDATE 0.1 beta: 11.09.22
added nbh split to nbhMerge so rename it to nbhTool
script now support '#' to make a note and Blank lines won't be error
added some functions
fix some bug
NOTE: it won't support script file of last version, just split a nbh file and you'll get a new scrpit.
Usage:
#Merge a nbh file use Script file:
nbhTool <Script>
e.g. nbhTool Mozart.txt
#Split a nbh file and create a Script file:
nbhTool -split <nbhFile> <Script>
e.g. nbhTool -split RUU.nbh Mozart.txt
NOW: i think it'll support all HTC WP7 Device, i test it with HTC HD7 & HTC Mozart Mango shipped Rom.
This tool is compiled by MinGW, so it can run without any runtime lib.Just test it and have fun, if any bugs just pm me.
nbTools - Split & Merge OS.NB Tools
nbSplit 0.2 beta - Split OS.NB File
if you used htcRIE to split a os.nb, i will tell you this tool is working in a different way.it just get BIN files only without addon bits from os.nb, so it only works with our tools to modify.
you can use this tool to get BIN Files from os.nb
USAGE:
nbSplit <OS.NB File>
Example:
nbSplit os.nb
Changelog:
0.1 beta first release version
0.2 beta fix a bug on split imgfs partition
Note:
this tool is only supported Roms of the 1st generation HTC WP7 Device and HTC HD2.
Tips:
just Drop the os.nb to nbSplit.exe can split os.nb directly.
nbSplit 0.2beta.zip
--------------------------------------------------
BINInsert 0.2 alpha - Insert BIN Files to OS.NB
Now it works, but not full functions, only support partitions below:
LOGO, BLDR, DPP, SLDR1, SLDR2, NK, IMGFS
Info:
For BINInsert 0.2 alpha
solved imgfs.bin file size must < 313.25M and i found a bug of nbSplit!
i will update BINInsert & nbSplit when i go back home tonight!
Still waiting someone who knows os.nb format well to help me solve my last 2 problem:
1.how to rebuild the last 2 blocks of IMGFS partition
2.how to rebuild the block right after LOG blocks in partition start
but tools can be used now, i just want my tool better
For HD2
maybe it'll work but not test now, some bits is different, so i'm not sure!
USAGE:
BINInsert -L <LOGO.BIN File> <OS.NB File> <New OS.NB File>
BINInsert -B <BLDR.BIN File> <OS.NB File> <New OS.NB File>
BINInsert -D <DPP.BIN File> <OS.NB File> <New OS.NB File>
BINInsert -S1 <SLDR1.BIN File> <OS.NB File> <New OS.NB File>
BINInsert -S2 <SLDR2.BIN File> <OS.NB File> <New OS.NB File>
BINInsert -N <NK.BIN File> <OS.NB File> <New OS.NB File>
BINInsert -I <IMGFS.BIN File> <OS.NB File> <New OS.NB File>
Example:
BINInsert -L LOGO.BIN OS.NB OS-new.NB
BINInsert -N NK.BIN OS.NB OS-new.NB
BINInsert -I IMGFS.bin OS.NB OS-new.NB
Changelog:
0.1 beta - first release version
0.2 beta - add DPP & IMGFS partition insert functions
BINInsert 0.2alpha.zip
WPBinaryTool 0.6.0
This place for my test version of windows phone binary tool:
I don't test the insert function, but it SHOULD work.
Use it on your own risk.
Feed back: [email protected]
Supported:
SLDR1
SLDR2
LOGO
Transfer these binary files to sth you can edit.
decompress logo will extract two bitmap image file.
decompress sldr will extract the binary file with witch you can use xidump to dump & pack.
Usage:
WPBinaryTool [-d(ecompress)|-c(ompress)|-i(nsert)] [-l(ogo)|-s(rpx)] <INPUT-FILENAME> (<INPUT-FILENAME-2>) <OUTPUT-FILENAME>
if you want to (de)compress logo/insert binary file to NB file, you should input two INPUT-FILENAME
Samples:
WPBinaryTool -d -l Logo.bin logo.bmp charge.bmp
WPBinaryTool -c -l logo.bmp charge.bmp Logo.bin
WPBinaryTool -d -s SLDR1.bin SLDR1.uncompr.bin
WPBinaryTool -c -s SLDR1.uncompr.bin SLDR1.bin
WPBinaryTool -i -l Logo.bin os.nb os.out.nb
Note:
Take your own risk to do all these things.
ChangeLog:
0.6.0 add insert function, add support of complex bitmap picture.
0.5.2 fix bmp header "84-03" issue, now will read in the right way;
0.5.1 initial release;
well done,thx for sharing
Nice work!~thanks a lot
Nice work!
Waiting for other device support.
Schubert OK
Hi!
You make my day,
So long I'm searching for way to rebuild my nbh files to create my own costum roms.
now I'm able to make costum roms too.
Flashed back a Schubert original 1.54 rom & installed HSPL
extract a 5.66.09.21a radio.nb from ansars costum radio rom
with hex editor i found out which CID's and languages ansar used
merg it back with your tool and try to flash it.
it works perfect.
thanks
Very glad this is working for you.
Now,we are trying to spend our spare time to do something funny~
Hope u can find more sweeties here next week~
UPDATE: 11.09.22
added nbh split to nbhMerge so rename it to nbhTool
script now support '#' to make a note and Blank lines won't be error
added some functions
fix some bug
NOTE: it won't support script file of last version, just split a nbh file and you'll get a new scrpit.
Usage:
#Merge a nbh file use Script file:
nbhTool <Script>
e.g. nbhTool Mozart.txt
#Split a nbh file and create a Script file:
nbhTool -split <nbhFile> <Script>
e.g. nbhTool -split RUU.nbh Mozart.txt
NOW: i think it'll support all HTC WP7 Device, i test it with HTC HD7 & HTC Mozart Mango shipped Rom.
Great work mate
works great for my hd7 kitchen
cheers
nice work!
---------- Post added at 06:17 PM ---------- Previous post was at 06:14 PM ----------
hoping a GUI
btxakita said:
This place for my test version of windows phone binary tool:
maybe you can't use this tool for now
because our new tool "nbsplit" and "nbmerge" is not ready yet
but if you know how these things work, you can try it yourself.
Supported:
SLDR1
SLDR2
LOGO
Transfer these binary files to sth you can edit.
decompress logo will extract two bitmap image file.
decompress sldr will extract the binary file with witch you can use xidump to dump & pack.
Usage:
WPBinaryTool [-d(ecompress)|-c(ompress)] [-l(ogo)|-s(rpx)] <inputfilename> <outputfilename>
if you want to (de)compress logo part, you should input two bmp filename
Samples:
WPBinaryTool -d -l Logo.bin logo.bmp charge.bmp
WPBinaryTool -c -l logo.bmp charge.bmp Logo.bin
WPBinaryTool -d -s SLDR1.bin SLDR1.uncompr.bin
WPBinaryTool -c -s SLDR1.uncompr.bin SLDR1.bin
Note:
Take your own risk to do all these things.
Click to expand...
Click to collapse
Hi,
I was able to decompress de logo and charge.bmp, edited both BMP with GIMP2.0 but when I start compress WPBinaryTool crashes.
If I do not make any changes to the bmp files WPBinaryTool works.
Anyone else tried this?
Thanks for the tool.
dotcompt said:
Hi,
I was able to decompress de logo and charge.bmp, edited both BMP with GIMP2.0 but when I start compress WPBinaryTool crashes.
If I do not make any changes to the bmp files WPBinaryTool works.
Anyone else tried this?
Thanks for the tool.
Click to expand...
Click to collapse
Simple way is: Edit logo.bmp file which was generated when you decompress. Eg: Open that logo.bmp by paint application, then edit it.
Great work! Thanks for that!
But I'm looking for a way to "implant" my newly made LOGO.bin (with my own Logo's in it) into os.nb...How can I achieve that?
Thanks!
dotcompt said:
Hi,
I was able to decompress de logo and charge.bmp, edited both BMP with GIMP2.0 but when I start compress WPBinaryTool crashes.
If I do not make any changes to the bmp files WPBinaryTool works.
Anyone else tried this?
Thanks for the tool.
Click to expand...
Click to collapse
you can send your bmp file to my email [email protected]
those crash is caused by the deference between Windows Bitmap Image format and your GIMP2.0.
It works with GIMP. But when you save it, you have to choose "Advanced Options" and then you have to choose "24 Bit", because Windows Phone 7 needs this setting. But I haven't found a way to implant the selfmade LOGO.bin into my os.nb...
-WP7User- said:
It works with GIMP. But when you save it, you have to choose "Advanced Options" and then you have to choose "24 Bit", because Windows Phone 7 needs this setting. But I haven't found a way to implant the selfmade LOGO.bin into my os.nb...
Click to expand...
Click to collapse
we are working on this - nbMerge.i got crazy on LOG Blocks of os.nb. if someone know os.nb format well, just pm me, i think exchange information can make our project moves faster!
btxakita said:
you can send your bmp file to my email [email protected]
those crash is caused by the deference between Windows Bitmap Image format and your GIMP2.0.
Click to expand...
Click to collapse
Thanks mate but I finally made it. The trick is using Paint and simple graphics otherwise WPBinaryTool will go out of memory
dotcompt said:
Thanks mate but I finally made it. The trick is using Paint and simple graphics otherwise WPBinaryTool will go out of memory
Click to expand...
Click to collapse
Yeah... just a simple graphic.
Update & Open Source, so maybe someone can make a GUI one!