If you want a complete set of unix tools in your phone, here are the steps to cross-compile and install busybox from source (there's no need to root the phone and/or install everything using the busybox installer from the market).
Download the latest ARM gnueabi toolchain from codesourcery.
Get the busybox source code from the git repository:
$ git clone git://busybox.net/busybox.git
Copy my busybox config file (or use your own config if you prefer, this can be just a starting point):
$ cd busybox
$ wget -O .config http://www.develer.com/~arighi/android/busybox/config
[optional] Change the busybox config if you want by running:
$ make menuconfig
Cross-compile busybox:
$ make oldconfig && make
At the end of the build the busybox binary should be available as a statically linked ELF for ARM:
$ file busybox
busybox: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, stripped
Upload the busybox binary to the device (you don't need root access to your phone):
$ adb push busybox /data/local/tmp/
Now busybox it's ready to be used:
$ adb shell /data/local/tmp/busybox CMD
Example:
$ adb shell /data/local/tmp/busybox lsusb
Bus 001 Device 001: ID 1d6b:0002
Bus 001 Device 002: ID 1519:0020
=== NOTE: all the following steps are optional ===
If you have enabled the adb root shell access to your phone (i.e., by rooting the phone or by installing my custom kernel), you can also install busybox in the /system partition and have all the commands available in the $PATH.
Remount the /system partition in read-write mode on your phone:
$ adb shell "mount -oremount,rw /dev/block/mmcblk0p9 /system
Upload the busybox binary to the /system partition:
$ adb push busybox /system/xbin/busybox
Install busybox by using busybox itself:
$ adb shell "chmod 755 /system/xbin/busybox"
$ adb shell "/system/xbin/busybox --install -s /system/xbin"
Remount /system in read-only:
$ adb shell "mount -oremount,ro /dev/block/mmcblk0p9 /system"
Now all the busybox applets are in your $PATH:
$ adb shell lsusb
Bus 001 Device 001: ID 1d6b:0002
Bus 001 Device 002: ID 1519:0020
Tuesday, August 30, 2011
HOWTO: custom kernel on Samsung Galaxy S II I9100
Recently I've replaced my Bravo HTC Desire with a new Android phone: a Samsung Galaxy S II I-9100. I couldn't resist too much with the stock kernel, so finally I've found some spare time to cook a custom kernel starting from the original Samsung kernel source code GT-I9100_OpenSource_Update2.
In this post I report (for me to remember later and for those who are interested) all the steps that I did to setup the build environment, cross compile the custom kernel and flash it into the phone.
DISCLAIMER: I take no responsibility for anything that may go wrong by you following these instructions. Proceed at your own risk!
=== Requirements ===
- A Samsung Galaxy S II (not necessarily rooted! you'll get a root shell when you'll flash the new kernel)
- The latest android SDK
- The arm-none-eabi cross-compile toolchain (you can get it from the CodeSourcery website)
=== HOWTO ===
Download and install the arm toolchain from the CodeSourcery website: be sure that arm-none-eabi-gcc is in your $PATH.
Get the autobuild script:
$ git clone git://github.com/arighi/gt-i9100.git
Run the script:
$ ./build-kernel.sh
The script downloads the "-arighi" kernel source code, a initramfs template and builds a new kernel ready to be flashed into the device.
At the end of the autobuild process the file kernel-gt-i9100-arighi.tar can be used to flash the new kernel to the phone using Odin (search on the web or in the xda-developers forum, there are tons of howtos/tutorials for this).
=== Results ===
The score with Quadrant benchmark is not bad at all, I got always > 4000, but remember that we're cheating during the IO test, due to the fsync-disable patch.
Anyway overall result looks good enough.
== Additional notes ===
- All the custom *.ko files are included into the initramfs to avoid potential errors/problems with the original kernel modules (so it is always possible to flash back the original kernel later, all the old kernel modules are still there, untouched).
- After you've flashed the -arighi kernel the first time you will also have root access to your device. The initramfs template enables adb root shell (ro.secure == 0), so an adb shell will immediately drop you to a root shell. This means you can also re-flash your device from Linux directly using the flash-kernel.sh script.
- For the complete list of all the patches applied to this kernel have a look at the git log here.
- IMPORTANT: the fsync-disable patch (enabled in the kernel by default) can increase performance and battery life, but it is dangerous, because it might eat your data!! It makes the software no longer crash safe, so if you start to randomly kill your apps you may lose some data
[UPDATE: the fsync-disable patch is no more enabled by default in the kernel, to enable it just set CONFIG_FILE_SYNC_DISABLE=y in the kernel .config)]
In this post I report (for me to remember later and for those who are interested) all the steps that I did to setup the build environment, cross compile the custom kernel and flash it into the phone.
DISCLAIMER: I take no responsibility for anything that may go wrong by you following these instructions. Proceed at your own risk!
=== Requirements ===
- A Samsung Galaxy S II (not necessarily rooted! you'll get a root shell when you'll flash the new kernel)
- The latest android SDK
- The arm-none-eabi cross-compile toolchain (you can get it from the CodeSourcery website)
=== HOWTO ===
Download and install the arm toolchain from the CodeSourcery website: be sure that arm-none-eabi-gcc is in your $PATH.
Get the autobuild script:
$ git clone git://github.com/arighi/gt-i9100.git
Run the script:
$ ./build-kernel.sh
The script downloads the "-arighi" kernel source code, a initramfs template and builds a new kernel ready to be flashed into the device.
At the end of the autobuild process the file kernel-gt-i9100-arighi.tar can be used to flash the new kernel to the phone using Odin (search on the web or in the xda-developers forum, there are tons of howtos/tutorials for this).
=== Results ===
The score with Quadrant benchmark is not bad at all, I got always > 4000, but remember that we're cheating during the IO test, due to the fsync-disable patch.
Anyway overall result looks good enough.
== Additional notes ===
- All the custom *.ko files are included into the initramfs to avoid potential errors/problems with the original kernel modules (so it is always possible to flash back the original kernel later, all the old kernel modules are still there, untouched).
- After you've flashed the -arighi kernel the first time you will also have root access to your device. The initramfs template enables adb root shell (ro.secure == 0), so an adb shell will immediately drop you to a root shell. This means you can also re-flash your device from Linux directly using the flash-kernel.sh script.
- For the complete list of all the patches applied to this kernel have a look at the git log here.
- IMPORTANT: the fsync-disable patch (enabled in the kernel by default) can increase performance and battery life, but it is dangerous, because it might eat your data!! It makes the software no longer crash safe, so if you start to randomly kill your apps you may lose some data
[UPDATE: the fsync-disable patch is no more enabled by default in the kernel, to enable it just set CONFIG_FILE_SYNC_DISABLE=y in the kernel .config)]
Subscribe to:
Posts (Atom)