{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Welcome to this subject where I'll share the following information to activate the terminal init.d our support, as well as the development of the topic is addressed primarily to the developer community roms in order to implement and improve its development in each of the phones and better autonomy thereof is provided.
Warning: Before continuing please read the documentation that will expose so they can check its development, those who only discuss other issues please abtenerse as this issue is not in order to respond is only to well that development develop properly targeted by this issue.
The tools I used for the development of the init.d support they can find at the end of the subject for downloading and asu same time the use so you can verify some of the things we will discuss on this issue.
no script can be universal because it is different and its code and some values and parameters are only applicable for each smartphone
Requirements: root access and SuperSU
1.- proceed with the most basic thing is to give root access to our terminal this method according in each terminal is indispensable as the first requirement
2.- as a second step this would be related to the installation of busybox in the terminal and ending with the installation of the same proceed with checking the same watching the following path with a file browser /system/xbin, if you have any doubts use the application busybox checker to verify the installation of the same
3.- as a third step needs a file browser and asu time they open the routes to them to enter and to edit text files comfortably
4.- as fourth step is to go to the /system /etc there init.qcom.post_boot.sh locate file name to open it proceed traditionally files editor of exploring and we should be on the part of all the way just to add the following lines
Code:
# support init.d
/system/xbin/busybox run-parts /system/etc/init.d
and finished we proceed to save changes to the file
5.- In this step we will create a folder called init.d name is created only once we proceed with changing the permissions would be: 0755 attached screenshot for more details of the permits, download the file will come a script called 99SuperSUDaemon and moved to the /system/etc/init.d apply the same route that takes the folder permissions ie the file 99SuperSUDaemon 0755 will have permission to run properly without any problem because if you put 0644 permits will not run
6.- proceed with terminal power cycle this is to enable support init.d our terminal as seen was not very complicated because they bring roms have actually proven but have not convecid me a story to execution of script obtaining a negative result this method I show a positive result :good:
-Tools
I bring a tool that enables init.d support only run automatically and ready
the end of the song I'll let the files that I used for this topic
1. As a first step it will be necessary to know what we are going and we want to remember that there is no script and not the same parameters with a value change at each terminal
2.- we will create in the internal memory of the terminal a folder called tools this may be optional but we'll use as an example to notice what we do at every step and can understand a bit about this topic
3.- after the tools created folder create a script so that they will ask is to copy the files that are present on that route in this case I will take as an example the following path: /proc/sys/vm is where some values are saved by heart
Code:
#!/system/bin/sh
# copying files
# script by kaiiori xda-developers
sleep 2
echo "creating internal memory directory"
busybox mkdir /storage/emulated/0/tools/vm
sleep 2
echo "copying files"
sleep 2
cp -r /proc/sys/vm /storage/emulated/0/tools
sleep 2
echo "copying completed"
exit 0;
save file vm.sh
4.- install android terminal in the terminal run the following commands
root permissions
Code:
su
go to the directory of your internal memory in this case this is my directory
Code:
cd /storage/emulated/0/tools
find files in the directory
Code:
ls
run the script through the terminal
Code:
sh vm.sh
in the directory /storage/emulated/0/tools/vm has been created a folder called VM and see if open files that have been copied to the internal memory of the terminal
5.- if you open the file values that have default in this case if you to installed scripts should the value applied to the parameter of the same appear if it is not is because there is a problem with the script in content and has to reahacer to carry just the change you want to apply
checking values applied
1.- after you created the script with the content you need to check to see if the value applied is that we have written script is the file we should show the same value as if it does not show is because the code is not right
2.- I leave a script will help them review the values and see if they were applied correctly
Code:
#!/system/bin/sh
# copying files
# script by kaiiori xda-developers
echo " " >>/storage/emulated/0/tools/info.log
echo "-------------------------------" >>/storage/emulated/0/tools/info.log
cat /proc/sys/vm/swappiness >>/storage/emulated/0/tools/info.log
echo " " >>/storage/emulated/0/tools/info.log
echo "-------------------------------" >>/storage/emulated/0/tools/info.log
root permissions
Code:
su
go to the directory of your internal memory in this case this is my directory
Code:
cd /storage/emulated/0/tools
find files in the directory
Code:
ls
run the script through the terminal
Code:
sh script_log.sh
in the directory you create a log file there appear the value that was applied in this case is 100 by default but as I modify it appears 40 that is the result we must apply
with this information I will end my subject just adding the init.d support users should provide updates and other improvements because honestly the code they use and check it when I get the same default the script I use for this and to apply the changes not be able to release it in no way is the greetings own development
reserv
reserved
Related
Hello !
I wrote some scripts for easily pushing and installing files/apks to your android device.
The advantage over "command line" and other scripts like mine :
- Multiple selection allowed (install 100 APKs in one click ! )
- You have a progress bar (shows only the progression between multiples files/ not the state of a single pushing).
- You can choose the destination on your phone with a simple prompt by choosing "Push to ..."
- It's a very simple and lightweight nautilus script...
- You don't have to (in fact, you can't) put the usb in "usb disk" mode, just have debugging enabled.
Examples
To simply install some applications, just select them, right click, go to scripts->ADB->install
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Progression :
Idem for files :
Progress :
Confirmation :
(So the "Push to ..." allow you to choose a destination. "Push to musique" is just a copy of "Push to sdcard" with the second line of the script changed to copy files to /sdcard/music/ instead of /sdcard/ )
How to install
- Download the scripts :
http://www.itstudents.be/~tom/android/ADB Scripts for Nautilus.tar.gz- Uncompress the files in ~/.gnome2/nautilus_scripts/ADB/
So if your name is mario, you should copy the 3 files to :
/home/mario/.gnome2/nautilus-scripts/ADB/
You are not obliged to make the last folder named ADB, it's just to make "categories" in the Nautilus script menu (like in the screenshots)
Requirements
- A correctly installed ADB
What is a correctly installed ADB?
- The PATH environment variable has to be set, to be able to just type "adb" and not "/path/to/sdk/platform-tools/adb". If it's not done :
Edit the file ~/.bashrc , you can do that by typing in the console
Code:
gedit ~/.bashrc
and add this line changed for yourself at the end of the file
Code:
export PATH=${PATH}:/path/to/android-sdk-linux_86/platform-tools/
Or, if this does'nt work :
Edit the file /etc/environment , you can do that by typing in the console
Code:
gedit /etc/environment
and add this text changed for yourself at the end of the line "PATH:", before the last ["]
Code:
:/path/to/android-sdk-linux_86/platform-tools/
- The rules for udev have to be made to allow any non-root user to access to the device
Method for any HTC device :
Edit with root rights the file /etc/udev/rules.d/51.android.rules by typing in the console :
Code:
gksudo gedit /etc/udev/rules.d/51.android.rules
and add the lines :
Code:
SUBSYSTEM=="usb|usb_device", SYSFS{idVendor}=="0bb4", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0666"
Hope you'll enjoy !
Please correct my english
don't want people to know what you're listening to, eh?
It's cool; I like it.
very useful
thanks man
I've been wanting to do something like this but never had time to. Will definitely test this out!
Sent from my Nexus One using XDA App
Oh epic win thanks for this!
Sent from my HTC Hero using XDA App
Please reupload ADB Scripts for Nautilus.tar.gz somewhere.
Stupid me...
http://www.kmel.be/~tom/android/ADB Scripts for Nautilus.tar.gz
Please note a little "bug", the progress bar progress when a file start transfer. So if you send just one big file, it will be at 100% for a little time...
Easily correctible, but I haven't the time now...
MappaM said:
Stupid me...
http://www.kmel.be/~tom/android/ADB Scripts for Nautilus.tar.gz
Please note a little "bug", the progress bar progress when a file start transfer. So if you send just one big file, it will be at 100% for a little time...
Easily correctible, but I haven't the time now...
Click to expand...
Click to collapse
nice work. very handy
EDIT: actually I may have spoke too soon, these don't seem to be working for me. Ubuntu 10.10
I know my udev and $PATH are all set up correctly. So I'm not sure where these are failing for me..
any thoughts?
EDIT2: OK it was a $PATH issue the ~.bashrc however is only for interactive non login shells adding the adb path to ~.profile and a re-login solved my problem with this script. Or alternatively you could call adb in the script using it's full path.
Thanks MappaM for the great base script!
Here is my version of "Push to Movies":
My solution to the immediately full progress bar was to use the --pulsate option in zenity this works for me because I am likely to only be sending one file anyway and don't need the fine grain feed back of an incremental progress bar. The one that bounces back and forth is what you will see.
echo "15" ; sleep 1
is a hack, you may not need it but for me it lets the pulsate flag work.
zenity bugs reported here
https://bugs.launchpad.net/zenity/+bug/291850
https://bugzilla.gnome.org/show_bug.cgi?id=567663
Code:
#!/bin/sh
#this is MY path, your path will be different . change this path.
android_path="/sdcard/media/video/movies/"
i=1
(
for thing in "[email protected]"
do
# this first echo tricks the pulsate into working you may not need it. try it both with and without it.
echo "15" ; sleep 1
echo $(($i * 100 / $#))
echo "# Pushing \"${thing}\"" ;
adb push "${thing}" $android_path
i=$(($i+1))
done; i=$(($i-1)) ; echo "# $i files pushed." ) | zenity --progress --pulsate --auto-kill --width=300 --text "Copying files..." --title "Pushing files to $android_path"
Code:
DISCLAIMER:
I am not responsible for any lost files, bricked devices, thermonuclear war,
zombie holocaust or your dog dropping dead after using these scripts.
You take full responsibility for your actions when using these scripts, and
consequently you should read the instructions, and gather enough knowledge
to know what these scripts are doing before running them on your device.
This is a series of scripts I call Android System Scripts for PowerShell, which I intend to expand upon over time. My goal is to provide some easy to use scripts to perform more or less trivial tasks that makes it easier to customize your Android system, and especially in relation to Android system upgrades on a custom ROM. (These scripts are completely ROM and device independent.)
I have chosen PowerShell because it’s a powerful scripting language that enables you to do most of the things you could in another .NET programming language (except I’m no programmer).
These scripts are made to easily replace some of your Android system files with alternate versions, primarily intended for use when upgrading your ROM. In this way you can easily further customize your ROM with alternate system APK’s, bootanimation.zip, or any other file you can think of. These scripts were primarily written out of my own need to replace Camera, MMS, Calendar and bootanimation.zip etc. in my custom ROM.
BEFORE USING THIS, please consider carefully which system files you want to replace !! Just know what you're doing, this is intended for experienced users only. This is why the script makes a backup of the old files so you can roll back. (For instance, I replaced the browser.apk with another version, which resulted in force closes, and I had to roll back to the previous version - be prepared to do so!)
Prerequisites
You must have ADB root access on your device.
A custom recovery is highly recommended.
Windows PowerShell 2.0 or higher.
Installing and preparing PowerShell
Most importantly, you need PowerShell 2.0 or higher - if you haven't already got it, download it from Microsoft here: (PowerShell is installed by default from Windows 7 and onwards)
http://support.microsoft.com/kb/968929
To use this script you also need to have the proper ADB executable present on your system, and you need to enable PowerShell to run scripts (which is disabled by default).
First, choose the folder in which you wish to install this script. This could very well be the same folder where your ADB executable files are, and it also has to be this folder where you later put the APK files to be installed.
I have installed mine into this folder: C:\Unified_Android_ToolKit\ADK tools
So if you haven't already, go grab a copy of ADB/Fastboot executables (although I don't use fastboot for anything yet), you can get them here:
http://forum.xda-developers.com/showthread.php?p=42407269
Install them into the chosen folder, and unzip the attached file with the script, so that the file android-system-scripts.ps1 is in the same folder as adb.exe. You can add this folder to your path, if you want to be able to execute the commands from anywhere.
Ok, so now ADB and the script is installed, but PowerShell still needs to be enabled to run any scripts at all. This is done by setting the Execution Policy in PowerShell, so you need to open a PowerShell console (found in Start->All Programs->Accessories->Windows PowerShell).
In PowerShell, type: Get-ExecutionPolicy
This will show you the current policy, which would be Restricted if you haven't set anything else. Now you have to set the execution policy to Unrestricted, meaning that all scripts will run.
So type: Set-ExecutionPolicy Unrestricted
Now the script is ready to be run in PowerShell.
The System-File-Replacer script
This script contains a function called System-File-Replacer. When this function is run, the script looks for a file called ass-filetable.tbl in the script folder, and any files listed in the data file will be written to the system of the attached device. A backup will be provided, both on the devices and pulled to your PC, so you can manually roll back at any time (revert function not included yet). The data file have the following format where 3 parameters are given, and each filename has its own line:
Code:
Filename Folder Permissions
firstfile.apk /system/app 644
etc.
An example ass-filetable.tbl is included in the zip. You can also define your own data file name as a parameter to the System-File-Replacer function, if you wish to maintain different file tables, like this:
Code:
System-File-Replacer mydatafile
What's important to understand about PowerShell is that running the script file android-system-scripts.ps1 only loads the function System-File-Replacer into memory. Afterwards, the function needs to be called by name (or by its alias sysfilerepl) to actually perform the task.
It is recommended to run this script while in your custom recovery, because you should clear your caches after the new system filess are installed to ensure everything works correctly.
Here is a screenshot of my first run on my N7:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
The screenshot shows 3 system files being replaced - or rather 1 installed and 2 replaced, as LockClock does not exist on the device (which is why the pull fails), while Apollo.apk and bootanimation.zip gets pulled and then replaced.
The System-App-Replacer script
This is a much simpler script that reads a list of APK's in the current directory, and then performs the same operation as the System-File-Replacer script. This is simpler if you only need to install system APK's, and don't want to list them in the data file.
Step-by-step guide
Start Windows PowerShell
Go to the folder where the files you want to install on your device (and other required files) are located
Make sure that ADB and this script is in the folder as well (or added to your path)
Connect your device
Boot your device into recovery (or if you just flashed a ROM, you're already in recovery)
Mount your system partition from recovery (Important!)
From PowerShell run:
Code:
. android-system-scripts.ps1
(Yes the above command is: dot space <filename>)
From PowerShell run:
Code:
sysfilerepl
Confirm the onscreen instructions
Clear cache and dalvik cache (if you use dalvik that is)
Reboot your device
Done!
Possible developments
I plan to expand upon this collection of scripts over time, and some possible future developments could be:
Bootanimation installer (provided with System-File-Replacer)
Install more file types (provided with System-File-Replacer)
Data files and directory for more devices (provided with System-File-Replacer)
Revert function
Update.zip maker
I'm also open to ideas and suggestions if you have any particular needs, and I'll see if it fits into the toolbox to be added in the future.
:: AM ::
Changelog:
Code:
[B]v1.2.1 - 2014/1/24[/B]
System-File-Replacer: remove all files instead of only apk in pulled folder
[B]v1.2.0 - 2014/1/23[/B]
System-File-Replacer: new function included
[B]v1.0.0 - 2013/7/29[/B]
System-App-Replacer: new function included
Q: I don't feel like setting my Execution Policy to Unrestricted - is there another option?
A: Neither do I, so yes there is. It's possible to set the policy to RemoteSigned instead, in which case you can run unsigned scripts only if they're created locally. This also means that you have to convert my remote script to a local script. This is pretty easy, as all you have to do is open the script file in a text editor, copy all the text, create a new blank text file locally and paste the entire contents into this new file. Now you can delete my remote file, and rename the local file to android-system-scripts.ps1 - the script file is now a locally created file and can be run with the policy set to RemoteSigned.
For Non-Rooted Devices and Rooted Devices
Here is a summary on how to get mounting points without rooting or extracting recovery.img.
The different procedures only needs to have adb shell or terminal emulator.. I will explain using adb shell through pc.
After establishing adb connection to your device, you can choose any of the following procedures to get your mounting points:
#1
Code:
adb shell
cat /proc/mounts
This will give you info about device, the mount point, the file system type, and how it is mounted.
Limitation: This method, however, will not give you all mounting points.!!!
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
#2
Code:
adb shell
cat /proc/partitions
This is more neat, it will give you info about ALL dev blocks and their names (not the familiar name!), and block size
Limitation: Needs from you to figure out which block belong to which partition name.!!
#3
Code:
adb shell
ls -al /dev/block/platform/[B][COLOR="Blue"]dw_mmc[/COLOR][/B]/by-name
This one is the command that I like on non-rooted device..! It will give you info about the dev block names WITH their familiar names (i.e, boot, recovery, system... etc) :laugh:
This command is not universal between devices, and you will need to gather its pieces (/dev/block/platform/dw_mmc/by-name).
How?
- In your device, use any explorer that can get you to the device root (personally I use ES Explorer, by pressing on "/" on navigation bar).
- Go to "/dev/block/platform/" folder
- Here you will see some files and folders, we need to open folders and search for the folder called "by-name" inside one of them; in my situation it was "dw_mmc" folder which has the folder "by-name" inside it.
- At the end, my targeted piece info will be (/dev/block/platform/dw_mmc/by-name)
- Now open adb shell and put the command..
***
For Rooted Devices Only
There are different ways to get mounting points in rooted device (including the non-rooted devices way), but the easiest way to get all device mounting points is to push parted binary to /system/bin folder and run it.
Code:
adb remount
adb shell "su" "" "mount -o remount,rw /system"
adb push parted /system/bin/parted
adb shell
chmod 755 /system/bin/parted
parted /dev/block/[B][COLOR="Blue"]mmcblk0[/COLOR][/B]
print
Here, your mounting points will start with /dev/block/mmcblk0p* where (*) is the number shown in the table above for each partition.
example:
The preload partition mounting point will be mmcblk0p12
The modem partition mounting point will be mmcblk0p8
The system partition mounting point will be mmcblk0p9
The Kernel partition mounting point will be mmcblk0p5
and so on
Don't forget to "quit" the parted action after grasping your device mounting points.
N.B:
- You may need to run first:
Code:
adb shell
cat /proc/partitions
to know what is the initial name for your device partition.. In the example above, it was mmcblk0.
- Also to be able to do adb push to /system partition, you will need adbd insecure installed in your device (Check this thread for that app), or to push it manually by any root explorer and then fix permissions to 755.
***
Pre-made ScriptsWindows users
Here is a script I wrote for both non-rooted (way #3) and rooted devices for windows users.
Just extract the content in any folder and run the script that you want ("Non-Rooted and Rooted.cmd" or "Rooted Only.cmd")
Don't forget to install adbd insecure in rooted device in order to use Rooted Only.cmd script.
Linux users
As same, here is a script I wrote for both non-rooted (way #3) and rooted devices for linux users.
Just extract the content in any folder and run the script that you want ("non-rooted" or "rooted")
Don't forget to install adbd insecure in rooted device in order to use rooted script.
N.B: The linux scripts are tested with cygwin emulator on windows machine.. So needs feedback on actual machine.!!
Cheers
reserved
Thank you, I go to try.
Linux script added to OP
Thanks
Thank you You are the best one
First of all, but not less important...
I'm not responsible for anything that happens with your phone, also, some people experienced some bricks on certain devices, so, just take care where you put paths and data because your phone maybe vulnerable to bricks!
This audio modding guide is intended for experienced users. Mainly, in the Linux handling area, like customizing the kernel and playing with system internal parameters. Please don't play with this, you could overheat and/or damage your smartphone's motherboard if you mess with this menu options.
Requirements:
A rooted LG device.
Stock ROM (includes customized or modded stock)
Universal Init.d
BusyBox
And remember, the curiosity killed the cat, don't be a cat.
System requirements:
Any LG device running ICS (or higher) stock ROM.
Procedure:
First part: setting up the environment
1. Open "Play Store", search for "BusyBox Free" (or open the play store link written above).
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
2. Tap the first result and install it, then open.
3. Now, install BusyBox binaries in your device. Just tap "Install".
4. All done. If you see this, close the app.
5. Now, get back to "Play Store" and search for "Universal Init.d" (or open the play store link written above). Tap the first result.
6. Install it.
7. Open it.
8. Here, move the switch from "Off" to "On".
9. Close the app. The environment set up is done.
Second part: testing device's hardware limits
1. Go to the phone's launcher and tap "Phone".
2. Dial 3845#*<your model's numeric part>#. Mine's LG Optimus L9 (Argentina version), it's model number is P778G, in that case, I should dial 3845#*778#.
3. You'll now see the "Hidden Menu" window. There tap "H/W Device Test".
4. Now pick "Sound Test".
5. Tap "Audio CAL Tool".
6. Pick "SetGain".
7. Tap in the list menu next to "Device Type" and pick "headset".
8. Here, you'll see that there's an item called "HS_DL" and next to it a box where you can type a value. This value should be from 0 to 21. This is you headphone output's gain. Mine's default is 13. The maximum for me is 16, it starts crackling if higher. I suggest you to set it to 16.
9. After setting the value, tap "Ok".
10. Exit the menu.
11. Now, to test your new setting, unplug (if plugged) and plug your headphones again.
Third part: sticking your changes
By default, your device will reset everything as it was before with every reboot. What we gotta do to save those changes? We'll save the files you change when you tap "Ok" to another folder and then retrieve it every time the device boots. How? Here you'll see that:
1. Unplug the USB Cable (if plugged), go to Settings > Developer options and enable "USB Debugging".
2. Plug you device to a computer which has ADB (Android Debugging Bridge) installed. (will work on both Windows and Linux) Don't you know if you have it? Type "adb" at the command line, or "sudo adb" (sudo, just in case) in a Linux Terminal. If you see something similar to the next screenshot, you're okay.
3. Open up a command prompt (or Terminal, in Linux). Type:
Code:
adb shell su -c "cp '/data/audio/gain.table.0 /data/local/'"
4. Open a text editor and create a new file. In Linux, use whatever you like to (includes command line and GUI). In Windows, use Notepad++.
4.1 Only if using Windows:
Right click the bar at the bottom saying "Windows (CR LF)" and pick "Convert to UNIX format".
5. Type (or copy-paste) the next code:
Code:
cp -f /data/local/gain.table.0 /data/audio/
chmod 600 /data/audio/gain.table.0
6. Save the file as 02setaudiogain somewhere in your PC.
7. Go to the folder you saved the file in your PC and then, type those commands:
Code:
adb push 02setaudiogain /sdcard/
adb shell su -c 'mount -o remount,rw /system'
adb shell su -c 'cp /sdcard/02setaudiogain /system/etc/init.d/'
adb shell su -c 'chmod 755 /system/etc/init.d/02setaudiogain'
adb shell su -c 'mount -o remount,ro /system'
8. All done, reboot your device to test . Liked the commands part? Reboot it with this command if you don't like the UI anymore:
Code:
adb shell su -c 'reboot'
Fourth part: troubleshooting
Can't install BusyBox or turn on Universal Init.d?
Check for permission denials at SuperSu's (or your root permission management app) logs.
Device not booting anymore?
Restore a backup over recovery or use LG Mobile Support tool (included in LG PCSuite) to re-flash your device.
Fifth part: how it works
As stated by the logs I took from logcat, what you do when you tap "Ok" in the "Audio CAL Tool" is save some fields to a file called gain.table.0 in /data/audio (/data/audio/gain.table.0)
logcat:
Changes it makes:
Credits:
To @pauliero 's post for the hidden menu code: http://forum.xda-developers.com/showthread.php?t=2126949
Hi guys!
I am posting a very noob friendly guide on replacing init with your patched init file. This will help loading the patched sepolicy and can get temporary unrestricted root shell.
This guide is a prequel to the guide I already posted.
A big thank you to my friend @matteogenacio for helping me out to compiling all the files and patching sepolicy and helping when I was stuck!
Requirements:
(1) dirtyc0w temporary root shell tool: Click Here (Windows only)
(2) dirtyc0w files needed: https://github.com/matteoserva/dirtycow-arm32/archive/master.zip
(2) IDA Pro (Demo version is ok)
(3) HexEditor
(4) You need Ubuntu
(5) Android NDK Compiler
(6)android-libsepol : https://android.googlesource.com/platform/external/libsepol
(7) LOT OF PATIENCE
Click to expand...
Click to collapse
→ Patching your init and loading it into your phone:
(1) Open run_for_arm_devices.bat.
(2) Type "id". You get something similar to this screenshot:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
(3) Type "cp init /sdcard/". Your original init file is copied into the sdcard.
(4) Type "exit" two times to get out of the shell.
(5) Type "adb pull /sdcard/init". The init file is copied into your computer.
(6) Open your init file in IDA PRO.
(7) Compare it with this source code: Click Here
(8) Look for the function which looks similar to this (This actually relates to bootchart_sample() function which you saw in the C++ code above):
(9) Compile shellcode.s using this command: arm-linux-androideabi-as shellcode.s -o shellcode
(10) Open shellcode file in HexEditor.
(11) Copy the content between AAAAINIT and AAAAFINE.
(12) Open init in XDA and copy the shellcode just after the "PUSHW {R4-R11,LR} line.
(13) My patched init file looked like this (more images to be added):
(14) At the end of the shellcode add "POP.W {R4-R11,PC}; NOP" instruction manually. Use ARMConverter. Copy the "Thumb2 HEX" Code.
(15) Click on File> Create DIFF File. Use a IDA Diff patcher to patch your original init.
(16) Now we have to load the init file. Turn off screen and wait 10 seconds.
(17) Type "adb push <your patched init file> /data/local/tmp".
(18) Open "run_for_arm_devices.bat".
(19) Type "run-as con". Then type "cd /data/local/tmp".
(20) Type "./a.out /init ./init". If it gives you "load destination error", try this one "./dirtycow /init ./init".
→ Injecting your sepolicy with rules for unrestricted access:
(1) Compile sepolicy-inject. Type this "gcc -std=gnu11 *.c -o t -I ../libsepol/include/ ../libsepol/src/libsepol.a -DARG_MAX=128" in terminal.
(2) Copy the the compiled sepolicy-inject file into sepolicy_generator. In sepolicy_generator folder, run ./installa.sh file.
(3) Now we have to copy the patched sepolicy file into phone. Type "adb push <your patched sepolicy file> /data/local/tmp/sepolicy".
Finally, open "adb logcat | grep audit". Look for messages that your sepolicy is loaded.
Hey we got root(temporary & unrestricted access)!
→ Notes:
(1) This works for only ARM32 Devices.
(2) This guide works regardless of your Android version. You can check if your phone is vulnerable to dirtyc0w using my debugging tools which I posted them in my guide.
(2) Another big thank you to my friend @matteogenacio for helping me out to compiling all the files and patching sepolicy and helping when I was stuck!
Reserved.
I'm glad I found this. I'm hoping maybe this can be converted to 64 bit, using a 64 bit dirty cow shell.
If you look in my thread, injecting root & setting SELinux, we have a 64bit shell.
Sorry if it's a noob question, but is "sepolicy" compatible between devices? My policy has attributes I wish it didn't have and I don't know how to remove them. So I thought replacing it with another one.
Was looking around XDA for a "guru's thread' on SeLinux - and found this one.
My Util bindfs wont work cos of SeL denials and I need help "neutralizing" the denial by changing SePolicy or alternatively running any relevant chron . So I'm putting my Q here. If ain't of relevance I'll Del it
A non root file explorer can rename existing file with bindfs but it cant create new files aka WhatsApp downloads fail
My Samsung Stock ROM SeLinux logging is disabled.
grep -i avc /proc/kmsg dmesg | grep -i avc logcat | grep -i avc
No results from above. So I cant figure out what's hurting the Create Perm
So I ( hopeully ) recreated the scenario on another Android 9 phone with SeLinux state changeable ( the other 1 is perm. enforced). & I get this avc denial
9421 9421 W com.whatsapp: type=1400 audit(0.0:15540): avc: denied { create } for comm=4D65646961446F776E6C6F61642023 name="LW9n+rkip578Ox9pPGthBD5DGfO7rIMxJyDHRHjQ9ZY=.tmp" scontext=u:r:untrusted_app:s0:c122,c257,c512,c768 tcontext=u:object_r:sdcardfs:s0 tclass=file permissive=0
So the issue could be untrusted app or becos my target /data/sdext3 has unlabeled context ?
ls -Zd /data/sdext3
u:object_r:unlabeled:s0 /data/sdext3
BTW just FYI chron fails. Why so ?
chcon -Rh u:object_r:sdcardfs:s0 /data/sdext3` # before that I `chown -R`ed to `root` entire `/data/sdext3` o/p of ths is `chcon: '/data/sdext3/j37 WhatsApp/data/colornote/backup/1606263606732-AUTO.doc' to u:object_r:sdcardfs:s0:
# Permission denied - throws this error for all files
. Does it mean I have to recompile kernel with updated policy OR any work-around ?