[ROM] Native Ubuntu on the Epic! - Epic 4G Android Development

I got Ubuntu 13.04 to boot cleanly on my Epic! No chroot or VNC hacks involved!
This method loads a custom kernel using kexec and runs off a microSD card.
Check the end of the post for the kernel config and patches, xorg.conf, /etc/modules, the kexec zip, and a pre-built kernel.
I may eventually provide a pre-built root filesystem, but for now it's easy enough to build your own.
For the technically inclined, Debian, Arch Linux, MeeGo/Mer/Nemo/Tizen, Fedora, Gentoo, Slackware, and a few other distros should also work with this method.
Working as of March 30, 2013:
* Touchscreen, 10-point multitouch!
* Unaccelerated X11 with fbdev, framebuffer console disabled for cleaner boot.
* Charging, battery meter
* WiFi
* Sound! NB, the hack I used to get it working disables the codec shutdown sequence, which could affect battery life and prevent the phone from sleeping.
Partially working:
* Keyboard (incomplete layout; not sure what to do with Fn/3rd level key mapping)
* Cameras (recognized as V4L2 devices but VLC complains with "invalid pixel format" so the drivers probably need fixing)
* Sensors/autorotate (sensors recognized in kernel/X11/SDL, I'm working on auto rotation)
Not tested:
* Bluetooth
* GPS
* Calls/data: https://github.com/morphis/libsamsung-ipc
Step by step guide!
PREREQUISITES:
* An Epic 4G with a custom recovery and a microSD card. 2GB free space on the card recommended.
* A Linux computer. Sorry, Windows/Mac users, you're on your own.
Step 0: Get the files you need
Extract the contents of linux_epicmtd.zip to a new folder somewhere and change to that folder in your terminal.
Step 1: Partition your SD card
Please backup of the contents of your SD card before doing anything else.
You can do this by mounting USB storage, but I prefer to remove the card and put it in a USB card reader, that way it's harder to accidentally disconnect it and corrupt data.
What you want to do is shrink the FAT partition from a computer by 2GB and create a new ext2/4 partition out of that free space.
2GB should more than suffice for a minimal Ubuntu install, but if you intend to install Unity (ubuntu-desktop) or other big packages, you may need anywhere from 2GB to 4GB, or possibly more. Resize accordingly.
The following instructions assume the Linux partition you just created is labeled "Ubuntu" and the FAT partition you resized is labeled "microSD". If you don't label them, your mount points will be different.
Step 2: Install Ubuntu on the second partition
Code:
# Assumes your new Ubuntu partition is mounted at "/media/$USER/Ubuntu"
wget http://cdimage.ubuntu.com/ubuntu-core/daily/current/raring-core-armhf.tar.gz
tar xvf raring-core-armhf.tar.gz -C /media/$USER/Ubuntu
Step 3: Configure the filesystem
Code:
# to chroot into the ARM rootfs on a non-ARM computer:
sudo apt-get install qemu-user-static
sudo cp /usr/bin/qemu-arm-static /media/$USER/Ubuntu/usr/bin
sudo mount -o remount,dev /media/$USER/Ubuntu
sudo chroot /media/$USER/Ubuntu
# check /etc/apt/sources.list and make sure universe is enabled
apt-get update
apt-get dist-upgrade
# select your preferred desktop environment
apt-get install {k,x,l,}ubuntu-desktop e17 gnome-session-fallback plasma-active
adduser yournamehere
usermod -a -G audio yournamehere
passwd yournamehere
tzselect
# do anything else you want to do, exit the chroot, then run the following commands from your working folder:
sudo cp X11.txt to /media/$USER/Ubuntu/etc/X11/xorg.conf
sudo cp modules.txt /media/$USER/Ubuntu/etc/modules
adb pull /vendor/firmware/fw_bcmdhd.bin
adb pull /system/etc/wifi/nvram_net.txt
sudo cp fw_bcmdhd.bin nvram_net.txt /media/$USER/Ubuntu/lib/firmware
Step 4: Install the kernel, copy the kexec zip to your SD card, and boot!
Option 1: Use my pre-built kernel.
Code:
cp zImage /media/$USER/microSD
sudo tar xvf modules.tar.gz -C /media/$USER/Ubuntu
cp boot_zImage.zip /media/$USER/microSD
Option 2: Build the kernel from source.
Code:
sudo apt-get install build-essential git gcc-arm-linux-gnueabi libncurses5-dev
git clone git://github.com/CyanogenMod/android_kernel_samsung_epicmtd
cd android_kernel_samsung_epicmtd
git checkout cm-10.1
git apply ../linux_epicmtd.patch
export CROSS_COMPILE=arm-linux-gnueabi- ARCH=arm
cp ../epicmtd_defconfig.txt .config
# make menuconfig if you want to enable the framebuffer console or customize anything
make -j8
sudo make modules_install INSTALL_MOD_PATH=/media/$USER/Ubuntu ARCH=arm
cp arch/arm/boot/zImage /media/$USER/microSD
cd ..
cp boot_zImage.zip /media/$USER/microSD
Reboot into recovery, install zip from sdcard, select boot_zImage.zip, and enjoy your new Ubuntu installation!

First! Very excited for this. Any screens available?
Sent from my Tangerine Dream Epic 4G using xda premium

Hmm can get my phone working on linux pretty flawlessly but my laptop just doesn't like it go figure. Anyways those are my issues [ would be cool if I could find someone to help me with my linux issues] but anyways this is pretty sweet .
Sent from my SPH-D700 using xda premium

Wow, did not see this coming! Gonna attempt this weekend. Awesome work
Sent from my MIUI V4 Epic 4G via Tapatalk 2 beta 5

How is 12.04 for PC in its current state? I'm on 11.10 and I would consider switching, if it wasn't buggy and what not.
Sent from my SPH-D700 using XDA

tdwp16 said:
How is 12.04 for PC in its current state? I'm on 11.10 and I would consider switching, if it wasn't buggy and what not.
Sent from my SPH-D700 using XDA
Click to expand...
Click to collapse
In my honest opinion, Ubuntu sucks since the 9.x days. I would try out the gnome version of LMDE (Linux Mint Debian Edition). You will never want to go back.
Sent from my SPH-D700 using Tapatalk

I tried out the last Linux mint. I kept having problems with the music player freezing my computer. idk how but that's the only thing that did it. So I switches back yo Ubuntu after using mint for a year or two and just loaded gnome shell.
Sent from my SPH-D700 using XDA

tdwp16 said:
I tried out the last Linux mint. I kept having problems with the music player freezing my computer. idk how but that's the only thing that did it. So I switches back yo Ubuntu after using mint for a year or two and just loaded gnome shell.
Sent from my SPH-D700 using XDA
Click to expand...
Click to collapse
LMDE is very different from the old mint.
Sent from my SPH-D700 using Tapatalk

I'll try it just because you said so marc. I'll just make another partition for it and play with it. If I like it I'll deff let you know.
Sent from my SPH-D700 using XDA

tdwp16 said:
I tried out the last Linux mint. I kept having problems with the music player freezing my computer. idk how but that's the only thing that did it. So I switches back yo Ubuntu after using mint for a year or two and just loaded gnome shell.
Sent from my SPH-D700 using XDA
Click to expand...
Click to collapse
weird, i had the EXACT same issue with my last debian install. A while back, but still weird...

beltsnspoons said:
weird, i had the EXACT same issue with my last debian install. A while back, but still weird...
Click to expand...
Click to collapse
I have no clue what it was. I tried everything. Looked up solutions ant there were none. I reinstalled 3 times and it still did it
Sent from my SPH-D700 using XDA

tdwp16 said:
How is 12.04 for PC in its current state? I'm on 11.10 and I would consider switching, if it wasn't buggy and what not.
Click to expand...
Click to collapse
12.04 is actually quite stable. I think they finally got GNOME Fallback ("Classic") right as well - it's set up more like 10.10 with some usability improvements. I never really liked Unity, but it also felt more stable than the version in 11.10 did.

tdwp16 said:
I have no clue what it was. I tried everything. Looked up solutions ant there were none. I reinstalled 3 times and it still did it
Sent from my SPH-D700 using XDA
Click to expand...
Click to collapse
You can always use vlc instead
Sent from my SPH-D700 using Tapatalk

marcusant said:
You can always use vnc instead
Click to expand...
Click to collapse
Correct me if I'm wrong, but I'm pretty sure they're referring to Debian and/or Linux Mint bugs on the desktop.
Somewhat off-topic, but with a guide this complicated, I don't expect many people to try it. The VNC hack still works, but it's too slow for me, which is the main reason I decided to boot natively.
On a somewhat related note, this can completely replace Android if you are so inclined, but unless you can figure out the internal storage, I still recommend booting from the SD card. You can permanently flash the kernel with Heimdall if you hate Android enough

Err... vlc
Sent from my SPH-D700 using Tapatalk

gTan64 said:
Correct me if I'm wrong, but I'm pretty sure they're referring to Debian and/or Linux Mint bugs on the desktop.
Somewhat off-topic, but with a guide this complicated, I don't expect many people to try it. The VNC hack still works, but it's too slow for me, which is the main reason I decided to boot natively.
On a somewhat related note, this can completely replace Android if you are so inclined, but unless you can figure out the internal storage, I still recommend booting from the SD card. You can permanently flash the kernel with Heimdall if you hate Android enough
Click to expand...
Click to collapse
I had a spell check error lol.
Sent from my SPH-D700 using Tapatalk

oh. em. gee.

awesome... When i finish with my epic i can turn it into a small little tablet now.
BtW, Debian beats the mint so hard... I hate Mint and Ubuntu so im glad those are not the only options.

Doing this right now, will report back with screenies soon.
Edit: everything went swimmingly up until step 3 (I know my way around linux but still pretty noobish):
[email protected]:~$ tar xvf /path/to/victory_patches.tar -C /path/to/
tar: /path/to/victory_patches.tar: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
[email protected]:~$ cd android_kernel_samsung_victory
[email protected]:~/android_kernel_samsung_victory$ scripts/patch-kernel . /path/to/patches
bash: scripts/patch-kernel: No such file or directory
[email protected]:~/android_kernel_samsung_victory$ cp /path/to/victory_config.txt .config || make -C Kernel cyanogenmod_epicmtd_defconfig
cp: cannot stat `/path/to/victory_config.txt': No such file or directory
make: Entering directory `/home/xopher/android_kernel_samsung_victory/Kernel'
HOSTCC scripts/basic/fixdep
HOSTCC scripts/basic/docproc
HOSTCC scripts/basic/hash
HOSTCC scripts/kconfig/conf.o
scripts/kconfig/conf.c: In function ‘conf_sym’:
scripts/kconfig/conf.c:159:6: warning: variable ‘type’ set but not used [-Wunused-but-set-variable]
scripts/kconfig/conf.c: In function ‘conf_choice’:
scripts/kconfig/conf.c:231:6: warning: variable ‘type’ set but not used [-Wunused-but-set-variable]
scripts/kconfig/conf.c:307:9: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
scripts/kconfig/conf.c: In function ‘conf_askvalue’:
scripts/kconfig/conf.c:105:8: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
HOSTCC scripts/kconfig/kxgettext.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
#
# configuration written to .config
#
make: Leaving directory `/home/xopher/android_kernel_samsung_victory/Kernel'
[email protected]:~/android_kernel_samsung_victory$ # Check hints.txt for customization tips.
[email protected]:~/android_kernel_samsung_victory$ make -C Kernel menuconfigmake -C Kernel -j8
make: *** Kernel: No such file or directory. Stop.
[email protected]:~/android_kernel_samsung_victory$ make -C Kernel -j8
make: /home/bbelos/toolchain/arm-eabi-4.4.3/bin/arm-eabi-gcc: Command not found
make: Entering directory `/home/xopher/android_kernel_samsung_victory/Kernel'
scripts/kconfig/conf -s arch/arm/Kconfig
make: Leaving directory `/home/xopher/android_kernel_samsung_victory/Kernel'
make: /home/bbelos/toolchain/arm-eabi-4.4.3/bin/arm-eabi-gcc: Command not found
make: Entering directory `/home/xopher/android_kernel_samsung_victory/Kernel'
CHK include/linux/version.h
UPD include/linux/version.h
CHK include/generated/kernelversion.h
UPD include/generated/kernelversion.h
CHK include/generated/utsrelease.h
CC scripts/mod/empty.o
/bin/sh: /home/bbelos/toolchain/arm-eabi-4.4.3/bin/arm-eabi-gcc: not found
make[2]: *** [scripts/mod/empty.o] Error 127
make[1]: *** [scripts/mod] Error 2
make: *** [scripts] Error 2
make: *** Waiting for unfinished jobs....
UPD include/generated/utsrelease.h
make: Leaving directory `/home/xopher/android_kernel_samsung_victory/Kernel'
[email protected]:~/android_kernel_samsung_victory$
Sent from my MIUI V4 Epic 4G via Tapatalk 2 beta 5

You are using /path/to/patches... you need to put the path there...
Sent from my SPH-D700 using Tapatalk

Related

[DEV GUIDE] Build CM7 from source in its current state. Updated: 2011/05/16-23:52

PLEASE READ THIS BEFORE CONTINUING:
We are changing to a new build system which will result in an updated but VERY different ROM underneath the hood. There is a HIGH POSSIBILITY that building in the current state could BRICK your device, potentially PERMANENTLY. PLEASE DO NOT FLASH unless you are HIGHLY confident you know what you're doing.
For kernel building, see post #2.
For known issues and changelog, see post #3.
Kanged from the CM-Wiki. Yes it's a wiki, yes I could have created an epic page, but we aren't official yet.
Install ADB
Install the Android SDK.
Install the Build Packages
Install using the package manager of your choice:
For 32-bit & 64-bit systems:
Code:
git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.6-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev sun-java6-jdk pngcrush schedtool
For 64-bit only systems:
Code:
g++-multilib lib32z1-dev lib32ncurses5-dev lib32readline5-dev gcc-4.3-multilib g++-4.3-multilib
NOTE: On Ubuntu 10.10, and variants, you need to enable the parter repository to install sun-java6-jdk:
Code:
add-apt-repository "deb http://archive.canonical.com/ maverick partner"
Create the Directories
You will need to set up some directories in your build environment.
To create them:
Code:
mkdir -p ~/bin
mkdir -p ~/android/system
Install the Repository
Enter the following to download make executable the "repo" binary:
Code:
curl http://android.git.kernel.org/repo > ~/bin/repo
chmod a+x ~/bin/repo
NOTE: You may need to reboot for these changes to take effect.
Now enter the following to initialize the repository:
Code:
cd ~/android/system/
repo init -u git://github.com/EpicCM/android.git -b teamhacksung-merge
repo sync -j16
Download RomManager and Google Files
NOTE: This only needs to be done when an update to RomManager or GoogleApps is released. If you are up-to-date, you may skip to Building CyanogenMod.
Code:
cd ~/android/system/
./build.sh prepare
Building CyanogenMod
First, check for updates in the source:
Code:
cd ~/android/system/
repo sync
Configure Build & Compile
Now, the environment must be configured to build and the ROM compiled, from code, for the epic.
Code:
cd ~/android/system/
. build/envsetup.sh
./build.sh epic
Build failed? Check post #3 for common problems and solutions.
Install
1. The build system should create a flashable zipfile. Place it on the root of your sdcard.
Optional: Download Google Apps for CyanogenMod 7 and place it on the root of the SD card.
2. Boot into a custom recovery like ClockworkMod Recovery and flash the CM7 update.zip. Then flash google apps if you like.
Please don't flash yet, unless you want an expensive doorstop.
This section of the guide will inform you on how to build a CM7-compatible kernel using our github sources.
Download the Code
Due to the way the new build system works, you'll need the entire CM source to build a proper kernel. (Sorry)
Follow the steps in post #1 to initialize and download our entire CM source repository.
Keeping your code up-to-date:
Code:
cd ~/android/system
repo sync
Toolchain setup
The new build system automatically utilizes the toolchain included in CM7 source.
Prepare to build
The kernel build script requires a few environment vars be set by the CM build system.
Code:
cd ~/android/system/
. build/envsetup.sh
lunch cyanogen_epic-eng
Compile the kernel
Code:
cd ~/android/system/kernel/samsung/2.6.35/
./build.sh epic
cd ~/android/system/releasetools/
./kernel.sh epic
You should now have a flashable zip in out/target/product/epic/
Please don't flash yet, unless you want an expensive doorstop.
This is also incompatible with stock roms, and unless you're amazing, never will be compatible.
KNOWN BUILD-TIME ISSUES
WARNING: These fixes may cause your repo to become out-of-sync from the official repo. Make sure you know how to revert these changes so repo sync doesn't fail.
Error: New build does not boot.
Fix: Working on it
KNOWN RUN-TIME ISSUES
Will update this when it runs.
GUIDE CHANGELOG:
20110516-2352: New build system from teamhacksung.
20110506-1842: Switched to our forks of teamhacksung work.
CODE CHANGELOG:
Available at each of our repositories:
https://github.com/EpicCM
Love seeing these types of posts; makes a pathway for new developers to learn =)
XtaC318 said:
Love seeing these types of posts; makes a pathway for new developers to learn =)
Click to expand...
Click to collapse
I agree! Time to start playing!
Cool guide, makes it easy for the new guys.
Sent from my SPH-D700 using Tapatalk
getting same error. edited make file and tried to remove the samsung/device/crespo device.mk overlap but still a no-go
Code:
build/core/base_rules.mk:479: warning: overriding commands for target `out/target/product/epic/recovery/root/sbin/tune2fs'
bootable/recovery/Android.mk:87: warning: ignoring old commands for target `out/target/product/epic/recovery/root/sbin/tune2fs'
build/core/base_rules.mk:162: *** device/samsung/epic/libs3cjpeg: MODULE.TARGET.SHARED_LIBRARIES.libs3cjpeg already defined by device/samsung/crespo/libs3cjpeg. Stop.
smeyerhuky said:
getting same error. edited make file and tried to remove the samsung/device/crespo device.mk overlap but still a no-go
Code:
build/core/base_rules.mk:479: warning: overriding commands for target `out/target/product/epic/recovery/root/sbin/tune2fs'
bootable/recovery/Android.mk:87: warning: ignoring old commands for target `out/target/product/epic/recovery/root/sbin/tune2fs'
build/core/base_rules.mk:162: *** device/samsung/epic/libs3cjpeg: MODULE.TARGET.SHARED_LIBRARIES.libs3cjpeg already defined by device/samsung/crespo/libs3cjpeg. Stop.
Click to expand...
Click to collapse
yes, that's something that we can't easily fix in our own device repo. you could always remove the crespo folder as a temporary fix, but we need to push a patch upstream that fixes crespo makefiles. I will be adding this to known issues shortly.
So my windows seven crashed on me and I'm gonna go with Ubuntu 10.10 for now
I can play with this on that Linux install, correct?
sent by an Epic4g through the cosmos
raiderep said:
So my windows seven crashed on me and I'm gonna go with Ubuntu 10.10 for now
I can play with this on that Linux install, correct?
Click to expand...
Click to collapse
Yes, it's mentioned in the instructions.
Alternatively, you can use VMWare to do compiling from Windows. That's how I'd set up my old development system. There are tons of free Ubuntu 10.10 vm images.
Updated. Sorry for the mistake in Copy Proprietary Files. That should fix a compile error related to libcamera.
Any clue what causes a build to fail due to unable to dopen system/lib/egl/libandroid_servers.so. When I build with boardconfig has generic audio I'm fine, when I set has galaxys audio it fails
Sent from my SPH-D700 using Tapatalk
dreamsforgotten said:
Any clue what causes a build to fail due to unable to dopen system/lib/egl/libandroid_servers.so. When I build with boardconfig has generic audio I'm fine, when I set has galaxys audio it fails
Sent from my SPH-D700 using Tapatalk
Click to expand...
Click to collapse
Audio in and out works if you leave it at default values.
If you absolutely want to compile with galaxys audio, it looks like ./extract-files.sh might not be pulling that file? Check ~/android/system/vendor/samsung/epic/proprietary/lib/egl/ for that file.
Thanks for the heads up, no the fileisn't in egl and from what I can tell its not supposed to be.
Sent from my SPH-D700 using Tapatalk
Fix: Open up Context.java, find the three chunks of WimaxManager JAVADOC in comments. Delete JUST the commented stuff that's related to WiMax.
Click to expand...
Click to collapse
Can anyone please elaborate, I don't understand wat exactly to be done. Even though I deleted commented lines I still receive errors
Thanks
THANK YOU!!!!!!!!!!!!!!!!!!!!!!!!!!!!
So for kernel compilation I received and error
fs/binfmt_aout.c: In function 'load_aout_binary':
fs/binfmt_aout.c:271: error: 'SEGMENT_SIZE' undeclared (first use in this function)
Click to expand...
Click to collapse
And I had to update a line in Makefile
from
NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
Click to expand...
Click to collapse
to
NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) -Dlinux
Click to expand...
Click to collapse
Still nearly at the end of compile I receive
samsung-kernel-epic/scripts/mksysmap: line 44: arm-none-eabi-nm: No such file or directory
Click to expand...
Click to collapse
I'll see if I can cream system.map from vmlinux and report again
The kernel compilation issue was discussed here: http://forum.xda-developers.com/showthread.php?t=825611
I needed to do
make update-api
Click to expand...
Click to collapse
After removing those comments
it went ahead now the next place I'm stuck is
CameraService.cpp:1478: error: undefined reference to 'openCameraHardware'
Click to expand...
Click to collapse
Any ideas?
Thanks
\m/ I got cm7 compiled
So here are nullghosts instructions:
open android/system/device/samsung/epic/full_epic.mk for editing and
replace any instance of SPH-D700 to epic
Click to expand...
Click to collapse
Then open extract-files.sh for editing and make sure Copy Files (from mid to bottom) list is same as files list (at top)
add these 2 lines to
FILES="
Click to expand...
Click to collapse
section of extract-files.sh
bin/netcfg
lib/libQmageDecoder
Click to expand...
Click to collapse
If you have any other file missing read below:
head -197 extract-files.sh > files may come in handy to compare 2 files
vendor/samsung/__DEVICE__/proprietary/bin/netcfg:system/bin/netcfg
vendor/samsung/__DEVICE__/proprietary/lib/libQmageDecoder.so:system/lib/libQmageDecoder.so
Click to expand...
Click to collapse
are the 2 lines in copy files which did not have corresponding files
Now need to zip it and see if I can get kernel compiled
Can anyone that has it compiled post a zip? I dont wanna download lile 10gb of stuff.
Sent from my SPH-D700 using XDA App

HOWTO: Compile your own kernel from source (WIP)

Updated. You can find an easier to use and more up to date version here:
http://rootzwiki.com/topic/8824-howto-compile-your-own-kernel-v-01/
Hey folks,
Figured I would throw this out there for those who may want to know just what goes into compiling a kernel, and possibly, doing it themselves. This is a WIP, and is more about how to compile, than how to make changes to source or customize your own kernel.
Needed:
Linux. For this case, we will assume Ubuntu 10.10, 64 bit. This can be done with 32 bit as well, but you will need a different cross compiler.
Download | Ubuntu
dsixda's kitchen. So that we can easily split and repack kernels.
https://github.com/dsixda/Android-Kitchen/archives/master
Source. You can use mine. Its fairly heavily tweaked, and compiles without any modifcations.
https://github.com/adrynalyne/kernel_htc-mecha
A cross compiler toolchain. Because I use 64 bit linux, I use a 64 bit cross compiler.
http://rapidshare.com/files/394529815/HikaRi_toolchain_4.4.4.tbz2
(Credit adwinp from XDA)
Introduction
First, we install Ubuntu. I won't be going through that, however. So, assuming we have Ubuntu already installed, and working, we are ready to dive right in.
First, we need a tool Ubuntu does not install by default. This is called git. From a terminal:
Getting Source Code
sudo apt-get install git
Once git is installed, we can grab our source. Using a terminal:
[[email protected] ~]$
code
Code:
mkdir android
cd android
mkdir kernels
cd kernels
git clone git://github.com/adrynalyne/kernel_htc-mecha.git
Depending on your connection, this could take a while.
This will create a kernel_htc-mecha directory under your /home/username/android/kernels folder.
Grabbing Toolchain
Now we will grab the toolchain. Download it, decompress it, and just leave it in the 4.4.4 directory. Move it to your android directory.
Grabbing and setting up the kitchen
Download the kitchen from the link given above, and decompress it. Rename it to kitchen. Move it to your android directory. Then from a terminal:
code
Code:
cd ~/android/kitchen
chmod 755 menu
./menu
This installs the kitchen and starts it up. Now the first thing we need to do is setup a working directory. Take a rom, any rom, and copy it to the ogiinal_update folder inside the kitchen. You can then setup your working folder.
Inside the working folder, delete boot.img. Grab, one of say, my kernels, and extract it. Take boot.img from the extracted contents and copy to the kitchen.
To split the initramfs (ramdisk) from the kernel, simply choose 0 from the menu, then 20. Hitting w will extract the kernel to a BOOT-EXTRACTED directory inside the kitchen (not working folder). Inside that folder, you will find the ramdisk and a zImage. The zImage is the kernel. We will stop there for now.
Compiling the kernel
First, we move to the kernel directory.
code
Code:
cd ~/android/kernels/kernel_htc-mecha
To compile the kernel, first we must have a configuration file ready. To do this:
code
Code:
make mecha-lte_defconfig
It will configure the system for compiling.
Now to compile the kernel:
code
Code:
make -j5 ARCH=arm CROSS_COMPILE=/home/username/android/4.4.4/bin/arm-none-eabi-
Where username is your, well, username and the number after j (thats a J) is the number of cpus +1.
Depending on the speed of your system. a zImage should be created within 3-30 minutes.
Packing the kernel
The zImage will be located under ~/android/kernels/kernel_htc-mecha/arch/arm/boot directory.
We will copy that zImage into the BOOT-EXTRACTED directory of the kitchen. Then, back at our menu for the kitchen, we hit 'b' to build the kernel. Within seconds, there is a new boot.img inside our Working folder. Now, remember my kernel package you downloaded? Well, time to kang the installer! The directory you unzipped contains a META-INF and system directory. You need both of those. Copy the boot.img in with those two folders.
So, our directory layout currently looks like so:
META-INF
system
boot.img
We need one more file, the wifi driver, from our compiled source.
Under ~/android/kernels/kernel_htc-mecha/drivers/net/wireless/bcm4329_204 you will find a file named bcm4329.ko. Copy this into system/lib of your new kernels installer directory.
Zip these three folders and give it a name. Now its ready to install.
A couple of things of note:
You almost always have to match the wifi driver with the kernel.
make clean mrproper will clean all the precompiled and temp fikes out of your source. This is recommended when making major source changes. Don't forget to remake your configuration after running it though.
Troubleshooting
There may be some files not found errors. Please be careful with these commands.
If the files not found are libcloog.so.0 and/or libmpfr.so.1, take a look below.
Code:
sudo ln -s /usr/lib/libcloog-debian.so.0 /usr/lib/libcloog.so.0
sudo ln -s /usr/lib/libmpfr.so.4 /usr/lib/libmpfr.so.1
Very nice write up, I've been looking into this for a while so its nice someone put it all together in one thread.
Sent from my NookColor using XDA Premium App
Nice Adrynalyne
Sent from my Thunderbolt using XDA Premium App
I love learning new things... Thanks for sharing knowledge!
For those of us that play in a Virtual Box, any notes about issues that may come up? I used to dual boot but decided that a vb is more time efficient for me.
Thanks a lot, i was wondering about this too.
Sent from my ADR6400L using Tapatalk
I'm really glad you've posted this. Time to play for those of us who are lazy (or busy)!
awesome. I love the android community's open-ness. Not only do you post your source, but you tell people how to use it...
Thank you so much for spending the time to write this, i have been googleing this and your write up is the best ive found.
I know this is a work in progress, but some ideas for future revisions, at least things that I have been wondering,
The files tweaked for overclocking, undervolting, and maybe some explanations on what goes into this.
Important files and maybe files we should not touch, (if there are any).
Just things I have wondered.
Thank you again!!!
Wow. Thank you for taking the time to write this up. Some of us really do appreciate it!
You sir, are a gentleman and a scholar.
You really are amazing at what you do. Sometimes I wonder when you sleep..
Uggg, I am running Ubuntu 10.10 64bit.
I have followed this step by step but I am getting the following error:
/home/scott/android/4.4.4/bin/../libexec/gcc/arm-none-eabi/4.4.4/cc1: error while loading shared libraries: libcloog.so.0: cannot open shared object file: No such file or directory
make[2]: *** [scripts/mod/empty.o] Error 1
make[1]: *** [scripts/mod] Error 2
make: *** [scripts] Error 2
make: INTERNAL: Exiting with 3 jobserver tokens available; should be 2!
What package am I missing? I apt-get installed libcloog-ppl0.
Any help is appreciated.
Scott
UPEngineer said:
Uggg, I am running Ubuntu 10.10 64bit.
I have followed this step by step but I am getting the following error:
/home/scott/android/4.4.4/bin/../libexec/gcc/arm-none-eabi/4.4.4/cc1: error while loading shared libraries: libcloog.so.0: cannot open shared object file: No such file or directory
make[2]: *** [scripts/mod/empty.o] Error 1
make[1]: *** [scripts/mod] Error 2
make: *** [scripts] Error 2
make: INTERNAL: Exiting with 3 jobserver tokens available; should be 2!
What package am I missing? I apt-get installed libcloog-ppl0.
Any help is appreciated.
Scott
Click to expand...
Click to collapse
Go to /usr/lib and tell me what the name of libcloog.so.? Is. There are bound to be growing pains with this, as I originally used Fedora 64 bit when I did this. Still, its doable on Ubuntu, because I have this same toolchain on Arch as well.
Let me know what the name of that file is. I will help all I can.
Sent from my ADR6400L using XDA App
adrynalyne said:
Go to /usr/lib and tell me what the name of libcloog.so.? Is.
Sent from my ADR6400L using XDA App
Click to expand...
Click to collapse
Adrynalyne,
In my /usr/lib I have the following libcloog files:
libcloog.a
libcloog.so
libcloog-debian.a
libcloog-debian.so
libcloog-debian.so.0
libcloog-debian.so.0.0.0
libcloog-ppl.a
libcloog-ppl.so
libcloog-ppl.so.0
Hope this helps.... It has been a long time since I messed with Linux
Again, I am Ubuntu 10.10 64bit
Thanks again.
sudo ln -s /usr/lib/libcloog-debian.so.0 /usr/lib/libcloog.so.0
sudo ln -s /usr/lib/libmpfr.so.4 /usr/lib/libmpfr.so.1
Trying to run kitchen , when trying to setup working folder it doesnt appear to do anything, I hit 1 and it just sits there. I hit 0 for advanced options and it just sits there.
I have a rom in the right folder as a zip and extracted.
edit: guess you cant extract in windows and copy the files over .
happimeal said:
Trying to run kitchen , when trying to setup working folder it doesnt appear to do anything, I hit 1 and it just sits there. I hit 0 for advanced options and it just sits there.
I have a rom in the right folder as a zip and extracted.
Thanks
Click to expand...
Click to collapse
You arent supposed to extract the rom. The kitchen needs to.
Yes..
all the way to the make and got some errors
/home/jroncalli/android/4.4.4/bin/arm-none-eabi-gcc: 1: ELF: not found
/home/jroncalli/android/4.4.4/bin/arm-none-eabi-gcc: 2: @: not found
/home/jroncalli/android/4.4.4/bin/arm-none-eabi-gcc: 3: Syntax error: ")" unexpected
CHK include/linux/version.h
SYMLINK include/asm -> include/asm-arm
make[1]: `include/asm-arm/mach-types.h' is up to date.
CHK include/linux/utsrelease.h
CC scripts/mod/empty.o
/home/jroncalli/android/4.4.4/bin/arm-none-eabi-gcc: 1: ELF: not found
/home/jroncalli/android/4.4.4/bin/arm-none-eabi-gcc: 2: @: not found
/home/jroncalli/android/4.4.4/bin/arm-none-eabi-gcc: 3: Syntax error: ")" unexpected
make[2]: *** [scripts/mod/empty.o] Error 2
make[1]: *** [scripts/mod] Error 2
make: *** [scripts] Error 2
Any ideas.
You need the lib32 stuff installed for Ubuntu. Not sure why, as its a 64 bit toolchain. I'm using full 64 bit Arch Linux and don't need to.
adrynalyne said:
You need the lib32 stuff installed for Ubuntu. Not sure why, as its a 64 bit toolchain. I'm using full 64 bit Arch Linux and don't need to.
Click to expand...
Click to collapse
Hmm, probably easier to just install 64 bit version, ....... doing that now.
Thank You.
Where was this guide all weekend lol
been waiting for this thanks bro
now if only i can find a guide to creating flashable .zips hmm
Sent from my ADR6400L using XDA Premium App

[Tutorial] Building CyanogenMod for G2x

My other tutorial for building CM for Nexus One
Last tested on 8/8/2011
This tutorial is basically my Nexus One tutorial altered to support the G2x. This tutorial requires a basic to intermediate knowledge of linux terminal commands. First you will need to be running the latest CM nightly. Then you will need to install Ubuntu 11.04. This tutorial will work for if you are running Ubuntu in a virtual machine and if you installed it to your hard drive. I have tested this by installing it to my hard drive and in a virtual machine, but I have not tried it in Wubi but it should work. You need 11.04 64 bit.
How to install Ubuntu: https://help.ubuntu.com/community/Installation
After you have installed Ububtu, make sure that your OS is up to date. You can do that by running the Update Manager from the System>Administration menu. Once that is completed, go to Applications>Accessories and open Terminal.
Now you will be setting up your build environment.
Next lets open a terminal. Copy and paste the following into terminal.
(Copy from this tutorial with control+c and paste in terminal with control+shift+v)
Code:
sudo apt-get update && sudo apt-get install git-core gnupg flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev gitg qt3-dev-tools libqt3-mt-dev eclipse valgrind pngcrush schedtool
Code:
sudo add-apt-repository ppa:ferramroberto/java && sudo apt-get update && sudo apt-get install sun-java6-jdk && sudo update-java-alternatives -s java-6-sun
Now you will be installing ADB
Download the sdk from the android website (use the Linux download) http://developer.android.com/sdk/index.html
extract the sdk to your ~/ directory (home directory). So you should be able to go to a terminal and cd ~/AndroidSDK/platform-tools to access your platform-tools folder in your sdk. After that, update your android sdk by opening terminal and run:
Code:
~/AndroidSDK/tools/./android
Open the terminal, and type gedit .bashrc and at the top of the file, paste this (replacing user with your username)
Code:
#AndroidDev PATH
export PATH=${PATH}:/home/user/AndroidSDK/platform-tools
export PATH=${PATH}:/home/user/AndroidSDK/tools
This will make ADB, Fastboot and DDMS available from the terminal on next login.
Now, to make the device available to normal users, open a terminal and type
Code:
sudo gedit /etc/udev/rules.d/51-android.rules
Then paste
Code:
SUBSYSTEMS == "usb", ATTRS {idVendor} == "18d1", ATTRS {idProduct} == "4E11", MODE = "0666"
SUBSYSTEMS == "usb", ATTRS {idVendor} == "18d1", ATTRS {idProduct} == "4e12", MODE = "0666"
SUBSYSTEMS == "usb", ATTRS {idVendor} == "0bb4", ATTRS {idProduct} == "0FFF", MODE = "0666"
SUBSYSTEM=="usb",ATTRS(idVendor)=="18d1",SYMLINK+="android_adb",MODE="0666"
SUBSYSTEM=="usb", SYSFS{idVendor}=="18d1", MODE="0666"
SUBSYSTEM=="usb", SYSFS{idVendor}=="1004", MODE="0666"
Save and exit.
Ensure that the rules are executable:
Code:
sudo chmod a+rx /etc/udev/rules.d/*
Then type
Code:
sudo restart udev
You should restart your computer (or virtual machine) right now to ensure that everything is running properly.
Note: idVendor may vary. Use lsusb from the terminal, look for your Android device and replace “0bb4″ with the first 4 characters after “ID”.
If ADB is still not working, read http://forum.xda-developers.com/showthread.php?t=533 and http://alan.lamielle.net/2010/01/22/nexus-one-usb-in-ubuntu-9-10
You should now have a fully working android build environment.
Now before you begin getting and building the source, make sure that you are on the latest CM7 nightly and have the latest gapps from Rom Manager.
Now to setup the CyanogenMod build environment and to build it
Enter the following lines in terminal:
Code:
cd ~/
mkdir -p ~/bin
mkdir -p ~/cm7
cd ~/bin
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
cd ~/
chmod a+x ~/bin/repo
PATH="$HOME/bin:$PATH"
PATH="$HOME/AndroidSDK/platform-tools:$PATH"
PATH="$HOME/AndroidSDK/tools:$PATH"
cd ~/cm7
repo init -u git://github.com/CyanogenMod/android.git -b gingerbread
Press enter and enter the information it asks for.
The next command will download all of the CM source. It will take at least a few hours or more depending on your internet speed.
Code:
repo sync -j16
After the sync, plug your phone in, and run adb devices and if your phone is listed, continue. Otherwise, go back and make sure you have properly installed adb and the drivers.
Plug your phone in, copy the following commands into terminal, and press enter.
Code:
cd ~/cm7/device/lge/p999/
./extract-files.sh
cd ~/cm7/vendor/cyanogen/
./get-rommanager
./get-google-files
now you your CM build environment is complete.
Warning: Building CM pushes your computer to the max your cpu can handle. Make sure that your computer can handle compiling CM. If It cannot, DO NOT DO THIS.
To build, just run(use this command every time you want to build CM):
**** Here is a new updated command to build CM****
Code:
cd ~/cm7 && make clean && repo sync -j6 && . build/envsetup.sh && brunch p999
If you come across any problems while syncing use repo sync -f -j6 -d and it will force sync and override any changes made to the source on your computer.
and it will make an update.zip in ~/cm7/out/target/product/p999/update-cm-7.1.0-RC1-G2x-signed.zip (or whatever the latest RC is)
Congratulations you have just compiled CyanogenMod for the G2x!
Possible causes if the build fails:
1. Make sure you followed the directions precisely.
2. Try all three of the build commands.
3. If you changed any of the code, make sure it has no errors. Open it up in eclipse and check for errors.
4. Search Google and XDA.
**If you are getting a problem with getting the gapps, it it because of the CM gapps mirror system.
1. download and install the latest gapps
2. plug your phone in and run:
Code:
~/cm7/vendor/cyanogen/./extract-google-files
Sources:
http://developer.android.com/sdk/index.html
http://wiki.cyanogenmod.com/index.php?title=Compile_CyanogenMod_for_passion
http://www.lineardroid.co.uk/2010/07/configure-build-environment/
http://www.lineardroid.co.uk/2010/04/how-to-set-up-adb-in-ubuntu/
http://forum.xda-developers.com/showthread.php?t=533090
http://alan.lamielle.net/2010/01/22/nexus-one-usb-in-ubuntu-9-10
http://forum.xda-developers.com/showthread.php?t=704561
Be sure to thank if this was helpful!
reserved...
reserved...
that's good. Thank you
Nice... Ive been always wondering how to do that... Time to start tonight
Any news if there is some kind of an online kitchen for the g2x that is not cm7 based?
Very nice. Thanks for updating your guide for the G2x.
OSError: [Errno 2] No such file or directory
Hey there. I'm going through your how to here and I came into an error pasted below. I'm very new to all this but am very eager learn. Can you shed some light on what is happening? Thanks a ton!
[email protected]:~/cm7$ repo init -u git://github.com/CyanogenMod/android.git -b gingerbread
Traceback (most recent call last):
File "/home/dubntz/bin/repo", line 603, in <module>
main(sys.argv[1:])
File "/home/dubntz/bin/repo", line 570, in main
_Init(args)
File "/home/dubntz/bin/repo", line 184, in _Init
_CheckGitVersion()
File "/home/dubntz/bin/repo", line 213, in _CheckGitVersion
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
File "/usr/lib/python2.7/subprocess.py", line 672, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1213, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
[email protected]:~/cm7$
Install git.
I followed all of your steps but am getting the adb not found or whatever error when trying to run adb devices, or any adb command for that matter. I tried as root, and as a normal user and nothing worked.
Anyone else have this issue?
*black*silva* said:
I followed all of your steps but am getting the adb not found or whatever error when trying to run adb devices, or any adb command for that matter. I tried as root, and as a normal user and nothing worked.
Anyone else have this issue?
Click to expand...
Click to collapse
First, make sure that you did downloaded and extracted the Linux version of the Android SDK. Second, verify that the path to the directory where the adb command is correct. Third, check if the adb command is indeed present in that directory. If it's not in platform-tools directory then you need to run the ./android command and update the SDK.
Sent from my LG-P999 using XDA App
joackie27 said:
First, make sure that you did downloaded and extracted the Linux version of the Android SDK. Second, verify that the path to the directory where the adb command is correct. Third, check if the adb command is indeed present in that directory. If it's not in platform-tools directory then you need to run the ./android command and update the SDK.
Sent from my LG-P999 using XDA App
Click to expand...
Click to collapse
I downloaded and extracted my SDK to my home folder, and when i checked to see if the adb command was there it was not, so i am now getting everything i think i need from running the android command. Could it be because im on 32 bit? And it says you need 64? Or is that only to compile? I'd like to compile but i really just want ADB working.
*black*silva* said:
I downloaded and extracted my SDK to my home folder, and when i checked to see if the adb command was there it was not, so i am now getting everything i think i need from running the android command. Could it be because im on 32 bit? And it says you need 64? Or is that only to compile? I'd like to compile but i really just want ADB working.
Click to expand...
Click to collapse
I don't think it had to do with you being on a 32 bit. I think it had to do with the archive file not really having the adb command. You have to update the SDK first to get it. I may be wrong but if you want, you can inspect the contents of the archive file that you've downloaded to verify if it's really there. I've experienced the same thing that's why I was able to addressed your issues earlier.
If you want to compile then you need the 64 bit version as stated by the OP.
Sent from my LG-P999 using XDA App
i updated and installed all the things i needed and now ADB works perfect. Now i might try compiling. Thanks joackie27 for the help.
*black*silva* said:
i updated and installed all the things i needed and now ADB works perfect. Now i might try compiling. Thanks joackie27 for the help.
Click to expand...
Click to collapse
You're welcome! That's what the XDA community (help one another) is all about.
I wouldn't even try compiling not unless you've got the 64 bit version. I think it became a requirement with Gingerbread.
Sent from my LG-P999 using XDA App
joackie27 said:
You're welcome! That's what the XDA community (help one another) is all about.
I wouldn't even try compiling not unless you've got the 64 bit version. I think it became a requirement with Gingerbread.
Sent from my LG-P999 using XDA App
Click to expand...
Click to collapse
alright. thanks. i have already ran everything and all i have let to do is run the last code to compile it, so im going to and just gunna see what happens. if it works great. if not, i will always have chris to do it for me lol.
O and BTW for the code,
Code:
cd ~/cm7/device/htc/p999/
you will need to change it to
Code:
cd ~/cm7/device/lge/p999/
because HTC did not make the p999, LG did. but other than that everything has gone smooth.
*black*silva* said:
alright. thanks. i have already ran everything and all i have let to do is run the last code to compile it, so im going to and just gunna see what happens. if it works great. if not, i will always have chris to do it for me lol.
O and BTW for the code,
Code:
cd ~/cm7/device/htc/p999/
you will need to change it to
Code:
cd ~/cm7/device/lge/p999/
because HTC did not make the p999, LG did. but other than that everything has gone smooth.
Click to expand...
Click to collapse
Yeah I caught that one too. And after cloning the git repository for CM7, you can definitely see that there's no p999 directory under htc. And lastly, as you've pointed out p999 was from lge (LG Electronics).
joackie27 said:
Yeah I caught that one too. And after cloning the git repository for CM7, you can definitely see that there's no p999 directory under htc. And lastly, as you've pointed out p999 was from lge (LG Electronics).
Click to expand...
Click to collapse
yeah that how i got it to. And i dont really recommend using 32 bit because the guide says to use 64 but i already had 32 installed and didnt want to wipe that partition and reinstall 64 bit so i tried compiling on 32 bit and it worked fine. had no problems at all with compiling it or flashing it. But im just giving that information out for anyone who wants to compile and already has 32.
*black*silva* said:
yeah that how i got it to. And i dont really recommend using 32 bit because the guide says to use 64 but i already had 32 installed and didnt want to wipe that partition and reinstall 64 bit so i tried compiling on 32 bit and it worked fine. had no problems at all with compiling it or flashing it. But im just giving that information out for anyone who wants to compile and already has 32.
Click to expand...
Click to collapse
It worked fine on 32 bit for you? When i was getting all the files for the build environment it couldn't find some of the files while I was using 32bit like lib32ncursers or whatever, there were 4 of them.
brian6685 said:
It worked fine on 32 bit for you? When i was getting all the files for the build environment it couldn't find some of the files while I was using 32bit like lib32ncursers or whatever, there were 4 of them.
Click to expand...
Click to collapse
yup. everything worked perfectly fine for me. Although when i got my build environment i got them here...
http://forum.xda-developers.com/showthread.php?t=915435
I did not get any errors. And my ROM is running great!
*black*silva* said:
alright. thanks. i have already ran everything and all i have let to do is run the last code to compile it, so im going to and just gunna see what happens. if it works great. if not, i will always have chris to do it for me lol.
O and BTW for the code,
Code:
cd ~/cm7/device/htc/p999/
you will need to change it to
Code:
cd ~/cm7/device/lge/p999/
because HTC did not make the p999, LG did. but other than that everything has gone smooth.
Click to expand...
Click to collapse
Thanks. Changed it.

CROSS COMPILE path not found ?!

I've set up a VM build environment using Ubuntu with the aim of building kernel modules for my Samsung S3. Particularly interested in the asix
ethernet module so I can use this USB Ethernet adapter. Kevinf28 has very kindly assisted to provide initial builds of the module and prove that
it works. ( see http://forum.xda-developers.com/showthread.php?t=2131825) However, it needs to be rebuilt when a new ROM is released, and I
therefore want to create my own build environment. I have everything setup using git, have cloned the tool chains etc from git and have the kernel source ready to go from samsung. I can create the config file for the make, but then the build fails with the following. This seems very odd as the file its saying it cant find is clearly there! Any ideas ? I'm new to building kernels in linux. The output below was an attempt to build a CM10 version, but the same error occurs when building a samsung one.
export CROSS_COMPILE=/root/git/Android_Toolchains/arm-eabi-4.4.3/bin/arm-eabi-
[email protected]:~/kernel/android_kernel_samsung_smdk4412-43aaedbcde478c8e032771d62a1956133b29b1d4#
make cyanogenmod_i9300_defconfig#
# configuration written to .config
#
[email protected]:~/kernel/android_kernel_samsung_smdk4412-43aaedbcde478c8e032771d62a1956133b29b1d4#make make: /root/git/Android_Toolchains/arm-eabi-4.4.3/bin/arm-eabi-gcc: Commandnot found scripts/kconfig/conf --silentoldconfig Kconfig make: /root/git/Android_Toolchains/arm-eabi-4.4.3/bin/arm-eabi-gcc: Commandnot found CHK include/linux/version.h CHK include/generated/utsrelease.h make[1]: `include/generated/mach-types.h' is up to date. CC kernel/bounds.s /bin/sh: 1: /root/git/Android_Toolchains/arm-eabi-4.4.3/bin/arm-eabi-gcc:not found make[1]: *** [kernel/bounds.s] Error 127 make: *** [prepare0] Error 2----
-Saying its not found - but here is the directory showing the file is there:
[email protected]:~/git/Android_Toolchains/arm-eabi-4.4.3/bin# ls
arm-eabi-addr2line
arm-eabi-gcc
arm-eabi-ld
arm-eabi-readelf
arm-eabi-ar
arm-eabi-gcc-4.4.3
arm-eabi-ld.bfd
arm-eabi-run
arm-eabi-as
arm-eabi-gccbug
arm-eabi-ld.gold
arm-eabi-size
arm-eabi-c++
arm-eabi-gcov
arm-eabi-nm
arm-eabi-strings
arm-eabi-c++filt
arm-eabi-gdb
arm-eabi-objcopy
arm-eabi-strip
arm-eabi-cpp
arm-eabi-gdbtui
arm-eabi-objdump
arm-eabi-g++
arm-eabi-gprof
arm-eabi-ranlib
Code:
[SIZE=4][COLOR=Red]~[/COLOR][/SIZE]/git/Android_Toolchains/arm-eabi-4.4.3/bin
and
Code:
/root/git/Android_Toolchains/arm-eabi-4.4.3/bin/
are not the same directories.
~ = is your home directory, which is like /home/[username]/
You have to use this
Code:
export CROSS_COMPILE=~/git/Android_Toolchains/arm-eabi-4.4.3/bin/arm-eabi-
Thanks - but still no joy....
set the CROSS_COMPILE, confirmed its set, confirmed the contents of the dir, then make...
trying to set it using ~ gets replaced with /root/...
Code:
[email protected]:~/git/Android_Toolchains/arm-eabi-4.4.3/bin# export CROSS_COMPILE=~/git/Android_Toolchains/arm-eabi-4.4.3/bin/arm-eabi-
[email protected]:~/git/Android_Toolchains/arm-eabi-4.4.3/bin# echo $CROSS_COMPILE
/root/git/Android_Toolchains/arm-eabi-4.4.3/bin/arm-eabi-
[email protected]:~/git/Android_Toolchains/arm-eabi-4.4.3/bin# ls
arm-eabi-addr2line arm-eabi-gcc arm-eabi-ld arm-eabi-readelf
arm-eabi-ar arm-eabi-gcc-4.4.3 arm-eabi-ld.bfd arm-eabi-run
arm-eabi-as arm-eabi-gccbug arm-eabi-ld.gold arm-eabi-size
arm-eabi-c++ arm-eabi-gcov arm-eabi-nm arm-eabi-strings
arm-eabi-c++filt arm-eabi-gdb arm-eabi-objcopy arm-eabi-strip
arm-eabi-cpp arm-eabi-gdbtui arm-eabi-objdump
arm-eabi-g++ arm-eabi-gprof arm-eabi-ranlib
[email protected]:~/git/Android_Toolchains/arm-eabi-4.4.3/bin# cd /root/kernel/
[email protected]:~/kernel# make
make: /root/git/Android_Toolchains/arm-eabi-4.4.3/bin/arm-eabi-gcc: Command not found
CHK include/linux/version.h
CHK include/generated/utsrelease.h
make[1]: `include/generated/mach-types.h' is up to date.
CC kernel/bounds.s
/bin/sh: 1: /root/git/Android_Toolchains/arm-eabi-4.4.3/bin/arm-eabi-gcc: not found
make[1]: *** [kernel/bounds.s] Error 127
make: *** [prepare0] Error 2
Wait, you said ~ gets replaced with /root ?
Why your home_dir is root? That's odd...
However, do this
Code:
cd ~/git/Android_Toolchains/arm-eabi-4.4.3/bin
pwd
After "pwd" you will get a full path of the directory where you in
Use that path for
Code:
export CROSS_COMPILE=<path you got>/arm-eabi-
Are you logged in as root?
Sent from my SCH-R950 using Tapatalk 2
thewadegeek said:
Are you logged in as root?
Sent from my SCH-R950 using Tapatalk 2
Click to expand...
Click to collapse
Yes he is logged in as root. That's why his home directory is /root.
Sent from my GT-I9300 using xda app-developers app
I know, I was getting him to think of that though. Sorry missed the post answering his question, but he still hasn't responded. @op Why are you logged in as root? You can build as a standard user.
Sent from my SCH-R950 using Tapatalk 2
thewadegeek said:
I know, I was getting him to think of that though. Sorry missed the post answering his question, but he still hasn't responded. @op Why are you logged in as root? You can build as a standard user.
Sent from my SCH-R950 using Tapatalk 2
Click to expand...
Click to collapse
I actually have the exact same problem. I can't build as root or as a standard user. No matter what I do, it won't compile ( running a VM just like the OP).
The virtual machine environment causing the problem?
Sent from my GT-I9300 using xda app-developers app
Well what is the error? I've built on multiple VMs without a problem.
Sent from my SCH-R950 using Tapatalk 2
thewadegeek said:
Well what is the error? I've built on multiple VMs without a problem.
Sent from my SCH-R950 using Tapatalk 2
Click to expand...
Click to collapse
Make can't find gcc compiler in the path given through CROSS_COMPILE
123shree said:
I actually have the exact same problem. I can't build as root or as a standard user. No matter what I do, it won't compile ( running a VM just like the OP).
The virtual machine environment causing the problem?
Sent from my GT-I9300 using xda app-developers app
Click to expand...
Click to collapse
I don't think so, I've built a kernel several times on a virtual machine (virtualbox)
Well the fix for the OP is to use the toolchains fixed path instead of the relative path. I was curious as to what the other gentleman's error was.
Sent from my SCH-R950 using Tapatalk 2
I still cant get this to run - even following the instructions above.
I am using "sudo -i"
I could try as a user and shift everything across from the root home, but not sure that this will make a difference.... ?
gingerneil said:
I still cant get this to run - even following the instructions above.
I am using "sudo -i"
I could try as a user and shift everything across from the root home, but not sure that this will make a difference.... ?
Click to expand...
Click to collapse
Can you answer my question about why you were running as root in the first place? It is not needed so I want to know what circumstances lead up to this. Also now why is it failing? Same error? If so you got the path to the toolchain wrong.
No real reason to run as root - just that the instructions that I was following had it as root.
As far as the path being wrong - have a look back through my code snippets - I'm sure it isnt unless you can spot something I cant.....
gingerneil said:
No real reason to run as root - just that the instructions that I was following had it as root.
As far as the path being wrong - have a look back through my code snippets - I'm sure it isnt unless you can spot something I cant.....
Click to expand...
Click to collapse
64-bit VM by any chance?
thewadegeek said:
64-bit VM by any chance?
Click to expand...
Click to collapse
Yes - the vm is 64bit. Could that be why? Does the kernel only compile on 32bit?
Nope it will build, but do you have ia32-libs install? Any other toolchains on the machine?
Sent from my SCH-R950 using Tapatalk 2
thewadegeek said:
Nope it will build, but do you have ia32-libs install? Any other toolchains on the machine?
Sent from my SCH-R950 using Tapatalk 2
Click to expand...
Click to collapse
I've tried to install ia32-libs but I get lots of dependancy errors that Ive not been able to fix. As its a VM and easy to rebuild, I'm downloading the 32bit version and will see if I have any better results.
I've swapped my S3 for a Note2 - so will have a go at building the modules for that once I have the VM up again.
gingerneil said:
I've swapped my S3 for a Note2 - so will have a go at building the modules for that once I have the VM up again.
Click to expand...
Click to collapse
Looks like I may havce sorted this - i added in the CROSS_COMPILE= statement statement to the make command - like in (4) here: http://xda-university.com/as-a-developer/getting-started-building-a-kernel-from-source
Seems to be building ok now - but will see if it completes ok.
I reinstalled the VM with everything in a user home area rather than using /root/ - but the user is admin anyway so I dont suppose this will have made a difference.

[GUIDE] Building Pure Nexus

Introduction
Hello everyone, this is a guide to get you up and running with your own build of Pure Nexus for the Nexus 5X. In this thread, you will learn how to get your computer set up to build and the commands you will need to run. Please read the entire guide and the FAQ. Additionally, this is a developer's thread, there should be no off topic discussion.
Compilation Guide
This is available on my Github, where it may be a little more up to date.
0. Getting started
In this guide, I will go over how to build Pure Nexus on your Linux machine. This particular tutorial will focus on Ubuntu 16.04 as that is what I use (Mint 18 is also good) but this should work with any version of Linux; it does need to be 64-bit however. I will leave the installation of that up to you, Google is a wonderful resource. If you don't have a good computer but still want to build, check out this thread on XDA: http://forum.xda-developers.com/chef-central/android/guide-how-to-build-rom-google-cloud-t3360430
1. Set up your environment
1. Automatically
Code:
sudo apt-get install git-core
git clone https://github.com/akhilnarang/scripts
cd scripts
ls
bash <script-name>
<script-name> should be one of the scripts in the folder for your particular architecture.
2. Manually
1. Install Java 8
Code:
sudo apt-get update
sudo apt-get install openjdk-8-jdk
sudo apt-get install openjdk-8-jre
2. Install other build tools
Code:
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip
2. Configure repo and git
If you have any problems with the below commands, try running as root:
Code:
sudo -s
Git is an open source version control system which is incredibly robust for tracking changes across repositories. Repo is Google's tool for working with Git in the context of Android. More reading if you are interested: https://source.android.com/source/developing.html
Run these commands to get repo working (only do this if you did the manual set up method above:
Code:
mkdir ~/bin
PATH=~/bin:$PATH
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
Run these commands to get git working:
Code:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
3. Download the source
First, before downloading the source, create a folder for the source and move into it.
Code:
mkdir ~/<foldername> (eg. mkdir ~/PN or ~/PureNexus)
cd ~/<foldername>
Then, we need to grab the manifest and sync down the repositories. Here are the commands to do this for Pure Nexus for Nougat (make sure you are in the source folder you made above):
Code:
repo init -u https://github.com/PureNexusProject/manifest.git -b n
repo sync --force-sync
Here is the process generally for other ROMs:
When you go to build a ROM, you must download its source. All, if not most, ROMs will have their source code available on Github. To properly download the source, follow these steps:
Go to your ROM's Github (e.g. http://github.com/PureNexusProject)
Search for a manifest (usually called manifest or android_manifest).
Go into the repo and make sure you are in the right branch (located right under the Commits tab).
Go into the README and search for a repo init command. If one exists, copy and paste it into the terminal and hit enter.
If one does not exist, you can make one with this formula:
Code:
repo init -u <url_of_manifest_repo>.git -b <branch_you_want_to_build>
For example:
Code:
repo init -u http://github.com/PureNexusProject/manifest.git -b n
After the repo has been initialized, run this command to download the source:
Code:
repo sync --force-sync
This process can take a while depending on your internet connection.
4. Build it!
At this point, it'd be a good idea to set up ccache. ccache is a compiler cache, it stores previously compiled files in a directory and pulls from that instead of recompiling if nothing has changed. This speeds up compilation a LOT. If you want to use it, follow the below steps:
Open up your .bashrc file in your home directory using a text editor or nano and append this to the end of it:
Code:
export USE_CCACHE=1
Then type:
Code:
source ~/.bashrc
After that, run one of the below command (replacing the # with how many GBs of ccache you want, 50 is recommended)
Use this one if you used the manual method of set up in section 1:
Code:
prebuilts/misc/linux-x86/ccache/ccache -M #G
Use this one if you used the automatic method of set up in section 1:
Code:
ccache -M #G
After that, it's time to build!
Code:
. build/envsetup.sh
breakfast bullhead
mka bacon
After that, your computer will build the flashable zip file and if you see something that says make completed, you've done it!
Any time that you want to rebuild, type the following commands:
Code:
repo sync --force-sync
. build/envsetup.sh
breakfast bullhead
mka clobber
mka bacon
I also have a script to do this on my Github here
Frequently Asked Questions
1.1 Q: I got an error, what do I do??
1.1 A: Well to start, if it is anything with Ninja, I would go ahead and disable it. You can add this to your .bashrc file:
Code:
export USE_NINJA=false
Then type this
Code:
source ~/.bashrc
. build/envsetup.sh
breakfast bullhead
mka clobber
mka bacon
If it is saying you ran out of memory, follow this post.
If it isn't Ninja related, check out @AzraelsKiss's post here, where he has documented a few common issues. If none of those apply, post here with a detailed list of what you have done and we will do our best to help you.
1.2 Q: Can you guys share your personal builds?
1.2 A: No, personal builds are just that: personal. Beans releases whenever he feels that the release is ready for the masses and if a bunch of personal builds are floating around, that tarnishes the Pure Nexus name. We are more than happy to help get you up and running but we will not be sharing our builds. Thanks for understanding!
this wont work on Windows, right?
RonnellTapawan said:
this wont work on Windows, right?
Click to expand...
Click to collapse
I have heard people try to use Bash for Windows but I don't think it will work. Linux or bust.
nathanchance said:
I have heard people try to use Bash for Windows but I don't think it will work. Linux or bust.
Click to expand...
Click to collapse
I tried on bash for windows but it can't build android roms
Dude you should seriously get a XDA medallion or some sort of metal for all you do all over XDA. I see you everywhere. Thanks for building for us and also for this write up. :good: @ nathan
SM210 said:
Dude you should seriously get a XDA medallion or some sort of metal for all you do all over XDA. I see you everywhere. Thanks for building for us and also for this write up. :good: @ nathan
Click to expand...
Click to collapse
Talk to my superiors :silly: thanks for the kind words
Edited.......
Sent from my Nexus 5X using Tapatalk
myawan said:
Anybody wanna share home made build?
Sent from my Nexus 5X using Tapatalk
Click to expand...
Click to collapse
If you read at the end of the OP, it says:
"1.2 Q: Can you guys share your personal builds?
1.2 A: No, personal builds are just that: personal. Beans releases whenever he feels that the release is ready for the masses and if a bunch of personal builds are floating around, that tarnishes the Pure Nexus name. We are more than happy to help get you up and running but we will not be sharing our builds. Thanks for understanding!"
Reason being, because if we start compiling these and handing it out like it's no ones business, we're going to run Pure Nexus into the ground and people will start uploading them on AFH and it'll be one big mess. My guess is, this is just a courtesy by the original poster to those of us who can't wait.
My two cents.:laugh::highfive:
i'm on it!!!!! thank you very much!!! download is taking forever ugh
Building it right now! Thanks
I think this would work in Cygwin. I used to compile stuff for the PS3 way back. I'd have a lot of reading to do if I wanted to build this for my phone.
Which gapps to use with this?
Open Gapps micro are working fine.
Gesendet von meinem Nexus 5X mit Tapatalk
So WE can't share our build either? Or what, i didn't get it.
CreasingMass Dev said:
So WE can't share our build either? Or what, i didn't get it.
Click to expand...
Click to collapse
Don't distribute personal builds. Flash them yourself and that is it.
4 hours of download :crying:
OOH MAN!!!!!! no more space in my device!!! how can i resume that???
Code:
Checking out files: 100% (1717/1717), done.
error: unable to write file current/platforms/android-21/arch-x86_64/usr/lib/libz.a
error: unable to write file current/platforms/android-21/arch-x86_64/usr/lib/libz.so
fatal: cannot create directory at 'current/platforms/android-21/arch-x86_64/usr/lib64': Spazio esaurito sul device
Traceback (most recent call last):
File "/home/matteo/Scaricati/PureNexus/.repo/repo/main.py", line 531, in <module>
_Main(sys.argv[1:])
File "/home/matteo/Scaricati/PureNexus/.repo/repo/main.py", line 507, in _Main
result = repo._Run(argv) or 0
File "/home/matteo/Scaricati/PureNexus/.repo/repo/main.py", line 180, in _Run
result = cmd.Execute(copts, cargs)
File "/home/matteo/Scaricati/PureNexus/.repo/repo/subcmds/sync.py", line 769, in Execute
project.Sync_LocalHalf(syncbuf, force_sync=opt.force_sync)
File "/home/matteo/Scaricati/PureNexus/.repo/repo/project.py", line 1325, in Sync_LocalHalf
self._InitWorkTree(force_sync=force_sync)
File "/home/matteo/Scaricati/PureNexus/.repo/repo/project.py", line 2482, in _InitWorkTree
raise GitError("cannot initialize work tree")
error.GitError: cannot initialize work tree
can i move the PureNexus folder in an external drive and resume??? please
MatteXperiaU said:
4 hours of download :crying:
OOH MAN!!!!!! no more space in my device!!! how can i resume that???
can i move the PureNexus folder in an external drive and resume??? please
Click to expand...
Click to collapse
You can try. Your build times will be much slower though.
Sent from my Nexus 6P using XDA Labs
nathanchance said:
You can try. Your build times will be much slower though.
Sent from my Nexus 6P using XDA Labs
Click to expand...
Click to collapse
i have another partition in the same HD (300GB).. i can use that :fingers-crossed:
which command i need to resume?
sorry for the questions man, you're too kind
TPMJB said:
I think this would work in Cygwin. I used to compile stuff for the PS3 way back. I'd have a lot of reading to do if I wanted to build this for my phone.
Click to expand...
Click to collapse
No promises...
http://www.howtogeek.com/249966/how-to-install-and-use-the-linux-bash-shell-on-windows-10/
Out of curiosity, realistically how much disk space would be required to download everything and compile with a 50GB cache? I got everything downloaded and the compile ran but threw some warnings (most of which may have been benign). When the compile terminated with an error, I had about 40MB left on my Linux Mint 18 partition so I assume it ran out of space I started with about 70GB free space
I deleted everything and decided to try again if and when I have a larger partition to play with..... I am currently dual booting on a Windows machine and didn't think to allocate that much space to Mint.
Paul

Categories

Resources