Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Re: HOW-TO: Compile Custom Kernel Modules
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2014-02-14
11:28 AM
2014-02-14
11:28 AM
HOW-TO: Compile Custom Kernel Modules
This example is using my setup, which happens to be a RNDU6000 which I upgraded from 4.x to be able to run 6.x OS (http://www.readynas.com/forum/viewtopic.php?f=35&t=70323)
I'm creating this because the info was spread across multiple threads here, and was unclear in some spots, with conflicting info.
First, grab the source for the version you have installed. 6.1.6 in my case: http://www.readynas.com/download/GPL/readynasos/ReadyNASOS_V6.1.6_WW_src.zip
Other versions: http://www.readynas.com/download/GPL/index.php?dir=readynasos
Older versions: http://www.readynas.com/download/GPL/index.php
Alternative URL: http://kb.netgear.com/app/answers/detail/a_id/20684/
This will extract a lot of stuff, but one directory of value will be the 'linux-3.0.101' or similar dir!
Where we can find the previous config file, and work from there. THIS IS EXTREMELY IMPORTANT TO START FROM:
You'll need some additional packages to be able to compile the kernel:
These should be available, but if not, check /etc/apt/sources.list for these values:
and then update:
and try again.
You now should be able to configure your kernel:
Select whatever modules you want/need.
Then compile (YOU CANNOT ONLY COMPILE THE MODULES, YOU MUST RUN THIS FULL KERNEL COMPILE😞
You now should have available and installed into /lib/modules/3.0.101.RNx86_64.2.1/ your new modules.
modprobe and enjoy! (you may need to run depmod -a to have the new modules found by modprobe.
I'm creating this because the info was spread across multiple threads here, and was unclear in some spots, with conflicting info.
First, grab the source for the version you have installed. 6.1.6 in my case: http://www.readynas.com/download/GPL/readynasos/ReadyNASOS_V6.1.6_WW_src.zip
Other versions: http://www.readynas.com/download/GPL/index.php?dir=readynasos
Older versions: http://www.readynas.com/download/GPL/index.php
Alternative URL: http://kb.netgear.com/app/answers/detail/a_id/20684/
sudo su
cd
mkdir temp
cd temp
wget http://www.readynas.com/download/GPL/readynasos/ReadyNASOS_V6.1.6_WW_src.zip
unzip ReadyNASOS_V6.1.6_WW_src.zip
This will extract a lot of stuff, but one directory of value will be the 'linux-3.0.101' or similar dir!
Where we can find the previous config file, and work from there. THIS IS EXTREMELY IMPORTANT TO START FROM:
- You will need to compile the full kernel so any modules have proper references
- You need a custom kernel name reference which is present in this config
cd ~root/temp/linux-3.0.101
cp defconfig.x86_64 .config
You'll need some additional packages to be able to compile the kernel:
sudo apt-get install build-essential libncurses5-dev
These should be available, but if not, check /etc/apt/sources.list for these values:
deb http://apt.readynas.com/packages/readynasos 6.1.6 updates apps main
deb http://mirrors.kernel.org/debian wheezy main
deb http://ftp.us.debian.org/debian wheezy main non-free
and then update:
apt-get update
and try again.
You now should be able to configure your kernel:
make menuconfig
Select whatever modules you want/need.
Then compile (YOU CANNOT ONLY COMPILE THE MODULES, YOU MUST RUN THIS FULL KERNEL COMPILE😞
make ARCH=x86_64
make modules_install ARCH=x86_64
You now should have available and installed into /lib/modules/3.0.101.RNx86_64.2.1/ your new modules.
modprobe and enjoy! (you may need to run depmod -a to have the new modules found by modprobe.
Message 1 of 5
Labels:
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2014-02-14
07:40 PM
2014-02-14
07:40 PM
Re: HOW-TO: Compile Custom Kernel Modules
Thank you. I will be doing this again soon and it will save me looking all over how to do it again 🙂
Message 2 of 5
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2014-03-07
11:14 AM
2014-03-07
11:14 AM
Re: HOW-TO: Compile Custom Kernel Modules
Great tutorial. I've been working on cross-compiling for ARM platforms, because who wants to compile an entire kernel on an ARM?
Basic steps are the same, I used the ReadyNAS App Development VM available from:
http://apps.readynas.com/pages/?page_id=127
Your modules will be available in /tmp/build/modules. For simple modules such as USB serial and such you should be OK with just copying the modules over, however more advanced things (iptables NAT for instance) require replacing the kernel as well.
Basic steps are the same, I used the ReadyNAS App Development VM available from:
http://apps.readynas.com/pages/?page_id=127
######## Setup our temporary build environment ##########
# cd
# pwd
/home/readynas
# sudo apt-get update; sudo apt-get install build-essential ia32-libs ncurses-dev
(You may run into some issues with libsane and its config files; do it live and just delete everything in /etc/sane.d/)
# wget http://www.readynas.com/download/GPL/readynasos/armv7-marvell-linux-gnueabi-hard_i686_201201.tar.xz
(This is our cross compilation toolchain for ARM)
# wget http://readynas.com/download/GPL/readynasos/ReadyNASOS_V6.1.6_WW_src.zip
# mkdir /tmp/GPL; mkdir -p /tmp/build/modules
# unzip -q ReadyNASOS_V6.1.6_WW_src.zip -d /tmp/GPL
# tar -C /tmp/build/ -xJf armv7-marvell-linux-gnueabi-hard_i686_201201.tar.xz
# cp -R /tmp/GPL/linux-3.0.101 /tmp/build/linux-3.0.101.arm
# cp /tmp/build/linux-3.0.101.arm/defconfig.arm /tmp/build/linux-3.0.101.arm/.config
######## Drop to a root shell and compile ##########
# sudo -i
# export ARCH=arm
# export PATH=$PATH:/tmp/build/Marvell_toolchain_201201/armv7-marvell-linux-gnueabi-hard_i686/bin
# export CROSS_COMPILE=arm-marvell-linux-gnueabi-
# export CORES=`nproc`
(This gets the available number of cores on the system.)
# export INSTALL_MOD_DIR=/tmp/build/modules
# cd /tmp/build/linux-3.0.101.arm
# make menuconfig
# make -j$CORES
# make -j$CORES modules_install
Your modules will be available in /tmp/build/modules. For simple modules such as USB serial and such you should be OK with just copying the modules over, however more advanced things (iptables NAT for instance) require replacing the kernel as well.
Message 3 of 5
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2014-06-05
05:10 AM
2014-06-05
05:10 AM
Re: HOW-TO: Compile Custom Kernel Modules
I still running in to some errors when i'm trying to compile the desired modules...
I have a ReadyNas RN102, with firmware 6.1.8.
I want to compile the usb serial driver modules:
- PL2023
- Generic Serial
I did al the above instructions, accept:
- I copied this file /linux-3.0.101-0.15/arch/arm/configs/armada370_nas_defconfig to /linux-3.0.101-0.15/.config
- Then I ran menuconfig, and enabled the modules.
- Followed by make arch=arm
Then I receive the following error:
make: arm-mv7-linux-gnueabi-gcc: Command not found
This must have something to do with cross-compiling. But as far as I know, I don't want to crosscompile, because i'm compiling on the machine.
I tried to edit te .config file. Commented the line: #CONFIG_CROSS_COMPILE="arm-mv7-linux-gnueabi-"
Then its starts compile, but in the end I see a lot of errors and can't find my modules...
Any help would be appreciated!
I have a ReadyNas RN102, with firmware 6.1.8.
I want to compile the usb serial driver modules:
- PL2023
- Generic Serial
I did al the above instructions, accept:
- I copied this file /linux-3.0.101-0.15/arch/arm/configs/armada370_nas_defconfig to /linux-3.0.101-0.15/.config
- Then I ran menuconfig, and enabled the modules.
- Followed by make arch=arm
Then I receive the following error:
make: arm-mv7-linux-gnueabi-gcc: Command not found
This must have something to do with cross-compiling. But as far as I know, I don't want to crosscompile, because i'm compiling on the machine.
I tried to edit te .config file. Commented the line: #CONFIG_CROSS_COMPILE="arm-mv7-linux-gnueabi-"
Then its starts compile, but in the end I see a lot of errors and can't find my modules...
Any help would be appreciated!
Message 4 of 5
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2015-10-27
06:27 AM
2015-10-27
06:27 AM
Re: HOW-TO: Compile Custom Kernel Modules
Good morning,
I'm looking at how to compile kernel modules following your instructions, however I run into a bunch of issues:
- if using local compilation on the NAS itself, the make command exits as it cannot find the cross compile toolchain (which is odd, since I'm using local compile...)
- when trying to use the ReadyNAS VM you reference:
- basic apt-get commands fail, trying to resolve a link which apparently does not exist anymore (even a simple apt-get install man-db fails). Likewise, apt-get update fails on several IP (which however do resolve)
- the link to the cross compiler you indicate below does not exist anymore...
Any help would be welcome
Thanks
Vincent
Message 5 of 5