- Incorporate Wi-Fi access point into NAS driver.
- Eliminate requirement for attaching ADSL / Wi-Fi switch.
- Eliminate requirement for attaching secondary USB Ethernet port.
- Upgrade kernel from 2.6 to 3.X.
- Setup PPPoE on primary Ethernet port to also eliminate the need for an ADSL modem.
How to summary:
Let me summarize the three previous posts and fill in the gaps on how I eventually got this all to work. So firstly, let's mention that I couldn't get this working using the 3.2 kernel, though I am yet to identify the reason, given my TTL cable has only just arrived. So a 3.4 kernel is a minimum requirement. Building is fairly simple, you can do it on box (NAS) or cross compile it. The choice is yours, but it could be the difference between 7 hours or 5 minutes. Cross compiling on my i7 running parallel make processes up to a load average of 15, utilises all the memory and finishes the entire kernel build, including modules, in around four and a half minutes. Great if you need keep changing it in experimentation mode! I have a script that can be downloaded for making cross compilation a simple one-liner. It will ask for permission to install the necessary modules for cross compilation against ARM architecture and will auto create base kernel configuration. It has a usage '--help' option, so if you choose to use it, check out the options: --menuconfig is a good one to note, since you will need that for selecting the appropriate kernel modules.
Building the kernel:
Building is fairly straight forward. Depending on the platform, be it, armel or armhf, you can use the gnueabi cross compiler. To get started, install the following packages:
Next you need to be aware that all make invocations need to run with the architecture and cross compiler options set. The simplest way to make sure you get this right is to run the following:
alias make='make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi-'
This way, you can't forget! I actually went to the extent of creating a new user with this set in the .bashrc file.
So to build the kernel, clean it out first:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- mrproper
Now copy in your existing configuration. This will be the configuration you have on the target machine, not the one you are building on. The easiest way to obtain it, is to use the following command:
ssh you@yourmachine "zcat /proc/config.gz" > ~/linux-3.4.X/.config
The output file is within the root of the kernel source you will build.
Now you have that in place, you will need to upgrade the configuration. Run:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- oldconfig
That will prompt you for some details about what modules to build. For this, you may choose to accept the defaults. You should then change the following settings in the file:
CONFIG_ARCH="arm"
CONFIG_CROSS_COMPILE="arm-linux-gnueabi-"
CONFIG_LOCALVERSION="-2012-12-12-1212"
CONFIG_LOCALVERSION_AUTO=n
Once you have been through the setup, you then just need to setup the Atheros modules.
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- menuconfig
This will start the graphical menu configuration. To build the Atheros drivers for the TP-LINK device, you need to locate them under:
Before you can select what Atheros drivers to build, you must first select this category using the space bar. Once selected, you can hit enter to expand the category and enable the following modules:
Once you have selected these modules and any others you desire, you can exit the menu and build the kernel. Now, the target you need to build with depends on whether you need the uboot hack. If you are installing this kernel on your hacked Buffalo LinkStation NAS, you will need to build the zImage and perform the necessary hacks to create your uImage. However, if you are using a standard uboot configuration, then just get cracking by using the uImage target:
make -j -l 15 ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage modules
For the uImage hack:
make -j -l 15 ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- zImage modules
( devio 'wl 0xe3a01c06,4' 'wl 0xe3811031,4' ; cat arch/arm/boot/zImage ) > /tmp/zImage
mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n linux -d /tmp/zImage arch/arm/boot/uImage
Next, setup the modules install package, by installing them into a temporary directory.
make -j -l 15 ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- modules_install INSTALL_MOD_PATH=/some/temporary/path
You will now have a uImage that you can copy into your boot partition on your ARM device. You will also have modules setup and ready to install. To install them, use ssh to transfer them across:
( cd /some/temporary/path ; tar Jcf - lib ) | ssh you@yourmachine "cd / && sudo tar Jxvf && sudo chown -R root:root /lib/modules/linux-3.4.X-2012-12-12-1212"
You get the idea. But you can get the modules and firmware on however you choose.
Building is fairly straight forward. Depending on the platform, be it, armel or armhf, you can use the gnueabi cross compiler. To get started, install the following packages:
- g++-arm-linux-gnueabi
- dpkg-cross
- devio
- fakeroot
- uboot-mkimage
- u-boot-tools
If you want to use the graphical menu configuration tool, then also install:
- libcurses5
- libcurses5-dev
Next you need to be aware that all make invocations need to run with the architecture and cross compiler options set. The simplest way to make sure you get this right is to run the following:
alias make='make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi-'
This way, you can't forget! I actually went to the extent of creating a new user with this set in the .bashrc file.
So to build the kernel, clean it out first:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- mrproper
Now copy in your existing configuration. This will be the configuration you have on the target machine, not the one you are building on. The easiest way to obtain it, is to use the following command:
ssh you@yourmachine "zcat /proc/config.gz" > ~/linux-3.4.X/.config
The output file is within the root of the kernel source you will build.
Now you have that in place, you will need to upgrade the configuration. Run:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- oldconfig
That will prompt you for some details about what modules to build. For this, you may choose to accept the defaults. You should then change the following settings in the file:
CONFIG_ARCH="arm"
CONFIG_CROSS_COMPILE="arm-linux-gnueabi-"
CONFIG_LOCALVERSION="-2012-12-12-1212"
CONFIG_LOCALVERSION_AUTO=n
Set the LOCALVERSION to the date in the form of YYYY-MM-DD-HHMM. This makes it easier to identify when you built it, as opposed to some sequential value. Alternatively, set it to some unique name that you would prefer to use.
Once you have been through the setup, you then just need to setup the Atheros modules.
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- menuconfig
This will start the graphical menu configuration. To build the Atheros drivers for the TP-LINK device, you need to locate them under:
Device Drivers ---> Network Device Support ---> Wireless LAN ---> Atheros Wireless Cards
Once you have selected these modules and any others you desire, you can exit the menu and build the kernel. Now, the target you need to build with depends on whether you need the uboot hack. If you are installing this kernel on your hacked Buffalo LinkStation NAS, you will need to build the zImage and perform the necessary hacks to create your uImage. However, if you are using a standard uboot configuration, then just get cracking by using the uImage target:
make -j -l 15 ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage modules
For the uImage hack:
make -j -l 15 ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- zImage modules
( devio 'wl 0xe3a01c06,4' 'wl 0xe3811031,4' ; cat arch/arm/boot/zImage ) > /tmp/zImage
mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n linux -d /tmp/zImage arch/arm/boot/uImage
Next, setup the modules install package, by installing them into a temporary directory.
make -j -l 15 ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- modules_install INSTALL_MOD_PATH=/some/temporary/path
You will now have a uImage that you can copy into your boot partition on your ARM device. You will also have modules setup and ready to install. To install them, use ssh to transfer them across:
( cd /some/temporary/path ; tar Jcf - lib ) | ssh you@yourmachine "cd / && sudo tar Jxvf && sudo chown -R root:root /lib/modules/linux-3.4.X-2012-12-12-1212"
You get the idea. But you can get the modules and firmware on however you choose.
No comments:
Post a Comment