How to build kernel modules for OS5

Building kernel modules for 32bit firmware v5.x

In the example below my own toolchain is used:

# (1) extract the GPL code matching your firmware version

# (2) go to the extracted kernel source
cd Kernel/source/linux-2.6.33

# (3) prepare environment
export PATH=/path/to/toolchain/i686-thecus32v5-linux-gnu/bin:$PATH

# (4) prepare the kernel sources
make ARCH=i386 CROSS_COMPILE=i686-thecus32v5-linux-gnu- prepare
make ARCH=i386 CROSS_COMPILE=i686-thecus32v5-linux-gnu- scripts

# (5) build the modules
make M=drivers/usb/serial ARCH=i386             \
    CROSS_COMPILE=i686-thecus32v5-linux-gnu-    \
    CONFIG_USB_SERIAL=m                         \
    CONFIG_USB_SERIAL_FTDI_SIO=m                \
    CONFIG_USB_SERIAL_PL2303=m                  \
    modules

Building kernel modules for 64bit firmware v2.x (non-Atom CPU)

In the example below my own toolchain is used:

# (1) extract the GPL code matching your firmware version

# (2) go to the extracted kernel source
cd Kernel/source/linux-2.6.33

# (3) prepare environment
export PATH=/path/to/toolchain/x86_64-thecus64v1-linux-gnu/bin:$PATH

# (4) Copy configuration
cp N16000.config .config

# (5) Copy Module.symvers
cp Module.symvers.<version> Module.symvers

# (6) prepare the kernel sources
make ARCH=x86_64 CROSS_COMPILE=x86_64-thecus64v1-linux-gnu- prepare
make ARCH=x86_64 CROSS_COMPILE=x86_64-thecus64v1-linux-gnu- scripts

# (7) build the modules
make M=drivers/usb/serial ARCH=x86_64           \
    CROSS_COMPILE=x86_64-thecus64v1-linux-gnu-  \
    CONFIG_USB_SERIAL=m                         \
    CONFIG_USB_SERIAL_FTDI_SIO=m                \
    CONFIG_USB_SERIAL_PL2303=m                  \
    modules

Building kernel modules for 64bit firmware v2.x (Atom CPU)

In the example below my own toolchain is used:

# (1) extract the GPL code matching your firmware version

# (2) go to the extracted kernel source
cd Kernel/source/linux-2.6.33

# (3) prepare environment
export PATH=/path/to/toolchain/x86_64-thecus64v1-linux-gnu/bin:$PATH

# (4) apply atom patch
patch -p1 < atom.patch

# (5) Copy configuration

cp N16000.config .config

# (6) Copy Module.symvers
cp Module.symvers.<version>.atom Module.symvers

# (7) prepare the kernel sources
make ARCH=x86_64 CROSS_COMPILE=x86_64-thecus64v1-linux-gnu- prepare
make ARCH=x86_64 CROSS_COMPILE=x86_64-thecus64v1-linux-gnu- scripts

# (8) build the modules
make M=drivers/usb/serial ARCH=x86_64           \
    CROSS_COMPILE=x86_64-thecus64v1-linux-gnu-  \
    CONFIG_USB_SERIAL=m                         \
    CONFIG_USB_SERIAL_FTDI_SIO=m                \
    CONFIG_USB_SERIAL_PL2303=m                  \
    modules