Skip to content
Browse files

build_script cleanup + strip modules + payload for su and ntfs-3g

  • Loading branch information...
1 parent 813f81b commit 50cd9c3e9f8199c4170e434a9d2cfb4027d39684 @gokhanmoral committed
Showing with 52 additions and 3 deletions.
  1. +5 −3 build_kernel.sh
  2. +47 −0 mkshbootimg.py
  3. BIN payload.tar
View
8 build_kernel.sh
@@ -38,6 +38,7 @@ rm -rf $RAMFS_TMP/.hg
#copy modules into ramfs
mkdir -p $INITRAMFS/lib/modules
find -name '*.ko' -exec cp -av {} $RAMFS_TMP/lib/modules/ \;
+${CROSS_COMPILE}strip --strip-unneeded $INITRAMFS_TMP/lib/modules/*
cd $RAMFS_TMP
find | fakeroot cpio -H newc -o > $RAMFS_TMP.cpio 2>/dev/null
@@ -47,7 +48,8 @@ cd -
nice -n 10 make -j3 zImage || exit 1
-./mkbootimg --kernel $KERNELDIR/arch/arm/boot/zImage --ramdisk $RAMFS_TMP.cpio.gz --board smdk4x12 --base 0x10000000 --pagesize 2048 --ramdiskaddr 0x11000000 -o $KERNELDIR/boot.img
+./mkbootimg --kernel $KERNELDIR/arch/arm/boot/zImage --ramdisk $RAMFS_TMP.cpio.gz --board smdk4x12 --base 0x10000000 --pagesize 2048 --ramdiskaddr 0x11000000 -o $KERNELDIR/boot.img.pre
+
+$KERNELDIR/mkshbootimg.py $KERNELDIR/boot.img $KERNELDIR/boot.img.pre $KERNELDIR/payload.tar
+rm -f $KERNELDIR/boot.img.pre
-rm /Downloads/galaxys3/siyah.tar
-tar cvf /Downloads/galaxys3/siyah.tar boot.img
View
47 mkshbootimg.py
@@ -0,0 +1,47 @@
+#!/usr/bin/env python
+import sys, os
+
+def copydata(outfile, infile):
+ while 1:
+ data = infile.read(512)
+ if (data):
+ outfile.write(data)
+ else:
+ break
+
+def alignoffset(outfile):
+ offset = outfile.tell()
+ outfile.seek((offset + 511) & ~511)
+ return outfile.tell()
+
+def appendimage(outfile, infile):
+ offset = alignoffset(outfile)
+ copydata(outfile, infile)
+ length = alignoffset(outfile) - offset
+ assert (offset % 512 == 0)
+ assert (length % 512 == 0)
+ return (offset/512, length/512)
+
+if len(sys.argv) < 4:
+ print "Usage:", sys.argv[0], "output kernel boot [recovery]"
+ sys.exit(1)
+
+outfile = open(sys.argv[1], 'wb')
+kernel = open(sys.argv[2], 'r')
+boot = open(sys.argv[3], 'r')
+recovery = None
+if (len(sys.argv) == 5):
+ recovery = open(sys.argv[4], 'r')
+offset_table = "\n\nBOOT_IMAGE_OFFSETS\n"
+copydata(outfile, kernel)
+table_loc = alignoffset(outfile)
+outfile.write('\x00' * 512)
+offset_table += "boot_offset=%d;boot_len=%d;" % appendimage(outfile, boot)
+if recovery:
+ offset_table += "recovery_offset=%d;recovery_len=%d;" % appendimage(outfile, recovery)
+offset_table += "\n\n"
+outfile.seek(table_loc)
+outfile.write(offset_table)
+outfile.flush()
+os.fsync(outfile.fileno())
+outfile.close()
View
BIN payload.tar
Binary file not shown.

0 comments on commit 50cd9c3

Please sign in to comment.
Something went wrong with that request. Please try again.