[CROSS-PLATFORM] APK Sign/Zipalign/Install - Miscellaneous Android Development

Hello all!
Out of laziness, I made myself a Windows script for signing and zipaligning APKs I modded.
Then I thought, why not make it available to others?
So I added ADB support and user interaction, made a Linux version, and pushed my work to GitHub.
Features
User interaction
Colorful terminal output (Linux-only)
ADB installation support
Error output
What's included?
ADB 1.0.31
The zipalign binary
signapk.jar
The script, of course
Prerequisites
An APK to be signed
Java JDK in your path
Common sense
Downloads
Linux v1.0 / v1.1 / v1.2
Windows v1.0 / v1.1
Mac OS X v1.0
Credits
the Android Open Source Project for ADB and zipalign
I don't know who created signapk.jar, but thanks to him anyway
the AOSPA team, because I adapted their colored terminal output located in build.sh
Let me know what you think - and of course, press thanks! :good:​

How to use:
• APK to be signed and zipaligned must be in the same folder as the script.
• For Linux:
Code:
$ chmod a+x ./zipaligner.sh
$ ./zipaligner.sh
(follow onscreen instructions)
• For Windows
Doubleclick zipaligner.bat, then follow onscreen instructions.​

Reserved 1
Sent from my GT-I8730 using Tapatalk

Reserved 2
Sent from my GT-I8730 using Tapatalk

This is long overdue, but I've added OS X support. Check first post

Thank you very much for Linux support ! :good::good:

Related

[ROM] Gingerbread-2.3.4 (Codename Phoenix, released on 2011-10-20)

Hi @all,
This is a unofficial ROM of gingerbread for use in LG-P500 mobile devices.
NO Support by LG and after flashing you can't connect with this ROM to the LG PC-Suite for updates. If you want update a original firmware, u have to flash
a original ROM deployed by LG.
Please, do not ask when i release a build. If a build is ready to test, i upload the ROM and you'll see a download link in THIS post.
For general questions, please look here
Current state of Gingerbread ROM by andy572 (Version 2.3.4 Codename Phoenix)
previous rom for download based on CM7 has been removed, i dont support the latest rom from now.
Latest Changes
* light text color bug fixed
* gallery3D app: pinch to zoom fixed
* gallery3D app: loading a bit slow - fixed
* kernel: wifi not working, kernel module is broken - fixed
* kernel: kernel doesnt support clear ram feature in settings - fixed
* expanded statusbar bugs fixed
* new lockscreen implemented
* modified gps.conf
* modified apns-conf.xml
* network provider search fixed
* contact import from sim card fixed
* crash in contacts app fixed (app was FC'ing when swipe over the tabs on the top)
Very known bugs:
- If no default ringtone is choosen in settings menu, android choose one for u and change this randomly
- FM Radio and USB-/WiFi theasering not working (maybe with 3rd party apps)
- strong pixelation/color banding issues in wallpapers and picture gallery app
- Airplane-, Vibrate modes and audio volume settings change gets not detected in expanded statusbar view toggles
- rom is only working with old baseband and clockwork mod recovery
INSTALL
1.) Install ClockwordMod Recovery, old AmonRA isnt supported anymore.
2.) Flash the ROM file
3.) If you're coming from any other than THIS rom, YOU NEED TO DO A COMPLETE WIPE before reboot!!!
Download
http://www.phoenix-android.com (Android 2.3.4 Phoenix)
Further information:
The new rom is based on CodeAurora's Android Gingerbread, CM7 and android open source code (2.3.4 and 2.3.5).
Many thanks to franco for the cool kernel tips and the funny after work days
Sources
CodeAurora
Phoenix-Android
Whats next coming?
* Electron Beam feature is causing black screen: FIXED (Feature permanent disabled)
* allow swipe in contacts/phone app on call log
* optimize webkit code
* modify music app
* modify and bugfix launcher app again
* modify and bugfix camera app
* modify and bugfix fm radio app
* fix bluetooth audio
Greets from Munich/Germany
Andy
ooh, nice to have someone interested of doing that!
It's nice to have some people interesting in developing a gingerbread custom rom for our optimus P500. I would help if i knew what you need. I don't know what you are talking about so... Sorry
Hi,
i'm talking about to bring up a gingerbread installtion to our mobile.
All what i have is a ready compiled android 2.3.1 without a kernel and without LG addons, there are (possibly) required to boot the phone to gingerbread.
i've tryed yesterday and today to boot with a mix from froyo, but this does not works - even if i disabled some hardware, the system needs some information from modules build by LG - it boots only when gingerbread is flashed over froyo without a complete wipe, nothing but the launcher is working
After a wipe, the system loops around while booting and bringe lot of permission errors in logcat.
Did you look in this thread : http://forum.xda-developers.com/showthread.php?t=901247 ?
There is a kernel and it could help you
Thank you dark-k, but i don't search a kernel but peoples they are interested to help building
i am not a dev but i know how linux works and i got a p500 so if u need help u can count with me buddy.
andy572 said:
All what i have is a ready compiled android 2.3.1 without a kernel and without LG addons, there are (possibly) required to boot the phone to gingerbread.
Click to expand...
Click to collapse
hi can you tell me how to i can compile a clean complete version of android without kernel?
thanks
How about this kernel? The dev says it's supposed to be compatible with any rom.
http://forum.xda-developers.com/showthread.php?t=866774&page=9
How to compile android 2.3.3:
1.) If you use a windows system, install VirtualBox 4.x and than Ubuntu 10.10 Desktop Edition as guest OS (its the smallest version and is enough for compilings)
Attention: Android compiling requires lot of free space.
My Ubuntu virtual harddrives size is 30GB, partitions are 10GB, 512MB (SWAP) and 19.5GB. During install, mount the 10GB partition on /, the 19.5GB partition on /home.
1.1) Prepare user
to have easier system access, we act as root - so set a new password to root and change the current user:
Code:
sudo passwd root
Enter the new password to root and change user:
Code:
su -
1.2) change the shell to bash
Ubuntu 10.10 has a symlink in /bin/sh - this links not to the bash which is required by android to compile:
Code:
rm /bin/sh && ln -s /bin/bash /bin/sh
2.) Install required compilers and software:
Code:
apt-get install build-essential automake autoconf binutils libncurses5-dev xorg-dev git-core gnupg flex bison gperf zlib1g-dev
3.) Prepare home directory
Code:
mkdir -p /home/android/bin
cd /home/android
3.) Install JAVA
- Download latest java-1.6 (it's required by gingerbread to build java apps) from Oracle site:
https://cds.sun.com/is-bin/[email protected]_Developer and select Linux (not Linux64!!!)
Copy file jdk-6u23-linux-i586.bin to /home/android and exec the file:
Code:
./jdk-6u23-linux-i586.bin
and type "yes" to accept the license.
After install, move the new directory to /usr/lib/jvm:
Code:
mkdir -p /usr/lib/jvm && mv jdk1.6.0_23 /usr/lib/jvm
rm -rf jdk1.6.0_23
4.) Adopt JVM and user's bin path to all users env:
Code:
echo 'export PATH=$PATH:/home/android/bin:/usr/lib/jvm/jdk1.6.0_23/bin' >> /etc/profile
echo 'export JAVA_HOME=/usr/lib/jvm/jdk1.6.0_23' >> /etc/profile
echo 'export ANDROID_JAVA_HOME=$JAVA_HOME' >> /etc/profile
source /etc/profile
5.) Download Android 2.3.3
Code:
curl http://android.git.kernel.org/repo > bin/repo
chmod a+x bin/repo
repo init -u git://github.com/CyanogenMod/android.git -b gingerbread
repo sync
6.) Compiling Android 2.3.3
To build a final release on a 32bit machine, we must modify some files and use the target option "user" (default is "eng", which is only a debug build for the emulator).
Attention
following code must be run in root of your repo:
Code:
source build/envsetup.sh
lunch thunderg-user
make -j2
After a build time of 1-2 hours, we have in folder out/target/product/generic our images: system.img,ramdisk.img and userdata.img and in folder prebuild/linux-x86/toolchain our android arm-eabi to compile kernel and so on.
If any goes wrong, please post here - it's possible that i have forgot to post some...
awesome walkthrough
andy572 said:
How to compile android 2.3.1:
1.) If you use a windows system, install VirtualBox 4.x and than Ubuntu 10.10 Desktop Edition as guest OS (its the smallest version and is enough for compilings)
Attention: Android compiling requires lot of free space.
My Ubuntu virtual harddrives size is 30GB, partitions are 10GB, 512MB (SWAP) and 19.5GB. During install, mount the 10GB partition on /, the 19.5GB partition on /home.
1.1) Prepare user
to have easier system access, we act as root - so set a new password to root and change the current user:
Code:
sudo passwd root
Enter the new password to root and change user:
Code:
su -
1.2) change the shell to bash
Ubuntu 10.10 has a symlink in /bin/sh - this links not to the bash which is required by android to compile:
Code:
rm /bin/sh && ln -s /bin/bash /bin/sh
2.) Install required compilers and software:
Code:
apt-get install build-essential automake autoconf binutils libncurses5-dev xorg-dev git-core gnupg flex bison gperf zlib1g-dev
3.) Prepare home directory
Code:
mkdir -p /home/android/bin
cd /home/android
3.) Install JAVA
- Download latest java-1.6 (it's required by gingerbread to build java apps) from Oracle site:
https://cds.sun.com/is-bin/[email protected]_Developer and select Linux (not Linux64!!!)
Copy file jdk-6u23-linux-i586.bin to /home/android and exec the file:
Code:
./jdk-6u23-linux-i586.bin
and type "yes" to accept the license.
After install, move the new directory to /usr/lib/jvm:
Code:
mkdir -p /usr/lib/jvm && mv jdk1.6.0_23 /usr/lib/jvm
rm -rf jdk1.6.0_23
4.) Adopt JVM and user's bin path to all users env:
Code:
echo 'export PATH=$PATH:/home/android/bin:/usr/lib/jvm/jdk1.6.0_23/bin' >> /etc/profile
echo 'export JAVA_HOME=/usr/lib/jvm/jdk1.6.0_23' >> /etc/profile
echo 'export ANDROID_JAVA_HOME=$JAVA_HOME' >> /etc/profile
source /etc/profile
5.) Download Android 2.3.1
Code:
curl http://android.git.kernel.org/repo > bin/repo
chmod a+x bin/repo
repo init -u git://android.git.kernel.org/platform/manifest.git -b gingerbread
repo sync
6.) Compiling Android 2.3.1
To build a final release on a 32bit machine, we must modify some files and use the target option "user" (default is "eng", which is only a debug build for the emulator):
Code:
source build/envsetup.sh
$find . -name '*.mk' | xargs sed -i 's/-m64//g'
export TARGET_BUILD_VARIANT=user
lunch
make
After a build time of 3 hours, we have in folder out/target/product/generic our images: system.img,ramdisk.img and userdata.img and in folder prebuild/linux-x86/toolchain our android arm-eabi to compile kernel and so on.
If any goes wrong, please post here - it's possible that i have forgot to post some...
Click to expand...
Click to collapse
gonna start workin later tonight gonna upload it soon.
Problems ... problems ... more problems
Today, i've merged the LG P500 Froyo source with gingerbread to get the required LG libraries and bin's, but i get over and over compiler errors.
LG didn't provide the complete source to froyo, so many definitions in C-Header files are missig
I've fixed many of these errors, but the end result is a linker error because of missing libraries there are not provided in source code.
I'll try to compile a froyo to test out if this errors only comes with gingerbread.
...Where is my time ????
I have succesfully compile and boot CyanogenMod 7. But everything slow, 3d driver don't work (same as with Legend). Tried to use N1 driver but it crashes, seems it compiled as armv7.
mik_os said:
I have succesfully compile and boot CyanogenMod 7. But everything slow, 3d driver don't work (same as with Legend). Tried to use N1 driver but it crashes, seems it compiled as armv7.
Click to expand...
Click to collapse
Can you share with us??
MAybe we can help you to boost the system.
i didnt have much sleep last night alot of trouble gonna reinstall windows 7 then repack the img gonna post it later its 9:33 here in germany
Du sollst doch Nachts schlafen und nicht am PC sitzen *lol*
FROYO doesn't compile - same problem as to import LG FROYO sources to Gingerbread.
Error:
make: *** No rule to make target `out/target/product/generic/obj/STATIC_LIBRARIES/liblgdrmexpat_intermediates/liblgdrmexpat.a', needed by `out/target/product/generic/obj/SHARED_LIBRARIES/liblgdrmwbxml_intermediates/LINKED/liblgdrmwbxml.so'. Stop.
upd: wifi work
You can find sources at
Code:
https://github.com/mik9
BUT it's dirty (based on htc legend) and not full. I continue work.
Awesome job, you can count on me for any help you need, lol like tester or something
Sent from my LG-P500 using XDA App

[DEV] andpack - Automate Android Reverse Engineering Tool

andpack - Automate Android Reverse Engineering Tool​
A script to automate the Android reverse engineering. With one single command you can easily decompile or compile any APK. The application while in the compile mode, will sign the APK, uninstall the original version from your phone (if there is any version installed) and will also install the edited one. All with one single command.
Requirements
apktool
adb (Android SDK)
Bash (Shell Script)
Usage
Here is how to use the application to decompile an APK:
Code:
$ andpack d your.app.class.here
Where the your.app.class.here is the name of the APK without it's extension (.apk)
And here is the way of using my script to compile a decompiled code:
Code:
$ andpack b your.app.class.here
Where the your.app.class.here is the folder name, where all your decompiled files are
Don't forget to edit the variables $pass, $kalias and $keyst before using the application. What you need to add on each part is commented on the same line of the variables.
Download​
Click to expand...
Click to collapse
I've added 3MB of wallpapers on that archive so I could have some money for download, so if you use this link you're making a "donation". Thanks
You can also download/fork/watch it on GitHub at: https://github.com/nathanpc/andpack
For educational purposes only Like making dark editions of apps and discovering security holes that the app developer should be warned
Link not working
Hi,
Could you please put some other link as the one given here seems to be dead.
Thanks
You can get it from GitHub at https://github.com/nathanpc/andpack
nathanpc said:
You can get it from GitHub at https://github.com/nathanpc/andpack
Click to expand...
Click to collapse
Downloaded it. Thanks Nathanpc

[Script]Automated (Unix) Build Environment Setup v1.1

Automated Build Environment Setup
Version: 1.1​
Download:
- When your in Unix, follow the installation instructions
- When your in Windows, bootup your Unix VM or reboot in a Unix environment
Description:
I made a unix script that sets up an kernel developing environment fully automated. The script includes the good version of java (since the packages are not available trough apt-get) and the i9001 Kernel source (with adjusted makefile, ariesve_defconfig and the wifi drivers). This script may save you a lot of time, after the script is finished you will have a ready-to-mod kernel source. This script should be only used on a x64 machine (x86 will result in a corrupt environment)
(total process make take upto 30 min, depending on your connection speed)
(Please remind that I'm a unix noob, so If you find an error or missing package or w.e. please let me know!)
Made it on Mint Linux, but it should work for Ubuntu also.
What actions does it perform?
- Installing Java
- Getting required packages
- Installing Repo
- Cloning Prebuilt Repository (compiler)
- Extracting I9001 Kernel Source
- Copying ARIESVE_DEFCONFIG to source root (you can also pull config.gz from your phone "adb pull /proc/config.gz" then unzip it and copy the config file to .config (cp config .config)
- Run xconfig from kernel source after setup (optionally)
Installation Instructions:
1. Open Terminal Emulator, enter the following commands:
-- "mkdir -p ~/envsetup"
-- "cd ~/envsetup"
-- "wget http://broodplank.net/files/auto_build_env_setup.tar.gz"
-- "tar xvfz auto_build_env_setup.tar.gz"
-- "chmod +x setup.sh"
2. Now enter this command to start the script:
-- "./setup.sh"
3. After the script is done you will have a working android kernel development environment
4. You can find additional patches and scripts in the 'Patches & Addons' folder, use it!
What to do with the kernel afterwards?
- To configure: chmod +x xconfig && ./xconfig
- To clean the source: make clean
- To compile (quick): make -j8
- To compile (extended): chmod +x compile && ./compile
the zImage will be placed in /arch/arm/boot/
Adding things such as governors/io schedulers can be learned by browsing commits of other kernel developers (on github)
Thanks Brood! Awesome. Going to try it as soon as i have internet again :silly:
Sot0 said:
Thanks Brood! Awesome. Going to try it as soon as i have internet again :silly:
Click to expand...
Click to collapse
You're welcome, I hope more people will attempt to build a kernel now
Nice work brood. I see you are an "Recognized Contributor"
Congratz!!
Amazing as usual
mrjraider said:
Nice work brood. I see you are an "Recognized Contributor"
Congratz!!
Click to expand...
Click to collapse
Thanks, and yes idd got promoted!
YMYA said:
Amazing as usual
Click to expand...
Click to collapse
hehe thnx
congrats on your promotion brood..your contribution and support is highly appreciated by many (including myself). ^_^
btw, thanks for this awesome tutorial..
m0e_03 said:
congrats on your promotion brood..your contribution and support is highly appreciated by many (including myself). ^_^
btw, thanks for this awesome tutorial..
Click to expand...
Click to collapse
Thank you , I do my best to keep my roms/tuts and apps up to date ^^
And you're welcome, Hope you can build your own kernel if you would like to.
(If someone tests it, please let me know the results, so far 50 downloads but no feedback, so I really don't know if it works the way it should)
Nice Im gonna try it keep up the good work
Released v1.1,
changelog:
Added HKTW Patch and Localversion hack (else wifi doesn't work by default when compiling) and some additional shell scripts for easier use.
get it from the hub
broodplank1337 said:
Released v1.1,
changelog:
Added HKTW Patch and Localversion hack (else wifi doesn't work by default when compiling) and some additional shell scripts for easier use.
get it from the hub
Click to expand...
Click to collapse
Still no internet access at home
Really Want to try it and will report as soon as possible

[GUIDE] [BIN] Compile busybox on Linux

About Busybox: busybox.net/about.html
More on Busybox: busybox.net
This is just for anyone who wants to try, and especially those without access to a PC.
:
: --------------- BUILD STEPS --------------
:
Things we'll need besides your phone:
- "Android Terminal Emulator" app
- "Complete Linux Installer" app , I also recommend trying "linux deploy" for more advanced usage
- internet/wifi
- latest "busybox" source
1) We need to get Ubuntu or Debian booted for a sufficient build environment (kali linux works well too). I've used them all on Android but I like the better stocked terminal in the Ubuntu images. I used the app "Complete Linux Installer" which is free and works beautifully, very simple and easy. In the app you want to follow the short instructions to download an Ubuntu image, rename it to ubuntu.img, and place it in a folder named ubuntu in /sdcard. Then hit menu in the app and click the terminal screen icon that says "Launch". An Ubuntu terminal will now open in Android Terminal Emulator. Super quick and easy.
2) Let's download some crucial build environment tools.
Code:
apt-get install -y gcc build-essential libncurses5-dev libpam0g-dev libsepol1-dev libselinux1-dev
--EDIT-(30AUG2014)--
For Selinux compatibility and loginutils, we need to also download a few extra packages. Already included in the code above.
3) Now the cool thing about this chroot Ubuntu environment is that we still have access to the sdcard to transfer files between Android environment and the chroot jail. Extract your downloaded busybox source to your Ubuntu home with something like:
Code:
cd
tar -xf /sdcard/Download/busybox*bz2
cd busybox*
4) Now we can build busybox statically. The first thing we do is generate a Makefile by running "make" with a "defconfig" (default configuration file) Usually you will run "./configure" with other programs, but busybox compiles more like a kernel, so it uses a config which has a huge checklist of options.
(After successfully compiling busybox, we can go back and customize the .config; this entails that for each "CONFIG ..." line we see, we can uncomment it and mark it "y" or "n" to configure some option... This can be more easily done from a terminal busybox menu interface with "make menuconfig". You just need to crank font down to 7 or use telnet/ssh)
Skip "make defconfig" if you use a customized ".config" file such as one I've attached.
Code:
make defconfig
If all goes well, we now have a Makefile and are ready to compile:
Code:
make clean && make LDFLAGS=-static
Let "make" crank out the binary for a couple minutes. The extra variable we set after make is to compile statically. When compiling is complete we'll have a few different busybox binaries at the root of the source directory. We use the one named "busybox" since we're not debugging.
5) Now let's copy it to /system/usr/bin to install for test usage.
Code:
cp ./busybox /android/data/media/0
(Open a new terminal tab to get into Android Environment)
mount -o remount,rw /system
mkdir -p /system/usr/bin
cp -f /sdcard/busybox /system/usr/bin
chmod 0555 /system/usr/bin/busybox
/system/usr/bin/busybox --install -s /system/usr/bin
mount -o remount,ro /system
PATH+=:/system/usr/bin
.. and done. Run some scripts and enjoy your static busybox!
:
: Extra steps for SELinux-enabled busybox
:
Here are the extra steps you need to take to compile busybox with SELinux features. Sorry it took so long to get this added to this first post.
First we need to download the source for libselinux and libsepol and compile it. (This is for use with the standard glibc toolchain.)
Code:
cd
apt-get source libselinux libsepol
cd libselinux*
make
cd
cd libsepol*
make
Now that we have those libraries compiled, we can proceed to the busybox compilation.
Code:
cd
cd busybox*
make clean && make LDFLAGS='-static -L ../libselinux*/src -L ../libsepol*/src' CFLAGS='-Os -I ../libselinux*/include -I ../libsepol*/include'
That's pretty much it. It initially seems more complicated than it actually is, but all we're really doing is including the libraries for libselinux and libsepol into the busybox compilation.
edit:
**Commands to run if you have compile errors:
Code:
apt-get build-dep busybox
apt-get install -y build-essential
apt-get -f update
dpkg --configure -a
:
: --------------- DOWNLOADS --------------
:
***** Attached are flash installers for busybox (v1.23.1 stable, non-SELinux, 374 applets included!, ~1.1MB size) or busybox (v1.23.1 stable, SELinux, 386 applets included!, ~1.6MB size) *****
Since it's up-to-date it has some nice extras most people haven't seen like a "-I" option for xargs! Yes, that is correct, busybox xargs has its testicles back.
Code:
e.g.
$ echo Hello | xargs -I{} echo {} world!
> Hello world!
: ---------- UPDATES ----------
-------------------EDIT-2-(30AUG2014)----------------------
Got a Selinux-enabled busybox attached now. This means Selinux flags are integrated into applets like ls, id, ps, etc, and there are now 12 extra Selinux applets to give a total of 386 applets, ~1.6MB in size. The previous one is more portable, but this one can completely replace toolbox and gives you Selinux control for Android 4.4+. Plus it's pure maxed-out awesomeness.
***I've also attached the .config files for each busybox I've compiled, so anybody can remake them (from their phone!) as I've posted. You just need to download and extract the .config file to the root of your busybox source directory and type "make".***
-------------------EDIT-3----------------------
YashdSaraf has made some very useful flash zips to install either the non-selinux- or selinux-enabled busybox 1.23.1 via recovery. Installation replaces the stock busybox in /system/xbin. I've attached the zips he made to the end of this OP.
(**Note: Thought I'd mention that there will be a handful of applets that don't work in "Android" environment such as su(don't worry this isn't linked with the installer) Part of this is because of the way Android's default file structure is an amputated modified version of linux. With almost all of them, slight modifications to environment and file structure can be made to get them to work. This is just normal behaviour of busybox in android. The su and init applets shouldn't be used in Android though. I keep them compiled into the binary anyway for completeness of the build and because they work and are needed for a root.gz initrd or some chroot environments. It also doesn't hurt keeping them compiled in. You just have to remember not to link them when installing busybox.
-------------------EDIT-4-(06SEPT2014)----------------------
:
: How to compile against(using) uclibc for a smaller binary!!
:
Download the attached arm-linux-uclibcgnueabi toolchain package that I pre-compiled. Extract to /data/media:
Code:
cd /data/media
zip='/sdcard/Download/2014-09-06__arm-buildroot-linux-uclibcgnueabi.tar.lz.zip'
unzip -op "$zip" | lzip -d | tar -xf -
Then let's open up the "Complete Linux Installer" or "Linux Deploy" terminal.
To use the toolchain with a busybox build, we just need to specify the parameter CROSS_COMPILE which is a prefix to the compiler tools. So if you extracted the toolchain to /data/media, you will use:
Code:
make clean && make LDFLAGS=-static CROSS_COMPILE=/android/data/media/arm-buildroot-linux-uclibcgnueabi/bin/arm-buildroot-linux-uclibcgnueabi-
When you're done you should have a busybox binary with 374 functions with size around 1.1MB. That's a 20% decrease in size from using the standard glibc toolchain!
**IMPORTANT Notes
- The toolchain can't be used with lollipop since it's not compiled with -fPIC. I'll fix this later. Busybox is fine since it's static, it's just the toolchain I uploaded.
- Selinux-enabled busybox .config errors out when building using the uclibc toolchain; I think this is a lack of support issue. In the "Complete Linux Installer" app you'll need to add the mount "/data/media" in options. This gives you access to it as "/android/data/media", very very useful for extra space needs.
Difference between SELinux and non-SELinux busybox
The SELinux (NSA security enhanced Linux) binary comes with the following extra utilities: chcon, getenforce, getsebool, load_policy, matchpathcon, restorecon, runcon, selinuxenabled, setenforce, setfiles, setsebool, and sestatus. There are also some selinux flags enabled for applets such as "ps" and "ls", e.g. "ps -Z" and "ls -Z" to show the context for processes or files. If you are using Android 4.3 or newer, then you probably want to use the SELinux-enabled busybox since Android 4.3 is when SELinux was introduced to Android. Using the SELinux busybox on older version of Android without SELinux file structure should probably work besides the SELinux applets, but I haven't tested this. The non-SELinux binary can be used on any version of Android. When it comes down to it, the system actually uses "/system/bin/toolbox" SELinux applets for SELinux operations, so unless you specifically want to use busybox's SELinux tools for personal use, the safest option is to go with the non-SELinux busybox. I use Android 4.3.1 and 5.x, so I use busybox's better featured SELinux tools.
Latest updates see post 2
Busybox 1.23.1 (2015-02-06) below
Busybox compilation on Linux
reserved
Great Info here!
But I would be interested to know how well this method works on Samsung Stock devices running AOS 4.2 and above? Any experience?
Awesome info, this thread came up #1 while googling busybox 1.23
I made a flashable zip of the attached binary in the op to clean the old one(if any) and install the new busybox in xbin, just in case if anyone needs it. :good:
Is it work on xperia sp on 4.3 fw yes ?
YashdSaraf said:
Awesome info, this thread came up #1 while googling busybox 1.23
I made a flashable zip of the attached binary in the op to clean the old one(if any) and install the new busybox in xbin, just in case if anyone needs it. :good:
Click to expand...
Click to collapse
Thanx,worx fine with Carbon 4.4.4 on my LG.
GREETZ FROM TEAM-OPTIMA!!!
E:V:A said:
Great Info here!
But I would be interested to know how well this method works on Samsung Stock devices running AOS 4.2 and above? Any experience?
Click to expand...
Click to collapse
Thanks man. I've been compiling tons of stuff with Debian and Ubuntu chroot no problem on top of 4.3.1 Vanir and also 4.4.4 Carbon, both are my daily drivers. "Complete Linux Installer" is pretty fast compared to some other chroot apps like GNUroot (no offense to GNUroot, it works but is way too slow). It runs real-time compared to non-chroot. When compared to my dual-core 2007 Pentium M laptop, it's about 2-3 times as slow which isn't too bad for compiling something like mksh or even busybox which takes up to 5 mins I'd say.
In terms of binary size, compiling natively is better than cross-compiling it seems. I used gcc with no size optimizations here, so 1.37MB is pretty nice compared to some others around 2MB with full configs. With this method and klcc (gcc wrapper) I got mksh compiled to 192KB. I'm currently trying to build a uclibc toolchain on my laptop that will give me a mksh binary under 300KB..
YashdSaraf said:
Awesome info, this thread came up #1 while googling busybox 1.23
I made a flashable zip of the attached binary in the op to clean the old one(if any) and install the new busybox in xbin, just in case if anyone needs it. :good:
Click to expand...
Click to collapse
Cool thanks man! That is really useful, glad to hear from CALIBAN that it works. Could I add this to the OP with credit to you?
Hamidreza2010 said:
Is it work on xperia sp on 4.3 fw yes ?
Click to expand...
Click to collapse
Yes, xperia sp uses armv7 so you should be good to go.
7175 said:
Cool thanks man! That is really useful, glad to hear from CALIBAN that it works. Could I add this to the OP with credit to you?
Click to expand...
Click to collapse
Sure bro go ahead
Edit: Went ahead and made one for selinux enabled busybox :silly: , you can add this one in the op too.
Hey guys I was able to get an entire uClibc toolchain built the other day (using buildroot). I tested it and it makes some nice small binaries with about 20%+ smaller size than the standard glibc. Man that took hours to compile but was well worth it. It really put the stability of Android OS to the test as well. Kitkat absolutely couldn't finish compiling with multiple oom's and oops's, but Vanir 4.3.1 stuck it out real nice. Once I had the huge amount of required buildroot packages downloaded, I was able to compile in TWRP as well with good stability. (I have the "Complete Linux Installer" startup chroot script aliased in my mkshrc so I can pull up an ubuntu terminal without starting the app. )
So I got 3 new attachments to OP:
- arm-linux-uclibc toolchain for anyone who wants to compile stuff with it (host=arm AND target=arm)
- busybox (374 fcns, non-selinux) 1116KB
- lzip binary (in case you need it to unzip the toolchain, which is highly compressed from 64MB to 14MB with lzip's lzma)
**As I mentioned in the updated OP, I wasn't able to get selinux-enabled busybox compiled with uclibc. This may be something unsupported, or there may be a patch fix. I'll check it out. I'll try with musl libc and musl-gcc as well.
I have another approach, I try aboriginal cross compiler toolchain in archLinux it produced small binary, but I can't compile busybox for android. For Linux it work. Maybe need bionic lib?
ndrancs said:
I have another approach, I try aboriginal cross compiler toolchain in archLinux it produced small binary, but I can't compile busybox for android. For Linux it work. Maybe need bionic lib?
Click to expand...
Click to collapse
Sounds interesting. I honestly haven't given this a try yet, but I'm very interested in taking a look at it. At this point I'm pretty much addicted to making the smallest binaries I can and testing out different toolchains. I'll give it a good search on duckduckgo, and if you have any insightful links that would be great.
Edit: Alright cool I found the source for Aboriginal Linux at landley.net/aboriginal and am building on Android now. I'm also trying this on my x86_64 laptop so that I can compare the differences like I have with glibc, uclibc, musl, klibc binary builds in a native environment and a cross-compile environment.
I see from my laptop's build that a busybox was generated, but it was dynamic and has a libc.so.6 dependency. @ndrancs : this might be what you were talking about. Did you try compiling static? Also see if "make allnoconfig && make clean && make LDFLAGS=-static" works for compiling busybox with Aboriginal Linux.
7175 said:
Edit: Alright cool I found the source for Aboriginal Linux at landley.net/aboriginal and am building on Android now. I'm also trying this on my x86_64 laptop so that I can compare the differences like I have with glibc, uclibc, musl, klibc binary builds in a native environment and a cross-compile environment.
I see from my laptop's build that a busybox was generated, but it was dynamic and has a libc.so.6 dependency. @ndrancs : this might be what you were talking about. Did you try compiling static? Also see if "make allnoconfig && make clean && make LDFLAGS=-static" works for compiling busybox with Aboriginal Linux.
Click to expand...
Click to collapse
I preferred to use uclibc I think it easy to setup and produced small binary.. Aboriginal cross-compiler use uclibc as default. Btw I don't use cmd : LDFLAGS=-static instead I set it in .config.. Maybe I try this later..
ndrancs said:
I preferred to use uclibc mk it easy to setup and produced small binary.. Aboriginal cross-compiler use uclibc as default. Btw I don't use cmd : LDFLAGS=-static instead I set it in .config.. Maybe I try this later..
Click to expand...
Click to collapse
Ok yeah I like how aboriginal set up with uclibc, and it has scripts for each build stage, so you can stop at the toolchain. I'll be interested to see their future releases with the musl libc as well.
Also for anyone interested, I figured out how to run dynamic binaries in android:
- make the directories "/lib" and "/lib/arm-linux-gnueabihf"
Code:
mkdir -p /lib/arm-linux-gnueabihf
- copy the linker "ld-linux-armhf.so.3" to "/lib"
- find a specific binary's dependencies: e.g. for dynamic mksh do:
Code:
strings mksh | grep \\.so
- copy the listed libs to "/lib/arm-linux-gnueabihf": e.g. for mksh that would be libc.so.6. The libs/linker you copy over will come from the mounted ubuntu/debian/... image you have mounted like with "Complete Linux Installer".
- adjust your LD_LIBRARY_PATH:
Code:
LD_LIBRARY_PATH=/lib:/lib/arm-linux-gnueabihf:$LD_LIBRARY_PATH
Any plan to update the busybox to current version. Thanks.
@7175 can you update flashable zip to 1.23.0 stable ?
@ndrancs @exodius48 : Thanks for notifying me guys, I needed to get around to updating to 1.23.0 stable. I updated the original post with no-edify installers for busybox 1.23.0 stable. There's a non-SELinux uclibc compiled version and a full 386-applet SELinux glibc compiled version. They're included in this post too for ease.
7175 said:
@ndrancs @exodius48 : Thanks for notifying me guys, I needed to get around to updating to 1.23.0 stable. I updated the original post with no-edify installers for busybox 1.23.0 stable. There's a non-SELinux uclibc compiled version and a full 386-applet SELinux glibc compiled version. They're included in this post too for ease.
Click to expand...
Click to collapse
Great..been waiting for this release.. :good:
Btw, can i use busybox_full_selinux.zip on android 4.2.2 MIUI rom?
exodius48 said:
Great..been waiting for this release.. :good:
Btw, can i use busybox_full_selinux.zip on android 4.2.2 MIUI rom?
Click to expand...
Click to collapse
Yeah that should work just fine. I'm pretty sure any SELinux tools or applet flags should work since 4.2 introduced SELinux to its filesystem. Let me know if there are any issues.
7175 said:
Yeah that should work just fine. I'm pretty sure any SELinux tools or applet flags should work since 4.2 introduced SELinux to its filesystem. Let me know if there are any issues.
Click to expand...
Click to collapse
Great release..busybox_full_selinux.zip working fine so far on MIUI rom V5 android 4.2.2. :victory:
7175 said:
@ndrancs @exodius48 : Thanks for notifying me guys, I needed to get around to updating to 1.23.0 stable. I updated the original post with no-edify installers for busybox 1.23.0 stable. There's a non-SELinux uclibc compiled version and a full 386-applet SELinux glibc compiled version. They're included in this post too for ease.
Click to expand...
Click to collapse
Hey @7175
Great guide. I am able to compile just fine on my device using your guide. However, is there any way to compile the selinux applets support using a Linux PC (or NDK)? I am not able to find a selinux supported toolchain. May be you can help.

[Linux] Lightning Converter - Easily create a flashable ZIP from device via ADB

Just a simple script made to do 2 things -
Features
Create flashable ZIP from a system.img/system.img.ext4 and boot.img
Create flashable ZIP from device dump via ADB
Prerequisites
A Linux computer (preferably with an Ubuntu/Debian-based OS)
Ubuntu running in Virtualbox will work if you want
Both "zip" and "adb" binaries installed (the script shows you how if you don't have it already)
A brain (or part of one)
Installation/Usage
To install:
Code:
git clone https://github.com/Lightn1ng/lightningconverter.git
To use:
Code:
cd lightningconverter
sudo bash lightningconverter.sh
Thanks
@SuperR. - 2 lines of code for the device by-name detection
 @JustArchi - 1 line of code for the sparse image detection
Thankx, I wanna try.
vs985 China user

Categories

Resources