[Q] Best way to package a command line app - Android Q&A, Help & Troubleshooting

Hi,
I've crosscompiled a couple of useful command line applications (including binutils, gcc, make) to Android -- they work fine if I just move all the files to an Android device, or run them from an SD card etc.
Now I'm wondering what the best way to package them is -- last time I checked, an APK couldn't contain files in /system/bin or the likes, so if I want stuff installed in standard locations, that rules out using an APK (obviously that could be worked around by creating an empty app and just including all related files in the data storage area, and live with the fact that the files aren't where they ideally belong, as long as PATH is set correctly, shouldn't matter too much -- or do any devices mount the data area with the "noexec" bit?).
The other possibility I've considered is just making it a zip file to be installed through custom recoveries - unfortunately I'm running into problems there: trying to use ClockworkMod Recovery 6.0.1.0 on a Galaxy Nexus to install the zip file results in "Installing update..." immediately followed by "Installation aborted." -- that's despite the fact that signature verification works fine when enabled (I've used signing-tools to sign the zip file. Other than the META-INF directory created by signing-tools, the zip file contains system/bin/gcc, system/bin/make and friends). Am I doing anything wrong there?
And, of course, is there a third, even better, way to package command line tools that I'm missing?

Related

[TOOL] Back up custom system files from recovery

This is a tool I made for myself for backing up some of the custom files... Mostly as a result of wanting to expedite the process of backing up some configuration files in /system (such as inadyn.conf or bashrc on synergy rom). It reads a text file to determine what files you want, saves them in a tar on your sdcard (necessary to tar them to keep permissions the same when transferring to fat). Then you flash the restore zip to put them back.
It's set to not backup if there already is a backup (to prevent overwriting your custom files by clicking the wrong zip). The backup.tar is deleted on successful restore.
To use, create a text file in /sdcard/custBackups called custom_files.txt, and put the full pathname of each desired file in there, seperated by a single space (no newlines). While in recovery, run the backup zip to save your custom files, and run the restore zip to restore them after flashing.
An easy way to add the files while using adb shell (with busybox installed) is to cd and ls around to find your file, then while working in the same directory run this command
echo " `realpath myfilename`" >> /sdcard/custBackups/custom_files.txt
(those are backticks, not single quotes, which may be on hackers keyboard but isn't on most android keyboards, that's why I suggested adb shell)
looks long but is pretty quick with bash completion. But only needs to be done once for each file, the text file stays in place.
Thanks to Cyanogen's team and ginger yoshi, as I got the idea from them and learned the updater script reading their files.
A dev can put this in their own updater script so it's all in one (which I do when exporting the svn for synergy). If you can't figure out how to add it reading my script, let me know. And if any devs do use, just shoot me some credit.
If this is used on any other phone, the assert command and mount command in updater script needs to be changed to suit... the rest should be pretty universal.
Is this something like Titanium Backup.apk but in zip format?
No I made this just for synergy for backing up the special configuration files for some of the special tools i'm that ROM, like inadyn and dropbear. Also any special themed files, my fonts..
Basically, catching any system files that titanium and other apps don't get.
Sent from my PG86100 using XDA App

[Q] Signing ROM - What am I doing wrong?

I have a cheap Chinese tablet (Ainol Novo 7 Tornado). It comes from the factory rooted but with the 3e system recovery.
Here is the scenario (simplied to avoid complications):
Using update.zip from manufacturer, I can update the ROM (no signature failure)
I unzip the update.zip file and delete the CERT.RSA, CERT.SF, and MANIFEST.MF files and rezip (exact same structure just minus these files)
I sign the zip using any one of about 10 different tools including SignAPKtic and Zip Signer 2 (on device) (all state success with no errors)
I try to install the "new" update.zip, I get a failure verifying the signature in 3e
It seems as if is locked and requires the manufacturers signature. However, when I use 'jarsigner' to look at the signature, it is signed using the same google certs that all of the signers use. When comparing the output of 'jarsigner' on the original and the resigned version, they appear the same with the exception of the order in which contents are listed.
Does anyone have any idea what could be happening here? I have been struggling with this for over a week.
Thanks,
Jonathan

[Q] Unable to add scripts to init.d folder, cm 10.1

I have been trying to use int2ext, however flashing or placing the script directly fails to work.
There are no errors when using cwm, but when looking in a file manager the script is 0kb, and empty.
Pasting the script using ES file explorer does the same, places a empty 0kb file, this is with system mounted as r/w.
Tried using the file manager that comes with CyanogenMod but it shows an error when pasting rather than placing anything.
Different attempt with Mounts2sd, it asks to update the Init.d, but it fails with the error 'the init.d startup script cannot be copied to the system partition'
Busy box also fails to configure.
I am using CyanogenMod 10.1 for the wildfire s.
Not sure what's going on, followed all instructions when installing cyanogen originally. I will flash again, but unfortunately away from home to restore contacts once I'd re-install (though not major issue) Will go ahead with it if its recommended.
Looking to see if there might be another issue and way to resolve it.
It is partitioned just seems an issue with permissions and access.
Be happy to see the end of this low memory.

[SIMPLE GUIDE] How to get all user "/data" partition on External SD Card!

Have you ever had a phone where the space just wasn't enough for your apps or data, but you had an SD Card that you wished worked like the manufacturers advertise?
Well, today I will be teaching you how to create a modded kernel for almost ANY android device to allow all userspace data to be put on the sd card.
#### You will need the following:
* An Ubuntu based distribution in a Virtual Machine, or installed direct to disk.
* Superr's Kitchen [From here](http://forum.xda-developers.com/chef-central/android/kitchen-superrs-kitchen-t3202296)
* A way to backup your current boot.img from your phone (Some ways include: TWRP, CWM, Terminal Emulator, etc)
* Basic understanding of Linux(Specifically Ubuntu) commands like nano, unzip, etc.
* A phone that has an unlocked bootloader to flash the new boot.img (Some phones do not require this, but always good to have when making custom kernels and ROMs)
#### Basic Setup
After installing Superr's kitchen you can launch it and create a new project. I usually name mine "nameOfProject_DeviceModel_Version" to keep it pretty simple. Example: "ExtDataKernel_a32eul_1".
So, backup the boot.img of your phone, I used twrp because it keeps the image decompressed, and original. Then follow these steps to get the boot.img decompressed on ubuntu, and edit files to work on the mod:
Put the boot.img into the project folder in superrs kitchen, then launch the Kitchen.
Select Boot/Recovery options
Select Unpack, this should take less than 10 seconds.
Now go back into the boot.img folder and find all files that have the extension of .fstab
In the file you will see a line that is something like "/dev/platform/block/mmcblk0pX /data"
a. Be sure the line in question has /data in it because that is all user data.
Edit the line to match your External SD Cards 2nd partition. (Should be partition 2 and setup as described [here.](https://urgero.org/android-projects/htc-desire-626-external-sdcard-data-partition) ) (Also note that partition one for this must be fat32 to work properly.)
Save the file(s) and then repack the boot.img.
Flash to your phone and reboot, wait some time and you should see it come up.
This is a basic how to, but if you have any more questions, please let me know and I will try to answer all of them.
I am try this on my android one but is not working.

[Q] How to merge various system_*.img files?

Hello.
I have a Lenovo Vibe K5 (A6020L36 model), and as many people, I want root and, if possible, a custom recovery and custom ROM.
So, the first step was find and download a stock ROM and flashing program, this is already done. But the ROM comes with several "system.img" files (system_1.img, system_2.img, and so on until system_39.img), some of them have several megabytes in size, and others have only 8kb. I need to merge them to get one system.img to edit, but all process I tried failed.
First, I tried the command "copy /b system_1.img+system_2.img+etc", and get a system.img about 2Gb in size, but the file is somehow corrupt:
When I extract it with unyaffs, I only get the "app" and "lost+found" folders;
When I navigate the remaining folders with EXT2 Explorer, I can see the remaining folders, but they are empty;
When I try to open with EXT4 Unpacker, it gives an error about 'list index out of bounds';
The same happens if I use the command but ignoring the 8kb files.
When I open only system_1.img in EXT4 Unpacker, it comes with same error. With EXT2 Explorer, I again can see all the folders, but except for 'app' folder, all others are empty. The others system files appears blank in both programs.
Then, I tried to use this tool, but it gives the same error at post #8 (tried with Win10 64bits and Win7 32bits, both as administrator).
The stock recovery don't have an option to make a backup, then I tried to launch a TWRP recovery made by another user, but gives an error 'dtb not found'.
Tried also the adb 'dd' command, wich comes with a 'permission denied' error, because don't have root. The flashing programs (QFIL and others Qualcomm programs) appears to don't have a backup option for system partition, only for nvram stuff.
I stucked now, I can't find a way to generate a single and valid system.img. Any ideas to get it? Attached are some usefull files to look at, I think. I also have the stock boot.img and recovery.img.
Any help will be appreciated. Thanks in advice.
No ideas?
Deleted.

Categories

Resources