Copy device files from src folder to proprietary. - Android Q&A, Help & Troubleshooting

How to copy device files from a folder (src) to proprietary/ and have the blobs build. ????
(I really dont want to connect my device to the pc all the time!)
I have my device (Rom files) in the folder: src
My device tree is in: home/ICS/device/YG/m805_892x/
This is what i have sow far now. Well what i found and changed a bit:
#!/bin/sh
if [ $# -lt 1 ]
then
echo "Usage:" $0 "<Source>"
exit
fi
SOURCE=$1
VENDOR=YG
DEVICE=m805_892x
rm -r ../../../device/$VENDOR/$DEVICE
mkdir -p ../../../device/$VENDOR/$DEVICE/proprietary
# Pull needed standard libs voorbeeld:
cp -a $SOURCE/system/lib/libaudio.so ../../../device/$VENDOR/$DEVICE/proprietary
cp -a $SOURCE/system/lib/libaudiopolicy.so ../../../device/$VENDOR/$DEVICE/proprietary
#and sow on.
./setup-makefiles.sh

Any one?

Well i got something working. Here a small example of my copy-files.sh
#!/bin/sh
VENDOR=YG
DEVICE=m805_892x
#MANUFACTURER=YG
mkdir -p ../../../device/$VENDOR/$DEVICE/proprietary/bin
mkdir -p ../../../device/$VENDOR/$DEVICE/proprietary/etc/bluetooth
mkdir -p ../../../device/$VENDOR/$DEVICE/proprietary/etc/dhcpcd
mkdir -p ../../../device/$VENDOR/$DEVICE/proprietary/etc/permissions
mkdir -p ../../../device/$VENDOR/$DEVICE/proprietary/etc/ppp
mkdir -p ../../../device/$VENDOR/$DEVICE/proprietary/etc/ril
mkdir -p ../../../device/$VENDOR/$DEVICE/proprietary/etc/wifi
mkdir -p ../../../device/$VENDOR/$DEVICE/proprietary/fonts
mkdir -p ../../../device/$VENDOR/$DEVICE/proprietary/framework
mkdir -p ../../../device/$VENDOR/$DEVICE/proprietary/lib/egl
mkdir -p ../../../device/$VENDOR/$DEVICE/proprietary/lib/hw
mkdir -p ../../../device/$VENDOR/$DEVICE/proprietary/lib/modules
mkdir -p ../../../device/$VENDOR/$DEVICE/proprietary/media/audio/alarms
mkdir -p ../../../device/$VENDOR/$DEVICE/proprietary/media/audio/notifications
mkdir -p ../../../device/$VENDOR/$DEVICE/proprietary/media/audio/ringtones
mkdir -p ../../../device/$VENDOR/$DEVICE/proprietary/media/audio/ui
mkdir -p ../../../device/$VENDOR/$DEVICE/proprietary/usr/idc
mkdir -p ../../../device/$VENDOR/$DEVICE/proprietary/usr/keychars
mkdir -p ../../../device/$VENDOR/$DEVICE/proprietary/usr/keylayout
mkdir -p ../../../device/$VENDOR/$DEVICE/proprietary/usr/share/zoneinfo
mkdir -p ../../../device/$VENDOR/$DEVICE/proprietary/usr/srec/config/en.us/dictionary
mkdir -p ../../../device/$VENDOR/$DEVICE/proprietary/usr/srec/config/en.us/g2p
mkdir -p ../../../device/$VENDOR/$DEVICE/proprietary/usr/srec/config/en.us/grammars
mkdir -p ../../../device/$VENDOR/$DEVICE/proprietary/usr/srec/config/en.us/models
mkdir -p ../../../device/$VENDOR/$DEVICE/proprietary/vendor/lib/egl
mkdir -p ../../../device/$VENDOR/$DEVICE/proprietary/vendor/lib/hw
mkdir -p ../../../device/$VENDOR/$DEVICE/proprietary/wifi
cp -a src/lib/libril.so ../../../device/$VENDOR/$DEVICE/proprietary/lib/libril.so
cp -a src/key_921600.psr ../../../device/$VENDOR/$DEVICE/proprietary/key_921600.psr
cp -a src/key_3000000.psr ../../../device/$VENDOR/$DEVICE/proprietary/key_3000000.psr
cp -a src/ts.conf ../../../device/$VENDOR/$DEVICE/proprietary/ts.conf
cp -a src/bin/bugmailer.sh ../../../device/$VENDOR/$DEVICE/proprietary/bin/bugmailer.sh
cp -a src/bin/busybox ../../../device/$VENDOR/$DEVICE/proprietary/bin/busybox
cp -a src/bin/chkntfs ../../../device/$VENDOR/$DEVICE/proprietary/bin/chkntfs
cp -a src/bin/flash_eraseall ../../../device/$VENDOR/$DEVICE/proprietary/bin/flash_eraseall
cp -a src/bin/hostapd ../../../device/$VENDOR/$DEVICE/proprietary/bin/hostapd
cp -a src/bin/hostapd_cli ../../../device/$VENDOR/$DEVICE/proprietary/bin/hostapd_cli
cp -a src/bin/hostapd_wps ../../../device/$VENDOR/$DEVICE/proprietary/bin/hostapd_wps
cp -a src/bin/iptables ../../../device/$VENDOR/$DEVICE/proprietary/bin/iptables
cp -a src/bin/iwconfig ../../../device/$VENDOR/$DEVICE/proprietary/bin/iwconfig
cp -a src/wifi/wlan.ko ../../../device/$VENDOR/$DEVICE/proprietary/wifi/wlan.ko
./setup-makefiles.sh
my copy-files.sh

Related

Two versions of the same app

Is it possible to install two versions of the same app without overwriting the previous one??
i have tried to decompile the app and change the app name in package field of manif
est.xml, i was successful in installing the apps but the one with unedited manifest.xml works whereas the other force closes
This is possible, but you will need to adjust the folders containing the smali files (after using apktool), as well as (not sure about this bit) changing the class declaration names in each smali file.
It's complex, but it is possible to do and you're on the right tracks with the package name
is there any automated tool to do all that?
keyboardcowboy said:
is there any automated tool to do all that?
Click to expand...
Click to collapse
Unlikely
10 char
I have seen Brut's modified Google maps, it can be installed beside original app...How did he do it?
keyboardcowboy said:
is there any automated tool to do all that?
Click to expand...
Click to collapse
Someone could make a script. I'll post my solution to give that person a head start.
Code:
apktool d -f base_MYAPP.apk base_MYAPP
mv base_MYAPP/smali/com/MYCOMPANY/MYAPP base_MYAPP/smali/com/MYCOMPANY/NEW_MYAPP
find base_MYAPP/smali/com/MYCOMPANY/NEW_MYAPP -name "*.smali" -print | xargs sed -i -e 's/MYAPP/NEW_MYAPP/g'
sed -i -e 's/MYAPP/NEW_MYAPP/g' base_MYAPP/AndroidManifest.xml
sed -i -e 's/APP NAME/APP NAME NEW/g' base_MYAPP/res/values/strings.xml
rm -f base_MYAPP/res/values/strings.xml-e base_MYAPP/AndroidManifest.xml-e
find base_MYAPP/smali/com/MYCOMPANY/NEW_MYAPP -name "*.smali-e" -print | xargs rm -f
apktool b base_MYAPP NEW_MYAPP-unaligned.apk
jarsigner -keystore my.keystore -storepass pass1 -keypass pass2 NEW_MYAPP-unaligned.apk alias
zipalign -f -v 4 NEW_MYAPP-unaligned.apk NEW_MYAPP.apk
Something like that. I need to go home. =)
awesome
Try something like this:
Code:
#!/bin/bash
##### Constants
APK_NAME="My App"
PACKAGE="My_App"
PACKAGE_PATH=com/my_company/
KEYSTORE="my.keystore"
KEYSTORE_PASS="keystore_pass"
ALIAS="alias_name"
ALIAS_PASS="alias_pass"
##### Functions
function copy_apk
{
# Parameters
base_file=$1
new_package=$2
new_apk_name=$3
input_dir=base/
file_modification_date=$(stat -f "%Sm" -t "%Y%m%d" $input_dir/$base_file)
file_modification_time=$(stat -f "%Sm" -t "%H%M%S" $input_dir/$base_file)
output_dir=$file_modification_date/
# Variables
file_name=$(echo "$base_file" | cut -d'.' -f1)
file_extension=$(echo "$base_file" | cut -d'.' -f2)
new_file_name_unaligned="${file_name}-unaligned.${file_extension}"
new_file_name_aligned="${file_name}_${file_modification_date}_${file_modification_time}.${file_extension}"
work_directory=$input_dir$file_name/
smali_directory=$work_directory/smali/$PACKAGE_PATH/
# Function Body
mkdir -p $input_dir
mkdir -p $output_dir
apktool d -f $input_dir$base_file $work_directory
mv $smali_directory/$PACKAGE $smali_directory/$new_package
find $smali_directory/ -name "*.smali" -print | xargs sed -i -e "s/$PACKAGE/$new_package/g"
find $smali_directory/ -name "*.smali-e" -print | xargs rm -f
find $work_directory/ -name "*.xml" -print | xargs sed -i -e "s/$PACKAGE/$new_package/g"
sed -i -e "s/$APK_NAME/$new_apk_name/g" $work_directory/res/values/strings.xml
find $work_directory/ -name "*.xml-e" -print | xargs rm -f
apktool b $work_directory $input_dir/$new_file_name_unaligned
jarsigner -keystore $KEYSTORE -storepass $KEYSTORE_PASS -keypass $ALIAS_PASS $input_dir/$new_file_name_unaligned $ALIAS
zipalign -f 4 "$input_dir/$new_file_name_unaligned" "$output_dir/$new_file_name_aligned"
}
function apk_version
{
# Parameters
base_file=$1
package_extension=$2
# Variables
new_package="${PACKAGE}_${package_extension}"
new_apk_name="${APK_NAME} $package_extension"
# Function Body
$(copy_apk "$base_file" "$new_package" "$new_apk_name")
}
##### Main
$(apk_version my_app_sandbox.apk Sandbox)
$(apk_version my_app_release.apk Release)
sgeos said:
Try something like this:
Code:
#!/bin/bash
##### Constants
APK_NAME="My App"
PACKAGE="My_App"
PACKAGE_PATH=com/my_company/
KEYSTORE="my.keystore"
KEYSTORE_PASS="keystore_pass"
ALIAS="alias_name"
ALIAS_PASS="alias_pass"
##### Functions
function copy_apk
{
# Parameters
base_file=$1
new_package=$2
new_apk_name=$3
input_dir=base/
file_modification_date=$(stat -f "%Sm" -t "%Y%m%d" $input_dir/$base_file)
file_modification_time=$(stat -f "%Sm" -t "%H%M%S" $input_dir/$base_file)
output_dir=$file_modification_date/
# Variables
file_name=$(echo "$base_file" | cut -d'.' -f1)
file_extension=$(echo "$base_file" | cut -d'.' -f2)
new_file_name_unaligned="${file_name}-unaligned.${file_extension}"
new_file_name_aligned="${file_name}_${file_modification_date}_${file_modification_time}.${file_extension}"
work_directory=$input_dir$file_name/
smali_directory=$work_directory/smali/$PACKAGE_PATH/
# Function Body
mkdir -p $input_dir
mkdir -p $output_dir
apktool d -f $input_dir$base_file $work_directory
mv $smali_directory/$PACKAGE $smali_directory/$new_package
find $smali_directory/ -name "*.smali" -print | xargs sed -i -e "s/$PACKAGE/$new_package/g"
find $smali_directory/ -name "*.smali-e" -print | xargs rm -f
find $work_directory/ -name "*.xml" -print | xargs sed -i -e "s/$PACKAGE/$new_package/g"
sed -i -e "s/$APK_NAME/$new_apk_name/g" $work_directory/res/values/strings.xml
find $work_directory/ -name "*.xml-e" -print | xargs rm -f
apktool b $work_directory $input_dir/$new_file_name_unaligned
jarsigner -keystore $KEYSTORE -storepass $KEYSTORE_PASS -keypass $ALIAS_PASS $input_dir/$new_file_name_unaligned $ALIAS
zipalign -f 4 "$input_dir/$new_file_name_unaligned" "$output_dir/$new_file_name_aligned"
}
function apk_version
{
# Parameters
base_file=$1
package_extension=$2
# Variables
new_package="${PACKAGE}_${package_extension}"
new_apk_name="${APK_NAME} $package_extension"
# Function Body
$(copy_apk "$base_file" "$new_package" "$new_apk_name")
}
##### Main
$(apk_version my_app_sandbox.apk Sandbox)
$(apk_version my_app_release.apk Release)
Click to expand...
Click to collapse
this is fun, but I am not sure how to runt he script on my phone.

need help to translate MIUI V4 (ICS)

Hi,
i tried to translate a MIUI for Galaxy Nexus rom into french (can also be an other language)
i wrote an unix script to automate the process.
What i do is quite simple:
i get a specific MIUI V4 version for my device and the same translated version for the nexus S (because the nexus S has a french version)
i decompile each apk from the french rom, an put the french files into to decompile galaxy nexus directories
i recompile each apk
and i copy the compiled resources into the origin galaxy nexus apks
and i build the new ROM
but i get a bootloop any ideas ?
here is my script
if there are any part of this script that isn't clear, i could try to explain them.
of course this script could also be used on other device or other translation with some changes.
Thanks in advance .
Code:
#!/bin/bash
# MIUI-FRENCH TRANSLATE SCRIPT FOR GNEX V1.0 By Alain57
BASE_DIR=$PWD
FRENCH_DIR=$BASE_DIR/french_rom
ORIGINAL_DIR=$BASE_DIR/original_rom
OUTPUT_ROM_DIR=$BASE_DIR/output_rom
OUT_DIR=$BASE_DIR/out
WORK_DIR=$BASE_DIR/workdir
ORIGIN_APK_DIR=$WORK_DIR/origin
TRANSLATION_DIR=$WORK_DIR/translation
DECODED_APK_DIR=$WORK_DIR/decoded
LOG_FILE=$BASE_DIR/log.txt
TEMP_DIR=$BASE_DIR/temp
# clean the log file and create the missing directories if they don't exist (for exemple on first run)
function cleanLog(){
rm -fr $LOG_FILE
ARRAY_DIR=( $FRENCH_DIR $ORIGINAL_DIR $OUTPUT_ROM_DIR $OUT_DIR $WORK_DIR $ORIGIN_APK_DIR $TRANSLATION_DIR $DECODED_APK_DIR $TEMP_DIR )
echo "creating missing directoriesi if needed"
for DIR in ${ARRAY_DIR[@]}; do
if [ ! -d $DIR ]; then
mkdir $DIR
fi
done
}
# configure apktool to use framework-res and framework-miui-res
function setFramework(){
cd $FRENCH_DIR
echo "<- apktool if system/framework/framework-res.apk ->" >> $LOG_FILE
apktool if framework-res.apk >> $LOG_FILE 2>&1
echo "<- apktool if system/framework/framework-miui-res.apk ->" >> $LOG_FILE
apktool if framework-miui-res.apk >> $LOG_FILE 2>&1
}
#decompile all apk file from the english Gnex miui rom
function decompileOriginFiles(){
cd $ORIGINAL_DIR
COUNT_ORIGINAL_ZIP=`ls . | grep '.zip' | wc -l`
if [ "$COUNT_ORIGINAL_ZIP" -eq "1" ]; then
mv *.zip en.zip
echo "unzip the original rom"
unzip -q -o en.zip
echo "copy the apks to the origin dir"
cp -a system/framework/*.apk $ORIGIN_APK_DIR
cp -a system/app/*apk $ORIGIN_APK_DIR
cd $ORIGIN_APK_DIR
for F in *.apk; do
echo "decompiling origianl file $F ..." | tee -a $LOG_FILE
apktool d $F $DECODED_APK_DIR/${F%.apk} >> $LOG_FILE 2>&1
done
else
echo "there need to be ONE zip file in the original directory"
exit
fi
}
# decompile all apk files from the french Nexus S ROM
function decompileTranslatedFiles(){
cd $FRENCH_DIR
COUNT_FRENCH_ZIP=`ls . | grep '.zip' | wc -l`
if [ "$COUNT_FRENCH_ZIP" -eq "1" ]; then
mv *.zip fr.zip
echo "unzip the french rom"
unzip -q -o fr.zip
setFramework
echo "copy the apks to the working dir"
cp -a system/framework/*.apk $WORK_DIR
cp -a system/app/*.apk $WORK_DIR
cd $WORK_DIR
for F in *.apk; do
echo "decompiling french file $F ..." | tee -a $LOG_FILE
apktool d $F $TRANSLATION_DIR/${F%.apk} >> $LOG_FILE 2>&1
done
else
echo "there neeed to be ONE zip file in the french directory"
exit
fi
}
# Delete the given directory, because it is not needed
function deleteDirectoryWithoutTranslation(){
echo " ---> directory useless, removed"
cd $TRANSLATION_APK_DIR
rm -fr $1
}
# delete all useless data from the french apks
function cleanTranslatedFiles(){
cd $TRANSLATION_DIR
for d in *; do
echo "cleaning the directory $d"
cd $TRANSLATION_DIR/$d
if [ -d "res" ]; then
ls . | grep -v res | xargs -o rm -fr
cd "res"
CONTAINS_FRENCH_TRANSLATION=`ls .| grep '\-fr' | wc -l`
if [ "$CONTAINS_FRENCH_TRANSLATION" -eq "0" ]; then
deleteDirectoryWithoutTranslation $d
else
echo "---> transltation here, clean it"
ls . | grep -v '\-fr\|\./\|\.\./' | xargs -o rm -fr
fi
else
echo "no res directory"
deleteDirectoryWithoutTranslation $d
fi
if [ ! -f $ORIGIN_APK_DIR/$d.apk ];then
echo "directory not in original rom $d"
deleteDirectoryWithoutTranslation $d
fi
done
}
# merge the decoded translation in the decoded english files
function mergeTranslations(){
cd $DECODED_APK_DIR
mv $TRANSLATION_DIR/* .
cd $WORK_DIR
rm -f *.apk
}
# compile new apks including french files
function compileApk(){
cd $ORIGIN_APK_DIR
for f in *.apk; do
echo "compiling $f"
echo "apktool b $DECODED_APK_DIR/${f%.apk} $WORK_DIR/$f"
apktool b $DECODED_APK_DIR/${f%.apk} $WORK_DIR/$f >> $LOG_FILE 2>&1
done
}
# delete apk in work directory and put the original apks there
function deleteWorkFileAndCopyOriginalApk(){
cd $WORK_DIR
rm -f *.apk
cp -a $ORIGIN_APK_DIR/*.apk .
}
# put the compiled modified files in the original apk files
function finalMerge(){
cd $DECODED_APK_DIR
for F in *.apk; do
echo "doing final build $F"
cd $TEMP_DIR
rm -fr *
unzip -q $DECODED_DIR/$F
ls . | grep -v 'res\|classes.dex\|resources.arsc\|\./\|\.\./' | xargs -o rm -fr
if [ -d res ]; then
cd res
ls . | grep -v '\-fr\|\./\|\.\./' | xargs -o rm -fr
HAS_FR=`ls . | grep '\-fr' | wc -l`
if [ "$HAS_FR" -eq "0" ]; then
cd ..
rm -fr res
else
cd ..
fi
fi
zip -r $WORK_DIR/$F *
done
}
#replace the english apk files with the new french apk files, change the build.prop value and create an unsigned zip that can be flashed
function createRom(){
cd $OUTPUT_ROM_DIR
mv $ORIGINAL_DIR/system $ORIGINAL_DIR/boot.img $ORIGINAL_DIR/META-INF .
mv $WORK_DIR/*.apk system/app
mv system/app/framework*.apk system/framework
mv system/build.prop build.prop
sed 's/=en/=fr/g' build.prop > build1.prop
rm -f build.prop
sed 's/=US/=FR/g' build1.prop > system/build.prop
rm -f build1.prop
zip -r $BASE_DIR/new_rom.zip *
}
cleanLog
decompileTranslatedFiles
decompileOriginFiles
cleanTranslatedFiles
mergeTranslations
compileApk
deleteWorkFileAndCopyOriginalApk
finalMerge
createRom
Questions or Problems Should Not Be Posted in the Development Forum
Please Post in the Correct Forums & Read the Forum Rules
Moving to Q&A

[Q] how to make livesuit flashable image from Custom ROM.zip

hi,
I have iball Slide i6012 and its brick.
Since there is no firmware for this device,I downloaded Ice Fusion v0.2.zip which is a working custom rom for this device.
My tablet can only be flash from Livesuit because other method are not possible because it stuck in the first 'Iball' logo(adb, memory card not detected).
Is it possible to make livesuit Flashable image file from this zip file?
Can anyone give me instructions?
anyone willing to help?
anyone? ???
kcisrael said:
hi,
I have iball Slide i6012 and its brick.
Since there is no firmware for this device,I downloaded Ice Fusion v0.2.zip which is a working custom rom for this device.
My tablet can only be flash from Livesuit because other method are not possible because it stuck in the first 'Iball' logo(adb, memory card not detected).
Is it possible to make livesuit Flashable image file from this zip file?
Can anyone give me instructions?
Click to expand...
Click to collapse
Found this on:
https://www.miniand.com/wiki/Allwinner/Unpacking+and+building+LiveSuit+images
---------- Post added at 10:37 PM ---------- Previous post was at 10:29 PM ----------
kcisrael said:
hi,
I have iball Slide i6012 and its brick.
Since there is no firmware for this device,I downloaded Ice Fusion v0.2.zip which is a working custom rom for this device.
My tablet can only be flash from Livesuit because other method are not possible because it stuck in the first 'Iball' logo(adb, memory card not detected).
Is it possible to make livesuit Flashable image file from this zip file?
Can anyone give me instructions?
Click to expand...
Click to collapse
Converting a ZIP ROM to a system.img
This is basically for Rockchip ROMs.
OK so first lets understand the difference.
system.img is nothing more than a image file that is formatted EXT4 and mounted in Linux.
You make the image file using DD and then format it EXT4 (or EXT3 for older devices).
Then you mount it in Linux and copy all your stuff into it.
Now this is EASY when you mount an existing system.img and copy it into a new system.img Why? Because that original system.img has all the symbolic links and permissions already set!
However, if you get a update that is a ZIP file this is not the case. Or if you get a CWM backup and untar it, you can loose the symlinks and permissions.
So one day I got a ROM that was only supplied as a zip. It used what is called a edify script to install it which that script copies all the files into system then does all the file permissions and setup up the needed symlinks.
The commands in the script do not map in Linux! Thus I had to convert them. Let me tell you this was somewhat a pain and special thanks to 900Supersport and Petrus for helping me understand and convert.
So here is how you do it.
First create a directory to unzip or un-tar all the files into. I called mine system_orig
Then this is my script to build a system.img The harder part is getting the IMG file size correct. You have to watch out making it too big as the parameter file defines how big system can be. If yours is bigger than what the parameter file allows, you will need to adjust the parameter file. I believe most parameter files today allow up to 500megs.
#create the system dir
mkdir system2
# create the system image using DD. Set size here:
dd if=/dev/zero of=system.img count=471000000
#format the image you just created. This is EXT4 but you can use anything the kernel allows as defined in init.rc
sudo /sbin/mkfs.ext4 -q system.img
#Now mount it in Linux
sudo mount -o loop system.img system2
# Now copy everything from your unzipped folder into the new image.
sudo cp -r system_orig/* system2
#OK lets create all the symbolic links
#make symlinks
sudo ln -s Roboto-Bold.ttf system2/fonts/DroidSans-Bold.ttf
sudo ln -s Roboto-Regular.ttf system2/fonts/DroidSans.ttf
sudo ln -s mksh system2/bin/sh
sudo ln -s toolbox system2/bin/cat
sudo ln -s toolbox system2/bin/chmod
sudo ln -s toolbox system2/bin/chown
sudo ln -s toolbox system2/bin/cmp
sudo ln -s toolbox system2/bin/date
sudo ln -s toolbox system2/bin/dd
sudo ln -s toolbox system2/bin/df
sudo ln -s toolbox system2/bin/dmesg
sudo ln -s toolbox system2/bin/getevent
sudo ln -s toolbox system2/bin/getprop
sudo ln -s toolbox system2/bin/hd
sudo ln -s toolbox system2/bin/id
sudo ln -s toolbox system2/bin/ifconfig
sudo ln -s toolbox system2/bin/iftop
sudo ln -s toolbox system2/bin/insmod
sudo ln -s toolbox system2/bin/ioctl
sudo ln -s toolbox system2/bin/ionice
sudo ln -s toolbox system2/bin/kill
sudo ln -s toolbox system2/bin/ln
sudo ln -s toolbox system2/bin/log
sudo ln -s toolbox system2/bin/ls
sudo ln -s toolbox system2/bin/lsmod
sudo ln -s toolbox system2/bin/lsof
sudo ln -s toolbox system2/bin/md5
sudo ln -s toolbox system2/bin/mkdir
sudo ln -s toolbox system2/bin/mount
sudo ln -s toolbox system2/bin/mv
sudo ln -s toolbox system2/bin/nandread
sudo ln -s toolbox system2/bin/netstat
sudo ln -s toolbox system2/bin/newfs_msdos
sudo ln -s toolbox system2/bin/notify
sudo ln -s toolbox system2/bin/printenv
sudo ln -s toolbox system2/bin/ps
sudo ln -s toolbox system2/bin/r
sudo ln -s toolbox system2/bin/reboot
sudo ln -s toolbox system2/bin/renice
sudo ln -s toolbox system2/bin/rm
sudo ln -s toolbox system2/bin/rmdir
sudo ln -s toolbox system2/bin/rmmod
sudo ln -s toolbox system2/bin/route
sudo ln -s toolbox system2/bin/schedtop
sudo ln -s toolbox system2/bin/sendevent
sudo ln -s toolbox system2/bin/setconsole
sudo ln -s toolbox system2/bin/setprop
sudo ln -s toolbox system2/bin/sleep
sudo ln -s toolbox system2/bin/smd
sudo ln -s toolbox system2/bin/start
sudo ln -s toolbox system2/bin/stop
sudo ln -s toolbox system2/bin/sync
sudo ln -s toolbox system2/bin/top
sudo ln -s toolbox system2/bin/touch
sudo ln -s toolbox system2/bin/umount
sudo ln -s toolbox system2/bin/uptime
sudo ln -s toolbox system2/bin/vmstat
sudo ln -s toolbox system2/bin/watchprops
sudo ln -s toolbox system2/bin/wipe
#OK now lets set all the permissions
sudo chown -R 0:0 system2
sudo chmod -R 0755 system2
sudo find system2 -type d -exec chmod 0755 {} \;
sudo find system2 -type f -exec chmod 0644 {} \;
sudo chown -R 0:2000 system2/bin
sudo chmod 0755 system2/bin
sudo find system2/bin -type d -exec chmod 0755 {} \;
sudo find system2/bin -type f -exec chmod 0755 {} \;
sudo chown 0:3003 system2/bin/netcfg
sudo chmod 2750 system2/bin/netcfg
sudo chown 0:3004 system2/bin/ping
sudo chmod 2755 system2/bin/ping
sudo chown 0:2000 system2/bin/run-as
sudo chmod 6755 system2/bin/run-as
sudo chown -R 1002:1002 system2/etc/bluetooth
sudo chmod 0755 system2/etc/bluetooth
sudo find system2/etc/bluetooth -type d -exec chmod 0755 {} \;
sudo find system2/etc/bluetooth -type f -exec chmod 0440 {} \;
sudo chown 0:0 system2/etc/bluetooth
sudo chmod 0755 system2/etc/bluetooth
sudo chown 1000:1000 system2/etc/bluetooth/auto_pairing.conf
sudo chmod 0640 system2/etc/bluetooth/auto_pairing.conf
sudo chown 3002:3002 system2/etc/bluetooth/blacklist.conf
sudo chmod 0444 system2/etc/bluetooth/blacklist.conf
sudo chown 1002:1002 system2/etc/dbus.conf
sudo chmod 0440 system2/etc/dbus.conf
sudo chown 1014:2000 system2/etc/dhcpcd/dhcpcd-run-hooks
sudo chmod 0550 system2/etc/dhcpcd/dhcpcd-run-hooks
sudo chown 0:2000 system2/etc/init.goldfish.sh
sudo chmod 0550 system2/etc/init.goldfish.sh
sudo chown 0:0 system2/etc/install-recovery.sh
sudo chmod 0544 system2/etc/install-recovery.sh
sudo chown -R 0:0 system2/etc/ppp
sudo chmod -R 0755 system2/etc/ppp
sudo find system2/etc/ppp -type d -exec chmod 0755 {} \;
sudo find system2/etc/ppp -type f -exec chmod 0555 {} \;
sudo chown -R 0:2000 system2/vendor
sudo chmod -R 0755 system2/vendor
sudo find system2/vendor -type d -exec chmod 0755 {} \;
sudo find system2/vendor -type f -exec chmod 0644 {} \;
sudo chown -R 0:2000 system2/xbin
sudo chmod -R 0755 system2/xbin
sudo find system2/xbin -type d -exec chmod 0755 {} \;
sudo find system2/xbin -type f -exec chmod 0755 {} \;
sudo chown 0:0 system2/xbin/librank
sudo chmod 06755 system2/xbin/librank
sudo chown 0:0 system2/xbin/procmem
sudo chmod 06755 system2/xbin/procmem
sudo chown 0:0 system2/xbin/procrank
sudo chmod 06755 system2/xbin/procrank
sudo chown 0:0 system2/xbin/tcpdump
sudo chmod 06755 system2/xbin/tcpdump
# Note I added this to ROOT the new ROM. I simply copied in SU and Superuser and busybox.
# However if you want stock remove this area.
# Also note, some only put busybox and SU in /bin or /xbin. I usually do both.
sudo chown 0:0 system2/bin/su
sudo chmod 06755 system2/bin/su
sudo chown 0:0 system2/xbin/su
sudo chmod 06755 system2/xbin/su
sudo chown 0:0 system2/bin/busybox
sudo chmod 6755 system2/bin/busybox
sudo chown 0:0 system2/xbin/busybox
sudo chmod 6755 system2/xbin/busybox
sudo chown 0:0 system2/app/Superuser.apk
sudo chmod 6755 system2/app/Superuser.apk
# OK now lets unmount system.img
sudo umount system2
# for clean up I usually delete system2 folder.
sudo rm -f -R system2
That should do it!
FYI, you do not RKCRC system.img.
Hope this helps
Help
azithro said:
Found this on:
https://www.miniand.com/wiki/Allwinner/Unpacking+and+building+LiveSuit+images
---------- Post added at 10:37 PM ---------- Previous post was at 10:29 PM ----------
Converting a ZIP ROM to a system.img
This is basically for Rockchip ROMs.
OK so first lets understand the difference.
system.img is nothing more than a image file that is formatted EXT4 and mounted in Linux.
You make the image file using DD and then format it EXT4 (or EXT3 for older devices).
Then you mount it in Linux and copy all your stuff into it.
Now this is EASY when you mount an existing system.img and copy it into a new system.img Why? Because that original system.img has all the symbolic links and permissions already set!
However, if you get a update that is a ZIP file this is not the case. Or if you get a CWM backup and untar it, you can loose the symlinks and permissions.
So one day I got a ROM that was only supplied as a zip. It used what is called a edify script to install it which that script copies all the files into system then does all the file permissions and setup up the needed symlinks.
The commands in the script do not map in Linux! Thus I had to convert them. Let me tell you this was somewhat a pain and special thanks to 900Supersport and Petrus for helping me understand and convert.
So here is how you do it.
First create a directory to unzip or un-tar all the files into. I called mine system_orig
Then this is my script to build a system.img The harder part is getting the IMG file size correct. You have to watch out making it too big as the parameter file defines how big system can be. If yours is bigger than what the parameter file allows, you will need to adjust the parameter file. I believe most parameter files today allow up to 500megs.
#create the system dir
mkdir system2
# create the system image using DD. Set size here:
dd if=/dev/zero of=system.img count=471000000
#format the image you just created. This is EXT4 but you can use anything the kernel allows as defined in init.rc
sudo /sbin/mkfs.ext4 -q system.img
#Now mount it in Linux
sudo mount -o loop system.img system2
# Now copy everything from your unzipped folder into the new image.
sudo cp -r system_orig/* system2
#OK lets create all the symbolic links
#make symlinks
sudo ln -s Roboto-Bold.ttf system2/fonts/DroidSans-Bold.ttf
sudo ln -s Roboto-Regular.ttf system2/fonts/DroidSans.ttf
sudo ln -s mksh system2/bin/sh
sudo ln -s toolbox system2/bin/cat
sudo ln -s toolbox system2/bin/chmod
sudo ln -s toolbox system2/bin/chown
sudo ln -s toolbox system2/bin/cmp
sudo ln -s toolbox system2/bin/date
sudo ln -s toolbox system2/bin/dd
sudo ln -s toolbox system2/bin/df
sudo ln -s toolbox system2/bin/dmesg
sudo ln -s toolbox system2/bin/getevent
sudo ln -s toolbox system2/bin/getprop
sudo ln -s toolbox system2/bin/hd
sudo ln -s toolbox system2/bin/id
sudo ln -s toolbox system2/bin/ifconfig
sudo ln -s toolbox system2/bin/iftop
sudo ln -s toolbox system2/bin/insmod
sudo ln -s toolbox system2/bin/ioctl
sudo ln -s toolbox system2/bin/ionice
sudo ln -s toolbox system2/bin/kill
sudo ln -s toolbox system2/bin/ln
sudo ln -s toolbox system2/bin/log
sudo ln -s toolbox system2/bin/ls
sudo ln -s toolbox system2/bin/lsmod
sudo ln -s toolbox system2/bin/lsof
sudo ln -s toolbox system2/bin/md5
sudo ln -s toolbox system2/bin/mkdir
sudo ln -s toolbox system2/bin/mount
sudo ln -s toolbox system2/bin/mv
sudo ln -s toolbox system2/bin/nandread
sudo ln -s toolbox system2/bin/netstat
sudo ln -s toolbox system2/bin/newfs_msdos
sudo ln -s toolbox system2/bin/notify
sudo ln -s toolbox system2/bin/printenv
sudo ln -s toolbox system2/bin/ps
sudo ln -s toolbox system2/bin/r
sudo ln -s toolbox system2/bin/reboot
sudo ln -s toolbox system2/bin/renice
sudo ln -s toolbox system2/bin/rm
sudo ln -s toolbox system2/bin/rmdir
sudo ln -s toolbox system2/bin/rmmod
sudo ln -s toolbox system2/bin/route
sudo ln -s toolbox system2/bin/schedtop
sudo ln -s toolbox system2/bin/sendevent
sudo ln -s toolbox system2/bin/setconsole
sudo ln -s toolbox system2/bin/setprop
sudo ln -s toolbox system2/bin/sleep
sudo ln -s toolbox system2/bin/smd
sudo ln -s toolbox system2/bin/start
sudo ln -s toolbox system2/bin/stop
sudo ln -s toolbox system2/bin/sync
sudo ln -s toolbox system2/bin/top
sudo ln -s toolbox system2/bin/touch
sudo ln -s toolbox system2/bin/umount
sudo ln -s toolbox system2/bin/uptime
sudo ln -s toolbox system2/bin/vmstat
sudo ln -s toolbox system2/bin/watchprops
sudo ln -s toolbox system2/bin/wipe
#OK now lets set all the permissions
sudo chown -R 0:0 system2
sudo chmod -R 0755 system2
sudo find system2 -type d -exec chmod 0755 {} \;
sudo find system2 -type f -exec chmod 0644 {} \;
sudo chown -R 0:2000 system2/bin
sudo chmod 0755 system2/bin
sudo find system2/bin -type d -exec chmod 0755 {} \;
sudo find system2/bin -type f -exec chmod 0755 {} \;
sudo chown 0:3003 system2/bin/netcfg
sudo chmod 2750 system2/bin/netcfg
sudo chown 0:3004 system2/bin/ping
sudo chmod 2755 system2/bin/ping
sudo chown 0:2000 system2/bin/run-as
sudo chmod 6755 system2/bin/run-as
sudo chown -R 1002:1002 system2/etc/bluetooth
sudo chmod 0755 system2/etc/bluetooth
sudo find system2/etc/bluetooth -type d -exec chmod 0755 {} \;
sudo find system2/etc/bluetooth -type f -exec chmod 0440 {} \;
sudo chown 0:0 system2/etc/bluetooth
sudo chmod 0755 system2/etc/bluetooth
sudo chown 1000:1000 system2/etc/bluetooth/auto_pairing.conf
sudo chmod 0640 system2/etc/bluetooth/auto_pairing.conf
sudo chown 3002:3002 system2/etc/bluetooth/blacklist.conf
sudo chmod 0444 system2/etc/bluetooth/blacklist.conf
sudo chown 1002:1002 system2/etc/dbus.conf
sudo chmod 0440 system2/etc/dbus.conf
sudo chown 1014:2000 system2/etc/dhcpcd/dhcpcd-run-hooks
sudo chmod 0550 system2/etc/dhcpcd/dhcpcd-run-hooks
sudo chown 0:2000 system2/etc/init.goldfish.sh
sudo chmod 0550 system2/etc/init.goldfish.sh
sudo chown 0:0 system2/etc/install-recovery.sh
sudo chmod 0544 system2/etc/install-recovery.sh
sudo chown -R 0:0 system2/etc/ppp
sudo chmod -R 0755 system2/etc/ppp
sudo find system2/etc/ppp -type d -exec chmod 0755 {} \;
sudo find system2/etc/ppp -type f -exec chmod 0555 {} \;
sudo chown -R 0:2000 system2/vendor
sudo chmod -R 0755 system2/vendor
sudo find system2/vendor -type d -exec chmod 0755 {} \;
sudo find system2/vendor -type f -exec chmod 0644 {} \;
sudo chown -R 0:2000 system2/xbin
sudo chmod -R 0755 system2/xbin
sudo find system2/xbin -type d -exec chmod 0755 {} \;
sudo find system2/xbin -type f -exec chmod 0755 {} \;
sudo chown 0:0 system2/xbin/librank
sudo chmod 06755 system2/xbin/librank
sudo chown 0:0 system2/xbin/procmem
sudo chmod 06755 system2/xbin/procmem
sudo chown 0:0 system2/xbin/procrank
sudo chmod 06755 system2/xbin/procrank
sudo chown 0:0 system2/xbin/tcpdump
sudo chmod 06755 system2/xbin/tcpdump
# Note I added this to ROOT the new ROM. I simply copied in SU and Superuser and busybox.
# However if you want stock remove this area.
# Also note, some only put busybox and SU in /bin or /xbin. I usually do both.
sudo chown 0:0 system2/bin/su
sudo chmod 06755 system2/bin/su
sudo chown 0:0 system2/xbin/su
sudo chmod 06755 system2/xbin/su
sudo chown 0:0 system2/bin/busybox
sudo chmod 6755 system2/bin/busybox
sudo chown 0:0 system2/xbin/busybox
sudo chmod 6755 system2/xbin/busybox
sudo chown 0:0 system2/app/Superuser.apk
sudo chmod 6755 system2/app/Superuser.apk
# OK now lets unmount system.img
sudo umount system2
# for clean up I usually delete system2 folder.
sudo rm -f -R system2
That should do it!
FYI, you do not RKCRC system.img.
Hope this helps
Click to expand...
Click to collapse
Can you help me with this ?
http://forum.xda-developers.com/showthread.php?p=46541879#post46541879

[Q] How to use string array in init.d script?

I want to make app symlinks to sd-ext on booting.
I made a short init.d script, And It correctly worked on JB based rom.
But after I downgraded to GB, It doesn't work anymore.
I founded that pure bone shell doesn't support arrays.
The script uses string array to declare apk list I want to symlink.
So is there a way to use string array or make similar effect?
Here is my script.
Code:
#!/system/bin/sh
if [ -z "$SD_EXT_DIRECTORY" ]; then SD_EXT_DIRECTORY=/sd-ext; fi
SYSBLOCK=`mount | grep system | cut -f 1 -d ' '`
sysapp2sd=("BackupRestoreConfirmation.apk" "BasicDreams.apk" "Bluetooth.apk" "CertInstaller.apk" "Calculator.apk" "CMFileManager.apk" "CMScreenshot.apk" "DSPManager.apk" "DrmProvider.apk" "Email.apk" "Email2.apk" "Exchange.apk" "Exchange2.apk" "Gmail.apk" "GoogleBackupTransport.apk" "InputDevices.apk" "Music.apk" "OneTimeInitializer.apk" "PhotoTable.apk" "PicoTts.apk" "SamsungTTS.apk" "SharedStorageBackup.apk" "SoundRecorder.apk" "Talk.apk" "ThemeChooser.apk" "ThemeManager.apk" "Torch.apk" "VpnDialogs.apk" "WAPPushManager.apk")
app2sd_exception=("com.UCMobile" "com.adobe.flashplayer" "com.android.lmt" "com.fiberthemax.OpQ2keyboard" "com.fiberthemax.OpQ2keyboard.dict.ko" "com.google.android.gms" "com.google.android.googlequicksearchbox" "com.jungsup.thecall" "com.mobint.hololauncher" "com.mobint.hololauncherplus" "com.mobitobi.android.gentlealarm" "com.myhome.mytheme" "com.rs.autorun" "com.teslacoilsw.launcher" "com.vladlee.callconfirm.free" "eu.chainfire.supersu" "kz.mek.DialerOne" "me.dennis.weather.naver" "net.dinglisch.android.taskerm" "net.everythingandroid.smspopup" )
# make sure $SD_EXT_DIRECTORY is actually mounted
if ! awk -vDIR="$SD_EXT_DIRECTORY" '$2 == DIR { exit 1; }' /proc/mounts ; then
mount -rw -o remount SYSBLOCK /system
mkdir -p /sd-ext/symlink/system/app
# /system/app/ -> /sd-ext/symlink/system/app/
FILES=`find /system/app -maxdepth 1 -type f`
for file in $FILES; do
filename=`basename $file`
for pattern in ${sysapp2sd[@]}; do
if [[ $filename == $pattern ]]; then
cp /system/app/$filename /sd-ext/symlink/system/app/
rm -f /system/app/$filename
ln -s /sd-ext/symlink/system/app/$filename /system/app/$filename
fi
done
done
# /data/app/ -> /sd-ext/symlink/data/app/
FILES=`find /data/app -maxdepth 1 -type f`
for file in $FILES; do
filename=`basename $file`
match=false
for pattern in ${app2sd_exception[@]}; do
if [[ $filename == $pattern* ]]; then
match=true
fi
done
if ! $match; then
cp /data/app/$filename /sd-ext/symlink/data/app/
rm -f /data/app/$filename
ln -s /sd-ext/symlink/data/app/$filename /data/app/$filename
fi
done
mount -r -o remount SYSBLOCK /system
fi
You can use echo or cat command to wrap list and grab it with awk.
and add another for loop over for loop for getting the counted numbers to be used on awk...

SuperR's Kitchen CLI (command line)(Donate Version)

The command line options for Linux/WSL/WSL2/Mac are a result of all the requests for a way to build img files outside of the kitchen. Now there is a way to do exactly this and more.
This post will be updated as features/commands are added or changed. The example commands below will work with the latest version of the kitchen.
If you have problems, make sure you are fully updated.
If something works in the kitchen but does not work in the CLI, please post about it in this thread.
If something does not work in the kitchen and does not work in the CLI, please post in the main kitchen thread.
Command Line Examples:
Unpack img file
Code:
$ /path/to/kitchen/superr -f unpack_img system.img -p superr_project-name
Pack img file
Code:
$ /path/to/kitchen/superr -f pack_img system.img raw -p superr_project-name
$ /path/to/kitchen/superr -f pack_img system.img sparse -p superr_project-name
$ /path/to/kitchen/superr -f pack_img system.img dat -p superr_project-name
$ /path/to/kitchen/superr -f pack_img system.img lz4 -p superr_project-name
Unpack super.img
Code:
$ /path/to/kitchen/superr -f unpack_super super.img -p superr_project-name
Pack super.img
Code:
$ /path/to/kitchen/superr -f pack_super system_new.img vendor_new.img product_new.img raw -p superr_project-name
$ /path/to/kitchen/superr -f pack_super system_new.img vendor_new.img product_new.img sparse -p superr_project-name
$ /path/to/kitchen/superr -f pack_super system_new.img vendor_new.img product_new.img dat -p superr_project-name
$ /path/to/kitchen/superr -f pack_super system_new.img vendor_new.img product_new.img lz4 -p superr_project-name
Deodex
Code:
$ /path/to/kitchen/superr -f deodex -p superr_project-name
Remove dm-verity
Code:
$ /path/to/kitchen/superr -f dmverity -p superr_project-name
Remove forceencrypt
Code:
$ /path/to/kitchen/superr -f forcee -p superr_project-name
Reserved
amazing, thank you!
Want to thank you for this. Awesome !!!
Thank you
PLZ HELP
I am trying to unpack stock rom for moto g play 2021 (C:\Users\Code3p0\Downloads\XT2093-3_GUAMNA_BOOST_11_RZA31.Q2-146-14-6_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml.zip)
super.img_sparsechunk.0
cannot upload rom to Kitchen
cannot unpack due to errno 2 (file not found no such file system.img)
hi, good move.
adding plugins options via cli will be appeciated

Categories

Resources