Skip to content

A simple example of Linux (hardhat) kernel module for Motorola MotoMAGX phones.

Notifications You must be signed in to change notification settings

EXL/hellomoto_kmod

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 

Repository files navigation

hellomoto_kmod

Example of Linux (hardhat) kernel module for MotoMAGX phones.

Requirements

Build

  1. Create directory for experiments.

    mkdir -p ~/Projects/MagxKernel
    cd ~/Projects/MagxKernel
  2. Download and install MotoMAGX Toolchain & SDK, setup it.

    TODO

  3. Download MotoMAGX mini-platform build system framework, unpack it and setup.

    curl -LOJ "https://master.dl.sourceforge.net/project/motozinezn5.motorola/MOTOZINE%20ZN5/R6637_G_81.11.2CR_128/platform-R6637_G_81.11.2CR_128.tgz"
    tar -xvzf platform-R6637_G_81.11.2CR_128.tgz
    
    # Fix wrong file rights and set executable flag on necessary script.
    find platform -type f ! -path "*/.git/*" -exec chmod 0644 {} \;
    chmod 0755 platform/tools/bin/api_manager
    
    mv platform/Makefile.top Makefile
    
    # Just set "COMPILERTOOLPATH" variable to our MotoMAGX Toolchain & SDK.
    sed -i 's/COMPILERTOOLPATH = \/vobs\/jem\/cee4_lsp\/mobilinux\/devkit\/arm\/v6_vfp_le\/bin/COMPILERTOOLPATH = \/arm-eabi\/bin/g' Makefile
  4. Download Linux (hardhat) sources, unpack it, setup and compile.

    curl -LOJ "https://master.dl.sourceforge.net/project/motozinezn5.motorola/MOTOZINE%20ZN5/R6637_G_81.11.2CR_128/hardhat-R6637_G_81.11.2CR_128.tgz"
    tar -xvzf hardhat-R6637_G_81.11.2CR_128.tgz
    
    # Fix some compilation error via patching vanilla file.
    # Additional information: https://github.com/GodFox/magx_kernel_xpixl/pull/1
    sed -i 's/+ =/+=/g' hardhat/linux-2.6.x/drivers/media/dvb/b2c2/Makefile
    
    make hardhat.dir V=1

    Alternatively, you can use the already patched and modern kernel sources from magx_kernel_xpixl by GodFox and motomagx-kernel_linux_hardhat by fill.sa projects.

    # 1. https://github.com/fillsa/motomagx-kernel_linux_hardhat by fill.sa.
    git clone https://github.com/fillsa/motomagx-kernel_linux_hardhat hardhat
    cd hardhat
    ln -s properties.xpixl.11.2cr properties
    cd ..
    
    # 2. https://github.com/GodFox/magx_kernel_xpixl by GodFox.
    git clone https://github.com/GodFox/magx_kernel_xpixl hardhat
  5. Download this Linux (hardhat) kernel module sources and compile it.

    git clone https://github.com/EXL/hellomoto_kmod
    make hellomoto_kmod.dir V=1
  6. Get compiled and ready to use Linux (hardhat) kernel module hellomoto.ko from build/hellomoto_kmod/lib/modules/2.6.10_dev/extra/ directory.

Use

insmod hellomoto.ko
dmesg

# Simulate pressing the "1" button on keypad.
# See all keycodes here: https://github.com/fillsa/motomagx-kernel_linux_hardhat/blob/master/linux-2.6.x/include/linux/keypad.h
echo "1" > /proc/hellomoto
dmesg

# Get status of camera lens cover by GPIO pin.
# See GPIO signals here: https://github.com/fillsa/motomagx-kernel_linux_hardhat/blob/master/linux-2.6.x/include/asm-arm/mot-gpio.h
cat /proc/hellomoto

Information

See additional information in the The Linux Kernel Module Programming Guide | 5.2. Read and Write a /proc File article, TODO article, and Сборка ядра для ZN5. Compiling your own kernel | TODO (in Russian) thread post.

// TODO: Fix link, add exlmoto.ru article

Releases

No releases published

Packages

No packages published