forked from xiaolu/galaxys2_kernel_repack
-
Notifications
You must be signed in to change notification settings - Fork 0
xiaobingyu/galaxys2_kernel_repack
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
= Galaxy S2 Kernel Packing/Repacking Tools = Use cygwin you must install lzop and OpenSSL binary. arm-linux-androideabi-4.4.3-windows.tar.gz compiler: http://d-h.st/Tqj To unpack: $ ./unpack.sh [original_zImage] [unpack_output_dir] Modify files in unpack output dir as necessary. To repack: a) Generate ramfs output.cpio from unpack output dir: $ ./gen_initramfs.sh -o [output.cpio] -u 0 -g 0 [unpack_output_dir] b) Ensure your toolchain binaries are on your path c) Set COMPILER_LIB environment variable to your toolchain gcc lib directory d) Repack ramfs output.cpio and kernel from original zImage to new zImage $ ./repack.sh [original_zImage] [output.cpio] [new_zImage] e) Resize new zImage to size of original zImage $ dd if=[new_zImage] of=[new_zImage_resized] bs=[original_zImage_size] conv=sync = Original Documentation = Please edit repack.sh: # you should point where your cross-compiler is 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 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 中文版: 修改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¬e kernel and rebuild,thanks :z4mod,Tungstwenty
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published