Results 1 to 2 of 2

Thread: [Help] Compiling Drivers for Chrooted Environment

  1. #1
    Join Date
    2013-Nov
    Posts
    1

    [Help] Compiling Drivers for Chrooted Environment

    Hi,

    First of all a thanks to anyone who lends a hand on this one!!

    I am trying to compile drivers for a chrooted (Kali Linux) environment on a Galaxy Tab2 (P5100) as well as other devices. I seem to have hit a stumbling block as the information on building kernel source with imported drivers seems to be sparse and I have cobbled together bits and pieces from multiple forums however no success! If I manage to successfully complete this insane task I play to fully document the process as a guide here and on a blog.

    I will lay out the stages below from where I am at.

    Tablet = Samsung Galaxy Tab 2 - P5100 Model
    ROM: CyanogenMod 10.1.3-p5100
    Device: USB Alfa AWUS036H (RTL8187L driver)
    Development Environment: Ubuntu 12.04 64 bit

    I have successfully configured a Kali Linux Chrooted Environment

    Commands issued on ubuntu to compile the drivers, please tell me where I am going wrong:

    ##Install agcc compilers and tools
    cd /tmp
    wget https://neurodroid.googlecode.com/git/nrn/agcc
    wget https://neurodroid.googlecode.com/git/nrn/agcc-vfp
    sudo mv agcc* /usr/local/bin
    sudo chmod +x /usr/local/bin/agcc*
    sudo apt-get install vim vim-common make cmake lzop gcc git python

    ##SDK & NDK Tools installed at ~/android-adt/ndk & ~/android-adt/sdk
    ##Update the build path with the SDK and NDK tools
    PATH=~/android-adt/sdk/platform-tools:~/android-adt/sdk/tools:~/android-adt/ndk:$PATH
    cd ~/android-adt/ndk/build/tools

    #remove any previously built toolchain
    rm -rf ${HOME}/android-toolchain
    #create new toolchain for android 4.2
    ./make-standalone-toolchain.sh --arch=arm --ndk-dir=${HOME}/android-adt/ndk --install-dir=${HOME}/android-toolchain --platform=android-17 --system=linux-x86_64
    PATH=~/android-toolchain/bin:$PATH

    ##Get the kernel for the ROM (Galaxy Tab 2 p5100, cyanmodgen 10.2)
    cd ~
    git clone https://github.com/CyanogenMod/andro...espresso10.git

    ##Modify the make file in the kernel
    cd android_kernel_samsung_espresso10
    nano Makefile
    ##Change the CFLAGS_MODULE line and add -fno-pic

    ##Compile the kernel source
    make ARCH=arm clean
    make ARCH=arm cyanogenmod_p5100_defconfig
    make -j4 ARCH=arm CROSS_COMPILE=arm-linux-androideabi-

    Now this is as far as I seem to be able to get without any errors, some warning however! The last step does produce the zImage but I want the *.ko drivers for RTL8187

    So what is the next step? Download the source drivers from Realtek copy them too ~/android_kernel_samsung_espresso10/drivers/net/wireless? then what?

    Any help would be greatly appreciated!!

    Thanks

    Gazos

  2. #2
    Join Date
    2013-Apr
    Posts
    14
    You don't really need to produce a kernel module to do this. If you did you would need to make sure module loading is supported by your kernel, or recompile to enable it.

    What I did for nexus 7 and nexus 5 was enable it in the kernel config before compiling. You can cd to you kernel source then run

    $ make menuconfig

    Then you can enable it yourself. Here's a pastebin of a n7 config with rtl8187 enabled that you can use for reference.
    http://pastebin.com/h2a0WzY0
    Make sure you set your options to "y" not "m" so it compiles statically.

    After your options are set compile your kernel.

    When you have your zimage you need to extract your boot.img from your device and use boot.IMG tools (Google it) to split the image, swap in your zimage, then remake the image. You may then flash it to your device with fastboot.

    Then with your awus adapter connected, open up a root terminal and type

    $ ifconfig wlan1 up

    Since a chroot shares the running kernel this will work from an android shell as well as one in your chroot.

    Hope that helps.
    Last edited by m4xx3d0ut; 2013-12-11 at 20:14. Reason: missing info

Similar Threads

  1. Replies: 13
    Last Post: 2016-01-26, 14:05
  2. compiling kwavecontrol (or alternative?)
    By ball in forum General Archive
    Replies: 2
    Last Post: 2015-09-24, 08:47
  3. Errors when compiling the kernel
    By @nonymous in forum Building NetHunter
    Replies: 8
    Last Post: 2015-04-20, 05:32

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •