Thursday, November 28, 2013

Android command line tips

Allow Unknown Sources (w/ non root user)
settings put global install_non_market_apps 1
or
settings put secure install_non_market_apps 1

Change screen resolution:
#am display-size 800x480

Connect WiFi network
#wpa_cli
> scan
> scan_results
> list_networks
> add_network
0
> set_network 0 ssid "MY_SSID"
> set_network 0 psk "MY_PSK"
> enable_network 0
> save_config
> ^D

Button press from command line!
POWER
# input keyevent 26
BACK
# input keyevent 4
VOL +
# input keyevent 24
VOL -
# input keyevent 25
MENU
# input keyevent 82
SEARCH
# input keyevent 84

Remount /system rw
# mount -o remount,rw -t ext4 /system 

get Android version via adb (https://stackoverflow.com/a/29968138)

adb shell getprop ro.build.version.release 


to get API level:
adb shell getprop ro.build.version.sdk 
You can see all available properties with this command:
adb shell getprop

Write and erase rockchip rk2928 nand partitions

=====ERASE=====
#erase kernel
sudo rkflashtool e 0x00004000 0x00006000
#erase boot
sudo rkflashtool e 0x0000a000 0x00008000
#erase recovery
sudo rkflashtool e 0x00012000 0x00010000
#erase cache
sudo rkflashtool e 0x00042000 0x00040000
#erase userdata
sudo rkflashtool e 0x00082000 0x00200000
#erase system
sudo rkflashtool e 0x00100000 0x00284000
#erase misc
sudo rkflashtool e 0x00002000 0x00002000


=====WRITE=====
#write kernel
sudo rkflashtool w 00004000 0x00006000 < kernel.img
#write boot
sudo rkflashtool w 0x0000a000 0x00008000 < boot.img
#write recovery
sudo rkflashtool w 0x00012000 0x00010000 < recovery.img
#write system
sudo rkflashtool w 0x00100000 0x00284000 < system.img
#write misc
sudo rkflashtool w 0x00002000 0x00002000 < misc.img

Rockchip unpack/repack boot.img

UNPACKING
rkunpack boot.img
mkdir boot-extracted
cd boot-extracted
cat ../boot.img-raw | gunzip | cpio -i

REPACK
find . | cpio -o -H newc | gzip > ../newboot.img
rkcrc -k newboot.img newboot-signed.img



#ALTERNATE METHOD

#UNPACK
dd if=boot.img of=boot.img.gz skip=8 bs=1 count=100000000000
gunzip boot.img.gz
mkdir unpacked
cd unpacked
cpio -i <../boot.img

#PACK
cd unpacked
find . | xargs -I file touch -d "1970-01-01 01:00" file
find . | cpio -o -H newc | gzip -n >../newboot.img.gz
rkcrc -k newboot.img.gz newboot.img

https://sites.google.com/site/embedheadfiles/multiboot-rk2928-extsd-SIGNED-v0.8.img

Thursday, November 21, 2013

CWM for RK2928

download recovery.img [1]
adb kill-server
adb devices
adb push flash_image /dev/
adb push recovery.img /dev/
adb shell
chmod 755 /dev/flash_image
/dev/flash_image recovery /dev/recovery.img

or

sudo rkflashtool w 0x00012000 0x00010000 < ~/shared/T711/rom/rk2928-CWM/recovery.img

ignore message:  rkflashtool: fatal: premature end-of-file reached.

[1] http://files.androtab.info/rockchip/rk2928/20130425/RK2928GENERIC_CWM.zip

RK2928sdk kernel compile notes [INCOMPLETE/IN PROGRESS]

### YET ANOTHER TRIAL ###

Kernel source: https://s3.amazonaws.com/tabletfirmwares/GPL/bqCurie_GPL.tar.gz
Base kernel config: http://source.android.com/devices/tech/kernel.html

got error:
make[1]: *** No rule to make target `arch/arm/plat-rk/vpu_service.o', needed by `arch/arm/plat-rk/built-in.o'.  Stop.
fixed by:

cd bqCurie/kernel/arch/arm/mach-rk2928/include/mach
wget https://raw.github.com/DJNoXD/rockchip-kernel-rk2918/master/arch/arm/mach-rk29/include/mach/vpu.h
wget https://raw.github.com/DJNoXD/rockchip-kernel-rk2918/master/arch/arm/mach-rk29/include/mach/vpu_mem.h
wget https://raw.github.com/DJNoXD/rockchip-kernel-rk2918/master/arch/arm/mach-rk29/include/mach/vpu_service.h
cd bqCurie/kernel/arch/arm/mach-rk2928
wget https://raw.github.com/DJNoXD/rockchip-kernel-rk2918/master/arch/arm/mach-rk29/vpu_mem.uu
wget https://raw.github.com/DJNoXD/rockchip-kernel-rk2918/master/arch/arm/mach-rk29/vpu_service.uu
mv bqCurie/kernel/arch/arm/plat-rk/include/plat/vpu_service.h  bqCurie/kernel/arch/arm/plat-rk/include/plat/vpu_service.h-DELETED

remove line obj-$(CONFIG_RK29_VPU) += vpu_service.o from bqCurie/kernel/arch/arm/plat-rk/Makefile
got error:

arch/arm/mach-rk2928/devices.c:806:2: error: implicit declaration of function 'rk2928_init_i2c' [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors

fixed by:
                   removing line from MAKEFILE
-Werror-implicit-function-declaration \


### NEW TRIAL ###
sudo apt-get install git-core gnupg flex bison gperf libsdl-dev libesd0-dev libwxgtk2.8-dev build-essential zip curl libncurses5-dev zlib1g-dev ia32-libs-multiarch lib32z1-dev  gcc-multilib g++-multilib sharutils lzop sharutils

git clone https://github.com/Galland/rk30_linux_initramfs.git initramfs
cd initramfs/
gzip -dc debian-3.0.8+fkubi.cpio.gz > initramfs.cpio
git clone https://github.com/crewrktablets/rk3x_kernel_3.0.36.git

# CONFIG_VIDEO_RK29 is not set
# CONFIG_RK29_VPU is not set
# CONFIG_RK29_IPP is not set

patch [1] include/drm/drm.h

-#if defined(__linux__)
+#if defined(__KERNEL__) || defined(__linux__)
Ref: http://comments.gmane.org/gmane.linux.linaro.devel/4634
cp arch/arm/mach-rk30/include/mach/mtk_wcn_cmb_stub.h arch/arm/mach-rk2928/include/mach/

cp -a ~/rk/rk3x_kernel_3.0.36/drivers/mtk_wcn_combo/common/core/ drivers/mtk_wcn_combo/common/

### OLD NOTES ###



git clone https://github.com/DooMLoRD/android_prebuilt_toolchains.git toolchains
git clone https://github.com/olegk0/tools.git
git clone https://github.com/Galland/rk30_linux_initramfs.git initramfs
cd initramfs/
gzip -dc debian-3.0.8+fkubi.cpio.gz > initramfs.cpio
git clone https://github.com/Galland/rk3x_kernel_3.0.36.git

unbrick T711-NEO rk2928sdk with stock rom image


disconnect USB from computer
hold down POWER button ~20sec to be sure device is powered off
hold down VOL+
[hold down POWER]
Connect USB to computer
[release POWER]
release VOL+

Burn update.img [1] using RKDevelopTool_v1.35 [2]

[1] http://yadi.sk/d/-xu0CuiM5Yhgg
[2] https://github.com/jerry2012/rk2906_tools/tree/master/RKDevelopTool_v1.35