[SCRIPT][UBUNTU][ROM-BUILDING] Build Environment Setuper :P - Other Tools & General Discussion

This is a script that should last a while when it comes to compatibility. It helps guide you through setting up a build environment to build an AOSP rom from source. I'll create a few more that help for compiling from some other ROM repos (think PA, CM, AOKP, that kind of thing) but for now this is what I've got. I'm working on a second that can set up the source for compiling, choose a device to compile for (and hopefully be able to download stuff like prebuilts and other stuff as well and downloading proprietary blobs) actual devices, compile them, copy the zip to an out folder, and in some cases even directly sideload it. Enjoy!
Oh yeah, you need Ubuntu/derivative other than mint 14.04 or later (64 bit version ONLY) and over 60gb of free space.
This guide currently downloads source for android 5.0.

Has anyone tried this? Did it help?

Related

Relationship between Android and kernel

Hi all,
Looking to build my first custom Rom and had some queries terminology-wise.
What is the relationship between the kernel and Google's android platform? For instance, is froyo tied to a specific kernel and is this in the source tree?
Second q: HTC release their kernel sources. Say I wanted to get a froyo build up for a device that currently only has eclair, would the procedure be to diff the HTC modifications against the vanilla version and then make the appropriate changes to froyo?
Third q: what makes a Rom specific to a device? Probably linked to first question...
Many thanks,
Martin
Sent from my HTC Wildfire using XDA App
The kernel is basically just a linux kernel with device specific drivers and such added. I've done a 'diff' between the Eris 2.6.29 kernel from HTC and the 'generic' 2.6.29 kernel from kernel.org. It's kind of neat to see the difference. I highly recommend you do that.
There are also device specific drivers in the file structure that the ROM needs in order to function.
What I've done is compile AOSP from source, compile the kernel from source, zip up the needed files/folders, signed the ROM, and then flashed it to test. If you look at Android Builder in my sig, you can figure out the difference between the Eris and your device. You'll have to change the kernel that gets downloaded, of course. And it really just gives you a basic ROM without the device specific drivers, so things will not work without figuring the rest out. Grab a stock ROM to get drivers, libs, etc. out of.
/system/usr/keychars & /system/usr/keylayout usually have the keyboard drivers, which are somewhat important.
Also in my sig is the SgtShultz ROM where I tried to make a usable ROM from as close to source as possible. You might get some ideas from there. I still haven't figured out how to get the audio to work. If I get that worked out, I'll actually start using the ROM daily and work out the rest!
Froyo seems to work with kernel versions 2.6.29+, btw.
Many thanks for this; it's given me a good set of places to start reading.
Just pulling down all the AOSP source as we speak, with the hopes of getting a basic build up in the near future
gnarlyc said:
What I've done is compile AOSP from source, compile the kernel from source, zip up the needed files/folders, signed the ROM, and then flashed it to test. If you look at Android Builder in my sig, you can figure out the difference between the Eris and your device. You'll have to change the kernel that gets downloaded, of course. And it really just gives you a basic ROM without the device specific drivers, so things will not work without figuring the rest out. Grab a stock ROM to get drivers, libs, etc. out of.
[...]
/system/usr/keychars & /system/usr/keylayout usually have the keyboard drivers, which are somewhat important.
[...]
Froyo seems to work with kernel versions 2.6.29+, btw.
Click to expand...
Click to collapse
A couple of questions on this front...
I can see, obviously, where to get the kernel source and needed drivers; I am, however, unclear as to where I should obtain AOSP drivers from (to go, for instance, in /devices/htc/buzz and/devices/htc/buzz-common). Can I extract these from my device? (or do I need to wait until they release Froyo and then extract them from a device running the newer build?) Where on the device should I be looking for this driver set?
Thanks again,
Martin
MartinEve said:
A couple of questions on this front...
I can see, obviously, where to get the kernel source and needed drivers; I am, however, unclear as to where I should obtain AOSP drivers from (to go, for instance, in /devices/htc/buzz and/devices/htc/buzz-common). Can I extract these from my device? (or do I need to wait until they release Froyo and then extract them from a device running the newer build?) Where on the device should I be looking for this driver set?
Thanks again,
Martin
Click to expand...
Click to collapse
For the most part, any Eclair drivers seem to work. At least that's what I have used for the Eris. 2.1 -> 2.2 isn't too big of a jump. I used drivers from a stock 2.1 ROM.
Look up vendor tree, vendor config, and 'extract-files.sh'. You'll see what people with other devices have done. I have yet to quite get the whole vendor tree thing worked out, but others have. You can just come up with a list of needed drivers to add to the 'extract-files.sh' script and just copy those files in manually. (That's what I have done.) This will get pretty close to making an AOSP build complete. However, it appears that actually using the vendor tree setup while compiling will get things 'right'. There appear to be some libs that will compile differently for different devices.
So, basically, if you compile AOSP without a vendor tree for your device, the build will be located in out/target/product/generic. (And, you can copy drivers in later while using the kitchen, but you might miss out on some AOSP stuff with device-specific changes.) If you use the vendor tree, it will be in /out/target/product/buzz and will contain the drivers that the 'extract-files.sh' script grabbed from your device along with custom compiled libs.
If you are able to get a working vendor tree for your device, it will be helpful to the entire community. They'll all be able to use it for their builds. I highly recommend doing that. Most groups use github or something similar to post the code.
I still have much to learn myself, and you are starting to reach my limit! Good stuff.
Hi,
Many thanks for your reply; to a degree, it's about knowing the terms to search for -- the extract-files.sh is a godsend for information that I would have otherwise missed.
Anyway, onwards to build a usable vendor tree
Best,
Martin

[Q] Need Help with Compiling AOSP Nougat - Proprietary Binaries

So I've decided to give building Android a go, considering we've recently obtained the source code for the device in question (R1 HD) and no one else has done this yet for this device. I've been following this guide, since all the other guides I've found assume there is already a GitHub repo for your device. There's literally NOTHING out there regarding this device, aside from the kernel source we've obtained in the form of a .zip archive.
I've done everything up to and including pulling the 7.0.0 r1 source with the reop sync command, and I am now stuck on the Preparing to Build section. The first thing it talks about at this point is implementing proprietary binaries into my source. I have no idea where to find proprietary binaries for my R1 HD, let alone if they even exist out there to be implemented. Literally all I have regarding this device is the kernel source in a zip file. I can't find anything else out there nor do I really know what to look for.
Can anyone tell me what to do here? I've never compiled Android or even a kernel before, and I'd really like to get something out there for this device that others can base their work off of.

First CyanogenMod Build - generated ROM only 9.7MB?

I am working for the first time to get a complete build box setup for CyanogenMod 12.1 on a Galaxy Core Prime. I have repo CyanogenMod 12.1, Installed the Port from this thread: http://forum.xda-developers.com/gal.../rom-cyanogenmod-12-1-samsung-galaxy-t3405669, and I have installed the Kernel build code from this thread: http://forum.xda-developers.com/gal...kernel-core2013266073-kernel-samsung-t3410112.
I did have to fix some compile errors with the Kernel code but nothing spectacular. The restore file that got generated is only 9.7mb? I was expecting something in the 250MB+ range in size so I have not loaded it on my phone. Is there something I am missing?
My goal once the build box is setup properly is to try to port Sailfish OS to the phone. I need a fully working CyanogenMod 12.1 build box in order to do that.
Thank you for your help and any pointers. I have gone through the various guides and searched but have not been able to come up with any answers.
Changed to different source files
There was definitely an issue with the source files I was using. I have changed to an alternate source file for the SM-G360T which I pulled from this thread: http://forum.xda-developers.com/gal...d-galaxy-core-prime-sm-g360t1-t3243611/page39
I am working on running the build now. If I successfully generate a ROM that works I will upload it and link.

ext2/3/4 filesystem create/fix tools (e2fstools pkg) static build for arm64 devices

e2fstools package, statically built for arm64 devices from Google's googlecode.com Oreo branch
NOTE: These will support ANY version of android's filesystems that use ext2 or ext3 or ext4. I built them from oreo branch as that one was the closest to compiling without any editing of the Makefiles. Don't let the name throw you off
I needed to run a modern fsck on a rooted device I have that I have been doing some hacking on.
The filesystem was in bad shape and the on-device e2fsck absolutely refused to check it while it was even mounted, even with the force option. Out of part desperation part determination I decided I would just build one myself. So I went and dug up the sources from googlecode.com, transfered them to my linux workstation, and after much fighting with gcc for cross compilation, finding a place in the google git repo where they actually build (hence going with orero), and having to tweak the c code even in a few places (mostly fixing includes and whatnot, no actual coding on my part), I succeeded.
As it says in the title, these are all the e2fstools binaries built from Google's googlecode.com source tree in their Oreo release branch. They are also compiled statically (no libraries are needed for them to function) so they should work absolutely fine on any device that has a 64bit arm (aarch64) processor. I have tested a handfull of them and they work perfectly fine on my Samsung Galaxy s8. In fact I used the fsck.ext4 binary to repair my system partition which it did perfectly.
https://www.dropbox.com/s/owb76hohnjzjdwe/e2fstools-oreo-aarch64-static.tar.gz?dl=0
Hope they come in as handy to someone else as they did me.
List of files follows:
Code:
[email protected]:~> tar tzf e2fstools-oreo-aarch64-static.tar.gz
e2fsbin/
e2fsbin/e2undo
e2fsbin/e2image
e2fsbin/badblocks
e2fsbin/mkfs.ext3
e2fsbin/fsck.ext4dev
e2fsbin/e2initrd_helper
e2fsbin/fsck.ext3
e2fsbin/e4crypt
e2fsbin/e4defrag
e2fsbin/mke2fs
e2fsbin/e2fsck
e2fsbin/fsck.ext4
e2fsbin/filefrag
e2fsbin/tune2fs
e2fsbin/e2freefrag
e2fsbin/uuidd
e2fsbin/e2label
e2fsbin/mkfs.ext2
e2fsbin/blkid
e2fsbin/logsave
e2fsbin/lsattr
e2fsbin/uuidgen
e2fsbin/findfs
e2fsbin/mklost+found
e2fsbin/dumpe2fs
e2fsbin/mkfs.ext4
e2fsbin/debugfs
e2fsbin/fsck.ext2
e2fsbin/mkfs.ext4dev
e2fsbin/resize2fs
e2fsbin/chattr
e2fsbin/fsck
PS: Now that I have a working arm64 cross compilation system setup, if anyone else desperately needs a working static binary for anything relatively simple to build (as in not 50 million dependencies for me to track down and install) and can send me or link me the sources for it and its dependencies, I would be happy to oblige.
Unfortunately, my device is armv7
buengeut said:
Unfortunately, my device is armv7
Click to expand...
Click to collapse
I forget, is that 32bit? If so i could fairly easily build new ones that are 32bit. Did you try them and they didnt work? If its 64bit they may work anyway, as these dont use any fancy instructions, and i did not build them even with -O1. I thought the main differences between the different "v"s of the same arch (32v64) was in libc and friends, of which these dont use as they are completely static so libc is built in.
I was even thinking of making this a flashable zip, but i hadnt bothered as no one replied to my initial post so i didnt think anyone cared ?️
partcyborg said:
I forget, is that 32bit? If so i could fairly easily build new ones that are 32bit. Did you try them and they didnt work? If its 64bit they may work anyway, as these dont use any fancy instructions, and i did not build them even with -O1. I thought the main differences between the different "v"s of the same arch (32v64) was in libc and friends, of which these dont use as they are completely static so libc is built in.
I was even thinking of making this a flashable zip, but i hadnt bothered as no one replied to my initial post so i didnt think anyone cared ?️
Click to expand...
Click to collapse
ARMv7 is ARM 32bit, 64bit program will not work on a 32bit system.
Can you build e2fstools for ARMv7.
Sadly your link is down.
would you care to reupload?
LNQ said:
Sadly your link is down.
would you care to reupload?
Click to expand...
Click to collapse
Sure. I'll even make it flashable this time ?
Thanks alot, good sir!
Legend! I'd been dealing with not being able to repair my /data errors for the past few days since my Oreo update. The current TWRP (3.2.3.4) still has an ancient e2fsck that doesn't support the ext4 quota option that LG formats their Oreo data partition with. The updated version in /system/bin works while the OS is running which is why I knew I had errors, but I couldn't get it to run in TWRP to fix them because of the incompatible library files.
I was all set to reinstall my Android SDK and compile another version with inbuilt libraries when I decided to do one last search and found this thread where you'd already done it. So thanks for saving me a few hours of downloading/installing/remembering how to compile for Android all over again
I guess I can also vouch for it working on an LG V20. I don't know if it's just LG's version of Oreo that needs the later e2fsck or others too, but anyone who can't repair errors on their ext4 partitions in TWRP due to needing a newer e2fsck version should be able to use this version. I just copied the file fsck.ext4dev to /cache and ran it from there on my data partition.
Your link is dropbox banned...
Any chance you could attach the zip here...?
quotient said:
Your link is dropbox banned...
Any chance you could attach the zip here...?
Click to expand...
Click to collapse
Seconded!
@partcyborg
Any chance you could put this file somewhere else? The above link is banned.
Thanks!
Hi,
I have a Oneplus 3 that after 3 years of use became sluggish as hell at file system access.
After reading thus document https://www.usenix.org/system/files/conference/hotstorage16/hotstorage16_ji.pdf
I would give a try to your e2fstools build.
Can you repost a link to download?
Thanks in advance
partcyborg said:
I forget, is that 32bit? If so i could fairly easily build new ones that are 32bit. Did you try them and they didnt work? If its 64bit they may work anyway, as these dont use any fancy instructions, and i did not build them even with -O1. I thought the main differences between the different "v"s of the same arch (32v64) was in libc and friends, of which these dont use as they are completely static so libc is built in.
I was even thinking of making this a flashable zip, but i hadnt bothered as no one replied to my initial post so i didnt think anyone cared ?️
Click to expand...
Click to collapse
Late to this thread, great work!
I have the exact same problem.
Could you please post flashable zip and/or instructions how to load this into android?
Thank you
I found a binary on website, tested on Nexus 5 (ARMv7L 32bits)
GitHub - FerryAr/e2fsprogs-arm: Static build of e2fsprogs for Android Magisk Module
Static build of e2fsprogs for Android Magisk Module - GitHub - FerryAr/e2fsprogs-arm: Static build of e2fsprogs for Android Magisk Module
github.com
partcyborg said:
e2fstools package, statically built for arm64 devices from Google's googlecode.com Oreo branch
NOTE: These will support ANY version of android's filesystems that use ext2 or ext3 or ext4. I built them from oreo branch as that one was the closest to compiling without any editing of the Makefiles. Don't let the name throw you off
I needed to run a modern fsck on a rooted device I have that I have been doing some hacking on.
The filesystem was in bad shape and the on-device e2fsck absolutely refused to check it while it was even mounted, even with the force option. Out of part desperation part determination I decided I would just build one myself. So I went and dug up the sources from googlecode.com, transfered them to my linux workstation, and after much fighting with gcc for cross compilation, finding a place in the google git repo where they actually build (hence going with orero), and having to tweak the c code even in a few places (mostly fixing includes and whatnot, no actual coding on my part), I succeeded.
As it says in the title, these are all the e2fstools binaries built from Google's googlecode.com source tree in their Oreo release branch. They are also compiled statically (no libraries are needed for them to function) so they should work absolutely fine on any device that has a 64bit arm (aarch64) processor. I have tested a handfull of them and they work perfectly fine on my Samsung Galaxy s8. In fact I used the fsck.ext4 binary to repair my system partition which it did perfectly.
https://www.dropbox.com/s/owb76hohnjzjdwe/e2fstools-oreo-aarch64-static.tar.gz?dl=0
Hope they come in as handy to someone else as they did me.
List of files follows:
Code:
[email protected]:~> tar tzf e2fstools-oreo-aarch64-static.tar.gz
e2fsbin/
e2fsbin/e2undo
e2fsbin/e2image
e2fsbin/badblocks
e2fsbin/mkfs.ext3
e2fsbin/fsck.ext4dev
e2fsbin/e2initrd_helper
e2fsbin/fsck.ext3
e2fsbin/e4crypt
e2fsbin/e4defrag
e2fsbin/mke2fs
e2fsbin/e2fsck
e2fsbin/fsck.ext4
e2fsbin/filefrag
e2fsbin/tune2fs
e2fsbin/e2freefrag
e2fsbin/uuidd
e2fsbin/e2label
e2fsbin/mkfs.ext2
e2fsbin/blkid
e2fsbin/logsave
e2fsbin/lsattr
e2fsbin/uuidgen
e2fsbin/findfs
e2fsbin/mklost+found
e2fsbin/dumpe2fs
e2fsbin/mkfs.ext4
e2fsbin/debugfs
e2fsbin/fsck.ext2
e2fsbin/mkfs.ext4dev
e2fsbin/resize2fs
e2fsbin/chattr
e2fsbin/fsck
PS: Now that I have a working arm64 cross compilation system setup, if anyone else desperately needs a working static binary for anything relatively simple to build (as in not 50 million dependencies for me to track down and install) and can send me or link me the sources for it and its dependencies, I would be happy to oblige.
Click to expand...
Click to collapse
Hi nice compilation job! I know it's not always easy to compile these binaries from source...
Can you please reupload you archive here as attachment? Thanks!
lebigmac said:
Hi nice compilation job! I know it's not always easy to compile these binaries from source...
Can you please reupload you archive here as attachment? Thanks!
Click to expand...
Click to collapse
There's a Magisk module that does cross-compilation specifically, you should get it.
By the way, the link for that drop box is dead.

Question attempt at learning how to compile TWRP for our device.

I am not an experienced dev, and only know enough to be dangerous. that said, i used twrpdtgen from https://github.com/twrpdtgen/twrpdtgen to generate what ought to be the berlna device tree with the necessary board files etc.
what do i have to do, specifically, to clone the twrp source via git/repo? can anybody here explain it like you realize i don't know what i am doing i'll figure git and repo out eventually, but this will go quicker if someone would enlighten me
which android version do i want to build twrp with? apparently 12.1 support isn't finished yet, so i should use 11 with aosp source?
note, for our deivce you need to use the script on upon boot.img as we've a/b format, grab from latest stock rom to gen yourself, or see attached. also, necessary to use WSL on windows with a linux distro, or a linux vm, python on windows will not work.
please feel free to use these if it furthers the cause of compiling twrp before i learn how to use git and repo and compile it.. hehe
I wanted to try my hand at this and start digging into git and repo. I got as far as getting all the files ready, setting up the tree where it needed to be, used ". build/envsetup.sh", then lunched with option 5, which is omni-berlna_eng, which is closest to the twrp minimal manifest build option.
After I lunch, the issue arrives with the fact that omni-berlna_eng uses a depreciated PRODUCT_STATIC_BOOT_CONTROL_HAL, whatever that means. So I tried using lunch option 2, which would be an aosp-arm64_eng, but that just gives me the error "#### failed to build some targets (1 seconds) ####".
As of now, I'm at a loss. I don't have the extra time to spend working on this to make it function, and I only get a few hours at a time to get a crack at it, but nothing seems to work.
Edit:
I should mention, this is my first attempt at anything android development. I got this phone as a secondary carry on and I've dirtyflashed Pixel Experience onto it using a method found for Moto G Power TONGA. Wanted to see if I could get TWRP running since dirty flashing killed my mms and calling services.

Categories

Resources