[Q] Help needed compiling Android from source - GT540 Optimus General

Hi folks,
I'm trying to compile Android from source. I'm doing this just for learning purposes. I'm trying to compile Android 2.1. I read here and did whatever it said. Now my first question is:
When initializing Repo client, what I should enter:
repo init -u git://android.git.kernel.org/platform/manifest.git
or
repo init -u git://android.git.kernel.org/platform/manifest.git -b eclair​
After doing Repo sync, I need to extract LG drivers into the main directory. After that I compiled the Kernel and obtained the zImage file. Then when I started building the system, I got too many warnings. Anyhow the build was completed. But it wasn't working on the emulator itself.
I asked Joe.stone for help. He said that I need to create the device config files in the /device/lg/swift folder. Neither I found the device folder, nor I know how to create the device config files. I'm a damn noob when it comes to such complex things.
Please help me out. If I'm able to create a successful build, the I promise I'll write a tutorial for you all. Help needed!!

tejasdj12 said:
Hi folks,
I'm trying to compile Android from source. I'm doing this just for learning purposes. I'm trying to compile Android 2.1. I read here and did whatever it said. Now my first question is:
When initializing Repo client, what I should enter:
repo init -u git://android.git.kernel.org/platform/manifest.git
or
repo init -u git://android.git.kernel.org/platform/manifest.git -b eclair​
After doing Repo sync, I need to extract LG drivers into the main directory. After that I compiled the Kernel and obtained the zImage file. Then when I started building the system, I got too many warnings. Anyhow the build was completed. But it wasn't working on the emulator itself.
I asked Joe.stone for help. He said that I need to create the device config files in the /device/lg/swift folder. Neither I found the device folder, nor I know how to create the device config files. I'm a damn noob when it comes to such complex things.
Please help me out. If I'm able to create a successful build, the I promise I'll write a tutorial for you all. Help needed!!
Click to expand...
Click to collapse
I don't know how to create the files,but you can use the lg gt540 source uploaded by LG.

Well, "device" folder will not work with eclair source, it using "vendor" folder to make a device - specific build. Also, zImage from builded kernel is not the only thing you need, bcos you need also ramdisk image.

Thanks for your replies guys,
I compiled the system successfully (Eclair 2.1) and got it running perfectly on emulator. But, I have sent my phone to the LG Service coz my computer restarted during the KDZ process. I'll be uploading the system.img file tonight. I just need some guys to test it out with the Quarx Kernel.
@pebe94:
I would rather extract any prebuilt boot.img and replace the zImage file. Is that OK?

@up
Yes. If you using extractor from bt.zip, you have to move (or delete) boot.img-kernel from extracted boot, and paste zImage and rename to boot.img-kernel. After that you will able to build boot.img

Related

[REF] How to compile your own kernel and initrd for HTC Leo

Kernel compile :
Do it on user not root :
1. Make sure you have an appropriate environment to get the source (git) and to compile the kernel. Install git, gcc, make and libncurses5-dev at least. For Ubuntu based distributions.
apt-get install git-core build-essential libncurses5-dev
2. Create a directory to hold the kernel sources
mkdir ~/htcleo
3. Download the kernel source
cd ~/htcleo
git clone git://git.linuxtogo.org/home/groups/mobile-linux/kernel.git
cd kernel
git checkout -b htc-qsd8k-2.6.29 origin/htc-qsd8k-2.6.29
4. Download and decompress the arm toolchain (64mb)
cd ~/htcleo
wget http://www.codesourcery.com/gnu_too...-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
tar xjf arm-2008q1-126-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
5. Generate the default .config for the kernel(ARCH is case sensitive)
cd kernel
make htcleo_defconfig ARCH=arm
6. Compile
export PATH=~/htcleo/arm-2008q1/bin:$PATH
make Image ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
Find your kernel Image in /htcleo/kernel/arch/arm/boot/
Now you can configure your proper kernel :
mousepad (Xfce) or gedit (Gnome) ~/htcleo/kernel/arch/arm/configs/htcleo_defconfig
cd ~/htcleo/kernel
make mrproper
make htcleo_defconfig ARCH=arm
export PATH=~/htcleo/arm-2008q1/bin:$PATH (must need once time)
make Image ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
Use git pull in ~/htcleo/kernel to update file and recompile to have the last modified on development
Initrd compile :
Need to be root !
1. Download initrd.gz from other HTC compiled
mkdir initrd (or anything else in propely folder nothing else on)
cd initrd (put your initrd.gz here)
gzip -dc initrd.gz | cpio -id
Now you have all file and folder you can touch and modified
Use mousepad or gedit on root
2. Recompile proper
rm initrd.gz (before do a copy for other instance)
find (all name of folder and file) | cpio --create --format='newc' > initrd
Compile source for Arm :
(root user)
On source folder :
#export ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- PATH=(your path)/arm-2008q1/bin:$PATH
#CC=arm-none-linux-gnueabi-gcc ./configure --host=arm-none-linux-gnueabi --target=arm-none-linux-gnueabi
# make
For who want to take time to test and finaly make Android works on HTC Leo.
I thinks all members hav's HTC Leo !!
hey guys..
i really want to use android on my new HD2!
i'm a little-medium (^^) n00b, but spent a lot of time in android on my kaiser.. so i'm not a totally noob, i think.
i can help testing files for you.
so, what do the dev's think, how long did it take to use android on our phones?
greetings
Thanks for the tip, will try it tomorrow and report what I see
wget http://www.codesourcery.com/gnu_tool...ux-gnu.tar.bz2 -O arm-2008q1-126-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
Click to expand...
Click to collapse
On the wget command supplied you have to right click and copy link location and paste that as the wget url or it wont work, the forum has truncated the text with ... in the middle . use the -O afterwards as shown
1. Download initrd.gz from other HTC compiled
Click to expand...
Click to collapse
Im also not quite understanding this, what is other HTC compiled ? Another set of sources with Android?
Thread Edit
You can take any one initrd.gz and modified script on it.
HTC Vogue initrd.gz its the better.
Tigrouzen said:
Thread Edit
You can take any one initrd.gz and modified script on it.
HTC Vogue initrd.gz its the better.
Click to expand...
Click to collapse
Thanks for fixing the wget ..
Cool so i already have another initrd and i hang at the freeing 104k init error .. Are you able to get past this ?
Nice job writing that up.
Personally I use a different toolchain, but if the toolchain you mention works without a problem, then all is well When I used a toolchain from codesourcery I somehow got compile errors as there was no VFP support (maybe I just took the wrong binary).
The toolchain i'm using is in this git repo: http://android.git.kernel.org/?p=platform/prebuilt.git;a=summary and under linux-x86/toolchain/arm-eabi-4.4.0
NetRipper said:
Nice job writing that up.
Personally I use a different toolchain, but if the toolchain you mention works without a problem, then all is well When I used a toolchain from codesourcery I somehow got compile errors as there was no VFP support (maybe I just took the wrong binary).
The toolchain i'm using is in this git repo: http://android.git.kernel.org/?p=platform/prebuilt.git;a=summary and under linux-x86/toolchain/arm-eabi-4.4.0
Click to expand...
Click to collapse
This toolchain works, compiles fine but fails on boot at the 104k error for me .. Not sure how to progress this without further info / debug ..
NetRipper said:
Nice job writing that up.
Personally I use a different toolchain, but if the toolchain you mention works without a problem, then all is well When I used a toolchain from codesourcery I somehow got compile errors as there was no VFP support (maybe I just took the wrong binary).
The toolchain i'm using is in this git repo: http://android.git.kernel.org/?p=platform/prebuilt.git;a=summary and under linux-x86/toolchain/arm-eabi-4.4.0
Click to expand...
Click to collapse
Yes cause you use 2009q3 arm-eabi not contain VFP support maybe not important.. i try with your toolchain and 2008q1 binary
This is one worked with 2008q1 binary
Nice work! When do you think Android will be avaible on HD2?
How should I format the micro SD Card ?
Do I have to create two partitions (one eith FAT to boot and another ext3 to filesystem ?)
Does anyone have a tutorial to configure the sd card ?
My experience format SD card make some mistake and brick some SD card on linux. For now dont do that cause no way and ist not ready to work.
But Android porting hardware its now everything ok, just wait some moment maybe one or two month to see it on HD2.
This test just need put haret, default.txt based on Leo, initrd.gz and Image on sdcard root and executed haret
If you have drivers to every piece of hardware then tell me how did you managed to detect the SD card reader. Because I simply can't.
The developer find right interrupt for hardware on Leo but we dont have definitively realized driver, this is a problem to communicate right with Leo hardware.
If we have main console work then its ok!!
Now just have boot working and freez.
We need wait.
You can maybe look in this thread Martijn Stolk works, 38hours ago he add some instruction on kernel, then its signified we advanced to make Android works.
http://git.linuxtogo.org/?p=groups/mobile-linux/kernel.git;a=shortlog;h=refs/heads/htc-qsd8k-2.6.29
I think 2 months later if everything ok.
Now you dont need formating your sd card just put file on root.
What's about other non-Leo QSD8x50 devices? I tried some of previous NetRipper's kernels, but they didn't work... As I'm completely next to nothing in ARM kernel development, I take someone should port IRQ and GPIO map (If I remember correctly) of respective devices (e.g. neoTouch, Expo, TG01 etc), isn't it?
Or is the kernel universal?
I thinks HTC take's other hardware way and this hardware doesn't have any driver on linux.
HTC just make's driver for Windows mobile and then have realy code source to ported on linux and android.
Or maybe system locked protection !! Like's Archos 5 IT code secure implentation !!
Maybe HTC do it protection hardware cause Microsoft ask him to not porting it on Android !!!
Or marketing way not arrenged HTC to sell HTC Supersonic simillar hardware with Android !!
I hope its not this way, cause no way to ported Android or linux on Leo..
Last issue if there no protection just wait for HTC Supersonic and porting in Leo.
Tigrouzen said:
Last issue if there no protection just wait for HTC Supersonic and porting in Leo.
Click to expand...
Click to collapse
Would love it, with DualBoot in more
I'll donate for Android, I am really excited to get it on our device !
Thank you to all developpers who take time for us !
See you.
Edit : Use "git pull" to update automatically file modified on development
Thanks for developers.
Edit : compile source for Arm

ClockworkMod for Vision 2.5.1.2

Seems to up in the market now, just wondering if it's good for the DHD, there are now 2 HTC desires in the 'choose your phone'
nope this won't work, its only out for the g2. The desire hd shouldn't be too far behind though so just hold off.
teihoata said:
nope this won't work, its only out for the g2. The desire hd shouldn't be too far behind though so just hold off.
Click to expand...
Click to collapse
ill compile it+ the kernel when i get home
Feel free to have a go yourself: http://www.koushikdutta.com/2010/10/porting-clockwork-recovery-to-new.html
This guide will assume you have some familiarity with doing an Android Build.
First, let's check out the CyanogenMod tree. The CyanogenMod repository contains Clockwork Recovery, which is part of a full Android build.
repo init -u git://github.com/CyanogenMod/android.git -b froyo
repo sync
make -j4 otatools
Now, use dump_image or dd to dump your recovery or boot image from a running phone and copy it to your computer somewhere.
dump_image boot boot.img
Note that dump_image only works on phones using MTD. You will need to use dd to dump mmc partitions.
To build Android from source for a new device, you need to set up a board config and its makefiles. This is generally a long and tedious process. Luckily, if you are only building recovery, it is a lot easier. From the root of your Android source directory (assuming you've run envsetup.sh), run the following (substituting names appropriately):
build/tools/device/mkvendor.sh device_manufacturer_name device_name /your/path/to/the/boot.img
You will receive the confirmation "Done!" if everything worked.
The mkvendor.sh script will also have created the following directory in your Android source tree:
manufacturer_name/device_name
Now, type the following:
lunch generic_device_name-eng
This will set the build system up to build for your new device.
Open up the directory in a file explorer or IDE. You should have the following files: AndroidBoard.mk, AndroidProducts.mk, BoardConfig.mk, device_.mk, kernel, system.prop, and vendorsetup.sh.The two files you are interested in are BoardConfig.mk and kernel. The kernel in that directory is the stock one that was extracted from the boot.img that was provided earlier. BoardConfig.mk will need to be tweaked to support ext mounts and their mount points.
For example, if your /data mount is ext and the device is /dev/block/mmcblk0p2, you would need the following lines added in your BoardConfig.mk:
BOARD_DATA_DEVICE := /dev/block/mmcblk0p2
BOARD_DATA_FILESYSTEM := auto
Once the BoardConfig.mk has been properly setup, you can build the recovery using:
make -j4 recoveryimage
Your recovery can then be found at $OUT/recovery.img.
If you are in need of building a fakeflash recovery, you will need to run the following to create the update.zip that hot replaces the recovery:
. build/tools/device/mkrecoveryzip.sh
Once this is done, build, and tested, notify me, "koush", on Github and I can build official releases and add ROM Manager support!
Tip: Run "make clobber" between builds if you change the BoardConfig.mk, or the change will not get picked up.

Help compiling Nexus 4 kernel from sources

Hi, I'm trying to compile the Nexus 4 kernel from the sources following the android.developers tutorial:
http://source.android.com/source/building-kernels.html
And also this guides:
[Tutorial] Building Your First Kernel: http://forum.xda-developers.com/showthread.php?t=1748297
Getting Started: Building a Kernel from source: http://xda-university.com/as-a-developer/getting-started-building-a-kernel-from-source
My goal is to learn to compile from AOSP, but I'm failing hard. After doing this step:
Code:
$ git clone https://android.googlesource.com/device/lge/mako-kernel
And after downloading the sources:
Code:
$ git clone https://android.googlesource.com/kernel/msm.git
All I get is a "kernel" file (without extension) and a folder .git folder. Inside that folder there aren't the files I assume I need, because I can't do "make mako_defconfig" as there isn't such file.
I don't know what I'm doing wrong as I'm not getting the files I need, althought download was nearly 1GB (I think they should be like this android tree):
https://android.googlesource.com/kernel/msm.git/+/android-msm-mako-3.4-jb-mr1.1
I'll appreciate your help, and sorry if this is the wrong section. Thanks in advance.
PS: I forgot, I already have the toolchain 4.6 and know how to call it, I tried it after clonning the trinity kernel git, I just wonder why I don't get similar files when clonning mako kernel from google source.
I solved it. I had to add the desired branch to the end of the command:
$ git clone https://android.googlesource.com/kernel/msm.git -b "brand"
Doubt is solved, thread can be closed.

[Q] Question on Building

Hey guys, I downloaded the LG D800 lollipop source files from the opensource LG site, and I was trying to build it.
From my understanding, the instructions.
Code:
1. Android build
- Download original android source code ( Lollipop 5.0.1_r1 ) from http://source.android.com
- Untar opensource packages of LGD800_L_Android.tar.gz into downloaded android source directory
a) tar -xvzf LGD800_L_Android.tar.gz
- And, merge the source into the android source code
- Run following scripts to build android
a) source build/envsetup.sh
b) lunch 1
c) make -j4
- When you compile the android source code, you have to add google original prebuilt source(toolchain) into the android directory.
- After build, you can find output at out/target/product/generic
2. Kernel Build
- Uncompress using following command at the android directory
tar xvzf LGD800_L_Kernel.tar.gz
- When you compile the kernel source code, you have to add google original prebuilt source(toolchain) into the android directory.
- Run following scripts to build kernel
a) cd kernel
b) export PATH=$PATH:tools/lz4demo
c) make ARCH=arm CROSS_COMPILE=../prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin/arm-eabi- g2-att-perf_defconfig zImage -j4
* "-j4" : The number, 4, is the number of multiple jobs to be invoked simultaneously.
* lz4demo : More information can be found at "https://code.google.com/p/lz4/"
- After build, you can find the build image(zImage) at arch/arm/boot/
3. how to build chromium34_lge (vendor\lge\external\chromium34_lge\src),
please refer to README.txt at the folder mentioned above.
say to build the AOSP_ARM generic image.
I am building it now, and it did include the make files for the vendor directories. But I am wondering if this is actually going to work, and if it's missing anything?
If someone has ever done this before, and can accurately describe the process I would appreciate it.
I understand it as download android>extract the files to that directory and "Merge"(Overwrite?) the files, then run the envsetup, lunch for AOSP_ARM and make.
I don't understand what this line means "When you compile the android source code, you have to add google original prebuilt source(toolchain) into the android directory."
I also don't understand what the Chromium34_LGE thing is, and what it's for.
If anyone can shine some information on this, I would really appreciate it. Thanks!
Download site instructions, file size, and Linux knowledge
Silentwidow said:
Hey guys, I downloaded the LG D800 lollipop source files from the opensource LG site, and I was trying to build it.
- Download original android source code ( Lollipop 5.0.1_r1 ) from http://source.android.com
Click to expand...
Click to collapse
Go to http://opensource.lge.com, and search for LGD800. The downloaded file named LGD800_Lollipop_Android_D800_v30f.zip is a 633,894KB file containing LGD800_L_Android.tar.gz 505,244 KB and LGD800_L_Kernel.tar.gz 133,042 KB. When both are extracted the result is over 2GB of files and folders.
To build you'll need a Linux OS and be very knowledgeable with Linux commands and file structures.
As for a prebuilt, there is one buried in the folders at LGD800_L_Android.tar.gz\LGD800_L_Android.tar\android\vendor\lge\prebuilt\LGBackup\tar\LGBackup_tar.zip\
I don't know if there is another prebuilt in the LGD800_L_Kernel.tar.gz because I didn't look. Linux is far out of my reach, so I'll stay away from build scripts and makefiles...etc..

[GUIDE] Porting Kernel Source to Snapdragon Device

Some OEMs violating GPL licenses and won't publish linux kernel sources for their Android devices.
On this post I’ll explain how to port kernel source to any android device.
Maybe you can port kernel sources to other SoCs with similiar ways but I've explained qcom way.
What do we need ?
A Computer which has Linux or Mac installation.
Device to test.
Let’s Start, Shall we ?
First of all we need to take dmesg of stock kernel using adb shell dmesg > dmesg.txt command. (I recommend you to take it while device is booting)
You got dmesg ? Nice. Open it with any text editor and search for “hardware” or “machine” and note the result to somewhere. By doing this we’ll get the name of device-tree-blobs.
Download android image kitchen and extract it to somewhere.
Now hold and move your device’s stock boot.img to unpackimg.(bat/sh)
Now your stock kernel got extracted to split_img/boot.img-zImage. After this line I will referance this file as “stock kernel”
Fetch split-appended-dtb using git clone https://github.com/MacTavishAO/split-appended-dtb-mac command. We’ll use this tool to extract dtb from stock kernel.
Copy stock kernel to split-appended-dtb-mac folder.
Now we will extract dtb(device-tree-blobs) from stock kernel. If you are on Linux use ./split-appended-dtb boot.img-zImage command for Mac use ./split-appended-dtb-mac boot.img-zImage command.
Now we have bunch of files named dtbdump_xx.dtb. We have to find out which one our device uses. Use grep -r <machine name that we found at step 2> . to find out which dtb our device using. (Write different parts of machine name to find out)
Install dtc using apt install device-tree-compiler command.
Let’s say it turns out dtbdump_21.dtb is the right one. We have to decompile dtb file to dts using dtc -I dtb -O dts -o extracted.dts dtbdump_21.dtb command.
Now we have to extract defconfig from stock kernel.
Use wget https://github.com/torvalds/linux/raw/master/scripts/extract-ikconfig && chmod a+x extract-ikconfig command to download necessary tool.
Use ./extract-ikconfig boot.img-zImage > extracted_defconfig to get defconfig from stock kernel.
Now we got what we need, we need to download kernel source to start porting to our device.
After this point I’ll start to explain as porting to Qualcomm device but almost same on other system-on-chips.
Go to Settings -> About Phone -> and note “Kernel version”
We need to download soc manufacturer’s sources. From here find msm-X.X that matching with your phone and copy link of it.
And from here find tag matching your chipset and write it down somewhere.
Use git clone <sources from 2 steps up> -b <tag>
Now enter to msm-X.X folder.
Copy extracted_defconfig to arch/<your device's architecture>/configs/ folder.
If your device is arm64 copy extracted.dts to arch/arm64/boot/dts/qcom/ if this directory doesn’t exist copy to arch/arm/boot/dts/qcom/ folder. (If you have 3.x qcom device skip the arm64 part and copy it directly into arm)
Open “Makefile” file in arch/arm(64)/boot/dts/qcom/ and add extracted.dts to the line matching with your chipset.
It’s time to import drivers. After this step I cannot help you because every devices’ hardware isn’t same but I can give some tactics.
To get driver names you can read dts file or install any device info app from Google Play Store etc.
Search these names and GitHub you can find files and commits which will help you to add drivers.
You did all of these without my help ? Excellent! Now it’s time to build kernel. I suggest you to use @natchanchance 's kernel compilation guide.
After compiling kernel. Copy compiled kernel to split_img folder which mentioned at early of this tutorial. rename it to boot.img-zImage and double click repackimg.(bat.sh) and you have new file named image-new.img.
Boot it using fastboot boot image-new.img command and if everything is working you can use fastboot flash boot image-new.img to use it permanently.
Leave a comment here about your questions. I'll try to reply all of them.
Planned to make a guide video about it but I don't have much time. Keep checking this thread may I post soon.
Reserved
Reserved.
Reserved
Thanks Dude!
This is very useful guide especially fir those who want to port the kernel source.
Thanks man. I am following your guide.
Thanks ?
While looking for matching dtbdump file I got a match in all four files for PMI8996, which file should I use?
"We have to decompile dtb file to dts using dtc" stuck at this step.
Any help on which "App" to use to find driver names..
Thanks
CPUZ / AIDA64
ataberkozen said:
It’s time to import drivers. After this step I cannot help you because every devices’ hardware isn’t same but I can give some tactics.
To get driver names you can read dts file or install any device info app from Google Play Store etc.
Search these names and GitHub you can find files and commits which will help you to add drivers.
Click to expand...
Click to collapse
I've found another way to find hardware info using hwinfo tool inside termux. The trick is to use it with root permissions.
Install hwinfo in termux:
Code:
apt-get install hwinfo
Run it with root permission tee into a text file:
Code:
su -c $(which hwinfo) | tee hwinfo.txt

Categories

Resources