What .ko's from kernel build?

Search This thread

Edge-Case

Senior Member
Jul 10, 2013
97
25
I just successfully built a kernel with my phone over nfs (wifi). I used gcc-armhf or rather to be specific, when it complained I set 'CROSS_COMPILER=/usr/bin/', cleaned, and retried. Everything seems to have went fine, and as expected I have the zImage in arch/arm/boot and the modules are scattered around, but theres a list on stdout I can use to copy them somewhere.

1.) Which kernel object files do I need?

2.) I will look at the device/samsung/d2spr/extract-files.sh file to see where I should put them, but where should I put the ones that may have been created from the config changes and are not listed?

My first couple of trys failed due to the kernel being too large, so I changed some things to modules that I think can wait to load or set up an init script. I also didn't use mkbootimg, I used abootimg, that may have been why, not too sure. I used unmkbootimg and saved the stdout to a file this time and built the kernel on my phone, still, those are some questions I still have.

Edit: Another way to ask this question...

3.) Do I need to replace the 'blobs' that I got from the official CM ROM with the ones I just built?
4.) Do the modules I built contain the proprietary code to run the hardware, or where some (wifi driver for instance) 'filled' in with 'dummy code'?

Note: The zImage built was 3699216 bytes or about 3.6 MB. The zImage I need to replace is "Kernel size 3907440" or roughly 3.9MB, things are looking good, for once! :highfive:
 
Last edited:

CNexus

Senior Member
May 17, 2012
9,010
14,000
~/android
Google Pixel 7
Just use a script to find and copy all of them

Code:
find . -iname '*.ko' -exec cp {} MODULES_OUTPUT_FOLDER_HERE \;

Run from the root folder of your kernel source

Kernel modules go in the system/lib/modules folder

They contain code to assist the kernel, it's not so much proprietary blobs like pulling libs from stock to get AOSP working but they are device and kernel specific. The entire source for each module is there...so it's not proprietary or else someone would get sued

And no, they don't get filled in with dummy code, they get built with drivers that have been adapted for the specific board and then for the specific phone model and kernel code. Modules add in what the kernel leaves out...the kernel might say "initialize wifi chip, load driver and then connect", but the main code with all the specifics of how to do that is actually stored in the wifi module (dhd.ko)
 
  • Like
Reactions: Edge-Case

Edge-Case

Senior Member
Jul 10, 2013
97
25
Just use a script to find and copy all of them

Code:
find . -iname '*.ko' -exec cp {} MODULES_OUTPUT_FOLDER_HERE \;

Run from the root folder of your kernel source

Kernel modules go in the system/lib/modules folder

They contain code to assist the kernel, it's not so much proprietary blobs like pulling libs from stock to get AOSP working but they are device and kernel specific. The entire source for each module is there...so it's not proprietary or else someone would get sued

And no, they don't get filled in with dummy code, they get built with drivers that have been adapted for the specific board and then for the specific phone model and kernel code. Modules add in what the kernel leaves out...the kernel might say "initialize wifi chip, load driver and then connect", but the main code with all the specifics of how to do that is actually stored in the wifi module (dhd.ko)

Well, I hope all is not lost.

I took my last working zip I built and used an archive manager to crack it open, I replaced the zImage with the one I built on my phone. Then I replaced all .ko files that where built in system/lib/modules and closed the archive. I flashed it to my phone and installed it, now I am stuck in aboot loop and can't get to recovery.

What should I do? Can I fix it with Oden or something? That is what I used to originally root it.
 

Edge-Case

Senior Member
Jul 10, 2013
97
25
Scratch that, I pulled the battery and pushed the buttons more cautiously (nervous shakes), in recovery.

What do ya think it coulda been?

I disabled paranoid networking, removed CIFS, and changed NFS to Modules instead of built-ins.

Edit: I'll try cross compiling on my lap-top, maybe had to do with the toolchain and arm abei(sp?), maybe wifi nfs is unreliable in witing to the disk?

Maybe if I use the original .ko files that I pulled from the device as per the CM extract-files.sh script, and just add the new kernel and new modules that didn't already exit?

I'll have to brute this out and hope I don't brick my phone in the process.
 
Last edited:

CNexus

Senior Member
May 17, 2012
9,010
14,000
~/android
Google Pixel 7
Kernels won't brick your phone unless it overclocks to the point where it's melting, otherwise you're good

What it sounds like is something went wrong and you had a kernel panic...or maybe the kernel didn't load at all

Check /proc/last_kmsg to see if it loaded at all
 

Edge-Case

Senior Member
Jul 10, 2013
97
25
Kernels won't brick your phone unless it overclocks to the point where it's melting, otherwise you're good

What it sounds like is something went wrong and you had a kernel panic...or maybe the kernel didn't load at all

Check /proc/last_kmsg to see if it loaded at all

My bad, as soon as I got into recovery I flashed a known working zip.

I am going to keep trying to build a custom kernel but I would like to figure out how to configure it within my source tree and let it get compiled with a rom.


but here is a cat of /proc/last_kmsg just incase it survived.
Code:
[    0.000000] Truncating memory at 0xc0000000 to fit in 32-bit physical address space
[    0.000000] smem_find(137, 80): wrong size 72
[    0.023561] AXI: msm_bus_fabric_init_driver(): msm_bus_fabric_init_driver
[    0.056035] msm_rpm_get_status(): Status id 433 not defined for target
[    0.056035] msm_rpm_get_status(): Status id 433 not defined for target
[    0.056065] msm_rpm_get_status(): Status id 433 not defined for target
[    0.056065] msm_rpm_get_status(): Status id 433 not defined for target
[    0.056065] msm_rpm_get_status(): Status id 433 not defined for target
[    0.056096] msm_rpm_get_status(): Status id 433 not defined for target
[    0.056096] msm_rpm_get_status(): Status id 433 not defined for target
[    0.056096] msm_rpm_get_status(): Status id 433 not defined for target
[    0.076056] msm_gpiomux_install: write failure: -14
[    0.076056] msm_gpiomux_install: write failure: -14
[    0.076056] msm_gpiomux_install: write failure: -14
[    0.076087] msm_gpiomux_install: write failure: -14
[    0.125194] [msm8960_init_cam:1572]setting done!!
[    0.177262] i2c i2c-14: Invalid 7-bit I2C address 0x00
[    0.177384] i2c i2c-14: Can't create device at 0x00
[    0.177872] i2c i2c-19: Failed to register i2c client cmc624 at 0x38 (-16)
[    0.177964] i2c i2c-19: Can't create device at 0x38
[    0.178483] Error-Bad Function Input
[    0.179185] max8952 19-0060: DVS modes disabled because VID0 and VID1 do not have proper controls.
[    0.407630] AXI: msm_bus_scale_register_client(): msm_bus_scale_register_client: name: scm_pas 
[    0.418953] smd_channel_probe_worker: allocation table not initialized
[    0.429757] msm_ipc_router_init: Unable to create IPC logging for IPC RTR
[    0.430581] msm_ipc_router_ipc_log_init: Unable to create IPC logging for Req/Resp
[    0.430856] msm_ipc_router_ipc_log_init: Unable to create IPC logging for Indications
[    0.437082] AXI: msm_bus_scale_register_client(): msm_bus_scale_register_client: name: acpuclk-8960 
[    0.473950] AXI: msm_bus_scale_register_client(): msm_bus_scale_register_client: name: dtv 
[    0.477857] AXI: msm_bus_scale_register_client(): msm_bus_scale_register_client: name: mdp 
[    0.491316] pm_runtime: fail to wake up
[    0.991881] hdmi_msm hdmi_msm.1: external_common_state_create: sysfs group eeb42a08
[    0.993804] Inside writeback_driver_init
[    0.994353] Inside writeback_probe
[    1.534289] AXI: msm_bus_scale_register_client(): msm_bus_scale_register_client: name: rotator 
[    1.548023] AXI: msm_bus_scale_register_client(): msm_bus_scale_register_client: name: grp3d 
[    1.558583] AXI: msm_bus_scale_register_client(): msm_bus_scale_register_client: name: grp2d0 
[    1.568686] AXI: msm_bus_scale_register_client(): msm_bus_scale_register_client: name: grp2d1 
[    1.602289] AXI: msm_bus_scale_register_client(): msm_bus_scale_register_client: name: qsee 
[    1.789500] cm36651_setup_reg: initial proximity value = 0
[    1.910697] AXI: msm_bus_scale_register_client(): msm_bus_scale_register_client: name: usb 
[    1.930016] mms_ts 3-0048: [TSP] ISC Ver [0xbd] [0x22] [0x22]
[    1.934777] mms_ts 3-0048: [TSP] fw is latest. Do not update.
[    1.947077] [__s5c73m3_probe:3868] S5C73M3 probe
[    1.950862] [s5c73m3_sensor_probe_cb:3843] Entered
[    1.955562] [s5c73m3_i2c_probe:3725] Entered
[    1.959896] [s5c73m3_init_client:3424] Entered
[    1.965359] [s5c73m3_i2c_probe:3745] Exit
[    1.968655] [s5c73m3_sensor_probe:3776] Entered
[    1.973081] [s5c73m3_spi_init:226] Entered
[    1.977170] [s5c73m3_spi_probe:191] Entered
[    1.981321] [s5c73m3_spi_probe:201] s5c73m3_spi successfully probed
[    1.987669] [s5c73m3_sensor_probe :  3799] Probe_done!!
[    2.042698] AXI: msm_bus_scale_register_client(): msm_bus_scale_register_client: name: msm_sdcc 
[    2.049076] couldn't get usb power supply
[    2.057530] mmc0: No card detect facilities available
[    2.064153] AXI: msm_bus_scale_register_client(): msm_bus_scale_register_client: name: msm_sdcc 
[    2.081245] AXI: msm_bus_scale_register_client(): msm_bus_scale_register_client: name: msm_sdcc 
[    2.093575] aat1290a_led_probe : Probe
[    2.378849] bam_dmux_init : unable to create IPC Logging Context
[    2.419594] cypress_touchkey 16-0020: Touchkey FW Version: 0x06
[    2.534594] init: invalid uid 'fm_radio'
[    2.950068] enable_store: android_usb: already disabled
[    2.954768] init: Unable to open persistent property directory /data/property errno: 2
[   87.924614] SysRq : Emergency Remount R/O
[   88.153181] Restarting system.

No errors detected

Maybe disabling Android's Paranoid Networking breaks other things?

If this wont work, maybe I will try writing a post installation script for apt-get and try to get Android to recognize the new packages nd define some permission for that .xml file I know is hiding somewhere. I might have to create a database of permissions required for all the packages in the repos (that would suck). But really, if I could just get basic Linux filesystem permissions I wouldn't need to do all of that. That whole, "only allow certain groups to create sockets" option is pulling the chair out from under me. I'll have to study the source for the filesystem a little deeper, maybe I can disable it (or at least allow root) from the source without taking it out of the kernel config.

For instance, postgresql needs to open a socket and bind to a port, it tries ipv4 an ipv6 AF_INET and AF_INET6, and this paranoid feature will check the processes gid as well as other permissions I think to see if it can. So I tried setting the gid bit to run /etc/init.d/postrgresql as gid AID_INET but it still fails, probably because the file is not listed in that .xml file I mentioned earlier. I think a post installation script might work best if I can't turn the feature off or fix it to be more permissive.
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    Just use a script to find and copy all of them

    Code:
    find . -iname '*.ko' -exec cp {} MODULES_OUTPUT_FOLDER_HERE \;

    Run from the root folder of your kernel source

    Kernel modules go in the system/lib/modules folder

    They contain code to assist the kernel, it's not so much proprietary blobs like pulling libs from stock to get AOSP working but they are device and kernel specific. The entire source for each module is there...so it's not proprietary or else someone would get sued

    And no, they don't get filled in with dummy code, they get built with drivers that have been adapted for the specific board and then for the specific phone model and kernel code. Modules add in what the kernel leaves out...the kernel might say "initialize wifi chip, load driver and then connect", but the main code with all the specifics of how to do that is actually stored in the wifi module (dhd.ko)