wlan.ko trouble in self built kernel - G1 Android Development

Hi,
I'm struggling with a strange problem with wlan.ko module while building my own kernel. I've googled and read all possible tutorials
and set up different build systems and built different kernel versions (2.6.27 and 2.6.29) using msm_defconfig
and the config grabbed from my working kernel. Everything builds fine and I'm able
to boot my HTC Dream with fastboot. The only problem I'm facing is with the wlan.ko module that freezes as soon as i try to insmod it.
insmod hangs and never returns and lsmod shows:
wlan 587292 1 - Loading 0xbf000000
but there is nothing suspicious in dmesg
<6>[ 127.020904] mmc0: new SDIO card at address 0001
<6>[ 127.028503] TIWLAN: Found SDIO controller (vendor 0x104c, device 0x9066)
<6>[ 127.030456] tiwlan0 (): not using net_device_ops yet
<6>[ 127.034942] TIWLAN: Driver initialized (rc 0)
nor in logcat output. At this point it is impossible to rmmod the module.
rmmod: delete_module 'wlan' failed (errno 16)
I've double checked that magicversion of kernel and wlan module match.
I've recompiled everything with different toolchains, compilers and clean sources but i'm getting always the same problem.
Now i'm running out of ideas and as other people seem to be able to build their kernels I suspect I'm overlooking something
obvious or doing something very stupid. Any hint or advice is welcome.
Thanks in advance,
farmatito.

Did you rebuild the module and set KERNEL_DIR properly? It's in system/wlan/ti/sta_dk_4_0_4_32.

Yes, think so. Latest attempts I did with checked out snapshots of android-msm-2.6.27 and 2.6.29, using this script and everything built fine:
#!/bin/sh
d=../arm-eabi-4.2.1/bin
make ARCH=arm CROSS_COMPILE=$d/arm-eabi- msm_defconfig
#make ARCH=arm CROSS_COMPILE=$d/arm-eabi- oldconfig
#make ARCH=arm CROSS_COMPILE=$d/arm-eabi- oldconfig
make ARCH=arm CROSS_COMPILE=$d/arm-eabi- EXTRAVERSION=
make ARCH=arm CROSS_COMPILE=$d/arm-eabi- EXTRAVERSION= modules
mkdir -p modules.tmp
make ARCH=arm CROSS_COMPILE=$d/arm-eabi- EXTRAVERSION= INSTALL_MOD_PATH=modules.tmp modules_install
cd ../sta_dk_4_0_4_32
make ARCH=arm CROSS_COMPILE=$d/arm-eabi- DEBUG=n EXTRAVERSION= KERNEL_DIR=../msm clean
make ARCH=arm CROSS_COMPILE=$d/arm-eabi- DEBUG=n EXTRAVERSION= KERNEL_DIR=../msm
The dir tree im using is:
ls -la htc-g1-kernel/
drwxr-xr-x 9 tito tito 4096 2009-05-30 21:33 .
drwx------ 23 tito tito 4096 2009-05-30 21:30 ..
drwxr-xr-x 9 tito tito 4096 2009-04-26 21:29 arm-eabi-4.2.1
drwxr-xr-x 24 tito tito 4096 2009-05-30 22:30 msm
drwxr-xr-x 8 tito tito 4096 2009-05-30 21:37 sta_dk_4_0_4_32
Previously I used a git tree set up as described on the android web site and managed with the repo tool, but same results.

Related

compcache - working on emulator

I've seen a few people trying compcache and failing horribly, but it seems to work for me.
Build instructions, still raw, not tested on actual device only on emulator (left my phone at work...). I've only tested for a few minutes, but I've seen none of the "horrible crashing the second I swapon" I've seen reported elsewhere.
NOTE THAT /data IS A DUMB PLACE TO PUT KERNEL MODULES, but it's on the emulator for me so I couldn't care less, and that location was rw to begin with
Code:
cd ~/compcache
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- KERNEL_BUILD_PATH=/home/neuron/android-kernel/new/goldfish
emulator -avd CupcakeVM01 -kernel arch/arm/boot/zImage show-kernel -shell
#In compcache directory:
adb push sub-projects/allocators/xvmalloc-kmod/xvmalloc.ko /data
adb push ramzswap.ko /data
#In kernel directory:
adb push lib/lzo/lzo_compress.ko /data
adb push lib/lzo/lzo_decompress.ko /data
#Download and push busybox:
http://benno.id.au/blog/2007/11/14/android-busybox
adb push busybox /data
adb shell
insmod xvmalloc.ko
insmod lzo_decompress.ko
insmod lzo_compress.ko
insmod ramzswap.ko
chmod 744 /data/busybox
cat /proc/devices
- mknod with same block device id
/data/busybox mknod /dev/ramzswap0 b 254 0
#missing priority, wont be needed unless you have swapper too
/data/busybox swapon /dev/ramzswap0
# cat /proc/swaps
Filename Type Size Used Priority
/dev/ramzswap0 partition 23540 204 -1
# cat /proc/ramzswap
DiskSize: 23544 kB
NumReads: 12
NumWrites: 42
FailedReads: 0
FailedWrites: 0
InvalidIO: 0
PagesDiscard: 0
ZeroPages: 3
GoodCompress: 97 %
NoCompress: 2 %
PagesStored: 39
PagesUsed: 8
OrigDataSize: 156 kB
ComprDataSize: 28 kB
MemUsedTotal: 32 kB
I just built this (with some tips from cyanogen) for the compcache author, so he could have a way of reproducing the problem locally to solve it, but I cant seem to find any problem .
I've tested opening a ton of apps, switching between em, and suspending the phone.
Tested on :
cupcake 1.5 emulator
kernel goldfish 2.6.27
latest compcache (not svn)
armv5 compiler
Very basic quick copy&paste info on kernel choice:
Code:
mkdir ~/android-kernel
cd ~/android-kernel
wget http://www.codesourcery.com/sgpp/lite/arm/portal/package3696/public/arm-none-linux-gnueabi/arm-2008q3-72-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 -O arm-2008q3-72-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
tar xjf arm-2008q3-72-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
export PATH=~/android-kernel/arm-2008q3/bin:$PATH
> >> git clone git://android.git.kernel.org/kernel/common kernel-common
> >> cd kernel-common
> >> git branch goldfish origin/android-goldfish-2.6.27
> >> git checkout goldfish
make goldfish_defconfig ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- menuconfig
- enable loadable modules + lzo
make zImage ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
make modules ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
Well thats a big WTF. I can 100% confirm that it does not work on a regular G1, on neither the 2.6.27 nor the 2.6.29 kernel. Guess the compcache author needs to get himself a G1
Could be an issue with one of the kernel modules that isn't on the emulator I suppose.
On a bright note I can throw in that GoodCompress stays fairly high when swapping between normal android apps, so when we do get it working it's gonna be good
//edit, cyanogen can you send me your kernel .config and any custom patches? And what kernel tree/compiler are you on?
It could be compiler related.
nurre said:
Could be an issue with one of the kernel modules that isn't on the emulator I suppose.
On a bright note I can throw in that GoodCompress stays fairly high when swapping between normal android apps, so when we do get it working it's gonna be good
//edit, cyanogen can you send me your kernel .config and any custom patches? And what kernel tree/compiler are you on?
It could be compiler related.
Click to expand...
Click to collapse
I use the CodeSourcery toolchain to compile kernels. Right now I'm using the android-msm-2.6.29 branch from Android GIT (with all the new camera stuff reverted because it's broken). The only patches I have applied are the Synaptics multitouch patch and the mtd6 enabler patch. I'm attaching the config from my running device.
Thanks, if I dont toy with this tonight I will do tomorrow
On a side note, doing free -m on a 94mb memory device and seeing 120mb used and free memory available is nice
this would be a revolutionary hack for our devices if we can get this to work, I may go ahead and try compiling it when im free today
I would love to see this working. An additional 20megs or so of free RAM would make a huge difference.
defconoi said:
this would be a revolutionary hack for our devices if we can get this to work, I may go ahead and try compiling it when im free today
Click to expand...
Click to collapse
The question is when not if
//edit, hell if we cant get it to work for long enough I'll start a donate poll for "buy the compcache developer a rooted G1"
http://code.google.com/p/compcache/issues/detail?id=33
reported upstream, now waiting for more info (until I get impatient and start trying myself )
Someone using cyan 3.5 try this if your feeling adventurous. This is sortof a todo list for myself of **** to try. First commands did work for me however, no reboots.
insmod xvmalloc.ko
insmod ramzswap.ko disksize_kb=100
/data/busybox free
cat /proc/swaps
cat /proc/ramzswap
All reports ok, catting ramzswap actually shows GoodCompress 84%, so it is in use.
Things worth testing:
- higher disksize_kb
- if higher disksize_kb fails, try freeing memory before inserting the module and enabling swap (can use a combination of ps and kill to find the memory hoggers).
- echo 100 > /proc/sys/vm/swappiness
//edit, to be specific I'm running cyan 3.5.1 without squashfs.
ok so I couldn't leave this alone, it works with higher swap size as well, but I got a crash after torturing it for a while. Gonna look into it more tomorrow.
Code:
<4>[ 316.945526] send sigkill to 568 (app_process), adj 14, size 4436
<4>[ 324.601165] select 612 (app_process), adj 15, size 4411, to kill
<4>[ 324.601196] send sigkill to 612 (app_process), adj 15, size 4411
<6>[ 346.488891] binder: release 134:323 transaction 6478 in, still active
<6>[ 346.489135] binder: send failed reply for transaction 6478 to 194:505
<6>[ 346.744750] binder: 194 invalid dec strong, ref 1079 desc 17 s 0 w 1
<6>[ 346.754028] binder: 423 invalid dec strong, ref 8585 desc 17 s 0 w 1
<6>[ 346.760559] binder: 585 invalid dec strong, ref 9347 desc 17 s 0 w 1
<6>[ 348.089965] request_suspend_state: wakeup (0->0) at 341189074786 (2009-06-28 19:54:03.283935557 UTC)
<3>[ 348.092315] init: untracked pid 371 exited
<3>[ 348.093719] init: untracked pid 383 exited
<3>[ 348.094207] init: untracked pid 390 exited
<3>[ 348.094635] init: untracked pid 414 exited
<3>[ 348.133636] init: untracked pid 190 exited
<3>[ 348.133911] init: untracked pid 273 exited
<3>[ 348.134277] init: untracked pid 621 exited
<3>[ 348.140106] init: untracked pid 266 exited
<3>[ 348.140563] init: untracked pid 352 exited
<3>[ 348.160003] init: untracked pid 194 exited
<3>[ 348.160461] init: untracked pid 423 exited
<3>[ 348.160705] init: untracked pid 585 exited
<6>[ 381.844940] request_suspend_state: wakeup (0->0) at 374944049146 (2009-06-28 19:54:37.038909917 UTC)
<6>[ 384.697967] binder: release 112:127 transaction 10775 in, still active
<6>[ 384.698333] binder: send failed reply for transaction 10775 to 645:653
<6>[ 385.784729] htc-acoustic: open
<6>[ 385.845764] htc-acoustic: mmap
<6>[ 385.846740] htc-acoustic: ioctl
<6>[ 385.846954] htc-acoustic: ioctl: ACOUSTIC_ARM11_DONE called 678.
<6>[ 385.849548] htc-acoustic: ioctl: ONCRPC_ACOUSTIC_INIT_PROC success.
<6>[ 385.849792] htc-acoustic: release
<6>[ 385.890563] snd_set_device 1 1 1
<6>[ 385.901885] snd_set_volume 0 0 5
<6>[ 385.903289] snd_set_volume 1 0 5
<6>[ 385.912017] snd_set_volume 3 0 5
<6>[ 385.913360] snd_set_volume 2 0 5
<6>[ 386.833923] snd_set_volume 256 0 5
Doesn't seem to work for me. Running cyan 3.5.1 nosquash
Do you need to include these modules?
lzo_decompress.ko
lzo_compress.ko
Code:
# lsmod
lsmod
ramzswap 9648 0 - Live 0xbf007000
xvmalloc 5192 1 ramzswap, Live 0xbf000000
# busybox free
busybox free
total used free shared buffers
Mem: 97848 96272 1576 0 260
Swap: 0 0 0
Total: 97848 96272 1576
# cat /proc/swaps
cat /proc/swaps
Filename Type Size Used Priority
# cat /proc/ramzswap
cat /proc/ramzswap
DiskSize: 100 kB
NumReads: 0
NumWrites: 0
FailedReads: 0
FailedWrites: 0
InvalidIO: 0
PagesDiscard: 0
ZeroPages: 0
GoodCompress: 0 %
NoCompress: 0 %
PagesStored: 0
PagesUsed: 0
OrigDataSize: 0 kB
ComprDataSize: 0 kB
MemUsedTotal: 0 kB
#
nurre said:
Someone using cyan 3.5 try this if your feeling adventurous. This is sortof a todo list for myself of **** to try. First commands did work for me however, no reboots.
insmod xvmalloc.ko
insmod ramzswap.ko disksize_kb=100
/data/busybox free
cat /proc/swaps
cat /proc/ramzswap
All reports ok, catting ramzswap actually shows GoodCompress 84%, so it is in use.
Things worth testing:
- higher disksize_kb
- if higher disksize_kb fails, try freeing memory before inserting the module and enabling swap (can use a combination of ps and kill to find the memory hoggers).
- echo 100 > /proc/sys/vm/swappiness
//edit, to be specific I'm running cyan 3.5.1 without squashfs.
Click to expand...
Click to collapse
slightly carried away there and forgot you actually need the swapon instructions as well:
Code:
cat /proc/devices
- mknod with same block device id
busybox mknod /dev/ramzswap0 b 253 0
sync; sync
busybox swapon /dev/ramzswap0
adb logcat info of the device failing would save me some time debugging this
Got it working. I tried with a 16meg ramzswap and it worked for a while then I get crashing apps left and right and finally the phone reboots.
I'm not sure if its related to compcache or not because I experienced the same issue using a regular swapfile on the ext2/3 partition. It took a while for it to crash though. With compcache I can get it to crash in about 10min.
If I used a swap partition, I didn't see any crashes.
Dave
nurre said:
slightly carried away there and forgot you actually need the swapon instructions as well:
Code:
cat /proc/devices
- mknod with same block device id
busybox mknod /dev/ramzswap0 b 253 0
sync; sync
busybox swapon /dev/ramzswap0
adb logcat info of the device failing would save me some time debugging this
Click to expand...
Click to collapse
nurre said:
slightly carried away there and forgot you actually need the swapon instructions as well:
Code:
cat /proc/devices
- mknod with same block device id
busybox mknod /dev/ramzswap0 b 253 0
sync; sync
busybox swapon /dev/ramzswap0
adb logcat info of the device failing would save me some time debugging this
Click to expand...
Click to collapse
Attached you'll find a logcat of 3.5.2 cm build with compcache and apps crashing, hope this helps.
The author has a posted a new version, and it works on android!
I've been testing it and it works. Go try it out.
http://code.google.com/p/compcache/issues/detail?id=33
http://compcache.googlecode.com/issues/attachment?aid=-8516568331917785992&name=arm_test1.tbz2
these modules are compiled for cyanogen's .29 kernel.
copy xvmalloc.ko and ramzswap.ko to /system/sd
Add these lines to your userinit.sh
make sure to disable the sdcard swap..
insmod /system/sd/xvmalloc.ko;
insmod /system/sd/ramzswap.ko;
busybox mknod /dev/ramzswap0 b 253 0;
echo 60 > /proc/sys/vm/swappiness;
swapon /dev/ramzswap0;
What exactly is compcache?
Testing. So far so good! Using cyan 3.6.4.1...
persiansown said:
What exactly is compcache?
Click to expand...
Click to collapse
It uses part of your RAM as a swapfile by using compression, which effectively increases the size of you RAM.
The thinking is that compressing/decompressing from RAM is still faster than swapping to a flash device.
I'm eager to try this out on jachero, but the kernel is slightly different than cyanogen's so these modules don't work. daproy or somebody else has to recompile these modules for that kernel.
But its working pretty well on cy's image. The browser will stay in memory if I load up other apps, and I can't really see a big degradation in performance.

[Q] Problems booting kernel

Hi, hopefully this is the correct place to post this.
I´m developing a device on a beagleboard and have some problems starting the kernel.
I´m using yaffs2 as root filesystem and the version of the kernel is 2.6.29.
We have the latest yaffs2 code compiled into the kernel, not from googles kernel but from yaffs git sources.
We come so far as it has finished uncompressing the kernel and tried booting it but after that it freezes without no output what so ever.
The uBoot enviroment is as following:
OMAP3_Kajsa # printenv
bootdelay=10
baudrate=115200
loadaddr=0x82000000
usbtty=cdc_acm
console=ttyS0,115200n8
loadbootscript=fatload mmc 0 ${loadaddr} boot.scr
bootscript=echo Running bootscript from mmc ...; source ${loadaddr}
loaduimage=fatload mmc 0 ${loadaddr} uImage
netmask=255.255.255.0
gatewayip=192.168.0.99
dieid#=1d5a0004000000000403643203019007
ethact=smc911x-0
ethaddr=00:11:22:33:44:55
ipaddr=10.0.0.2
serverip=10.0.0.1
echo=Booting from nand ...
nandargs=console=ttyS0,115200n8 root=/dev/mtdblock4 opamfb.mode=lcd vram=32M omapfb.vram=0:8M rdinit=/init rootwait rootfstype=yaffs2
nandboot=echo Booting from NAND...; nand read ${loadaddr} 280000 400000; bootm ${loadaddr}
bootfile=uMulti-2
bootargs=console=ttyS0,115200n8 root=/dev/mtdblock4 rw opamfb.mode=lcd vram=32M omapfb.vram=0:8M init=/init rootwait rootfstype=yaffs2
stdin=serial
stdout=serial
stderr=serial
Environment size: 1175/131068 bytes
And the output when we start to boot the kernel is:
OMAP3_Kajsa # set ethaddr 00:11:22:33:44:55 ; set ipaddr 10.0.0.2 ; set serverip 10.0.0.1 ; tftp 0x82000000 uImage-yaffs
smc911x: detected LAN9220 controller
smc911x: phy initialized
smc911x: MAC 00:11:22:33:44:55
Using smc911x-0 device
TFTP from server 10.0.0.1; our IP address is 10.0.0.2
Filename 'uImage-yaffs'.
Load address: 0x82000000
Loading: T #################################################################
#################################################################
###############################
done
Bytes transferred = 2360952 (240678 hex)
OMAP3_Kajsa # bootm
## Booting kernel from Legacy Image at 82000000 ...
Image Name: Linux-2.6.29-rc3-omap1-gb7a2014-
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 2360888 Bytes = 2.3 MB
Load Address: 80008000
Entry Point: 80008000
Verifying Checksum ... OK
Loading Kernel Image ... OK
OK
Starting kernel ...
Uncompressing Linux...................................................................................................................................................... done, booting the kernel.
We have also tried to write the kernel to NAND and booted from there with the same result.
Any input will be appriciated.
Best regards.
Eric

[Tutorial] How to compile a kernel module outside the kernel

I've decided to make a short tutorial and present the way I compile kernel modules (outside the kernel sources).
I've built few kernel modules (governors - ineractive and smartass, cifs, nls, etc) and I started receiving private messages asking how I did it.
For kernel modules that come with the kernel itself - cifs / tun for example - they just work if you compile the kernel and activate correct config parameters.
Some other modules (such as the smartass governor that doesn't come with the kernel) you compile outside the kernel source. However they require changes since kernel does not export the symbols the module needs to use - so you have to know what k_all_syms are needed, grab them from the phone and update the kernel module.
So there will be changes there. However, the main steps are:
a) follow tutorials to get the kernel / android ndk to compile. People seem able to do this.
b) then take the module you want (For example cpufreq_smartass.c from here: http://pastebin.com/rR4QUCrk ) and copy it in a new folder on the disk.
c) create a Makefile like the one below, but with your paths of course:
Code:
KERNEL_DIR=/home/viulian/android_platform/kernel-2.1.A.0.435/kernel
obj-m := cpufreq_smartass.o
PWD := $(shell pwd)
default:
$(MAKE) ARCH=arm CROSS_COMPILE=/home/viulian/android_platform/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi- -C $(KERNEL_DIR) SUBDIRS=$(PWD) modules
clean:
$(MAKE) -C $(KERNEL_DIR) SUBDIRS=$(PWD) clean
d) execute make
Of course, the module source needs to be adjusted as you need to put in the frequencies, and also update the k_all_syms pointers .. But you can retrieve them from /proc/kallsyms on the device itself - just look for the method name, and use the address you see in the log.
If you still can't get it to compile, try to compile a very basic hello_world kernel module. I used the code below when testing:
Code:
#include <linux/module.h> /* Needed by all modules */
#include <linux/kernel.h> /* Needed for KERN_ALERT */
MODULE_LICENSE("GPL");
MODULE_AUTHOR("viulian, 2011");
MODULE_DESCRIPTION("Demo module for X10i");
int init_module(void)
{
printk("<1>Hello world\n");
// A non 0 return means init_module failed; module can't be loaded.
return 0;
}
void cleanup_module(void)
{
printk(KERN_ALERT "Goodbye world 1.\n");
}
It is not perfect, but if you manage to insmod-it and check dmesg, you will see "Hello world" written there.
One more thing, linux kernel is fussy about the module versions. Even if nothing is changed between two kernel versions related to what a module needs, is enough a small difference in module's modinfo value to make the kernel to refuse the module.
For this, you need to trick your local kernel and adjust EXTRAVERSION value in kernel's main Makefile to have the exact version of the one on the device:
In X10 stock kernel (GB 2.3.3 release), the kernel version is 2.6.29-00054-g5f01537 visible in phone settings.
This means that the kernel on the phone will only accept modules that are compiled for that exact version. But the kernel version is just a string in the module .ko, so is a string comparison - the module might work perfectly, but is not loaded.
There is luck though, the string value comes from a define in kernel's Makefile, which you can change before you compile!
The Makefile in the kernel you are going to use to build the module will have to include these lines at the top:
Code:
VERSION = 2
PATCHLEVEL = 6
SUBLEVEL = 29
EXTRAVERSION = -00054-g5f01537
Other than that, it should work .. Expect phone reboots and difficulty to debug if stuff goes wrong. Android kernel doesn't come with syslog functionality, kernel prints are found in /proc/kmsg. Dmesg works, but you can't execute if if phone reboots.
I usually had to keep another adb shell opening with 'cat /proc/kmsg' which showed as much as possible from the module's outputs.
Happy compiling on your risk!
Good
Sent from my GT-S5570 using Tapatalk
Nice really nice.
Anyone help me.have someone who could compile the linux bluetooth modules please? Iam noob in linux
http://www.multiupload.com/58OPISAYNH
Anyone please can make a video tutorial?
That's really nice of you for sharing this.
Guide to Compiling Custom Kernel Modules in Android
I've spent the better part of today trying to figure out how to compile and load a custom kernel modules in android to aid me in my research. It has been in entirely frustrating experience, as there is almost no documentation on the topic that I can find. Below you will find my attempt at a guide. Hopefully this will help save someone else the hassle.
PREREQUISITES
Disclaimer: This list may be incomplete, since I've not tried it on a fresh install. Please let me know if I've missed anything.
Install the general android prereqs found here .
Download and un(zip|tar) the android NDK found here .
http://developer.android.com/sdk/ndk/index.html
Download and un(zip|tar) the android SDK found here .
http://developer.android.com/sdk/index.html
Download and untar the kernel source for your device. This can usually be found on the website of your device manufacturer or by a quick Google search.
Root your phone. In order to run custom kernel modules, you must have a rooted phone.
Plug your phone into your computer.
PREPARING YOUR KERNEL SOURCE
First we must retrieve and copy the kernel config from our device.
Code:
$ cd /path/to/android-sdk/tools
$ ./adk pull /proc/config.gz
$ gunzip ./config.gz
$ cp config /path/to/kernel/.config
Next we have to prepare our kernel source for our module.
Code:
$ cd /path/to/kernel
$ make ARCH=arm CROSS_COMPILE=/path/to/android-ndk/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi- modules_prepare
PREPARING YOUR MODULE FOR COMPILATION
We need to create a Makefile to cross-compile our kernel module. The contents of your Makefile should be similar to the following:
Code:
obj-m := modulename.o
KDIR := /path/to/kernel
PWD := $(shell pwd)
CCPATH := /path/to/android-ndk/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin
default:
$(MAKE) ARCH=arm CROSS_COMPILE=$(CCPATH)/arm-linux-androideabi- -C $(KDIR) M=$(PWD) modules
COMPILING AND INSTALLING YOUR MODULE
Code:
$ cd /path/to/module/src
$ make
$ cd /path/to/android-sdk/tools/
$ ./adb push /path/to/module/src/modulename.ko /sdcard/modulename.ko
RUNNING YOUR MODULE
Code:
$ cd /path/to/android-sdk/
$ ./adb shell
$ su
# insmod /sdcard/modulename.ko
---------- Post added at 07:40 PM ---------- Previous post was at 07:37 PM ----------
IMPORNTANT TOO
Preparing a build environment
To build an Android kernel, you need a cross-compiling toolchain. Theoretically, any will do, provided it targets ARM. I just used the one coming in the Android NDK:
$ wget http://dl.google.com/android/ndk/android-ndk-r6b-linux-x86.tar.bz2
$ tar -jxf android-ndk-r6b-linux-x86.tar.bz2
$ export ARCH=arm
$ export CROSS_COMPILE=$(pwd)/android-ndk-r6b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-
For the latter, you need to use a directory path containing prefixed versions (such as arm-eabi-gcc orarm-linux-androideabi-gcc), and include the prefix, but not “gcc”.
You will also need the adb tool coming from the Android SDK. You can install it this way:
$ wget http://dl.google.com/android/android-sdk_r12-linux_x86.tgz
$ tar -zxf android-sdk_r12-linux_x86.tgz
$ android-sdk-linux_x86/tools/android update sdk -u -t platform-tool
$ export PATH=$PATH:$(pwd)/android-sdk-linux_x86/platform-tools
not yet ((((
Come on, please make video tuto
that's interesting.
Thanks for sharing
Any takers to do a video status? Come on people it would be good for newbies like me and many that tme around. When teaching the community grows.
hi
i'm traing to compile module for acer a500.
but i have got an error: Nothing to be done for `default'.
my makefile:
Code:
obj-m += hello.o
KDIR := /home/hamster/android
PWD := $(shell pwd)
CCPATH := /home/hamster/android-ndk/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin
default:
$(MAKE) ARCH=arm CROSS_COMPILE=$(CCPATH)/arm-linux-androideabi- -C $(KDIR) M=$(PWD) modules
acer kernel code is located in /home/hamster/android
could you help me?
thanks
Thanks man. The step "modules_prepare" is what did the trick for me!
Makefile including tabs
hamsterksu said:
hi
i'm traing to compile module for acer a500.
but i have got an error: Nothing to be done for `default'.
my makefile:
Code:
obj-m += hello.o
KDIR := /home/hamster/android
PWD := $(shell pwd)
CCPATH := /home/hamster/android-ndk/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin
default:
$(MAKE) ARCH=arm CROSS_COMPILE=$(CCPATH)/arm-linux-androideabi- -C $(KDIR) M=$(PWD) modules
acer kernel code is located in /home/hamster/android
could you help me?
thanks
Click to expand...
Click to collapse
This is probably because you need to add a tab in front of your $(MAKE). Without the tab it will not recognize the command.
Help with compiling module
I am trying to compile a module for Galaxy S. I am getting this error.
# insmod hello_world.ko
insmod: init_module 'hello_world.ko' failed (Exec format error)
These are the module related options that I have enabled in the .config
CONFIG_MODULES=y
CONFIG_MODULE_FORCE_LOAD=y
CONFIG_MODULE_UNLOAD=y
CONFIG_MODULE_FORCE_UNLOAD=y
# CONFIG_MODVERSIONS is not set
# CONFIG_MODULE_SRCVERSION_ALL is not set
Further this is the cat /proc/kmsg out put
<3>[53597.457275] hello_world: version magic '2.6.35.7-I900XXJVP-CL264642 preempt mod_unload ARMv7 ' should be '2.6.35.7-I9000XXJVP-CL264642 preempt mod_unload ARMv7 '
Why am I getting this error??
These are the steps I followed,
1. Downloaded the GT-I9000_OpenSource_GB.zip from samsung open source.
2. Change the EXTRAVERSION to EXTRAVERSION = .7-I900XXJVP-CL264642 (kernel version shown on phone is [email protected] #2)
I tried with EXTRAVERSION = [email protected] as well.
3. Added this line to the main make file -
core-y := usr/ TestModule/
5. Place the TestModule/ with the module code on the root directory.
6. Created the TestModule/Makefile and added this entry
obj-m := hello_world.o
4. On the read me of the kernel source it says to install Sourcery G++ Lite 2009q3-68 toolchain for ARM EABI, which I did.
5. Execute 'make aries_eur_defconfig'.
6. Execute make (again this is how the readme in the source says)
I have compiled this module for the emulator and it works fine, What am I doing wrong here?
Thanks in advance.
hamsterksu said:
hi
but i have got an error: Nothing to be done for `default'.
Code:
default:
$(MAKE) ARCH=arm CROSS_COMPILE=$(CCPATH)/arm-linux-androideabi- -C $(KDIR) M=$(PWD) modules
Click to expand...
Click to collapse
be sure to have {tab} not space or other symbol before: $(MAKE) in:
Code:
default:
$(MAKE) ARCH=arm CROSS_COMPILE=$(CCPATH)/arm-linux-androideabi- -C $(KDIR) M=$(PWD) modules
Hello,
I'm trying to load a module in my GS3 but I encounter problems about version. Maybe it's just a mismatch between the kernel i use to compile and the one on my phone.
I have a 3.0.31-742798 kernel version on my GS3, so I put this info in the makefile like viulian said but it didn't work.
I manage to compile and put the module on the phone, but when I want to insmod it, I've got
Code:
insmod: init_module 'hello_world.ko' failed (Exec format error)
and the /proc/kmsg say
Code:
... disagrees about version of symbol module_layout
And there no config.gz on the /proc/ dir like fabricioemmerick suggest to use
EDIT: I try to modify the symbol by copying the one of module from the phone. Have another error.
btw , with modinfo I found that the compilation always add -gc33f1bc-dirty after the subversion. Maybe something in the compilation goes wrong. Still use the stock kernel and the toolchain from the ndk sourcecode
m00gle said:
Hello,
I'm trying to load a module in my GS3 but I encounter problems about version. Maybe it's just a mismatch between the kernel i use to compile and the one on my phone.
I have a 3.0.31-742798 kernel version on my GS3, so I put this info in the makefile like viulian said but it didn't work.
I manage to compile and put the module on the phone, but when I want to insmod it, I've got
Code:
insmod: init_module 'hello_world.ko' failed (Exec format error)
and the /proc/kmsg say
Code:
... disagrees about version of symbol module_layout
And there no config.gz on the /proc/ dir like fabricioemmerick suggest to use
EDIT: I try to modify the symbol by copying the one of module from the phone. Have another error.
btw , with modinfo I found that the compilation always add -gc33f1bc-dirty after the subversion. Maybe something in the compilation goes wrong. Still use the stock kernel and the toolchain from the ndk sourcecode
Click to expand...
Click to collapse
Maybe your kernel source code version and your phone kernel version is different. If both are 3.0.31 but just the subversion is different, you can
try "insmod -f" to load. The -f option will ignore the version.
How can I get a dmesg of a specific kernel module using adb shell or any other way?
ravike14 said:
How can I get a dmesg of a specific kernel module using adb shell or any other way?
Click to expand...
Click to collapse
I'm not sure I understand the question ... you can just dmesg and grep by the module name ? Or some string that the module outputs ? You have full control
viulian said:
I'm not sure I understand the question ... you can just dmesg and grep by the module name ? Or some string that the module outputs ? You have full control
Click to expand...
Click to collapse
That's the part I don't understand, the grep part.. When I enter grep with my commamd I get as it's not a recognized command.. I'm using Windows is that the reason?
I'm using 'adb shell dmesg > dmesg.txt' how do I add the grep part for it and and the module name.. I did alot research but all are Linux kernel specific debugging guides.. What would be the exact command to grep a specific module.ko logs?
Sent from my HTC_Amaze_4G using XDA Premium 4 mobile app
ravike14 said:
I'm using 'adb shell dmesg > dmesg.txt' how do I add the grep part for it and and the module name.. I did alot research but all are Linux kernel specific debugging guides.. What would be the exact command to grep a specific module.ko logs?
Click to expand...
Click to collapse
I think I understand now
The order is this:
a) DroidSSHd from here: http://code.google.com/p/droidsshd/downloads/list
b) Busybox installer from the market.
c) Putty on your windows to connect to the phone
Now you can dmesg + grep once you are connected to the phone (don't forget to su before and allow DroidSSHd root).
You need to be connected to the phone since it is much more easier. Use the phone as your remote Linux machine.

Getting Working Wifi for Kernel builds

I have been buliding some kernels recently, but have been unable to get the wifi working.
I have tried it having the modules included in initramfs/lib/modules when ramdisk is created and i do mkbootimg, and have also tried just putting all the modules in the flash zip in /system/lib/modules, and excluded it from build process. Both result in no Wifi [Edit, putting the newly built correct modules in my working folders /lib/modules fixed wifi, must not have done it correctly before)
basic overview of what I've done (after zImage compile)
I use "./unpack-bootimg.pl boot.img" to pull the "ramdisk-contents" from the stock kernel, I renamed that folder "initramfs" and threw it in a folder along with my mkbootimg binary, and my zImage I just compiled.
I put the newly created modules from zImage build in my initramfs/libs/modules with
find -name '*.ko' -exec cp -av {} [path to desired folder] \;
I navigate to the initramfs folder and
find .|cpio -o -H newc > ../ramdisk
cd ..
gzip ramdisk
./mkbootimg --kernel ./zImage --ramdisk ./ramdisk.gz --board smdk4x12 --base 0x10000000 --pagesize 2048 --ramdiskaddr 0x11000000 -o boot.img
the resultant boot.img boots fine and shows all other changes, just cant seem to get the wifi working. Anyone have idea for getting wifi working on our Note 2 kernel builds?
Edit: I re-tried and this time it worked. Not sure what was different. Copied the newly created modules into my ramdisk folder (for me was /initramfs/lib/modules) and created my ramdisk.gz etc. made the boot.img and it's all good. The difference must've been having the correct modules in place prior to creating the ramdisk.cpio(then .cpio.gz).
Mods please move if you feel this is in wrong section now etc. Found the answer, thank you
It's only in the wrong section if you don't share what you did wrong, and how you fixed it.
Facing an almost similiar issue over here with the wifi modules. For me, I found that my boot.img is itself too large for initramfs to accomodate the compiled modules (optimization was off). So I put them in system/lib/modules and tried to insmod them.
Using the sbin's insmod gives me this:
Code:
[[email protected] android]$adb shell
[email protected]:/ $ su
[email protected]:/ # insmod /system/lib/modules/dhd.ko
insmod: init_module '/system/lib/modules/dhd.ko' failed (No such file or directory)
255|[email protected]:/ # busybox insmod /system/lib/modules/dhd.ko
insmod: can't insert '/system/lib/modules/dhd.ko': unknown symbol in module, or unknown parameter
2|[email protected]:/ #
I've turned off module versioning, and am not sure why there's a symbol error.
Droidzone said:
Facing an almost similiar issue over here with the wifi modules. For me, I found that my boot.img is itself too large for initramfs to accomodate the compiled modules (optimization was off). So I put them in system/lib/modules and tried to insmod them.
Using the sbin's insmod gives me this:
Code:
[[email protected] android]$adb shell
[email protected]:/ $ su
[email protected]:/ # insmod /system/lib/modules/dhd.ko
insmod: init_module '/system/lib/modules/dhd.ko' failed (No such file or directory)
255|[email protected]:/ # busybox insmod /system/lib/modules/dhd.ko
insmod: can't insert '/system/lib/modules/dhd.ko': unknown symbol in module, or unknown parameter
2|[email protected]:/ #
I've turned off module versioning, and am not sure why there's a symbol error.
Click to expand...
Click to collapse
Add --strip-debug into the LDFLAGS_MODULE of the main makefile and make sure the modules went through second stage compilation. The OS probably forwards some parameters and you can't just insmod it.
I fixed that issue..
The real reason is something queer and interesting. It was because I'd defined GREP_OPTIONS defined as '--color -in'. This seemed to interfere with the kernel scripts. Once the var was unset, problem was solved.
However the inability to load the module persists.
My main kernel has the version name "3.0.31-g5d44d80-dirty", and the vermagic of module seems to be "3.0.31-gc299ec6 SMP preempt mod_unload modversions ARMv7 p2v8".
This obviously leads to version mismatch, and inability to load the module. Do you know why this happens? The kernel and module were used from the same compilation session. In fact I havent even changed the version name in .config.
dmesg during insmod gives this error code which narrows down the issue:
Code:
c0 dhd: version magic '3.0.31-gc299ec6 SMP preempt mod_unload modversions ARMv7 p2v8 ' should be '3.0.31-g5d44d80-dirty SMP preempt mod_unload ARMv7 '
EDIT:
Maybe I had made a script error and forgot to replace the original kernel/module..That error has disappeared to be replaced by the former issue-unable to insert module. Module was compiled with debug symbols.
Insmod reports:
insmod: init_module '/system/lib/modules/dhd.ko' failed (No such file or directory)
Modprobe reports:
modprobe: chdir(3.0.31-ge52b835-dirty): No such file or directory
Kernel reports:
Code:
c0 dhd: Unknown symbol _GLOBAL_OFFSET_TABLE_ (err 0)
Trying to narrow it down to the source file. I'm expecting that some function has 'forgotten' to export symbol.
I'm wondering whether this is just me, or is Samsung source dump supposed to have these kind of errors on defconfig. First they "forget" to include cypress drivers. Now errors related to symbol export.
EDIT2:
Still no more closer to finding the cause of the error. Did a grep and these are the only things I found:
Code:
[[email protected] kernel_IN]$grep --color -inr '_GLOBAL_OFFSET_TABLE_' * | grep -v 'Binary file'
arch/powerpc/boot/crt0.S:42: addis r11,r10,(_GLOBAL_OFFSET_TABLE_-p_base)@ha
arch/powerpc/boot/crt0.S:43: lwz r11,(_GLOBAL_OFFSET_TABLE_-p_base)@l(r11)
arch/m32r/boot/compressed/head.S:39: seth r3, #high(_GLOBAL_OFFSET_TABLE_+8)
arch/m32r/boot/compressed/head.S:40: or3 r3, r3, #low(_GLOBAL_OFFSET_TABLE_+12)
arch/s390/kernel/module.c:149: "_GLOBAL_OFFSET_TABLE_") == 0)
arch/avr32/kernel/module.c:104: "_GLOBAL_OFFSET_TABLE_") == 0)
scripts/mod/modpost.c:565: if (strcmp(symname, "_GLOBAL_OFFSET_TABLE_") == 0)
System.map:49417:c0b4f468 d _GLOBAL_OFFSET_TABLE_
The relevant segment of scripts/mod/modpost.c:
Code:
static int ignore_undef_symbol(struct elf_info *info, const char *symname)
{
/* ignore __this_module, it will be resolved shortly */
if (strcmp(symname, MODULE_SYMBOL_PREFIX "__this_module") == 0)
return 1;
/* ignore global offset table */
if (strcmp(symname, "_GLOBAL_OFFSET_TABLE_") == 0)
return 1;
Edit3: Solved.
AndreiLux said:
Add --strip-debug into the LDFLAGS_MODULE of the main makefile and make sure the modules went through second stage compilation. The OS probably forwards some parameters and you can't just insmod it.
Click to expand...
Click to collapse
I'd like to thank you for this information - this cut my dhd.ko from 4.6 MB to around 550 kB - and my resulting kernel as a result. Fully expect this will now get my kernel working as it should.
Droidzone said:
I fixed that issue..
The real reason is something queer and interesting. It was because I'd defined GREP_OPTIONS defined as '--color -in'. This seemed to interfere with the kernel scripts. Once the var was unset, problem was solved.
However the inability to load the module persists.
My main kernel has the version name "3.0.31-g5d44d80-dirty", and the vermagic of module seems to be "3.0.31-gc299ec6 SMP preempt mod_unload modversions ARMv7 p2v8".
This obviously leads to version mismatch, and inability to load the module. Do you know why this happens? The kernel and module were used from the same compilation session. In fact I havent even changed the version name in .config.
dmesg during insmod gives this error code which narrows down the issue:
Code:
c0 dhd: version magic '3.0.31-gc299ec6 SMP preempt mod_unload modversions ARMv7 p2v8 ' should be '3.0.31-g5d44d80-dirty SMP preempt mod_unload ARMv7 '
EDIT:
Maybe I had made a script error and forgot to replace the original kernel/module..That error has disappeared to be replaced by the former issue-unable to insert module. Module was compiled with debug symbols.
Insmod reports:
insmod: init_module '/system/lib/modules/dhd.ko' failed (No such file or directory)
Modprobe reports:
modprobe: chdir(3.0.31-ge52b835-dirty): No such file or directory
Kernel reports:
Code:
c0 dhd: Unknown symbol _GLOBAL_OFFSET_TABLE_ (err 0)
Trying to narrow it down to the source file. I'm expecting that some function has 'forgotten' to export symbol.
I'm wondering whether this is just me, or is Samsung source dump supposed to have these kind of errors on defconfig. First they "forget" to include cypress drivers. Now errors related to symbol export.
EDIT2:
Still no more closer to finding the cause of the error. Did a grep and these are the only things I found:
Code:
[[email protected] kernel_IN]$grep --color -inr '_GLOBAL_OFFSET_TABLE_' * | grep -v 'Binary file'
arch/powerpc/boot/crt0.S:42: addis r11,r10,(_GLOBAL_OFFSET_TABLE_-p_base)@ha
arch/powerpc/boot/crt0.S:43: lwz r11,(_GLOBAL_OFFSET_TABLE_-p_base)@l(r11)
arch/m32r/boot/compressed/head.S:39: seth r3, #high(_GLOBAL_OFFSET_TABLE_+8)
arch/m32r/boot/compressed/head.S:40: or3 r3, r3, #low(_GLOBAL_OFFSET_TABLE_+12)
arch/s390/kernel/module.c:149: "_GLOBAL_OFFSET_TABLE_") == 0)
arch/avr32/kernel/module.c:104: "_GLOBAL_OFFSET_TABLE_") == 0)
scripts/mod/modpost.c:565: if (strcmp(symname, "_GLOBAL_OFFSET_TABLE_") == 0)
System.map:49417:c0b4f468 d _GLOBAL_OFFSET_TABLE_
The relevant segment of scripts/mod/modpost.c:
Code:
static int ignore_undef_symbol(struct elf_info *info, const char *symname)
{
/* ignore __this_module, it will be resolved shortly */
if (strcmp(symname, MODULE_SYMBOL_PREFIX "__this_module") == 0)
return 1;
/* ignore global offset table */
if (strcmp(symname, "_GLOBAL_OFFSET_TABLE_") == 0)
return 1;
Edit3: Solved.
Click to expand...
Click to collapse
How to Solved? Too detailed can you tell us a little bit?
wctliu said:
How to Solved? Too detailed can you tell us a little bit?
Click to expand...
Click to collapse
Used another toolchain.
Droidzone said:
Used another toolchain.
Click to expand...
Click to collapse
another toolchain????
Which version?
I uesd these:
/home/wctliu/toolchains/arm-eabi-4.4.3/bin/arm-eabi-
/home/wctliu/arm-2009q3/bin/arm-none-linux-gnueabi-
Which will cause the problem to occur?
wctliu said:
another toolchain????
Which version?
I uesd these:
/home/wctliu/toolchains/arm-eabi-4.4.3/bin/arm-eabi-
/home/wctliu/arm-2009q3/bin/arm-none-linux-gnueabi-
Which will cause the problem to occur?
Click to expand...
Click to collapse
Did you see and do the changes AndreiLux mentioned above to the makefile. That can be the difference of whether you get useable wifi modules. Simple place to start if your getting a working kernel but no wifi
Sent from my SPH-L900 using xda premium
sleshepic said:
Did you see and do the changes AndreiLux mentioned above to the makefile. That can be the difference of whether you get useable wifi modules. Simple place to start if your getting a working kernel but no wifi
Sent from my SPH-L900 using xda premium
Click to expand...
Click to collapse
YES i do it .
you can see this:
http://forum.xda-developers.com/showthread.php?t=2193358
and now, it's no wifi no exfat.
AndreiLux said:
Add --strip-debug into the LDFLAGS_MODULE of the main makefile and make sure the modules went through second stage compilation. The OS probably forwards some parameters and you can't just insmod it.
Click to expand...
Click to collapse
That is correct, the OS does pass parameters to the module when loading.
An example (from CM) can be seen at: https://github.com/CyanogenMod/andr...common/blob/cm-10.1/BoardCommonConfig.mk#L122
I cannot get Wifi to work either. I have the same exact problem as Droidzone with the "_GLOBAL_OFFSET_TABLE_" error.
I have checked that:
"LDFLAGS_MODULE = --strip-debug" is set in Makefile.
I'm using the 4.7 toolchain, but just tried the 4.6 to no avail.
Any help would be much appreciated.
Update: I was able to get it working by using CFLAGS_MODULE=-fno-pic as suggested in this guide.
Solved
I was running in the same issues. I solved my problem adding these to my kernel makefile:
LDFLAGS_MODULE = --strip-debug
CFLAGS_MODULE = -fno-pic
forfivo said:
I was running in the same issues. I solved my problem adding these to my kernel makefile:
LDFLAGS_MODULE = --strip-debug
CFLAGS_MODULE = -fno-pic
Click to expand...
Click to collapse
There must be something else goin on in my setup as this does not work for me to getting working WiFi. What is your build process?
Edit: or if you wouldn't mind shoot in me your kernel I'd be interested if it something small I'm missing like updater script etc
Edit2: I feel sometimes in android doing the same thing twice results in separate results. Crazy thx
Hey sorry to bump this. Not sure if anyone still remembers I have the same problem with my GT-B5330.
Even though I set in my kernel/Makefile :
CFLAGS_MODULE = -fno-pic
LDFLAGS_MODULE = --strip-debug
After building the kernel from source I get the dhd.ko file, copy it to ramdisk/lib/modules and then repack it with the zimage generated by the build.
Then i dd the newly created boot.img to the kernel partition.
lsmod doesnt show dhd.ko
and the file exists in system/lib/modules/dhd.ko
Toolchain arm-eabi-4.6
DroidFreak32 said:
Hey sorry to bump this. Not sure if anyone still remembers I have the same problem with my GT-B5330.
Even though I set in my kernel/Makefile :
CFLAGS_MODULE = -fno-pic
LDFLAGS_MODULE = --strip-debug
After building the kernel from source I get the dhd.ko file, copy it to ramdisk/lib/modules and then repack it with the zimage generated by the build.
Then i dd the newly created boot.img to the kernel partition.
lsmod doesnt show dhd.ko
and the file exists in system/lib/modules/dhd.ko
Toolchain arm-eabi-4.6
Click to expand...
Click to collapse
Are you able to test manually starting using insmod? If so, what is the result?
garwynn said:
Are you able to test manually starting using insmod? If so, what is the result?
Click to expand...
Click to collapse
I cannot insmod the module I get : /system/lib/module/dhd.ko invalid argument
DroidFreak32 said:
I cannot insmod the module I get : /system/lib/module/dhd.ko invalid argument
Click to expand...
Click to collapse
Can't get to my Linux env at the moment, but will follow up on this. Might even see if someone is willing to test for me.
garwynn said:
Can't get to my Linux env at the moment, but will follow up on this. Might even see if someone is willing to test for me.
Click to expand...
Click to collapse
Thanks man
Also I forgot to mention I use arm eabi 4.4.3 if that matters.

Sony Z5 Premium pure AOSP 7.0 Nougat

Z5 Premium AOSP
This rom is just AOSP build with Sony sources for Z5 premium. Not everything works perfectly.
Download: Download
== Installation ==
Flash all files via fastboot:
- fastboot flash boot boot.img
- fastboot boot boot-recovery.img
- enter recovery with volume up, advanced wipe: data, cache, dalvik cache
- flash or adb sideload the aosp.zip
- flash or adb sideload gapps and/or supersu
- Reboot
Enjoy!
XDA:DevDB Information
Sony Z5 Premium pure AOSP 7.0 Nougat, ROM for the Sony Xperia Z5 Premium
Contributors
krabappel2548
Source Code: https://github.com/xperia-aosp-project
ROM OS Version: 7.x Nougat
ROM Kernel: Linux 3.10.x
Based On: AOSP
Version Information
Status: Beta
Current Stable Version: 1.0
Stable Release Date: 2016-09-19
Created 2016-04-02
Last Updated 2016-09-19
Hi, know you from the Xperia S days! Thanks for your work. Would it be possible to add what's not working as intended?
K,
okay,
What's working, with the exception of NFC and Communications which i can't test as I have no sim installed or alternate device to test NFC.
NOTE: I did not flash userdata.img
Tunes :good:
Bluetooth Pairing :good: , no tethering for wifi, but then again I'm probably doing that wrong.
currently there is no app or filemanager with a transfer function so i can't test file transfer.
Rotation :good:
ADB :good:
Storage, external :good: , Exfat support needed [kernel]
Code:
adb shell cat /proc/filesystems
nodev sysfs
nodev rootfs
nodev bdev
nodev proc
nodev cgroup
nodev cpuset
nodev tmpfs
nodev debugfs
nodev sockfs
nodev pipefs
nodev anon_inodefs
nodev configfs
nodev devpts
ext3
ext2
ext4
nodev ramfs
vfat
fuseblk
nodev fuse
nodev fusectl
nodev pstore
nodev selinuxfs
nodev functionfs
Wifi , kind of mixed, I use mac filters on my router, when trying to connect with this rom connection fails.
mac address in this rom is different. After adding new mac, connection is go.
Youtube playback via browser is good. So video and audio playback are good.
Mic is up :good: Recording audio is good to go.
Cameras are janky, but well, yeah. :silly: Video recording DOES function though, the colors are all porked and images are backwards/flipped and off color, Note this is using opencamera and not default, default is porky.
Booting/rebooting , you don't have the sony init set up properly so no button trigger/ led functions to boot to FOTAKernel/recovery.
That's what i have so far. Didn't do the GAPPS test as per note on booting/rebooting.
m
Edit: Please post your specific sources if different from current offerings including any build system patches? Thanks.
krabappel2548 said:
- fastboot flash recovery recovery.img
Click to expand...
Click to collapse
Tried that (recovery.img) with the Z5 and it wouldn't work,
also there's some issue if you use the twrp recovery script to boot to TWRP via volume-button pressing during bootup - also didn't work - which was weird
moonbutt74 said:
[snip]
Storage, external :good: , Exfat support needed [kernel]
[snip]
Click to expand...
Click to collapse
not only that - it needs support in the ROM, I tried a kernel with exfat included and it still insisted to format the microSD with FAT32,
being formatted with exFAT - it said that it's corrupted and wouldn't recognized or automount it
This is ridiculous - using a patent encumbered filesystem as a default which can't be used with the default system (AOSP) :silly:
Who cares about Microsoft's filesystems ? They should have used ext4 with some minor changes, reiserfs, reiser4, etc. instead,
it's not like you access the microSD directly via usb-storage functionality like in the good ol' days, it's through MTP anyway ...
moonbutt74 said:
Wifi , kind of mixed, I use mac filters on my router, when trying to connect with this rom connection fails.
mac address in this rom is different. After adding new mac, connection is go.
Click to expand...
Click to collapse
Afaik there's a MAC address jumbling functionality in the Kernel that does this,
after a reboot it should fail for you again
moonbutt74 said:
Cameras are janky, but well, yeah. :silly: Video recording DOES function though, the colors are all porked and images are backwards/flipped and off color, Note this is using opencamera and not default, default is porky.
Click to expand...
Click to collapse
yeah, had the same experience, that was terrible
moonbutt74 said:
Booting/rebooting , you don't have the sony init set up properly so no button trigger/ led functions to boot to FOTAKernel/recovery.
Click to expand...
Click to collapse
Even when using the recovery script it didn't work for me - but perhaps on another revisit it might work with some changes - dunno
Besides that ... yeah, had similar experiences - it was rather stable so actually usable as a daily driver (aside from the camera, FM radio, etc.)
Bootrec stuff
Z,
Code:
also there's some issue if you use the twrp recovery script to boot to TWRP via volume-button pressing during bootup - also didn't work - which was weird
okay this is the bootimage repacked with bootrec setup, straight from androplus ramdisk setup aosp_z5p_boot.img
here's just the bootrec directory and init shortcut, unpack, rename init in ramdisk to init.real then extract zip, paste this directory [bootrec] and the init shortcut in.
check properties on the init shortcut to make sure it's pointing to /init bootrec.zip
and the recoveryimage you want is the twrp build for z5p
that should be it it worked for me just fine.
m
K, Z,
Quick note, the mac address in "stock" MM does not randomize. Meaning mac filter entry in router remains valid/correct across reboot.
So this is build or kernel. would appreciate the commit kernel side if you come across it that "makes it so" or modification to build system that achieves the same. Thanks.
m
derp, nvm i can just script it, init.d or service
Code:
[email protected]:/ # ifconfig -a | grep HWaddr
wlan0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
dummy0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
[email protected]:/ # ifconfig wlan0 down
[email protected]:/ # ifconfig wlan0 hw ether 00:11:22:33:44:55
[email protected]:/ # ifconfig wlan0 up
[email protected]:/ # ifconfig wlan0 | grep HWaddr
wlan0 Link encap:Ethernet HWaddr 00:11:22:33:44:55
Only posting because privacy is NOT an issue for my situation, so i need mac to stay the same.
@zacharias.maladroit the twrp build in my kernel thread.
I'm still in training for the army, and my gf needs the laptop this week. But I'll try to fix some bugs after next week
moonbutt74 said:
Z,
Code:
also there's some issue if you use the twrp recovery script to boot to TWRP via volume-button pressing during bootup - also didn't work - which was weird
okay this is the bootimage repacked with bootrec setup, straight from androplus ramdisk setup aosp_z5p_boot.img
here's just the bootrec directory and init shortcut, unpack, rename init in ramdisk to init.real then extract zip, paste this directory [bootrec] and the init shortcut in.
check properties on the init shortcut to make sure it's pointing to /init bootrec.zip
and the recoveryimage you want is the twrp build for z5p
that should be it it worked for me just fine.
m
Click to expand...
Click to collapse
Thanks M !
Perhaps I didn't do it correctly the last time I tried,
what Recovery did you use for this ? TWRP ?
moonbutt74 said:
K, Z,
Quick note, the mac address in "stock" MM does not randomize. Meaning mac filter entry in router remains valid/correct across reboot.
So this is build or kernel. would appreciate the commit kernel side if you come across it that "makes it so" or modification to build system that achieves the same. Thanks.
m
derp, nvm i can just script it, init.d or service
Code:
[email protected]:/ # ifconfig -a | grep HWaddr
wlan0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
dummy0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
[email protected]:/ # ifconfig wlan0 down
[email protected]:/ # ifconfig wlan0 hw ether 00:11:22:33:44:55
[email protected]:/ # ifconfig wlan0 up
[email protected]:/ # ifconfig wlan0 | grep HWaddr
wlan0 Link encap:Ethernet HWaddr 00:11:22:33:44:55
Only posting because privacy is NOT an issue for my situation, so i need mac to stay the same.
Click to expand...
Click to collapse
yeah, that is an annoyance when you're working with a MAC filter,
https://github.com/sonyxperiadev/kernel/commit/6ad557733ff801d6ba70fdba3af9a64a9819c9a4 is one related
net: wireless: bcmdhd: Remove random mac code from PNO module
Generalizing the code that sets the random mac
as it will be used by PNO, gscan, RTT.
Click to expand...
Click to collapse
but I had a different commit (or configuration) in mind, will notice you once I stumbled upon it again
Meanwhile git blame path/to/file is your friend that way you could trace down the offending commits of the changes in the files
krabappel2548 said:
I'm still in training for the army, and my gf needs the laptop this week. But I'll try to fix some bugs after next week
Click to expand...
Click to collapse
Can you host those changes somewhere, once you do ? That way it would be easier to fix issues across the devices (Z5, Z5P and Z5C)
I've just read that the flash of the cam doesn't appear to work (and the colors are off - perhaps that improved from the last time I tested due to recent kernel changes)
---------- Post added at 02:31 PM ---------- Previous post was at 02:20 PM ----------
moonbutt74 said:
K, Z,
Quick note, the mac address in "stock" MM does not randomize. Meaning mac filter entry in router remains valid/correct across reboot.
So this is build or kernel. would appreciate the commit kernel side if you come across it that "makes it so" or modification to build system that achieves the same. Thanks.
m
derp, nvm i can just script it, init.d or service
Code:
[email protected]:/ # ifconfig -a | grep HWaddr
wlan0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
dummy0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
[email protected]:/ # ifconfig wlan0 down
[email protected]:/ # ifconfig wlan0 hw ether 00:11:22:33:44:55
[email protected]:/ # ifconfig wlan0 up
[email protected]:/ # ifconfig wlan0 | grep HWaddr
wlan0 Link encap:Ethernet HWaddr 00:11:22:33:44:55
Only posting because privacy is NOT an issue for my situation, so i need mac to stay the same.
Click to expand...
Click to collapse
Found the commits:
commit d9c59afc703570ce1ed9f14945d288bf797fd8f3
Author: Chirayu Desai <[email protected]>
Date: Sat Dec 12 18:50:54 2015 +0530
net: wireless: bcmdhd/somc-wifi-ctrl: Fix random MAC usage ...
... when nothing is written to the macaddr file.
The current check for 'readlen > 0' only accounts for the cases
where something is written to the macaddr file.
If nothing is written at all, the random MAC won't be used either,
and the bcmdhd driver's random MAC setting fails as well, which results
in a MAC of all zeroes, which isn't usable.
While this isn't perfect for normal use cases (as it'll generate a new random
MAC each boot), it's better to have wifi functioning with this rather
than not working at all.
Also sneak in a little change to move the file closing near it's usage.
Change-Id: I27aed88160e735460ba6e76160e6f5660e0bbd39
commit a3263d45ed60227cd20c668df7215e9376d94099
Author: Ecco park <[email protected]>
Date: Wed Sep 3 14:06:05 2014 -0700
net: wireless: bcmdhd set random mac for SOFTAP
17373032 SoftAp has constant MAC that is not changed between reboots
Change-Id: I3cd0283175e47391e5def68cf1c6cc375b777163
Signed-off-by: Ecco park <[email protected]>
Signed-off-by: Dmitry Shmidt <[email protected]>
commit d82d3d0f0e79b46f18b0bbba9ae0d021e2b26f6c
Author: Ashwin <[email protected]>
Date: Fri Aug 1 18:33:51 2014 -0700
net: wireless: bcmdhd: PNO MAC address rotation
This change will need updated FW to work
Change-Id: Iaa94ee1969ddab1a3c3d61a3e1bbdebaea2022af
Signed-off-by: Ashwin <[email protected]>
Click to expand...
Click to collapse
the oldest one is probably that one that you seek,
didn't know that Apple with iOS8 also started to implement that "feature"
exfat card mount manual approach
K, Z, @CTXz
Okay got my exfat card to mount, but it's sort of funky here goes
first in your device tree make sure you have the following option set/defined
TARGET_KERNEL_HAVE_EXFAT := true
Patch in exfat support in kernel
OKay now,
Code:
cat /proc/partitions
major minor #blocks name
[ snip snip ]
[COLOR="Red"]179 64 124868608 mmcblk1[/COLOR]
Warning: slightly goofy example!
Code:
mkdir /storage/nubby
mount.exfat -d -o rw /dev/block/mmcblk1 /storage/nubby
which results from an adb shell in running output as:
Code:
FUSE exfat 1.2.3
FUSE library version: 2.9.3
nullpath_ok: 0
nopath: 0
utime_omit_ok: 0
unique: 1, opcode: INIT (26), nodeid: 0, insize: 56, pid: 0
INIT: 7.23
flags=0x0001f7fb
max_readahead=0x00080000
INIT: 7.19
flags=0x00000031
max_readahead=0x00080000
max_write=0x00020000
max_background=0
congestion_threshold=0
unique: 1, success, outsize: 40
unique: 2, opcode: GETATTR (3), nodeid: 1, insize: 56, pid: 6363
getattr /
unique: 2, success, outsize: 120
unique: 3, opcode: OPENDIR (27), nodeid: 1, insize: 48, pid: 6363
unique: 3, success, outsize: 32
unique: 4, opcode: READDIR (28), nodeid: 1, insize: 80, pid: 6363
readdir[0] from 0
unique: 4, success, outsize: 464
unique: 5, opcode: READDIR (28), nodeid: 1, insize: 80, pid: 6363
unique: 5, success, outsize: 16
unique: 6, opcode: GETATTR (3), nodeid: 1, insize: 56, pid: 6363
getattr /
unique: 6, success, outsize: 120
unique: 7, opcode: LOOKUP (1), nodeid: 1, insize: 56, pid: 6363
LOOKUP /.android_secure
getattr /.android_secure
NODEID: 2
unique: 7, success, outsize: 144
unique: 8, opcode: LOOKUP (1), nodeid: 1, insize: 48, pid: 6363
LOOKUP /Android
getattr /Android
NODEID: 3
unique: 8, success, outsize: 144
unique: 9, opcode: LOOKUP (1), nodeid: 1, insize: 45, pid: 6363
LOOKUP /DCIM
getattr /DCIM
NODEID: 4
unique: 9, success, outsize: 144
unique: 10, opcode: LOOKUP (1), nodeid: 1, insize: 49, pid: 6363
LOOKUP /Download
getattr /Download
NODEID: 5
unique: 10, success, outsize: 144
unique: 11, opcode: LOOKUP (1), nodeid: 1, insize: 47, pid: 6363
LOOKUP /Movies
getattr /Movies
NODEID: 6
unique: 11, success, outsize: 144
unique: 12, opcode: LOOKUP (1), nodeid: 1, insize: 49, pid: 6363
and so on, each LOOKUP is a directory on my external sdcard [exfat format]
this is in my cm13 build
and so
Code:
mount -o bind /storage/nubby /sdcard/nubby/
ls /sdcard/nubby/
Android DCIM Download Movies Pictures TWRP Tunes apkbak customized-capability.xml video
So, nubby rules !!! :silly:
What doesn't happen is the registering of the media files on the now mounted and readable/writeable external sdcard [exfat]
my guess is groups and permissions, as even manual launching of a media file does not pick up via cm's media player or mxplayer, but copying files to and from work.
m
derp, okay so with the above it appears to be vold being the problem and not format support on the kernel-side
Mounted External sdcard [exfat]
K, Z, @CTXz
Okay, continuing from my previous post on mounting your exfat external sdcard,
This works in CM13 and should in AOSP, admittedly it's a little sloppy but hey.
Changes in boot.img as follows:
/sbin/<name of script>
Script contents:
Code:
#!/system/bin/sh
mount -o rw,remount /
mkdir /mnt/media_rw/sdcard1
mount.exfat -o uid=1023,gid=1023 /dev/block/mmcblk1 /mnt/media_rw/sdcard1
mkdir /storage/sdcard1
mount -o bind,uid=1023,gid=1023 /mnt/media_rw/sdcard1 /storage/sdcard1
mount -o ro,remount /
/init.environ.rc
add the following line below
Code:
export SECONDARY_STORAGE /storage/sdcard1
/init.rc
make sure media_rw is 755
Code:
mkdir /mnt/media_rw 0755 root media_rw
AT THE VERY BOTTOM OF init.rc <just to make sure everything else is already in place,
add the service which will fire the script
Code:
service <name of script> /sbin/<name of script>
class main
oneshot
repack the boot.img and flash, recognition should be instant though some apps will still not register
the existence of the card, haven't tested on a full factory reset yet.
Again from my previous post, you must have exfat support patched into kernel,
you must make sure to include in boardconfig.mk
Code:
TARGET_KERNEL_HAVE_EXFAT := true
so your rom-side support will compile, all the exfat stuff.
m
K, i will make the mod to your build and test it out in a bit. I did not utilize the fstab in this so your external card will not be picked up as a candidate for adoptable storage.
@krabappel2548
Okay, yeah you don't have the rom-side exfat support, you're kernel's good.
You're missing:
Code:
/system/bin/exfatck
/system/bin/exfatinfo
/system/bin/exfatlabel
/system/bin/exfatvsn
/system/bin/fsck.exfat
/system/bin/mkexfat
/system/bin/mkfs.exfat
/system/bin/mount.exfat
/system/lib64/libexfat.so
/system/lib64/libfuse.so
I've attached the above mentioned files for convenience.
The above files i pushed into your build from cm13. Although vold still seems to accuse the card of being corrupt.
After pushing the above mentioned files in conjuction with the modifications to boot.img mentioned previously i do get my card to mount @ an alternate point. /sdcard1 , and it does pick up as storage in totalcommander file manager. but still doesn't get past the vold smell test so no other apps looking for "proper" mount point see it.
Okay final round,
after factory resetting, with your original boot.img modified only with the bootrec setup for booting into recovery, and the aforementioned files for exfat support rom-side:
The card initially comes up as corrupt,
Format for Portable storage succeeds , card useable normally.
Format for internal storage corrupts, I am guessing it to be an issue with the size of the card [128gb]
as two additional partitions are created but neither readable, i don't have a 32gb card to test/verify..
Card format as portable storage seems to survive across reboots so :good: ?
So adoptable storage option for this size card seems to be broken.
m
before the aosp formatting the card, the entire card/block/device was mmcblk1 <-- working for cm13 with sloppy mount / not working with aosp
after aosp format the card/block/device was mmcblk1p1 <-- not working at all cm13 / working in aosp
Click to expand...
Click to collapse
on closer look - this is an issue of the naming scheme of devices:
if devices e.g. are attached, not properly unmounted and then another one attached
the previous device name is already taken - so a "simple" script will fail
You could either see whether it works
1) with regular expressions:
mounting it via mmcblk1p*
(don't ask how to do it - I haven't done it yet )
2) with persistent naming:
/dev/disk/by-id , by-label (does exFAT use these ?), by-uuid
https://wiki.archlinux.org/index.php/persistent_block_device_naming
http://unix.stackexchange.com/questions/86764/understanding-dev-disk-by-folders
http://unix.stackexchange.com/quest...a-way-to-change-a-device-id-in-dev-disk-by-id
http://unix.stackexchange.com/questions/86764/understanding-dev-disk-by-folders
I flashed via fastboot files and reboots the phone screen only Sony ... why this happens ?
Rubensss said:
I flashed via fastboot files and reboots the phone screen only Sony ... why this happens ?
Click to expand...
Click to collapse
Make sure you really flash all:
(recovery is not necessarily needed for the AOSP to boot up)
- fastboot flash boot boot.img
- fastboot flash recovery recovery.img
- fastboot flash userdata userdata.img
- fastboot flash system system.img
Click to expand...
Click to collapse
otherwise you'll get into a loop during boot,
otherwise:
do an emergency off,
flash again and see whether that helps (it did once or twice for me)
zacharias.maladroit said:
Make sure you really flash all:
(recovery is not necessarily needed for the AOSP to boot up)
otherwise you'll get into a loop during boot,
otherwise:
do an emergency off,
flash again and see whether that helps (it did once or twice for me)
Click to expand...
Click to collapse
I try to flash it again without recovery.img No I have to do before flashing wipes ?
Rubensss said:
I try to flash it again without recovery.img No I have to do before flashing wipes ?
Click to expand...
Click to collapse
formatting /cache, wiping dalvik cache
might help, yes
Not sure what else you have in mind
Backup your data since this will surely wipe internal storage (userdata.img)
zacharias.maladroit said:
formatting /cache, wiping dalvik cache
might help, yes
Not sure what else you have in mind
Backup your data since this will surely wipe internal storage (userdata.img)
Click to expand...
Click to collapse
I have tried again , this time making full and wipes without flashing recovery.img but when you start the phone gets directly to the TWRP recovery ... I've flashed 2 times and does the same. I think I 'll wait to see if they make a flashable file TWRP , thank you very much anyway zacharias.maladroit . By the way , I have installed in your kernel v.2.2 and will RomAur luxury . a greeting
I'm having bootloops as well. I cleared the system, cache and dalvik using TWRP. Model is 6833
May I know what is the difference between your build and fxp's aosp?
frostmore said:
May I know what is the difference between your build and fxp's aosp?
Click to expand...
Click to collapse
There are FXP Marshmallow builds ?
Link please
I searched and I see this:
http://fxpblog.co/aosp/aosp-6-0/
http://uploaded.net/f/53n94q
AOSP_M_160416_satsuki.zip seems to be the latest. What do you think? @zacharias.maladroit
I might be wrong but you can check guys!

Categories

Resources