ymdzq / galaxys2_kernel_repack

unpack s2&note kernel and rebuild,thanks :z4mod,Tungstwenty

Home Page:http://666w.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use cygwin you must install lzop and OpenSSL binary.

arm-linux-androideabi-4.4.3-windows.tar.gz compiler: http://d-h.st/Tqj

Please edit repack.sh:
	# you should point where your cross-compiler is         
	COMPILER=/home/xiaolu/bin/android-toolchain-eabi/bin/arm-eabi-

Unpack zImage,Usage:
	./unpack.sh zImagesy267 sy267

Repack zImage,Usage:
	./repack.sh zImagesy267 initramfs.cpio new_zImage
	or
	./repack.sh zImagesy267 sy267 new_zImage

Padding sufile to new_zImage offset=7000000,Example:
	./repack.sh zImagesm189 sm189.cpio new_zImage su

	post-int.sh(init.rc services):
	dd if=/dev/block/mmcblk0p5 of=/system/bin/su skip=7000000 seek=0 bs=1 count=26336
	dd if=/dev/block/mmcblk0p5 of=/system/app/Superuser.apk skip=7026336 seek=0 bs=1 count=196640


Use tar.xz In the end of the new_zImage:
	./repack.sh zImagesy262 initramfs.cpio new_zImage payload

	how to use,pls read initramfs-sample/sbin/script/post-init.sh & recovery.sh
	recovery.tar.xz and boot.tar.xz in resources directory,you can customize.
	In recovery.sh:
	cd /
	eval $(read_boot_headers /dev/block/mmcblk0p5)
	load_offset=$recovery_offset
	load_len=$recovery_len
	dd bs=512 if=/dev/block/mmcblk0p5 skip=$load_offset count=$load_len | xzcat | tar x


Custom zImage compression type:
	./repack.sh zImagesy267 initramfs.cpio new_zImage gzip
	or
	./repack.sh zImagesy267 initramfs.cpio new_zImage payload gzip

中文版:
使用cygwin你必须安装lzop和openssl程序。
cygwin要使用windows版的编译器:arm-linux-androideabi-4.4.3-windows.tar.gz compiler http://d-h.st/Tqj

修改repack.sh开头的编译器路径和库文件路径,改为你自己的:
	COMPILER=/home/xiaolu/bin/android-toolchain-eabi/bin/arm-eabi-
	COMPILER_LIB=/home/xiaolu/bin/android-toolchain-eabi/lib/gcc/arm-eabi/4.5.4
	
解包zImage,例如:
	./unpack.sh zImagesy267 sy267
	
重新打包编译zImage:
	格式:
	./repack.sh 原始zImage initramfs(目录或者cpio文件) 新zImage名
	例如:
	./repack.sh zImagesy267 initramfs.cpio new_zImage
	or
	./repack.sh zImagesy267 sy267 new_zImage
	
	对于超出大小的initramfs,可以使用下边两种办法来打包:
	1.把2进制的su文件和Superuser.apk文件放在新zImage的7000000字节偏移处,命令:
	./repack.sh zImagesm189 sm189.cpio new_zImage su
	如何在启动的时候调用su和Superuser.apk,请在root脚本里添加如下:
	dd if=/dev/block/mmcblk0p5 of=/system/bin/su skip=7000000 seek=0 bs=1 count=26336
	dd if=/dev/block/mmcblk0p5 of=/system/app/Superuser.apk skip=7026336 seek=0 bs=1 count=196640
	
	2.使用把一些大文件打包成tar.xz放在zImage末尾,启动需要用到的时候读取压缩包偏移量,用DD复制出来解压到rootfs相应位置。
	./repack.sh zImagesy262 initramfs.cpio new_zImage payload
	上边的命令是打包的同时把recovery.tar.xz和boot.tar.xz放在zImage末尾,下边说一下如何使用,以启动recovery(recovery.sh)为例子:
	cd /
	eval $(read_boot_headers /dev/block/mmcblk0p5)
	load_offset=$recovery_offset
	load_len=$recovery_len
	dd bs=512 if=/dev/block/mmcblk0p5 skip=$load_offset count=$load_len | xzcat | tar x
	
	自定义zImage压缩类型:
	./repack.sh zImagesy267 initramfs.cpio new_zImage gzip
	或者
	./repack.sh zImagesy267 initramfs.cpio new_zImage payload gzip
	

About

unpack s2&note kernel and rebuild,thanks :z4mod,Tungstwenty

http://666w.com


Languages

Language:C 89.3%Language:Shell 3.6%Language:Assembly 3.6%Language:C++ 2.9%Language:Perl 0.3%Language:Objective-C 0.2%