On device c# compiling (Revisited) with scripts and download - Windows RT Development and Hacking

I revisited the work which had previously been done on the csbox thread by ssaaxx for windows 8, and created new scripts and utilities to support our current 8.1 testsigning environment.
I have created a zip file full of batch scripts, a command line signing utility (based on eisbaer82's source), and a few samples which enables compiling console and winforms apps.
You can download the attached zip, unblock it file properties, extract it to a new directory, and then you have several options :
There are four compile scripts :
compile.bat filename.cs (compile filename.cs as a console app)
compilerun.bat filename.cs (compile filename.cs as a console app and run it)
compile-winforms.bat filename.cs (compile filename.cs as a winforms app)
compulerun-winforms.bat filename.cs (compile filename.cs as a winforms app and run it)
For starters you can open command prompt, cd into the extracted files directory and compile the examples with the following commands :
Code:
compilerun helloconsole.cs
compilerun-winforms hellowinforms.cs
You can use notepad++ to set up 'run' commands such as this console 'compilerun' alias:
Code:
c:\cs-compiler\compilerun.bat "$(FULL_CURRENT_PATH)"
or a 'compilerun-winforms' alias might look like :
Code:
c:\cs-compiler\compilerun-winforms.bat "$(FULL_CURRENT_PATH)"
You can add aliases for all four scripts or just the ones you need in notepad++ and either update the directory in my examples to your actual locations or just use the file picker to browse for it and add "$(FULL_CURRENT_PATH)" after it.
If you frequently run into compiler errors and use notepad++ to launch compile scripts, you might want to add a 'pause' statement at the end of the batch file so that you can read the errors before the window closes.

Related

Ubuntu / Backtrack on Android [Complete Solution]

This guide had been on the Thunderbolt forum for quite some time and I decided it was time to share with the rest of the community
Having reviewed almost every other option I can safely and honestly say this is the most simplified, thorough, and customizable install available since its original launch. I will gladly retract this statement when it becomes false, but until then...
Installing Ubuntu onto Thunderbolt/Droid/Droid2/Etc:
Create a folder on the sdcard named ext2ubuntu, which is /sdcard/ext2ubuntu when listed in terminal or adb
Required files for Ubuntu install:
Ubuntu.sh http://db.tt/KgDNlMtb
Custom Packages for AutoConfig:
Coming soon
You will also want to download either an ubuntu image or archive. The major difference is that the image must be the same size as your ubuntu installation, so they are larger downloads, or need to be resized before you use them.
Ubuntu Prebuilt tar and img downloads:
(img: Extract only ubuntu.img and place in /sdcard/ext2ubuntu)
(tar: Rename, if desired, and put archive in /sdcard/ext2ubuntu)
10.04: http://android-cruft.googlecode.com/files/lucid-on-android-0.1.tar
(This image DOES need to be resized, see next post)
10.10 img: http://www.megaupload.com/?d=56AT71WD
(This image file does NOT need to be resized)
11.04 tar: http://db.tt/fuzoy8Te
Backtrack img: http://bit.ly/kJweA9
Borrowed from http://forum.xda-developers.com/showthread.php?t=1146255
(This image file does NOT need to be resized)
How to build your own Ubuntu Image:
http://androlinux.com/android-ubuntu-development/how-to-build-chroot-arm-ubuntu-images-for-android/
Notice:
The ubuntu mount folder is symlinked to /system/sd-ext allowing access to it there also.
First off you should have a running ubuntu install on your computer or at least a live cd running to create the ext2 partition.
Use gparted to add a 4gb (or whatever size you want) ext2 partition to your sdcard. I did this while the phone was mounted in disk drive mode, so you dont need to take the card out.
Ubuntu: Get gparted in synaptics or in terminal enter:
Code:
sudo apt-get install gparted
Widows: *Paragon Partition Manager*
If you do not need to partition, skip this step.
Use adb to run /sdcard/ext2ubuntu/ubuntu.sh
Code:
adb shell
su
sh /sdcard/ext2ubuntu/ubuntu.sh
Or from terminal (only supported on some ROMs)
Code:
su
bash /sdcard/ext2ubuntu/ubuntu.sh
All required scripts will download and install themselves automatically. Currently only ubuntu.sh and the chosen ubuntu image need to be placed in /sdcard/ext2ubuntu for proper install. Scripts include an autoupdate feature that will also keep them current.
Follow the instructions and select the appropriate options for your system configuration and download choices.
You can now open terminal and type "bootubuntu" to test install
A new Sdcard Direct option was added allowing user to replace the installed scripts with a unified "ubuntu" command that runs the scripts directly from the sdcard. This option was offered due to the frequency of updates to allow the user to simply replace the files in /sdcard/ext2ubuntu with newer versions that would run without any further steps.
If you get a localhost prompt, you are in but still need a couple things to move past command line.
Here is where we part from borrowed and modified instructions that recommend lxde and ice and all the dinky handheld ubuntu shells, and move to the Thunderbolt method.
Update vs Restore scripts: Update will base what scripts are put in system on the ones currently there, while restore determines what scripts are currently available on the sdcard.
For automatic installation of ubuntu applications, you will want to enter these commands next:
Code:
su
backubuntu
4
Choose your options
To view your ubuntu desktop, you will want a vnc viewer for android. I use real vnc, but android-vnc-viewer is free and has all the same features (i just liked the layout of realvnc)
The address for ubuntu is 127.0.0.1
The port is 5901
The password is the tightvncserver one you set.
i recommend making a folder named android in "your mounted ubuntu folder"/home/ for your personal files since /root is your local folder, but causes permission issues.
From your new ubuntu you can use synaptics and download eclipse there, but it can also be downloaded from the localhost prompt using "apt-get install eclipse" I also recommend downloading the android-sdk. To run the sdk from the localhost prompt, simply cd to the android-sdk directory and issue the command:
Code:
tools/android update sdk -u -s
and if you want to specify the downloads performed add
Code:
-t [specific items such as platform, platform-tool]
If you need help with any commands you can add
Code:
-h
to your existing command
The htc kitchen can be downloaded from ubuntu using the same instructions found: http://forum.xda-developers.com/showthread.php?t=633246
After it is installed, you have the option to launch this kitchen either from inside your ubuntu install, or from the localhost prompt, which avoids having to run vnc to use it.
A compiler toolchain is available http://www.codesourcery.com/sgpp/lite/arm by choosing download the latest release. I use gnu/linux even though it seems to be eabi included in the android source, but I have never used it to be sure. I have been told this one is a lot easier to use anyway.
I recommend backing up the ext2 once everything is done. This can be done by (entering "exit" at the localhost prompt and then) entering "backubuntu" in terminal.
backubuntu can also update newly downloaded scripts without having to use root explorer or worry about permissions. Just put any new versions in your sdcard/ubuntu folder and select the update option.
This replaces the ubuntu2.img with your backup so you dont have to "apt-get" everything over again. This will also save your tightvnc password so make sure you remember it.
Sent from my ADR6400L using Tapatalk
Screenshots:
https://picasaweb.google.com/110545...authkey=Gv1sRgCLDd48n2oMWzpAE&feat=directlink
References:
Personal insanity and the inability to accept whats already available
http://code.google.com/p/android-cruft/wiki/LucidWithAndroid
http://androlinux.com/android-ubuntu-development/how-to-install-ubuntu-on-android/
http://nexusonehacks.net/nexus-one-hacks/how-to-install-ubuntu-on-your-android/
http://forum.cyanogenmod.com/topic/15702-ubuntu-on-your-g2-anyone/
http://forum.xda-developers.com/showthread.php?t=633246
http://www.codesourcery.com/sgpp/lite/arm
http://forum.xda-developers.com/showthread.php?t=987740
http://androidclone.com/forums/showthread.php?tid=23
Sent from my ADR6400L using Tapatalk

Debug data collection - hybrid script Linux, Windows, ADB, device

GENERAL
This archive (debug.2.2.zip) is a debugging tool for users of Android applications to assist the developers in debugging their applications. This tool can be used three ways:
1. The archive is installed (flashed) in Recovery immediately after installing an application.
2. The script "collect.cmd" is extracted and run on the Android device.
3. The script "collect.cmd" is extracted and run on a Linux or Windows computer which has the Android Debug Bridge program.
In alternatives 2 and 3 the script "collect.cmd" is a Linux shell, Windows CMD, and Android shell script. For Linux and Android, "collect.cmd" nay be renamed to remove the ".cmd" extension but this is not necessary.
All three methods will collect data (including 'logcat') and save that data to the directory that the archive or extracted script is in. The file will be either a ZIP or a tape archive with a name having the form "debug-[model]-[version]-[timestamp].[zip|tar]"; for example "debug-SM-N900T-4.3-20141109T0706.zip". If the ZIP program is available then a ZIP archive will be created, otherwise a tape archive is created.
MINIMAL INSTRUCTIONS
When installing a beta version application through Recovery, first install that application, then without rebooting install this debug archive. If there are problems with the application then send the resulting data archive created by installing the debug archive to the developer of the troublesome application. If there are no problems to report then delete the data archive.
If an application is forced closed while running Android then extract the script "collect.cmd" from the debug archive onto a Linux or Windows computer which has a functional Android Debug Bridge application and run the script while the Android device is connected to that computer. The data archive will be created on the computer in the same directory that the script exists in. Send this data archive to the developer of the troublesome application.
If an application is forced closed as in the preceding paragraph but a Windows or Linux computer is not available for Android Debug Bridge usage then extract the script "collect.cmd" from the debug archive onto the Android device and run the script on the Android device. The data archive will be created on the Android device in the same directory that the script exists in. Send this data archive to the developer of the troublesome application.
DEVELOPERS
This debug system has been created so that it can be used as a general tool to collect standard data or it can be easily customized for your application's needs. Without customization the debug scripts try to collect the following:
- the environment (set > environment.txt).
- the logcat (logcat -d >logcat-all.txt).
- the build properties (cat /system/build.prop > build.prop).
- the Recovery log (cp /tmp/recovery.log OR /cache/recovery/last_log > recovery.log)
The debug archive contains a file named 'plan' for use when the debug archive is installed in Recovery, and the script "collect.cmd" contains a variable named 'plan' at the top of the script for use when that script is run on the device or from across the Debug Bridge.
The plan is a list of lines, each line divided left and right by the characters '>>'. The left side of the '>>' is the command to run and the right side is the name of the file to redirect output to (stdout and stderr). Output is always appended (>>) so you may use the same file for multiple commands.
When installed through Recovery you may also add your own programs to run. Copy them to the root of the archive and invoke them in 'plan' from the directory "/$my". For example, here's a short plan showing the collection of logcat with a filter and a custom script run from the archive root:
logcat -d|grep -E 'supersu|installer|/dev/log/main' >> logcat.txt
sh $my/custom.sh >> custom.txt
The script "custom.sh" would have first been placed in the archive's root directory.
The attachment has some additions to the plan in both the archive root 'plan' file and in the variable 'plan' in the collection script.
Frank

[GUIDE]Cross Compiling C/C++ for ARM on Linux

I wrote this guide to make it easy for everyone to be able to cross compile c/c++ for android, the easy way that I know. I admit, I am a total n00b to c/c++. I started learning to cross compile when I got my new nexus 9 for christmas. I, for some reason, couldnt get busybox installed on it. So, I had to manually compile and load it on there. After reading a hundred tutorials and none of them working, I got frustrated. Finally, I compiled a working version. And it was SO EASY. Anyway, Im specifically giving instructions for Ubuntu 14.04/14.10. First thing you need to do is download a package called binutils-arm-linux-gnueabi.
- sudo apt-get install binutils-arm-linux-gnueabi
- sudo apt-get install binutils-aarch64-linux-gnu (for aarch64, or arm 64bit, or armv8)
- sudo apt-get install binutils-arm-linux-gnueabihf (for armhf)
To compile busybox for your platform, you must download the source package you want to compile from http://busybox.net/downloads/. Then extract it
- tar xvf busybox.tar.gz
Then, cd into your root busybox folder.
- export ARCH=arm
- export CROSS_COMPILE=arm-linux-gnueabi- (dont forget the trailing dash(-))
This will setup your variables for compilation. Then
- make menuconfig (if you dont get a config menu, you need to "sudo apt-get install libncurses5-dev")
Now, go into the busybox settings -> Build options. Select the option "build busybox as static executable". You can select/deselect options by hitting the space bar. [ESC] key will take you back. Make sure to save your new configuration. Its almost time to compile! One last thing. If you want to add your name to it, go into the Makefile in the root busybox folder. At the top of the file, where it says EXTRAVERSION = .git, you can add something like -bynarie or whatever you want. That way when you run busybox on the terminal emulator on android, it will print out something like "BusyBox v1.24.0-bynarie". OK! Time to compile. Really simple:
- make install
This will compile every applet, and put everything in a folder called _Install. You will have busybox and busybox_unstripped in the root directory. Please, be aware that this busybox puts an applet named "su" in the bin folder in the _install folder. So, DO NOT COPY THE SU APPLET INTO YOUR ANDROID BIN FOLDER, OR YOU WILL LOSE ROOT!!! Now, to verify it compiled to the right architecture, do "file busybox" at the term and it should spit out something like "ELF 32bit ARM executable". If this is the case, congrats. We have successfully compiled busybox for android arm!! Copy the needed files over to your device and set permissions and you are done. The suggested way to move the busybox binary to your device is as follows:
- adb push busybox /data/local/tmp/busybox
- open adb shell and do "chmod 755 /data/local/tmp/busybox" or chmod it on your linux box before pushing.
- open file manager on device and move busybox to /system/xbin
- If properly done, should work.
For other nix programs like tar, the procedure is as follows:
- Open term, cd into root source folder
- ./configure CC="arm-linux-gnueabi-gcc" CPP="arm-linux-gnueabi-cpp" --host=arm-linux-gnueabi
- make
The CC variable is your C compiler command and the CPP variable is the C preprocessor, if you need to add a C++ compiler just add CXX="arm-linux-gnueabi-g++" but TAR is specifically C only. You can add all three variables I would assume to be safe. Most of the time, the readme or install documents will give you some guidance on cross compiling. But, this is how I successfully compiled TAR for arm and aarch64.
If you want to compile small/single source file c/c++, you will be using the same tools, but in a different way. Cd into your source file directory, and depending on which type of source it is (c or cpp), you will do the following:
- arm-linux-gnueabi-gcc helloWorld.c -static -o helloworld.out (for C)
- arm-linux-gnueabi-g++ helloWorld.cpp -static -o helloworld.out (C++)
Yep, its that easy. I cant guarantee 100% this will work on everything, but its a good starting point. And you dont even have to fool with the Android NDK. I find that the android ndk would mostly benefit "Apps" that need to integrate c/c++ code into them, not little console apps run from the terminal emulator. I hope someone finds this guide useful and if anyone has any problems trying to get somethin to work, you can respond and I will do my best to help.
thanks

Use Apktool command line on Android

I have used the excellent ApktoolX, (https://androidfilehost.com/?a=show&w=files&flid=66185), and openJDK by dongfangxunlei, (https://github.com/dongfangxunlei/openjdk/wiki/How-to-play-with-apktool-on-android), posted by @pqy330 here - https://forum.xda-developers.com/showpost.php?p=77459735&postcount=386, and they both work well, but, for one, I ran into a problem where my current rom has some system configuration that makes the framework inaccessible when trying to recompile any apk besides framework-res, and I was able to work around it using this method in recovery terminal, and for two, some people feel more familiar and more control using the command line. I figured out how to do it, using files from the projects posted above.
I would like to give full credit, but, as far as I can tell, Androblack is not on XDA, and I don't know if pqy330 is the author of those files or not. pqy apktool for Android goes back several years, and I've never seen much on any American sites to indicate exactly where it's coming from. Anyone knows better, let me know.
Requirements:
- Openjdk installer for armv7/arm64 or for x86_64 from the link above, or same files from ApktoolX.
- Root
- Good file manager (I prefer Mixplorer)
Instructions:
- Download and install openjdk installer for armv7/arm64 or for x86_64, from the link above. Open app, and go through each screen, (openjdk, Apktool, and Tomcat), selecting 'check', then 'download', then 'install'. When all done, you will have a directory on your phone, /data/data/per.pqy.openjdk/.
- Copy the contents of /data/data/per.pqy.openjdk/openjdk/ to /system/usr/local/, (you may have to create /system/usr/local/).
- Copy the Apktool.jar from /data/data/per.pqy.openjdk/ to /system/usr/local/bin, (or just download latest from Apktool site - it's the same), and rename it if you want. You can also mess around with Apktool wrapper script if you want. It should work. I didn't bother with it, because I just made scripts.
- Chmod 0755 -R /usr/local/bin/
- Now you are set up to use Apktool as usual from command line.
Without the use of the wrapper script, you will have to use
Code:
java -jar apktool.jar
plus usual Apktool commands. I just made a script with those commands, and put it in /system/bin/.
Update here - now working for me without having to use terminal in recovery - https://forum.xda-developers.com/showpost.php?p=78984858&postcount=393

MIUI Bloatware Remover - NO ROOT

MIUI_Boatware_Remover_NO_ROOT
I am not responsible for any damage or malfunction of your device.
REQUIREMENTS
Windows 10 or Linux
Python 3.x
CMD(Windows), PowerShell(Windows) or Terminal(Linux)
INFO
This app removes some apps of your choice from the MIUI rom
SUPPORTED DEVICES
All MIUI devices also not rooted
INSTRUCTIONS
FOR WINDOWS
Enable ADB Debug on your smartphone (Developer Settings)
Install Python3 from the official website: https://www.python.org/
Open the cmd and start the program by typing <dir python.exe> <dir MIUI_Boatware_Remover_NO_ROOT.py>. remember to also write python.exe and MIUI_Boatware_Remover_NO_ROOT.py. ES. C:\python\python.exe C:\Users\<name of your user>\Download\MIUI_Boatware_Remover_NO_ROOT.py
Follow the instructions displayed in the program
OR LINUX
Enabl OEM Unlock and ADB Debug on your smartphone (Developer Settings)
Open the terminal and type sudo apt install python3 to install Python3
Now type python3 <dir file MIUI_Boatware_Remover_NO_ROOT.py> remember to also write MIUI_Boatware_Remover_NO_ROOT.py
Follow the instructions displayed in the program
GitHub: FabioFabRob7/MIUI_Boatware_Remover_NO_ROOT (github.com)
Thank you @FabioFabRob7
I appreciate your effort.
Can I simply run the python script from linux as I don't have windows?
Are all those dll and exe files really necessary or can I simply delete those? I'm only interested in the debloater script itself.
You can download all the zip via github web or git clone in terminal, then delete all the exe file with file manager or command rm (remove) via terminal
you can also copy the code when view the file .py on github and use gedit and save a new file .py on your desktop

Categories

Resources