[GUIDE] Compiling and Installing Custom Kernel (based on pershoot's Kernel from git) - G Tablet Android Development

This is a intermediate guide for anyone who wants to manually compile their own kernel for the GTablet. If you merely want to use a prebuilt kernel then this is not for you. Personally, I am no expert on kernel development or bash scripting (which I will reference) but I get a kick out of analyzing and modifying bits and pieces here and there. I will not be covering retrieving all dependencies. This guide was written to work with pershoot's kernel repository. Every step has been tested using a fresh installation of Ubuntu 10.10 x64.
Step 1 - Obtaining tools and kernel source:
Install git-core.
[optional] Install ncurses-dev (if you want to use menuconfig to modify the kernel selections).
[optional] Install lib32stdc++ (if your development machine is running a x64 variant of linux). This is a necessary step to use the prebuilt android toolchain as it is compiled for a 32 bit machine.
Code:
sudo apt-get install git-core libncurses-dev lib32stdc++6
[optional] The next git clone steps will copy the repositories to the current directory, all following example will assume that you are cloning to "/usr/src/tegratab".
Code:
mkdir /usr/src/tegratab
Note: You need to be a member of the "src" group to modify the contents of "/usr/src" without sudoing. After adding yourself to the "src" group you need to restart for the permissions to take effect.
Code:
usermod -a -G src `whoami`
sudo reboot
Retrieve the prebuilt android toolchain.
Code:
git clone git://android.git.kernel.org/platform/prebuilt.git
Clone pershoot's "Gtablet Kernel 2.6.32" source repository.
Code:
git clone https://github.com/pershoot/gtab-2632.git
Note: We'll continue with the assumption of the following directory structure. Subsequent code snipets will use absolute paths so if your installation differs, just update the commands to adjust.
Code:
/usr/src/tegratab
/usr/src/tegratab/gtab-2632
/usr/src/tegratab/prebuilt
Step 2 - Kernel Configuration:
During the kernel compilation, the make utility utilizes the ".config" file in the kernel source's root directory to determine how the kernel should be compiled.
So before we begin the actual kernel compilation we need to perform the configuration.
To use pershoot's kernel configuration do the following:
Code:
make -C /usr/src/tegratab/gtab-2632/ ARCH=arm pershoot_tegra_harmony_android_defconfig
Note: When specifying the defconfig file, the make utility searches the arch/$ARCH/configs directory.
This will simply copy pershoot's defconfig file to the .config file (and update the timestamp). We could have bypassed the make utility and done this manually as follows:
Code:
cp /usr/src/tegratab/gtab-2632/arch/arm/configs/pershoot_tegra_harmony_android_defconfig /usr/src/tegratab/gtab-2632/.config
To manually modify the kernel configuration you have several options:
1. Generate the ".config" file (described above) and manually edit it.
Code:
vi /usr/src/tegratab/gtab-2632/.config
2. Create your own defconfig file and manually edit it.
Code:
cp /usr/src/tegratab/gtab-2632/arch/arm/configs/pershoot_tegra_harmony_android_defconfig /usr/src/tegratab/gtab-2632/arch/arm/configs/custom_tegra_harmony_android_defconfig
vi /usr/src/tegratab/gtab-2632/arch/arm/configs/custom_tegra_harmony_android_defconfig
Then use the make utility to generate (i.e. copy to the ".config") based on the new defconfig file.
Code:
make -C /usr/src/tegratab/gtab-2632/ ARCH=arm custom_tegra_harmony_android_defconfig
3. Use the menuconfig tool which comes with the linux source. This is the recommended solution to manually configuring the kernel. The menuconfig's initial kernel configuration selections are based on the ".config" file, so it should be generated first. After configuring the kernel as you please, you will have option when exiting the menuconfig tool to save your selections to the ".config" file.
Code:
make -C /usr/src/tegratab/gtab-2632/ ARCH=arm menuconfig
The optimal solution would be to define the initial kernel configuration selection and menuconfig simulaneously, the previous listings are mostly for educational purposes.
Code:
make -C /usr/src/tegratab/gtab-2632/ ARCH=arm pershoot_tegra_harmony_android_defconfig menuconfig
Step 3 - Kernel Compilation:
Now that the kernel has been configured it can finally compiled.
Make the kernel image itself (the resulting kernel image will be located at /usr/src/tegratab/gtab-2632/arch/arm/boot/zImage):
Code:
make -C /usr/src/tegratab/gtab-2632/ ARCH=arm CROSS_COMPILE=/usr/src/tegratab/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi- zImage
To make the kernel modules (typically used to add support for new hardware and/or filesystems, or for adding system calls):
Code:
make -C /usr/src/tegratab/gtab-2632/ ARCH=arm CROSS_COMPILE=/usr/src/tegratab/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi- modules
Step 4 - Packaging the Kernel for Deployment to the GTablet:
Now it's time to create the package file that will be used to install the new kernel.
This is where it used to get a bit tricky but luckily some great work from Pershoot and Koush has made it much easier.
Alternate Methods / References:
[FAQ] Flashing UPDATE.ZIP the old fashioned way (How and Did It Work?) http://forum.xda-developers.com/showthread.php?t=892090
HOWTO: Unpack, Edit, and Re-Pack Boot Images) http://android-dls.com/wiki/index.php?title=HOWTO:_Unpack,_Edit,_and_Re-Pack_Boot_Images
Building Android kernel images) http://www.cianer.com/androidg1/28-building-android-kernel-images
Ignore those, we'll do it the easy way:
Save a copy of pershoot's boot- zip from http://droidbasement.com/ to use as a template:
Code:
wget http://droidbasement.com/gtab/kernels/2632/1/boot-cm_2632.27-xtra-vfpv3_fp-010711.zip -O /usr/src/tegratab/boot-template.zip
Make a temporary directory so we can perform the staging:
Code:
mkdir /usr/src/tegratab/staging
Unzip the boot template here:
Code:
unzip -d /usr/src/tegratab/staging /usr/src/tegratab/boot-template.zip
Copy the kernel image which was built to this staging directory:
Code:
cp -v /usr/src/tegratab/gtab-2632/arch/arm/boot/zImage /usr/src/tegratab/staging/kernel/zImage
Install the kernel modules which were built:
Code:
make -C /usr/src/tegratab/gtab-2632/ ARCH=arm INSTALL_MOD_PATH=/usr/src/tegratab/staging/system modules_install
Replace the original bcm4329 kernel module which was extracted from the boot-template with the newly compiled kernel module:
Code:
cp -v /usr/src/tegratab/staging/system/lib/modules/2.6.32.28-cyanogenmod/kernel/drivers/net/wireless/bcm4329/dhd.ko /usr/src/tegratab/staging/system/lib/hw/wlan/bcm4329.ko
Remove the two symlink directories in our staging directory, these were created during the kernel module installation:
Code:
rm -v /usr/src/tegratab/staging/system/lib/modules/2.6.32.28-cyanogenmod/source
rm -v /usr/src/tegratab/staging/system/lib/modules/2.6.32.28-cyanogenmod/build
Zip the result:
Code:
cd /usr/src/tegratab/staging
zip -r /usr/src/tegratab/boot-custom-kernel *
[optional]Cleanup the staging directory:
Code:
cd /usr/src/tegratab
rm -R /usr/src/tegratab/staging
Step 5 - Package Installation
Boot into Clockwork Recovery.
Navigate to "mounts and storage".
Select "mount USB storage".
Copy /usr/src/tegratab/boot-custom-kernel.zip to the mounted filesystem.
Select "Unmount USB storage".
Navigate to "install zip from sdcard" => "choose zip from sdcard" => "boot-custom-kernel.zip".
Select "Yes - Install boot-custom-kernel.zip".
Select "reboot system now".
It's now installed!
Once reboot is complete navigate to the "Settings" => "About device".
Check "Kernel version", it should specify the some details about your new build.
2.6.32.28-cyanogenmod
[email protected] #1​
References:
Android Development: http://source.android.com/source/download.html
Here's a brief description of the command line options which were used:
Code:
-C dir, --directory=dir
Change to directory dir before reading the makefiles or doing anything else. If multiple -C options are specified, each is interpreted relative to the previous one: -C /
-C etc is equivalent to -C /etc. This is typically used with recursive invocations of make.
ARCH=<architecture>
# When performing cross compilation for other architectures ARCH shall be set
# to the target architecture. (See arch/* for the possibilities).
# ARCH can be set during invocation of make:
# make ARCH=ia64
# Another way is to have ARCH set in the environment.
# The default ARCH is the host where make is executed.
CROSS_COMPILE=<toolchain>
# CROSS_COMPILE specify the prefix used for all executables used
# during compilation. Only gcc and related bin-utils executables
# are prefixed with $(CROSS_COMPILE).
# CROSS_COMPILE can be set on the command line
# make CROSS_COMPILE=ia64-linux-
# Alternatively CROSS_COMPILE can be set in the environment.
# Default value for CROSS_COMPILE is not to prefix executables
# Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
export KBUILD_BUILDHOST := $(SUBARCH)
ARCH ?= $(SUBARCH)
CROSS_COMPILE ?=
#ARCH ?= arm
#CROSS_COMPILE ?=$(CURDIR)/../prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-
INSTALL_MOD_PATH=<module-target-path>
# INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory
# relocations required by build roots. This is not defined in the
# makefile but the argument can be passed to make if needed.
Scripts:
Kernel Configuration Script:
Code:
[size=3]AR[color=#000000]=[/color]arm
[color=#000080][b]if[/b][/color] [color=#000000][ -[/color]n [color=#ddbb00]"$1"[/color] [color=#000000]] && [ -[/color]n [color=#ddbb00]"$2"[/color] [color=#000000]][/color]
[color=#000080][b]then[/b][/color]
[color=#0000ff]make[/color] [color=#000000]-[/color]C [color=#000000]$1[/color] ARCH[color=#000000]=[/color][color=#000000]$AR $2[/color] menuconfig
[color=#000080][b]else[/b][/color]
[color=#000080]echo[/color] [color=#ddbb00]"Usage: $0 [source-dir] [defconfig]"[/color]
[color=#000080][b]fi[/b][/color]
[/size]
Kernel Compilation / Packing Script:
Code:
[size=3][color=#ff0000][i]#!/bin/sh[/i][/color]
CC[color=#000000]=/[/color]usr[color=#000000]/[/color]src[color=#000000]/[/color]tegratab[color=#000000]/[/color]prebuilt[color=#000000]/[/color]linux[color=#000000]-[/color]x86[color=#000000]/[/color]toolchain[color=#000000]/[/color]arm[color=#000000]-[/color]eabi[color=#000000]-[/color][color=#008800]4.4.0[/color][color=#000000]/[/color]bin[color=#000000]/[/color]arm[color=#000000]-[/color]eabi[color=#000000]-[/color]
AR[color=#000000]=[/color]arm
PREFIX[color=#000000]=[/color][color=#ddbb00]`echo $1 | sed -e 's/[/]*$//' -e 's/[/]/_/'`[/color]
POSTFIX[color=#000000]=[/color][color=#ddbb00]`date +%Y_%m_%e_%H%M%S`[/color]
KSOURCE_DIR[color=#000000]=[/color][color=#000000]$1[/color]
TARGET_NAME[color=#000000]=[/color][color=#000000]$PREFIX[/color][color=#000000]-[/color][color=#000000]$POSTFIX[/color]
SAMPLE_ZIP[color=#000000]=/[/color]usr[color=#000000]/[/color]src[color=#000000]/[/color]tegratab[color=#000000]/[/color]boot[color=#000000]-[/color]template.[color=#0000ff]zip[/color]
OUTPUT_ZIP[color=#000000]=/[/color]usr[color=#000000]/[/color]src[color=#000000]/[/color]tegratab[color=#000000]/[/color][color=#000000]$TARGET_NAME[/color]
STAGING_DIR[color=#000000]=/[/color]tmp[color=#000000]/[/color][color=#000000]$TARGET_NAME[/color]
do_compile[color=#000000]()[/color]
[color=#000000]{[/color]
[color=#000080]echo[/color] [color=#ddbb00]"do_compile()"[/color]
[color=#ff0000][i]# Build the kernel image.[/i][/color]
[color=#0000ff]make[/color] [color=#000000]-[/color]C [color=#000000]$KSOURCE_DIR[/color] ARCH[color=#000000]=[/color][color=#000000]$AR[/color] CROSS_COMPILE[color=#000000]=[/color][color=#000000]$CC[/color] zImage
[color=#000080][b]if[/b][/color] [color=#000000][[/color] $? [color=#000000]-[/color]ne [color=#008800]0[/color] [color=#000000]];[/color] [color=#000080][b]then[/b][/color] [color=#000080]return[/color] $?[color=#000000];[/color] [color=#000080][b]fi[/b][/color]
[color=#ff0000][i]# Build the kernel modules.[/i][/color]
[color=#0000ff]make[/color] [color=#000000]-[/color]C [color=#000000]$KSOURCE_DIR[/color] ARCH[color=#000000]=[/color][color=#000000]$AR[/color] CROSS_COMPILE[color=#000000]=[/color][color=#000000]$CC[/color] modules
[color=#000080][b]if[/b][/color] [color=#000000][[/color] $? [color=#000000]-[/color]ne [color=#008800]0[/color] [color=#000000]];[/color] [color=#000080][b]then[/b][/color] [color=#000080]return[/color] $?[color=#000000];[/color] [color=#000080][b]fi[/b][/color]
[color=#000000]}[/color]
do_staging[color=#000000]()[/color]
[color=#000000]{[/color]
[color=#000080]echo[/color] [color=#ddbb00]"do_staging()"[/color]
[color=#ff0000][i]# Unzip the sample update zip to create update structure[/i][/color]
[color=#ff0000][i]# and provide update scripts / utilities.[/i][/color]
[color=#0000ff]unzip[/color] [color=#000000]-[/color]d [color=#000000]$STAGING_DIR $SAMPLE_ZIP[/color]
[color=#000080][b]if[/b][/color] [color=#000000][[/color] $? [color=#000000]-[/color]ne [color=#008800]0[/color] [color=#000000]];[/color] [color=#000080][b]then[/b][/color] [color=#000080]return[/color] $?[color=#000000];[/color] [color=#000080][b]fi[/b][/color]
[color=#000000]}[/color]
do_populate[color=#000000]()[/color]
[color=#000000]{[/color]
[color=#000080]echo[/color] [color=#ddbb00]"do_populate()"[/color]
[color=#ff0000][i]# Copy the resulting image to the staging dir.[/i][/color]
[color=#0000ff]cp[/color] [color=#000000]-[/color]v [color=#000000]$KSOURCE_DIR[/color][color=#000000]/[/color]arch[color=#000000]/[/color][color=#000000]$AR[/color][color=#000000]/[/color]boot[color=#000000]/[/color]zImage [color=#000000]$STAGING_DIR[/color][color=#000000]/[/color]kernel[color=#000000]/[/color]
[color=#000080][b]if[/b][/color] [color=#000000][[/color] $? [color=#000000]-[/color]ne [color=#008800]0[/color] [color=#000000]];[/color] [color=#000080][b]then[/b][/color] [color=#000080]return[/color] $?[color=#000000];[/color] [color=#000080][b]fi[/b][/color]
[color=#ff0000][i]# Install the built modules to the staging dir.[/i][/color]
[color=#0000ff]make[/color] [color=#000000]-[/color]C [color=#000000]$KSOURCE_DIR[/color] ARCH[color=#000000]=[/color][color=#000000]$AR[/color] INSTALL_MOD_PATH[color=#000000]=[/color][color=#000000]$STAGING_DIR[/color][color=#000000]/[/color]system modules_install
[color=#000080][b]if[/b][/color] [color=#000000][[/color] $? [color=#000000]-[/color]ne [color=#008800]0[/color] [color=#000000]];[/color] [color=#000080][b]then[/b][/color] [color=#000080]return[/color] $?[color=#000000];[/color] [color=#000080][b]fi[/b][/color]
[color=#ff0000][i]# Remove symlinks.[/i][/color]
[color=#0000ff]rm[/color] [color=#000000]-[/color]v [color=#ddbb00]`find $STAGING_DIR -type l`[/color]
[color=#000080][b]if[/b][/color] [color=#000000][[/color] $? [color=#000000]-[/color]ne [color=#008800]0[/color] [color=#000000]];[/color] [color=#000080][b]then[/b][/color] [color=#000080]return[/color] $?[color=#000000];[/color] [color=#000080][b]fi[/b][/color]
[color=#ff0000][i]# Zip up the results. [/i][/color]
[color=#000080]cd[/color] [color=#000000]$STAGING_DIR[/color]
[color=#000080][b]if[/b][/color] [color=#000000][[/color] $? [color=#000000]-[/color]ne [color=#008800]0[/color] [color=#000000]];[/color] [color=#000080][b]then[/b][/color] [color=#000080]return[/color] $?[color=#000000];[/color] [color=#000080][b]fi[/b][/color]
[color=#0000ff]zip[/color] [color=#000000]-[/color]r [color=#000000]$OUTPUT_ZIP[/color] [color=#000000]*[/color]
[color=#000080][b]if[/b][/color] [color=#000000][[/color] $? [color=#000000]-[/color]ne [color=#008800]0[/color] [color=#000000]];[/color] [color=#000080][b]then[/b][/color] [color=#000080]return[/color] $?[color=#000000];[/color] [color=#000080][b]fi[/b][/color]
[color=#000080]cd[/color] [color=#000000]-[/color]
[color=#000080][b]if[/b][/color] [color=#000000][[/color] $? [color=#000000]-[/color]ne [color=#008800]0[/color] [color=#000000]];[/color] [color=#000080][b]then[/b][/color] [color=#000080]return[/color] $?[color=#000000];[/color] [color=#000080][b]fi[/b][/color]
[color=#000000]}[/color]
do_cleanup[color=#000000]()[/color]
[color=#000000]{[/color]
[color=#000080]echo[/color] [color=#ddbb00]"do_cleanup()"[/color]
[color=#0000ff]rm[/color] [color=#000000]-[/color]v [color=#000000]-[/color]r [color=#000000]$STAGING_DIR[/color]
[color=#000080][b]if[/b][/color] [color=#000000][[/color] $? [color=#000000]-[/color]ne [color=#008800]0[/color] [color=#000000]];[/color] [color=#000080][b]then[/b][/color] [color=#000080]return[/color] $?[color=#000000];[/color] [color=#000080][b]fi[/b][/color]
[color=#000000]}[/color]
[color=#000080][b]if[/b][/color] [color=#000000][ -[/color]z [color=#000000]$1[/color] [color=#000000]];[/color] [color=#000080][b]then[/b][/color] [color=#000080]echo[/color] [color=#ddbb00]"Usage: $0 [source-dir]"[/color][color=#000000];[/color] [color=#000080]exit[/color] [color=#008800]1[/color][color=#000000];[/color] [color=#000080][b]fi[/b][/color]
do_compile[color=#000000];[/color] [color=#000080][b]if[/b][/color] [color=#000000][[/color] $? [color=#000000]-[/color]ne [color=#008800]0[/color] [color=#000000]];[/color] [color=#000080][b]then[/b][/color] [color=#000080]exit[/color] [color=#008800]1[/color][color=#000000];[/color] [color=#000080][b]fi[/b][/color]
do_staging[color=#000000];[/color] [color=#000080][b]if[/b][/color] [color=#000000][[/color] $? [color=#000000]-[/color]ne [color=#008800]0[/color] [color=#000000]];[/color] [color=#000080][b]then[/b][/color] do_cleanup[color=#000000];[/color] [color=#000080]exit[/color] [color=#008800]1[/color][color=#000000];[/color] [color=#000080][b]fi[/b][/color]
do_populate[color=#000000];[/color] [color=#000080][b]if[/b][/color] [color=#000000][[/color] $? [color=#000000]-[/color]ne [color=#008800]0[/color] [color=#000000]];[/color] [color=#000080][b]then[/b][/color] do_cleanup[color=#000000];[/color] [color=#000080]exit[/color] [color=#008800]1[/color][color=#000000];[/color] [color=#000080][b]fi[/b][/color]
do_cleanup[color=#000000];[/color] [color=#000080][b]if[/b][/color] [color=#000000][[/color] $? [color=#000000]-[/color]ne [color=#008800]0[/color] [color=#000000]];[/color] [color=#000080][b]then[/b][/color] [color=#000080]exit[/color] [color=#008800]1[/color][color=#000000];[/color] [color=#000080][b]fi[/b][/color]
[color=#000080]exit[/color] [color=#008800]0[/color]
[/size]

Thanks! I appreciate this. Time to start hacking, again.

Very nice and thanks for sharing the knowledge. Can't wait to try it out.
Sent from my DROIDX using XDA App

This is exactly the type of HOWTO I was looking for. Many thanks!!

roebeet said:
This is exactly the type of HOWTO I was looking for. Many thanks!!
Click to expand...
Click to collapse
Many thanks to you roebeet! I just wanted to give back to the community which has given me so much.

Great instructions but I think you are missing one thing. In staging/system/lib/hw/wlan/bcm4329.ko it is the original .ko from the boot-template.zip file.
I think you need to move and rename kernel/drivers/net/wireless/bcm4329/dhd.ko and use it to overwrite bcm4329.ko. I haven't tried it yet but that's my theory.

If this is intermediate tutorial is there something more basic? I'm interested in learning more, but not sure where to start.

Thanks a bunch to Pershoot, Koush, and yourself for the hard work and documentation.

dblanketyblank said:
If this is intermediate tutorial is there something more basic? I'm interested in learning more, but not sure where to start.
Click to expand...
Click to collapse
Is there a certain step that alludes you, or where you taking aback due to the guide being labeled as an "intermediate tutorial"?
How well do you understand computers and linux?
Do you know anything about computer programming?
What sort of things do you want to learn more about?

browner said:
Great instructions but I think you are missing one thing. In staging/system/lib/hw/wlan/bcm4329.ko it is the original .ko from the boot-template.zip file.
I think you need to move and rename kernel/drivers/net/wireless/bcm4329/dhd.ko and use it to overwrite bcm4329.ko. I haven't tried it yet but that's my theory.
Click to expand...
Click to collapse
I agree that to utilize the bcm4329 module which was compiled during the "make modules" step that you would need to replace the bcm4329.ko from the boot-template.
I haven't done much analysis of this yet, but my assumption is that the rom knows to explicitly load that module. A quick vbindiff shows that the bcm4329.ko (from the latest pershoot release) and the dhd.ko (built from pershoot's git repository) are not identical.
As such, I did not include a step to explicitly remove the bcm4329 kernel module from the boot-template.
I do however, recommend that you pull the latest pershoot release and update the boot-template.zip or wget the latest copy of pershoot's release and use it as the boot-template.zip (I didn't want to have to update the tutorial with each pershoot release to reference the latest package, so I referenced his first release).
I'll research this a bit more this weekend so I have a better understanding. If you want to test out the dhd.ko you should be able to use adb to rmmod bcm4329 and insmod the dhd.ko.
See this thread: http://forum.xda-developers.com/showthread.php?t=906628

I overwrote the bcm4329.ko with dhd.ko and things are working for me. I found this because I was using pershoot's .27 update.zip as a boot-template but building pershoot's .28 kernel. Wifi did not work in this case until I replaced the bcm4329.ko

browner said:
I overwrote the bcm4329.ko with dhd.ko and things are working for me. I found this because I was using pershoot's .27 update.zip as a boot-template but building pershoot's .28 kernel. Wifi did not work in this case until I replaced the bcm4329.ko
Click to expand...
Click to collapse
Thanks for the update. I update the guide with the step.

blackSwanBB said:
[optional] The next git clone steps will copy the repositories to the current directory, all following example will assume that you are cloning to "/usr/src/tegratab".
Code:
mkdir /usr/src/tegratab
Note: You need to be a member of the "src" group to modify the contents of "/usr/src" without sudoing. After adding yourself to the "src" group you need to restart for the permissions to take effect.
Code:
usermod -a -G src `whoami`
sudo reboot
These steps are reversed, you can't create the dir in /src until you are a member of src.
Also a reminder to then cd to that dir would be good.
I'm starting with a fresh ubuntu 10.10 install.
Thanks!
Jim
Click to expand...
Click to collapse

jmdearras said:
blackSwanBB said:
[optional] The next git clone steps will copy the repositories to the current directory, all following example will assume that you are cloning to "/usr/src/tegratab".
Code:
mkdir /usr/src/tegratab
Note: You need to be a member of the "src" group to modify the contents of "/usr/src" without sudoing. After adding yourself to the "src" group you need to restart for the permissions to take effect.
Code:
usermod -a -G src `whoami`
sudo reboot
These steps are reversed, you can't create the dir in /src until you are a member of src.
Also a reminder to then cd to that dir would be good.
I'm starting with a fresh ubuntu 10.10 install.
Thanks!
Jim
Click to expand...
Click to collapse
Thanks for the feedback, I'll update the guide when I get on a proper computer. Let me know if you run into any other inconsistencies or issues.
Click to expand...
Click to collapse

blackswanBB,
I'm new in this android compile
I want to compile rfcomm and dun daemon utility
I have pulled aosp from
repo init -u git://github.com/aosp-gtablet/gtablet-aosp.git
and find source in /external/bluetooth/bluez/rfcomm
Can you assist me what's full command to compile this for gtablet?

Hi,
I have a zpad and not a gtab. gtab kernels generally work but often limit my 1024mb of ram down to 512 (which the gtab has).
Is available ram changeable in the kernel config? I'm assuming there or when you nvflash.
Sent from my GT-I9000 using XDA Premium App

sargorn said:
Hi,
I have a zpad and not a gtab. gtab kernels generally work but often limit my 1024mb of ram down to 512 (which the gtab has).
Is available ram changeable in the kernel config? I'm assuming there or when you nvflash.
Sent from my GT-I9000 using XDA Premium App
Click to expand...
Click to collapse
HIGHMEM is enabled.
it should detect all of the available ram in your ZPAD T2.
please flash the latest kernel, -040511 (http://droidbasement.com/db-blog/?p=1728), and type:
adb shell free
please paste output here.
note:
if you are on the new bootloader for your zpad T2, your downloads will be labelled:
zpad_newbl ([New Bootloader])
thx.

pershoot said:
HIGHMEM is enabled.
it should detect all of the available ram in your ZPAD T2.
please flash the latest kernel, -040511 (http://droidbasement.com/db-blog/?p=1728), and type:
adb shell free
please paste output here.
note:
if you are on the new bootloader for your zpad T2, your downloads will be labelled:
zpad_newbl ([New Bootloader])
thx.
Click to expand...
Click to collapse
Hi,
It's odd actually. The only rom(s) that will give me the full 1gb of ram are stock zpad, bigideas (obviously) and VEGAn 5.1. This is with or without your kernel.
All the other roms I've tried limit the ram down to 512mb. (All the CM7 variants, Zpad clean, stock gtab).
VEGAn 5.1
Code:
total used free shared buffers
Mem: 966656 205964 760692 0 3896
Swap: 0 0 0
Total: 966656 205964 760692
Zpad Clean w/ latest pershoot kernel.
Code:
total used free shared buffers
Mem: 446868 178456 268412 0 8072
Swap: 0 0 0
Total: 446868 178456 268412

sargorn said:
Hi,
It's odd actually. The only rom(s) that will give me the full 1gb of ram are stock zpad, bigideas (obviously) and VEGAn 5.1. This is with or without your kernel.
All the other roms I've tried limit the ram down to 512mb. (All the CM7 variants, Zpad clean, stock gtab).
VEGAn 5.1
Code:
total used free shared buffers
Mem: 966656 205964 760692 0 3896
Swap: 0 0 0
Total: 966656 205964 760692
Zpad Clean w/ latest pershoot kernel.
Code:
total used free shared buffers
Mem: 446868 178456 268412 0 8072
Swap: 0 0 0
Total: 446868 178456 268412
Click to expand...
Click to collapse
that is because of the CMD line used when packing the rom/boot.
if you build from src, you can just update your cmd line in BoardConfig.mk, rebuild, and you'll be good.

Wetware Kernel Panic
Being a curious kind of guy, I printed out the instructions and worked my way through them. Had a couple of permissions issues and discovered the files downloaded to my home directory so I had to move them. I worked my way up to the gui kernel configurator and had a wetware kernel panic. Lots of options, checkboxes, etc. but I realized that although the instructions were good, I was not equipped to do anything with the tool presented to me. So.... reading some of the posts here, there are obviously others to who this is familiar ground. While I know some knowledge is acquired over years, I also suspect that there are other guides that would help the less informed reach a point where this tutorial could be useful. So - this is an intermediate guide. Where could a padawan find the beginners guide to help make this one more comprehensible? I'm willing to study but I'm not sure where or what. Using the gtab as a model, I'd like to learn how to manipulate all the various components or at least understand how they are manipulated. Anyone want to throw me a line?

Related

[Q] compile own kernel? configuration

I used rotohammer's method for backing up the AT&T Galaxy Tab and it worked wonderfully. I compiled the GT-P1000_Kernel patched with SGH-I987_Kernel and did a standard make and then flashed the zImage onto the galaxy. It resulted in kernel panic. Does anyone know what parameters to use with make or configuration changes that need to be made?
Thanks
ps. when I used heimdall, I only "heimdall flash --kernel zImage".
I also couldn't find a config.gz in the /proc dir. Does anybody know why it is missing and what has taken its place?
success at last
Yay, it works now! thanks roto for the initramfs tip.
what kind of modification did u make to the kernel? do you mind sharing?
[Q] how did you compile your own kernel?
Hi,
I'm in disperate need to do this. I have downloaded the sources from samsung opensource -> followed the instruction in the README.txt -> compiled the kernel and the modules successfully -> used the initramfs from the stock zImage -> but when I flash the zImage (Size ~ 432 KB) I get kernel panic.
I do not think it is possible to boot in verbose mode or have a serial port console log.
letolkki: please share with us how you did it? how did you compile a zImage which boots.??????
share with us please!
I used make menuconfig to specify the location of the initramfs (compression to none). Do not use the build script above the root as that seemed to mess things up for me. The size of my kernel is approx ~5meg with the initramfs included and ~3 without. Then used Heimdall to push it on.
I didn't make any mods as of yet. Just a quest for knowledge and tinkering. Just making sure I can when I need to.
What exactly did you modify? Here's my config, as related to INITRAMFS:
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE=""
CONFIG_RD_GZIP=y
CONFIG_RD_BZIP2=y
CONFIG_RD_LZMA=y
CONFIG_INITRAMFS_COMPRESSION_NONE=y
# CONFIG_INITRAMFS_COMPRESSION_GZIP is not set
# CONFIG_INITRAMFS_COMPRESSION_BZIP2 is not set
# CONFIG_INITRAMFS_COMPRESSION_LZMA is not set
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
My kernel size is only 2.9 megs. What else did you specify that has your kernel at 5 megs?
Thanks
you don't have the initramfs source file specified. Put the complete path to the initramfs in the config.
Even when I specified the file location generated during the compile, it still didn't work...size only 3 meg. Are you using the ramdisk.img generated and output into Android/out/target/product/...? Or, did you pull boot.img from the device and split ramdisk.img from the kernel?
chuckbeasley said:
Even when I specified the file location generated during the compile, it still didn't work...size only 3 meg. Are you using the ramdisk.img generated and output into Android/out/target/product/...? Or, did you pull boot.img from the device and split ramdisk.img from the kernel?
Click to expand...
Click to collapse
yep, i pulled it from the device
Would you please tell me how you did it exactly? I've been attempting over the past several hours and haven't been able to find a tool that would split boot.img. They keep telling me that it's not a valid image, but I pulled it from the device.
chuckbeasley said:
Would you please tell me how you did it exactly? I've been attempting over the past several hours and haven't been able to find a tool that would split boot.img. They keep telling me that it's not a valid image, but I pulled it from the device.
Click to expand...
Click to collapse
I used the script from
http://forum.xda-developers.com/wiki/index.php?title=Extract_initramfs_from_zImage
to get the initramfs from the zImage pulled from the device.
Much appreciated! I'll try this later tonight. Right now, I need a break...
I used verizon_zImage from ClockworkMod, but it fails the extraction with a gzip invalid compressed data--format violated error. How can I pull the zImage directly from the phone? It seems that boot.img doesn't work either.
Thanks
Here are the error messages I'm receiving for both verizon_zImage and boot.img, which I pulled from the GT:
[email protected]:~/ramdisk$ ./extract_initramfs verizon_zImage
-I- Extracting kernel image from verizon_zImage (start = 13117)
gzip: stdin: decompression OK, trailing garbage ignored
5979431+0 records in
5979431+0 records out
5979431 bytes (6.0 MB) copied, 195.453 s, 30.6 kB/s
-I- Extracting compressed cpio image from kernel image (start = 5410216)
gzip: stdin: invalid compressed data--format violated
-I- Extracting initramfs image from /tmp/cpio.img (start = , end = 11)
dd: invalid number `'
[email protected]:~/ramdisk$ ./extract_initramfs boot.img
-I- Extracting kernel image from boot.img (start = 13117)
gzip: stdin: decompression OK, trailing garbage ignored
-I- Extracting compressed cpio image from kernel image (start = 5410216)
gzip: stdin: invalid compressed data--format violated
-I- Extracting initramfs image from /tmp/cpio.img (start = , end = 11)
dd: invalid number `'
Looks like the script had a bug and has been updated. Here's the link: http://forum.xda-developers.com/showthread.php?p=8679959
Here's the updated script that allowed me to extract initramfs.cpio from boot.img:
#!/bin/sh
# This is an update version of the script found at
# http://forum.xda-developers.com/wiki/index.php?title=Extract_initramfs_from_zImage
#
# The problem with that script is that the gzip magic number occasionally occur
# naturally, meaning that some non-compressed files get uncompressed.
zImage=$1
#========================================================
# 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 -n "-I- Extracting kernel image from $zImage (start = $pos)"
dd if=$zImage bs=1 skip=$pos | gunzip > /tmp/kernel.img
#==========================================================================
# 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!!!
#==========================================================================
start=`grep -a -b -m 1 --only-matching '070701' /tmp/kernel.img | head -1 | cut -f 1 -d :`
end=`grep -a -b -m 1 --only-matching 'TRAILER!!!' /tmp/kernel.img | head -1 | cut -f 1 -d :`
if [ $start = "" || $end = "" ]; then
#========================================================================
# the cpio archive must be archived
#========================================================================
echo "-I- Extracting compressed cpio image from kernel image (start = $pos)"
pos=`grep -P -a -b -m 1 --only-matching $'\x1F\x8B\x08' /tmp/kernel.img | cut -f 1 -d :`
dd if=/tmp/kernel.img bs=1 skip=$pos | gunzip > /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 -n "-I- Already uncompressed cpio.img, not decompressing"
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)"
dd if=$inputfile bs=1 skip=$start count=$count > initramfs.cpio
chuckbeasley said:
I used verizon_zImage from ClockworkMod, but it fails the extraction with a gzip invalid compressed data--format violated error. How can I pull the zImage directly from the phone? It seems that boot.img doesn't work either.
Thanks
Click to expand...
Click to collapse
I used rotohammer's backup method to pull the zImage from the device.
http://forum.xda-developers.com/showthread.php?t=850359&highlight=backup+install+kernel
So do you guys have working kernels ?
I know from my Nexus days that custom kernels can made a massive difference to performance on the beast, so I am looking forward to seeing what people can do with the TAB
Keep up the good work !
I've built my own kernel to see if I could work around the dialing limitation on my VZW tab. Right now, it crashes randomly, but it does boot! I'm looking into the difference between the international version of Onedram and Verizon's version and why Verizon includes a OnedramRecovery unit. My kernel doesn't reference OnedramRecovery and I made more mods. So, I haven't isolated what is causing the instability. Right now, I'm back to Koush's kernel. I'll keep you informed on my progress.
Sent from my SCH-I800 using XDA App

[HowTo] homebrew your custom Ubuntu image for Iconia A500

I'm posting this in a new thread as requested...
There is a simple way to preapare a custom Ubuntu image file compiled for ARMEL with only the packages and functionalities you need.
For this procedure you will need
- a linux machine with working ADB (I tried it on a x64 ubuntu machine)
- a rooted Iconia A500 with busybox installed
- a little knowledge about what you're doing, but just a little.
1. Install Rootstock
on your linux machine, open up the terminal and type
Code:
sudo apt-get install rootstock
If you use at least Ubuntu Karmic, it should automatically pull all the dependencies, otherwise you'll have to manually install Qemu and a newer debootstrap.
2. Create the tarball
you're ready to download the packages and prepare the tarball.
Remember: rootstock doesn't automatically include a kernel, so you'll have to manually include it in the package list
Here's the syntax for a basic run (run "man rootstock" for all the parameters):
Code:
sudo rootstock \
--fqdn [COLOR="Red"]<YOUR_CHOSEN_HOSTNAME>[/COLOR] \
--login [COLOR="Red"]<YOUR_CHOSEN_USERNAME>[/COLOR] \
--password [COLOR="Red"]<YOUR_CHOSEN_PASSWORD>[/COLOR] \
--imagesize [COLOR="Red"]<IMAGE_SIZE_IN_GB>[/COLOR]G \
--seed [COLOR="Red"]<LIST_OF_PACKAGES_SEPARATED_BY_COMMAS>[/COLOR]
Here's an example for a 2GB image with OMAP kernel and a complete Kubuntu-desktop distribution:
Code:
sudo rootstock \
--fqdn ubuntu \
--login ubuntu \
--password ubuntu \
--imagesize 2G \
--seed linux-image-omap,kubuntu-desktop
In --seed you can specify whatever package you want. You could start with just the kernel and build-essential, then add whatever you need. A good start could be like this:
Code:
--seed linux-image-omap,build-essential,lxde,tightvncserver,openssh-server
This will give you a running ubuntu with a very light, performance-oriented desktop environment (lxde) with ssh and vnc.
Remember: It's still possible to add new packages with apt-get from chroot whenever you want.
Once you have chosen the packages you want, you just have to press enter and rootstock will automatic download the packages and prepare the tarball.
You'll end up with a file named "armel-rootfs-<TIMESTAMP>.tgz"
3. Prepare the img file
This is very easy and quick:
Code:
dd if=/dev/zero of=arm_ubuntu.img bs=1MB count=0 seek=[COLOR="Red"]<SIZE_IN_MB>[/COLOR]
The seek parameter defines the size in MB of your image. make it as large as you want, it should at least be as big as the size you selected for the tarball (2G in my example).
Remember: 1 GB = 1024 MB
Now we format the image. Since the Iconia supports ext4 file system, we can use it!
Code:
mkfs.ext4 -F arm_ubuntu.img
You may want to pass other flags to define advanced options, labels and reserved blocks, but this is the least you need to make it work.
4. Decompress
Now we have to mount the img file in a loop:
Code:
sudo mount -o loop arm_ubuntu.img /mnt
and decompress the tarball into it.
Code:
sudo tar -C /mnt -zxf armel-rootfs-<TIMESTAMP>.tgz
It's done!
[OPTIONAL]
This is the right time to put custom scripts in /mnt/usr/bin like this one to start the vnc server with the correct geometry for the A500:
Code:
#!/bin/bash
rm -fr /tmp/.X1*
vncserver -geometry 1280x752
NB: the A500 screen is 1280x800, but the honeycomb statusbar (1280x48px) is always on top. To avoid panning to show the ubuntu menu bar, we just subtract those 48 pixels from the ubuntu vertical resolution.
Now we just umount it.
Code:
sudo umount /mnt
5. Load on the tablet and get it running
The script to mount and boot is derived from the one in the Backtrack 5 Thread.
Load the img file on the tablet with
Code:
adb push arm_ubuntu.img /sdcard/ubuntu/arm_ubuntu.img
It will take a loooong time and there's no progress bar, so just have faith.
Next, we prepare the boot script. The only thing you need to do is to put your username in (the one you chose in rootstock).
Code:
perm=$(id|cut -b 5)
if [ "$perm" != "0" ];then echo "This Script Needs Root! Type : su";exit;fi
mount -o remount,rw /dev/block/mmcblk0p5 /system
export kit=/sdcard/ubuntu
export bin=/system/bin
export mnt=/data/local/mnt
mkdir -p $mnt
export PATH=$bin:/usr/bin:/usr/local/bin:/usr/sbin:/bin:/usr/local/sbin:/usr/games:$PATH
export TERM=linux
export USER=[B][COLOR="Red"]<THE_USERNAME_YOU_CHOSE_BEFORE>[/COLOR][/B]
export HOME=/home/$USER
export stor=$mnt/home/$USER/storage
export sdcard=$stor/sdcard
export extsd=$stor/external_sd
export usb=$stor/USB_storage
if [ -b /dev/loop2 ]; then
echo "Loop device exists"
else
busybox mknod /dev/loop2 b 7 0
fi
mount -o loop,rw,noatime -t ext4 $kit/arm_ubuntu.img $mnt
echo "mounting storage devices in $stor..."
mkdir -p $sdcard
mkdir -p $extsd
mkdir -p $usb
busybox mount --bind /mnt/sdcard $sdcard
busybox mount --bind /mnt/external_sd $extsd
busybox mount --bind /mnt/usb_storage $usb
mount -t devpts devpts $mnt/dev/pts
mount -t proc proc $mnt/proc
mount -t sysfs sysfs $mnt/sys
busybox sysctl -w net.ipv4.ip_forward=1
echo "nameserver 8.8.8.8" > $mnt/etc/resolv.conf
echo "127.0.0.1 localhost ubuntu" > $mnt/etc/hosts
busybox chroot $mnt /bin/bash
echo "Shutting down Ubuntu ARM for Iconia A500"
umount $sdcard
umount $extsd
umount $usb
umount $mnt/dev/pts
umount $mnt/proc
umount $mnt/sys
umount $mnt
Once done, we can save the file as startubuntu and adb push it to the tab. (the same folder as the img is fine)
Done! We run it by invoking the startubuntu script from the android terminal emulator (must be in superuser mode)
I hope you found this how-to useful.
And we use this distro via our tablets ssh client?
EDIT: sorry my bad Never read code while tired
Hi,
i am running ubuntu natty.
and i got this error:
...
Setting up wireless-crda (1.13) ...
Setting up linux-image-2.6.38-8-omap (2.6.38-8.42) ...
Running depmod.
update-initramfs: Generating /boot/initrd.img-2.6.38-8-omap
/bin/df: Warning: cannot read table of mounted file systems: No such file or directory
Not sure if it is fatal. rootstock has created successful the rootfs
reida010 said:
Hi,
i am running ubuntu natty.
and i got this error:
...
Setting up wireless-crda (1.13) ...
Setting up linux-image-2.6.38-8-omap (2.6.38-8.42) ...
Running depmod.
update-initramfs: Generating /boot/initrd.img-2.6.38-8-omap
/bin/df: Warning: cannot read table of mounted file systems: No such file or directory
Not sure if it is fatal. rootstock has created successful the rootfs
Click to expand...
Click to collapse
Same happened to me. Totally not fatal. the tarball is good.
For everyone out there:
I would like your help with testing. I have a crash on start problem with firefox in all the images I tried. Does any of you have the same issue?
Hi,
i get
Code:
Loop device exists
then i did
Code:
echo "$kit/arm_ubuntu.img"
and i get
Code:
/sdcard/ubuntu/arm_ubuntu.img
but then i get
Code:
mount: cannot setup loop device: No such file or directory
any ideas?
Because of firefox.
i read a while ago a tweet about a bug in meego and ubuntu in firefox for arm.
when it is this bug then you should try firefox trunk because it is fixed.
but i cannot refind it :-(
edit:
bugzilla.mozilla.org/show_bug.cgi?id=634594
I was searching for that today, thanks mate. Nice Tutorial =D
reida010 said:
Hi,
but then i get
Code:
mount: cannot setup loop device: No such file or directory
any ideas?
edit:
bugzilla.mozilla.org/show_bug.cgi?id=634594
Click to expand...
Click to collapse
i have the same problem. You should make loop file not in /mnt/sdcard, but in /mnt/external_sd.
Kh_Shad said:
i have the same problem. You should make loop file not in /mnt/sdcard, but in /mnt/external_sd.
Click to expand...
Click to collapse
That would apply only if you put the image file in the external MicroSD, if you have put it in the internal memory (as described in the tutorial) the path is /mnt/sdcard. Also, the speed of the internal memory is better.
Hi,
i found out how i can make it work
but it's strange.
i don't works when i do
Code:
sh ./startubuntu
but with this it works fine:
Code:
/system/bin/sh ./startubuntu
Is this maybe because i didn't use adb.
Someone told me that copy paste might change the permissions (what the ****! really?)
on my tablet startubuntu is not executable.
And it doesn't change anything when i do chmod 755 startubuntu
but after moving it to /system/bin chmod works fine.
After then i can always just run
Code:
su
startubuntu
and ubuntu is up and running.
(many thanks by the way :-D)
Sorry guys, will this method produce a native Ubuntu install similair to how Wubi works? Or is this like the chroot methods were we have to VNC into the distro from within Android?
It is native!!!
but you need vnc to access the xserver
On my n900 i used xephyr but i don't think this is working for android because afaik they don't use X. (n900 is so cool for linux geeks ;-D)
edit:
if you mean with 'native' that it will replace android -> no -> it is a chroot
Yeah that answered my question. Thank you
I'm not going to bother until there is a native distro running with full system resources. I guess with the current bootloader situation that day may never come :-(
It failed in creating the image for me... and it seems like a error in the package linux-image-2.6.38-8-omap
[TRIM]
Need to get 37.4 MB of archives.
After this operation, 98.3 MB of additional disk space will be used.
Get:1 //ports.ubuntu.com/ubuntu-ports/ natty/main wireless-crda armel 1.13 [15.0 kB]
Get:2 //ports.ubuntu.com/ubuntu-ports/ natty/main linux-image-2.6.38-8-omap armel 2.6.38-8.42 [19.8 MB]
Get:3 //ports.ubuntu.com/ubuntu-ports/ natty/main devio armel 1.2-1build1 [16.9 kB]
Get:4 //ports.ubuntu.com/ubuntu-ports/ natty/main flash-kernel armel 2.28ubuntu19 [13.1 kB]
Get:5 //ports.ubuntu.com/ubuntu-ports/ natty/universe kubuntu-mobile armel 1.218 [2720 B]
Get:6 //ports.ubuntu.com/ubuntu-ports/ natty/main linux-firmware all 1.52 [17.5 MB]
Get:7 //ports.ubuntu.com/ubuntu-ports/ natty/main linux-image-omap armel 2.6.38.8.22 [2394 B]
Fetched 37.4 MB in 5min 29s (113 kB/s)
Selecting previously deselected package wireless-crda.
(Reading database ... 9309 files and directories currently installed.)
Unpacking wireless-crda (from .../wireless-crda_1.13_armel.deb) ...
Selecting previously deselected package linux-image-2.6.38-8-omap.
Unpacking linux-image-2.6.38-8-omap (from .../linux-image-2.6.38-8-omap_2.6.38-8.42_armel.deb) ...
Done.
Selecting previously deselected package devio.
Unpacking devio (from .../devio_1.2-1build1_armel.deb) ...
Selecting previously deselected package flash-kernel.
Unpacking flash-kernel (from .../flash-kernel_2.28ubuntu19_armel.deb) ...
Selecting previously deselected package kubuntu-mobile.
Unpacking kubuntu-mobile (from .../kubuntu-mobile_1.218_armel.deb) ...
Selecting previously deselected package linux-firmware.
Unpacking linux-firmware (from .../linux-firmware_1.52_all.deb) ...
Selecting previously deselected package linux-image-omap.
Unpacking linux-image-omap (from .../linux-image-omap_2.6.38.8.22_armel.deb) ...
Setting up wireless-crda (1.13) ...
Setting up linux-image-2.6.38-8-omap (2.6.38-8.42) ...
Running depmod.
Failed to run depmod
dpkg: error processing linux-image-2.6.38-8-omap (--configure):
subprocess installed post-installation script returned error exit status 1
Setting up devio (1.2-1build1) ...
No apport report written because MaxReports is reached already
Setting up flash-kernel (2.28ubuntu19) ...
Setting up kubuntu-mobile (1.218) ...
E: Second stage build in chroot failed !
E: Please see the log to see what went wrong.
Setting up linux-firmware (1.52) ...
I: Cleaning up...
dpkg: dependency problems prevent configuration of linux-image-omap:
linux-image-omap depends on linux-image-2.6.38-8-omap; however:
Package linux-image-2.6.38-8-omap is not configured yet.
dpkg: error processing linux-image-omap (--configure):
dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
Errors were encountered while processing:
linux-image-2.6.38-8-omap
linux-image-omap
E: Sub-process /usr/bin/dpkg returned an error code (1)
I: Umounting temporary Image
I keep getting a failure also!
Ceck out both of my log files below.
tholmewood said:
Sorry guys, will this method produce a native Ubuntu install similair to how Wubi works? Or is this like the chroot methods were we have to VNC into the distro from within Android?
Click to expand...
Click to collapse
It is a chroot/vnc method, currently the only method available to run linux on this device, because of the locked bootloader... I seriously hope for a chance to dual boot in the future.
i was wondering what packages are needed in order to create an ubuntu netbook Edition? Is the A500 powerful enough for that kind of interface?
Thought you guys might be interested in this post.
http://forum.xda-developers.com/showpost.php?p=15156543&postcount=64
Have fun!
@p-ille
Have you tried firefox daily?
Did it work?
reida010 said:
@p-ille
Have you tried firefox daily?
Did it work?
Click to expand...
Click to collapse
Not really, my job is killing me these days... I'll try it asap!
sent from my Iconia A500
p-ille said:
Not really, my job is killing me these days... I'll try it asap!
sent from my Iconia A500
Click to expand...
Click to collapse
You realize what a pain that tutorial is to follow? Could you please provide a pre built image at least if asking for scripts is probably way too much?

[Guide] How to build kernel from source on ubuntu 13.10...

Here are the steps to build your own kernel from source. This guide is showing you how to build your first the stock kernel on your own..... It is kick start for making things on your own way....
This guide applies to i9082/i9082L and general devices also.:laugh:
This guide assumes you have basic knowledge of linux and linux system configuration.
Prerequisites
1. Ubuntu 13.10
2. patience...lots and lots of patience.
Click to expand...
Click to collapse
Here starts the fun:-
1. Installing ubuntu 13.10.
This can be done in 3 ways and I am not gonna cover it all.
- along with windows ,i.e dual boot
- in virtualbox within windows
- as a windows application installation with "wubi" installer
For starting user i think second option, i.e installing in virtualbox is best.
here's starting tutorials
http://www.youtube.com/watch?v=tDDRFiwHujg
NOTE - you should have atleast 100 Gb partion for virtualbox.
Click to expand...
Click to collapse
2. Getting the kernel source.
Download source from http://opensource.samsung.com/
Type i9082 in search box and download "GT-I9082_SEA_JB_Opensource_Update1.zip"
After download unzip the source into new folder in home directory.
Type in terminal from you kernel directory.
Code:
unzip GT-I9082_SEA_JB_Opensource_Update1.zip
Then extract tar.
Code:
mkdir kernel
tar xzf kernel.tar.gz -C kernel
Click to expand...
Click to collapse
3. Setting up building environment.
Copied from http://soupdawg.wordpress.com/
All credits goes to
mysteriously inconspicuous
Click to expand...
Click to collapse
Initializing a fresh Android Build Environment in Ubuntu 13.10 sucks, right? The instructions at the AOSP page are outdated and inaccurate. Near as I can tell, they try to have you install 2 JDKs, the first one not even being the correct link for Saucy Salamander, and the second being OpenJDK. Which might work. But I dunno about all that, I’d rather have Oracle’s official stamp when it comes to building for Android.
Currently most of the guides are up to 12.04 LTS, which is fine and dandy, but being on the cutting edge is nice too.
This guide applies to all variations of Ubuntu 13.10 Saucy Salamander 64 bit. Do not use the 32 Bit version. Also, PAY CLOSE ATTENTION when to use “sudo” and when to not. It can make things funky if you do something as root that you shouldn’t.
Much thanks goes out to Google, ProTekk, Canonical, and everyone else that I read a random paragraph here and snippet there.
First, let’s set up the correct JDK.
Many of you probably have some kind of wrong Java installed unless you’re starting with a fresh Ubuntu base, and even then maybe.
Let’s get rid of that. Copy and paste this into a Terminal window:
Code:
sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*
Follow the instructions to remove OpenJDK.
If you must keep it, it’s possible. But I’m not going to tell you how to do it here. I don’t want any chance of confusion or mistake.
Now copy and paste the following into the Terminal:
Code:
sudo add-apt-repository ppa:webupd8team/java
This will add the correct PPA to your system for updated builds of Java 6 JDK that are compatible with 13.10.
No more unrecognized Java version errors! And it will update automatically with the rest of your system.
Next, we actually need to install the package. More copy-paste:
Code:
sudo apt-get update && sudo apt-get install oracle-java6-installer
Follow the on-screen instructions. You have to Accept the Licensing Agreement to complete the install. Hopefully no human centipede clauses.
Let’s make sure the correct version of Java is activated, run the following Terminal command:
Code:
java -version
You should see something like the following:
Code:
java version “1.6.0_45″
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.12-b01, mixed mode)
Ok, back to a fresh Terminal prompt. Time for installing the guts to build stuff in Ubuntu:
Code:
sudo apt-get install git-core gnupg ccache lzop flex bison gperf build-essential zip curl zlib1g-dev zlib1g-dev:i386 libc6-dev lib32ncurses5 lib32z1 lib32bz2-1.0 lib32ncurses5-dev x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 lib32z-dev libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc readline-common libreadline6-dev libreadline6 lib32readline-gplv2-dev libncurses5-dev lib32readline5 lib32readline6 libreadline-dev libreadline6-dev:i386 libreadline6:i386 bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev lib32bz2-dev libsdl1.2-dev libesd0-dev squashfs-tools pngcrush schedtool libwxgtk2.8-dev python
When that is done installing, run the following command in your Terminal window:
Code:
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
That’s it on the package side of things.
You guessed it, time for more Terminal. This really is the easiest way, seriously. And it’s totally worth it when you’re basking in the glory of a bunch of people on XDA.
The binary for a program called “repo” will let you talk to git servers and download all that precious source code. That second part after the && allows it to be executable:
Code:
mkdir ~/bin && curl http://commondatastorage.googleapis.com/git-repo-downloads/repo ~/bin/repo && chmod a+x ~/bin/repo
Use your favorite text editor to open ~/.bashrc
I like nano:
Code:
sudo nano ~/.bashrc
At the very bottom, add the following line:
Code:
export PATH=~/bin:$PATH
Save it. In nano that would be Ctrl-O and then Enter. Then Ctrl-X to exit back to a prompt. Restart bash:
Code:
source ~/.bashrc
That should be everything. Now you’re ready to build Android the right way. Luck!
4. Installing toolchain
Anyway, first order of the day is to get the official arm toolchain, which I'm going to install in /usr/local/share/ since I plan to keep using it for some time:
Code:
# cd /usr/local/share/
# git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6
Cloning into 'arm-eabi-4.6'...
remote: Sending approximately 124.64 MiB ...
remote: Counting objects: 33, done
remote: Finding sources: 100% (33/33)
remote: Total 580 (delta 146), reused 580 (delta 146)
Receiving objects: 100% (580/580), 124.64 MiB | 715 KiB/s, done.
Resolving deltas: 100% (146/146), done.
Now, let's add that arm toolchain to our path:
Code:
# export PATH=$PATH:/usr/local/share/arm-eabi-4.6/bin
# arm-eabi-gcc --version
arm-eabi-gcc (GCC) 4.6.x-google 20120106 (prerelease)
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5. Compiling kernel
Now we need to set the variables that will tell the OS that we're cross compiling (again, something that you may want to do in your .profile using something like alias cross='export ARCH="arm";export SUBARCH="arm";export CROSS_COMPILE="arm-eabi-"'):
Code:
# export ARCH=arm
# export SUBARCH=arm
# export CROSS_COMPILE=arm-eabi-
Finally, we can initialize our default config and get going:
Prepare source for new compilation
Code:
make bcm28155_capri_ss_baffin_rev05_defconfig
HOSTCC scripts/basic/fixdep
HOSTCC scripts/kconfig/conf.o
SHIPPED scripts/kconfig/zconf.tab.c
SHIPPED scripts/kconfig/lex.zconf.c
SHIPPED scripts/kconfig/zconf.hash.c
HOSTCC scripts/kconfig/zconf.tab.o
HOSTLD scripts/kconfig/conf
arch/arm/mach-capri/custom_boards/Kconfig:19:warning: defaults for choice values not supported
arch/arm/mach-capri/custom_boards/Kconfig:25:warning: defaults for choice values not supported
arch/arm/mach-capri/custom_boards/Kconfig:31:warning: defaults for choice values not supported
arch/arm/mach-capri/custom_boards/Kconfig:37:warning: defaults for choice values not supported
#
# configuration written to .config
#
Code:
# make -j*
(...)
OBJCOPY arch/arm/boot/zImage
Kernel: arch/arm/boot/zImage is ready
* stands for number of cpus your computer has.like my has 4 so I will make it j4
* bcm28155_capri_ss_baffin_rev05_defconfig is stock config, for cm11 you will have diffrent config and for some cutom kernel something else.
6. Crafting an Android boot.img
The format of this Android boot images can be found in the bootimg.h of the mkbootimg tool from the android platform/system/core source. I guess we have to start somewhere, and we'll need to produce our own images, so let's start by fetching and recompiling mkbootimg then.
Code:
# git clone https://android.googlesource.com/platform/system/core bootimg-tools
Cloning into 'bootimg-tools'...
remote: Counting objects: 92, done
remote: Finding sources: 100% (92/92)
remote: Total 19302 (delta 11674), reused 19302 (delta 11674)
Receiving objects: 100% (19302/19302), 5.87 MiB | 655 KiB/s, done.
Resolving deltas: 100% (11674/11674), done.
# cd bootimg-tools/libmincrypt/
# gcc -c *.c -I../include
# ar rcs libmincrypt.a *.o
# cd ../mkbootimg
# gcc mkbootimg.c -o mkbootimg -I../include ../libmincrypt/libmincrypt.a
mkbootimg.c: In function 'main':
mkbootimg.c:245:9: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]
# cp mkbootimg /usr/local/bin/
# cd ../cpio
# gcc mkbootfs.c -o mkbootfs -I../include
# cp mkbootfs /usr/local/bin/
New improved bootimg-tools can be found at.
Code:
# wget https://github.com/pbatard/bootimg-tools/archive/master.zip
lets compile from there
Code:
# cd /usr/src/android/bootimg-tools/mkbootimg/
# wget https://raw.github.com/pbatard/bootimg-tools/master/mkbootimg/unmkbootimg.c
# gcc -o unmkbootimg unmkbootimg.c
# cp unmkbootimg /usr/local/bin/
Now at last, you have the minimum of unmkbootimg, mkbootimg and mkbootfs installed in your path, and we can get going with our testing of the kernel.
I'll assume that you have a /usr/src/android/boot where you copied your boot.img, so let's get going....
Code:
# cd /usr/src/android/boot/
# ls
boot.img
# unmkbootimg -i boot.img
kernel written to 'kernel' (4738320 bytes)
ramdisk written to 'ramdisk.cpio.gz' (516287 bytes)
To rebuild this boot image, you can use the command:
mkbootimg --base 0 --pagesize 4096 --kernel_offset 0xa2008000 --ramdisk_offset 0xa3000000 --second_offset 0xa2f00000 --tags_offset 0xa2000100 --cmdline 'console=ttyS0,115200n8 [email protected] androidboot.console=ttyS0 vc-cma-mem=0/[email protected]' --kernel kernel --ramdisk ramdisk.cpio.gz -o boot.img
Code:
# ls
boot.img kernel ramdisk.cpio.gz
As an aside that you don't need to run, but since it should be elementary that this is the basic functionality you want from a proper boot image unpack tool, we can confirm that the data provided by the unpack tool will produce a boot.img that is binary identical to the original one-
Code:
# mkbootimg --base 0 --pagesize 4096 --kernel_offset 0xa2008000 --ramdisk_offset 0xa3000000 --second_offset 0xa2f00000 --tags_offset 0xa2000100 --cmdline 'console=ttyS0,115200n8 [email protected] androidboot.console=ttyS0 vc-cma-mem=0/[email protected]' --kernel kernel --ramdisk ramdisk.cpio.gz -o myboot.img
Code:
# ls
boot.img kernel myboot.img ramdisk.cpio.gz
# cmp -l boot.img myboot.img
#
Moving on. Since we just want to test a kernel, we shouldn't really have to touch the cpio image (ramdisk), but then again, my goal here is to give you as many pointers as I can, so we might as well see how we craft our own ramdisk while we're at it. What we're going to do here, as an academical exercise, is add an it_works file at the root of the filesystem, which we'll look for after we booted, to confirm that can use our modified stuff all the way through.
Code:
# mkdir ramdisk
# cd ramdisk
# gunzip -c ../ramdisk.cpio.gz | cpio -iu
1841 blocks
# ls
charger init.superuser.rc
data init.trace.rc
default.prop init.usb.rc
dev lpm.rc
file_contexts proc
fstab.capri_ss_baffin property_contexts
fstab.goldfish res
init sbin
init.bcm281x5.usb.rc seapp_contexts
init.capri_ss_baffin.rc sepolicy
init.cm.rc sys
init.environ.rc system
init.goldfish.rc ueventd.capri_ss_baffin.rc
init.log.rc ueventd.goldfish.rc
init.rc ueventd.rc
init.recovery.capri_ss_baffin.rc
# touch it-works
# ls
charger init.superuser.rc
data init.trace.rc
default.prop init.usb.rc
dev it-works
file_contexts lpm.rc
fstab.capri_ss_baffin proc
fstab.goldfish property_contexts
init res
init.bcm281x5.usb.rc sbin
init.capri_ss_baffin.rc seapp_contexts
init.cm.rc sepolicy
init.environ.rc sys
init.goldfish.rc system
init.log.rc ueventd.capri_ss_baffin.rc
init.rc ueventd.goldfish.rc
init.recovery.capri_ss_baffin.rc ueventd.rc
# find . | cpio -o -H newc | gzip > ../myramdisk.cpio.gz
1850 blocks
# cd ..
# ls
boot.img kernel myramdisk.cpio.gz ramdisk/ ramdisk.cpio.gz
We're finally set for the last part, where we copy the kernel we compiled earlier, and invoke mkbootimg with the set of parameters we got from unmkbootimg, and use both our modified kernel and cpio image:
Code:
# cp ~/kernel/arch/arm/boot/zImage .
# ls
boot.img kernel myramdisk.cpio.gz ramdisk/ ramdisk.cpio.gz zImage*
# mkbootimg --base 0 --pagesize 4096 --kernel_offset 0xa2008000 --ramdisk_offset 0xa3000000 --second_offset 0xa2f00000 --tags_offset 0xa2000100 --cmdline 'console=ttyS0,115200n8 [email protected] androidboot.console=ttyS0 vc-cma-mem=0/[email protected]' --kernel zImage --ramdisk myramdisk.cpio.gz -o myboot.img
# ls
boot.img kernel myboot.img myramdisk.cpio.gz ramdisk/ ramdisk.cpio.gz zImage*
7. testing new boot.img
Finally, a custom boot.img we can test. Let's press on by copying this myboot.img file into the directory we have adb and fastboot installed and run the following ser of commands which, unlike what many other guides seem to advise (what the heck, guys?), is NOT going to flash the kernel/boot.img but simply run it from memory. This means that, in case there's any mishap, you can simply power the "grand" off and you'll be good as new:
Code:
# ./adb start-server
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
# ./adb reboot bootloader
# ./fastboot boot myboot.img
downloading 'boot.img'...
OKAY [ 0.223s]
booting...
OKAY [ 0.023s]
finished. total time: 0.246s
All in all, this looks fairly good. And a quick look to the root filesystem (through adb shell or through ssh) will also confirm that our it_works file is there, so we can also add whatever we want on the initial filesystem. Neat!
From there on, you can go ahead and tweak your kernel and initial filesystem exactly as you see fit. And after you have tested that everything works as it should, you can go ahead and flash the boot partition with your shiny custom boot.img, using:
ODIN or cwm flashable zip
This is last part...
8. making flashable files
Tar your boot.img file so it can be flashed with Odin.
tar cvf mynewkernel.tar boot.img
md5sum -t mynewkernel.tar >> mynewkernel.tar
mv mynewkernel.tar mynewkernel.tar.md5
Click to expand...
Click to collapse
Note:- myboot.img is renamed to boot.img
9.Flashing kernel through ODIN
Flash mynewkernel.tar.md5 with odin under PDA. Please follow the flashing guides found in other posts.
Hope i help few of you...
Please HIT thanks if you find this helpful.:laugh:
Thankyou k2wl for this tutorial and pls also tell how to get pawitp source code for rom and kernel from his repositries : https://github.com/pawitp/android_device_samsung_i9082
https://github.com/pawitp/android_kernel_samsung_i9082
Repo tool is not working because there is no android manifest file in his repository
Pls help me
mr.phantom said:
Thankyou k2wl for this tutorial and pls also tell how to get pawitp source code for rom and kernel from his repositries : https://github.com/pawitp/android_device_samsung_i9082
https://github.com/pawitp/android_kernel_samsung_i9082
Repo tool is not working because there is no android manifest file in his repository
Pls help me
Click to expand...
Click to collapse
run the following in terminal
$git clone https://github.com/pawitp/android_device_samsung_i9082.git
and
$ git clone https://github.com/pawitp/android_kernel_samsung_i9082.git
k2wl said:
run the following in terminal
$git clone https://github.com/pawitp/android_device_samsung_i9082.git
and
$ git clone https://github.com/pawitp/android_kernel_samsung_i9082.git
Click to expand...
Click to collapse
well i already have done that cloning for cm11 but it had only downloaded files around 200KB and i dont think so that cm11 source code would be that much small
hi
mr.phantom said:
well i already have done that cloning for cm11 but it had only downloaded files around 200KB and i dont think so that cm11 source code would be that much small
Click to expand...
Click to collapse
That's not cm11 source. For that u need another tutorial.
Meanwhile try wiki.CyanogenMod.org
It has instructions for Building for new device
Code:
unmkbootimg.c:25:21: fatal error: bootimg.h: No such file or directory
#include "bootimg.h"
^
compilation terminated.
Getting this while compiling unmkbootimg
i actually am surprises that there are many unofficial CMs in high ends with HALO IN IT.. though our developers try to make rom as close to real one as possible...what if the users want halo integration (as developers only know it :/)
help..
akiratoriyama said:
Code:
unmkbootimg.c:25:21: fatal error: bootimg.h: No such file or directory
#include "bootimg.h"
^
compilation terminated.
Getting this while compiling unmkbootimg
Click to expand...
Click to collapse
try compiling as a root.
k2wl said:
try compiling as a root.
Click to expand...
Click to collapse
How to convert zImage to boot.img
Or do I have to directly copy it ?
Sent from my GT-I9082 using Tapatalk
raghavsharmaxda said:
i actually am surprises that there are many unofficial CMs in high ends with HALO IN IT.. though our developers try to make rom as close to real one as possible...what if the users want halo integration (as developers only know it :/)
help..
Click to expand...
Click to collapse
k2wl said:
try compiling as a root.
Click to expand...
Click to collapse
akiratoriyama said:
How to convert zImage to boot.img
Or do I have to directly copy it ?
Sent from my GT-I9082 using Tapatalk
Click to expand...
Click to collapse
read the last section of post, it covers the conversion of zimage to boot.img...
seems you compiled successfully.
congrats.:victory:
But what about boot.img ?
We need a boot.img in /android/boot ?
Now at last, you have the minimum of unmkbootimg, mkbootimg and mkbootfs installed in your path, and we can get going with our testing of the kernel.
I'll assume that you have a /usr/src/android/boot where you copied your boot.img, so let's get going....
Click to expand...
Click to collapse
Hi @k2wl.For the part "make -j8",if you don't mind putting a sign for others to only compile at the amount of their CPU have otherwise it will caused some error for others who are compiling
1 CPU= make -j1 with least error
Sent from my iPad using Tapatalk
Really nice guide especially about packing the initramfs with the zimage to make boot.img.
Sent from my GT-I9082 using Tapatalk
akiratoriyama said:
But what about boot.img ?
We need a boot.img in /android/boot ?
Click to expand...
Click to collapse
take one from my stock kernel zip....
Techix18 said:
Hi @k2wl.For the part "make -j8",if you don't mind putting a sign for others to only compile at the amount of their CPU have otherwise it will caused some error for others who are compiling
1 CPU= make -j1 with least error
Sent from my iPad using Tapatalk
Click to expand...
Click to collapse
thanks for suggestion.
skullface said:
Really nice guide especially about packing the initramfs with the zimage to make boot.img.
Sent from my GT-I9082 using Tapatalk
Click to expand...
Click to collapse
thanks....will modify more..
k2wl said:
That's not cm11 source. For that u need another tutorial.
Meanwhile try wiki.CyanogenMod.org
It has instructions for Building for new device
Click to expand...
Click to collapse
ok will check it out and will you make a guide for that also??
mr.phantom said:
ok will check it out and will you make a guide for that also??
Click to expand...
Click to collapse
if people wanted it, will make cm11 compilation from source tutorial for it.
Thanks to ya k2wl
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Sent from my GT-I9082 using Tapatalk
happy developing.....glad i helped you...
keep trying for learning new features...
k2wl said:
if people wanted it, will make cm11 compilation from source tutorial for it.
Click to expand...
Click to collapse
Pls k2wl make a new tutorial which include cm11 compilation for grand from source and its kernel also
Hey @k2wl
Just wanted to say thank you for this comprehensive guide. Very detailed.
I never had any interest in tweaking a kernel. I am more of a java guy. But after reading your guide, I thought, why not?!
So I started working on it. Now I have a fully functional kernel compiled separately from the ROMs that I compile.
I even named it. Nebula Kernel.
Learning alot about kernels since I started working on it. As I am tweaking nebula for myself and i'll use this kernel as my daily driver so i'll add tweaks and governors according to me, the ones which I'll use. I like keeping things light and simple! I'll use your github for reference and help. If I face any problems, I'll ask you.
Thank you for the guide!

[tool] ANDROID_IMG_REPACK_TOOLS

[tool] ANDROID_IMG_REPACK_TOOLS
&
Android_ROM_IMG_Repacker​​
android_img_repack_tools is a kit utilites for unpack/repack android ext4 and boot images in LINUX & WINDOWS
includes binaries:
mkbootfs
simg2simg
make_ext4fs
make_ext4fs_def
mkbootimg
ext2simg
simg2img
img2simg
sgs4ext4fs - Chainfire's tool
unpackbootimg - CyanogenMod tool
mkbootimg_tools - xiaolu
Android_ROM_IMG_Repacker
sources used:
https://android.googlesource.com
https://github.com/CyanogenMod/android_system_core.git
https://github.com/Chainfire/sgs4ext4fs
how to make:
Preparation OS:
Code:
sudo apt-get install git-core gnupg flex bison gperf libsdl-dev libesd0-dev build-essential zip curl libncurses5-dev zlib1g-dev valgrind libreadline6-dev gcc-multilib g++-multilib libc6-dev x11proto-core-dev libx11-dev libz-dev gawk texinfo automake libtool cvs libsdl-dev
Dowload repo:
Code:
git clone https://github.com/ASdev/android_img_repack_tools
Choose branch, for example:
Code:
cd android_img_repack_tools
git checkout android-4.4.4_r2.0.1
Building tools:
Code:
chmod +x configure
./configure
will download source from android git repositories
Code:
make
will compille binaries: mkbootfs simg2simg make_ext4fs mkbootimg sgs4ext4fs unpackbootimg ext2simg img2simg simg2img
Code:
make clean
will remove binaries
Code:
make clear
wiil remove sources
credits:
android.googlesource
Chainfire
CyanogenMod
go to the repository
Already have a branch:
android-2.3.7
android-4.0.4
android-4.1.1
android-4.1.2
android-4.2.2
android-4.3
android-4.4.2
android-4.4.3
android-4.4.4
android-5.0.0
android-5.0.2
android-5.1.0
android-5.1.1
android-6.0.0
android-6.0.1
Usage:
Code:
## Converting sparse flashing system.img from flashing android sparse img to ext4 img
$ simg2img system.img system.raw.img
## or all parts of sparse img
$ simg2img system.img* system.raw.img
## Mounting ext4 img for edit
$ mkdir system_mnt
$ mount -t ext4 -o loop system.raw.img system_mnt
Code:
## Creating new android sparse img for flashing (android 2.3.6-4.2)
$ mkuserimg.sh -s system_mnt system_new.img ext4 ./system [size partition MB for example 1024M]
## or
$ make_ext4fs -s -l 1024M system_new.img system_mnt
more
$ mkuserimg.sh -s system system.img ext4 /system [size partition MB for example 1024M] file_contexts
Code:
## Converting ext4 img to sparse img for flashing (android 4.3-etc)
$ ext2simg -v system.raw.img system_new.img
Code:
## Changing sparse img header size from 28bit to 32bit (for Samsung Exynos Octa)
$ sgs4ext4fs --bloat system_new.img system_32bit.img
Code:
## Remove Moto extra header... (for Motorola G-series, making after unsparse img)
$ mv system.raw.img system.moto.img
$ dd if=system.moto.img of=system.raw.img ibs=131072 skip=1
ANDROID_IMG_REPACK_TOOLS_CYGWIN WINDOWS​
ANDROID_IMG_REPACK_TOOLS_CYGWIN is a kit utilites for unpack/repack android ext4 and boot images in WINDOWS
mkbootfs.exe
simg2simg.exe
make_ext4fs.exe
mkbootimg.exe
ext2simg.exe
img2simg.exe
simg2img.exe
sgs4ext4fs.exe - Chainfire's tool
unpackbootimg.exe - CyanogenMod tool
Already have a branch:
android-4.1.2
android-5.1.0
android-5.1.1
android-6.0.0
android-6.0.1
Already have a .exe:
WINDOWS REPO
XDA:DevDB Information
android_img_repack_tools, Tool/Utility for the Android General
Contributors
A.S._id
Version Information
Status: Testing
Created 2014-01-06
Last Updated 2016-04-17
Odin3 ROM Editor
Reserved
Android ext4fs ROM editor
Android_ROM_IMG_Repacker
It is automatise for android_img_repack_tools for Linux & Windows CYGWIN
Instructions:
credits:
android.googlesource
@Chainfire
@Chenglu
@xpirt
Added v.2.1
* Configure:
Auto choice OS for compilation android_img_repack_tools
* MOUNT ext4 img:
Auto converting sparse to raw img
Auto find magic sparse img and remove vendor extra header
Auto choice OS for mount or extract raw img
* MAKE_EXT4FS - new img ANDROID permission:
Auto extract 'file_contexts' from recovery.img (if exist)
* EXT2SIMG - raw to sparse
Auto choice chunk header (28/32 bytes)
Added v.2.2
* Fixed some bugs
mod edit
Thank you very much. I'm waiting for you.
[tool] ANDROID_IMG_REPACK_TOOLS - CYGWIN EXE
Android_img_repack_tools - cygwin exe
Thanks you. I got it!
added branches:
android-2.3.7_r1
android-4.0.4_r2.1
android-4.2.2_r1.2
android-4.3_r3.1
android-4.4.2_r1
Some headers missed. I am using Ubintu 12.04 and installed zlib1g-dev for compiling zlib_host. But make_ext4fs don't compiling:
Building make_ext4fs...
extras/ext4_utils/make_ext4fs.c: In function 'build_directory_structure':
extras/ext4_utils/make_ext4fs.c:175:27: error: 'struct stat' has no member named 'st_stat'
extras/ext4_utils/make_ext4fs.c:176:26: error: 'struct stat' has no member named 'st_stat'
extras/ext4_utils/make_ext4fs.c:177:26: error: 'struct stat' has no member named 'st_stat'
make: *** [make_ext4fs] Error 1
MATPOC said:
Some headers missed. I am using Ubintu 12.04 and installed zlib1g-dev for compiling zlib_host. But make_ext4fs don't compiling:
Building make_ext4fs...
extras/ext4_utils/make_ext4fs.c: In function 'build_directory_structure':
extras/ext4_utils/make_ext4fs.c:175:27: error: 'struct stat' has no member named 'st_stat'
extras/ext4_utils/make_ext4fs.c:176:26: error: 'struct stat' has no member named 'st_stat'
extras/ext4_utils/make_ext4fs.c:177:26: error: 'struct stat' has no member named 'st_stat'
make: *** [make_ext4fs] Error 1
Click to expand...
Click to collapse
Well you has two ways:
This http://www.zlib.net/
or
Code:
make clean
make clear
./configure
cd ./zlib/src
./configure
make
sudo make install
cd ../..
make clean
make
A.S._id said:
Well you has two ways:
This http://www.zlib.net/
Click to expand...
Click to collapse
As I said I have compiled zlib_host by installing zlib1g-dev. Compile broken at ext4fs - maybe there are no extra headers for ext4fs, such as for struct stat.
MATPOC said:
As I said I have compiled zlib_host by installing zlib1g-dev. Compile broken at ext4fs - maybe there are no extra headers for ext4fs, such as for struct stat.
Click to expand...
Click to collapse
1. zlib1g-dev - не входит в состав zlib
2. у меня установлена Ubuntu 13.10 amd64 gcc 4.8
поэтому - не могу точно ответить по 12.04
gt.
1. zlib1g-dev - not part of zlib
2. I have installed Ubuntu 13.10 amd64 gcc 4.8
so - I can not exactly answer to 12.04
Click to expand...
Click to collapse
MATPOC said:
As I said I have compiled zlib_host by installing zlib1g-dev. Compile broken at ext4fs - maybe there are no extra headers for ext4fs, such as for struct stat.
Click to expand...
Click to collapse
Assembly must be done on 64 bit OS. Only installing zlib-1.2.8
View attachment zlib-1.2.8.tar.gz
And the following packages
Code:
sudo apt-get update
sudo apt-get install ia32-libs
gcc 4.8 can be set separately
hi sir. may i ask you to update op with more explanation of what can do your tool?
i understood that it unpack and repack boot.img and compile binaries...
and after that i am wondering what more? what for?
i use kernel tool master to unpack and repack boot.img...
what is the diffeence and the purpose of you tools?
thank you...
i know i miss of knowledge so that is why i ask.
desalesouche said:
hi sir. may i ask you to update op with more explanation of what can do your tool?
i understood that it unpack and repack boot.img and compile binaries...
and after that i am wondering what more? what for?
i use kernel tool master to unpack and repack boot.img...
what is the diffeence and the purpose of you tools?
thank you...
i know i miss of knowledge so that is why i ask.
Click to expand...
Click to collapse
Old binary do not work with newer versions of android
alexyuh said:
Old binary do not work with newer versions of android
Click to expand...
Click to collapse
does that tool can take binaries from one kernel to port it to another?
desalesouche said:
does that tool can take binaries from one kernel to port it to another?
Click to expand...
Click to collapse
The way is not into repacking boot image, but different version of android has different parametrs of FS. Example android 4.3 ext4 FS has support SELinux, but 4.1 and older hasn't
A.S._id said:
The way is not into repacking boot image, but different version of android has different parametrs of FS. Example android 4.3 ext4 FS has support SELinux, but 4.1 and older hasn't
Click to expand...
Click to collapse
I still don't get the purpose of these tools. I've been running Gentoo Linux as my primary OS for a dozen years, all the tools I need to compile kernels, create boot images, ramdisks, initrds, extract and manipulate from already created images, are already installed on my system by default. Why would I need these too? Are these supposed to be time-savers? Shortcuts? I still don't understand.
Odysseus1962 said:
I still don't get the purpose of these tools. I've been running Gentoo Linux as my primary OS for a dozen years, all the tools I need to compile kernels, create boot images, ramdisks, initrds, extract and manipulate from already created images, are already installed on my system by default. Why would I need these too? Are these supposed to be time-savers? Shortcuts? I still don't understand.
Click to expand...
Click to collapse
Well, how I can see, you're HTC user, and maybe this utilities isn't you needs, because htc don't use sparse images, and different header block size in self rom. But samsung, sony, asus and different brands using it...
why is this error?
Building mkbootimg...
core/mkbootimg/mkbootimg.c: In function 'main':
core/mkbootimg/mkbootimg.c:245:9: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]
/usr/bin/ld: cannot find -lz
collect2: ld returned 1 exit status
make: *** [mkbootimg] Error 1
Click to expand...
Click to collapse
rogerscrack said:
why is this error?
Click to expand...
Click to collapse
cd zlib/src
make clean
./configure
make
sudo make install
and try again...

I'm trying to boot my Nexus 10 with your linux-kvm-arm kernel version 3.13...

Hello to everyone,
I'm trying to boot my Nexus 10 with another kind of kernel version,because I'm not interested to use the Android kernel,but the Ubuntu pure kernel. I've chosen to use the linux-kvm-arm kernel version 3.13 :
These are the commands that I have used :
git clone git://github.com/virtualopensystems/linux-kvm-arm.git
cd linux-kvm-arm
git checkout origin/chromebook-3.13 -b chromebook-3.13
curl http://www.virtualopensystems.com/downloads/guides/kvm_on_chromebook/config > .config
and then I've added these lines to the .config file :
CONFIG_ANDROID=y
CONFIG_ANDROID_BINDER_IPC=y
CONFIG_ASHMEM=y
CONFIG_ANDROID_LOGGER=y
CONFIG_ANDROID_PERSISTENT_RAM=y
CONFIG_ANDROID_RAM_CONSOLE=y
CONFIG_ANDROID_TIMED_OUTPUT=y
CONFIG_ANDROID_TIMED_GPIO is not set
CONFIG_ANDROID_LOW_MEMORY_KILLER=y
CONFIG_ANDROID_SWITCH is not set
CONFIG_ANDROID_INTF_ALARM is not set
CONFIG_FB_TILEBLITTING=y
CONFIG_PHONE is not set
CONFIG_USB_WPAN_HCD is not set
CONFIG_WIMAX_GDM72XX is not set
CONFIG_ARM_PLATFORM_DEVICES=y
CONFIG_ARM_CHROMEOS_FIRMWARE=y
CONFIG_CHROMEOS=y
CONFIG_CHROMEOS_VBC_BLK=y
CONFIG_CHROMEOS_VBC_EC=y
CONFIG_CHROMEOS_RAMOOPS_RAM_START=0x41f00000
CONFIG_CHROMEOS_RAMOOPS_RAM_SIZE=0x00100000
CONFIG_CHROMEOS_RAMOOPS_RECORD_SIZE=0x00020000
CONFIG_CHROMEOS_RAMOOPS_DUMP_OOPS=0x1
CONFIG_CLKDEV_LOOKUP=y
and then I did :
ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make uImage dtbs
from here I've followed the tutorial that I've found here :
http://forum.xda-developers.com/showthread.php?t=1981788
and here :
http://forum.xda-developers.com/showthread.php?t=1981788&page=2
mkdir -p newkernel
cd newkernel
wget -c https://dl.google.com/dl/android/aosp/mantaray-kot49h-factory-174ba74f.tgz
tar xvzf mantaray-kot49h-factory-174ba74f.tgz
cd mantaray-kot49h
unzip image-mantaray-kot49h.zip
wget -c http://android-serialport-api.googlecode.com/files/getramdisk.py
chmod +x getramdisk.py
./getramdisk.py boot.img --> ramdisk.img
wget -c http://android-serialport-api.googlecode.com/files/android_bootimg_tools.tar.gz
tar xvf android_bootimg_tools.tar.gz
./mkbootimg --kernel ../../linux-kvm-arm/arch/arm/boot/zImage --ramdisk ramdisk.img --cmdline bootimg.cfg -o new-boot.img
fastboot flash boot new-boot.img
I think that something is wrong here,because it is not able to boot....I see a black screen and nothing else happens...
Hi,
probably too simple, but:
How does your .config look?
Did the curl actually work? (I ask because I tried your URL and it didn't work for me).
Did you actually compile a guest kernel too and boot it?
Special ChromeOS suupport does not exist in that branch.
Keep up the work, if you succeed booting linux, I got a prize for you.
Don't take it wrong, I'm just too bored of the tablet as it is now.
Wejgomi

Categories

Resources