I've had quite a few requests to include or create kernel modules for the debian image. So here are instruction to compile a kernel. There's plenty of information on the web for compiling kernels for the A10 and its not that difficult. All you require is a machine with Linux. Its best to do some background reading on using 'git' if you are not familiar with it. These instructions are for Ubuntu.
I've updated these instructions so that they use hard float instead of soft float which should give an increase in performance. 'arm-linux-gnueabi' is replaced with 'arm-linux-gnueabihf'
I've updated these instructions so that they use hard float instead of soft float which should give an increase in performance. 'arm-linux-gnueabi' is replaced with 'arm-linux-gnueabihf'
First retrieve the build and cross compiler tools:
sudo apt-get install gcc-arm-linux-gnueabihf build-essential git uboot-mkimage libncurses5-dev
Next create a directory where you want build the kernel and retrieve the kernel source from git. This will take some time. Note the old repository was git://github.com/amery/linux-allwinner.git it has now move to git://github.com/linux-sunxi/linux-sunxi.
mkdir kernel
cd kernel
git clone git://github.com/linux-sunxi/linux-sunxi
Now switch to branch you are interested in, the current stable is linux-sunxi. For debian I'm currently using revision 23e5456879db0175f571dec43095c49e181e0b10 (3.0.36+). Note kernels version beyond 3.0.36+ ethernet (eth0) on the hackberry fails to initialise correctly, see my patch at the end of the blog for a temporary fix.
cd linux-sunxi
git checkout 23e5456879db0175f571dec43095c49e181e0b10
next step is to create a default kernel config, this creates a .config file.
make ARCH=arm sun4i_defconfig
now to add additional modules or change kernel settings do
make ARCH=arm menuconfig
Now can compile the kernel and modules
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j3 uImage
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j3 INSTALL_MOD_PATH=output modules
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j3 INSTALL_MOD_PATH=output modules_install
Last step is to copy the kernel (uImage) to the boot fat partition and the kernel modules to the ext4 partition. Note keep track of the kernel version that is in .config as this will determine which modules directory has to be copied across. Here is the example for the debian image and git revision 23e5456879db0175f571dec43095c49e181e0b10.
cp arch/arm/boot/uImage /media/BOOT/
cp -rp output/lib/modules/3.0.36+/kernel /media/debian/lib/modules/3.0.36+
---------------------------------------------------------------------------------
Patch for ethernet initialisation failure:
--- a/drivers/net/sun4i/sun4i_wemac.c
+++ b/drivers/net/sun4i/sun4i_wemac.c
@@ -53,7 +53,7 @@
#define DRV_VERSION "1.01"
#define DMA_CPU_TRRESHOLD 2000
#define TOLOWER(x) ((x) | 0x20)
-#define PHY_POWER 0
+#define PHY_POWER 1
/*
* Transmit timeout, default 5 seconds.
*/
@@ -1563,7 +1563,8 @@ static int wemac_phy_read(struct net_device *dev, int phyaddr_unused, int reg)
writel(0x1, db->emac_vbase + EMAC_MAC_MCMD_REG);
spin_unlock_irqrestore(&db->lock, flags);
- wemac_msleep(db, 1); /* Wait read complete */
+ // wemac_msleep(db, 1); /* Wait read complete */
+ udelay(150); /* 100 */
/* push down the phy io line and read data */
spin_lock_irqsave(&db->lock, flags);
@@ -1596,7 +1597,8 @@ static void wemac_phy_write(struct net_device *dev,
writel(0x1, db->emac_vbase + EMAC_MAC_MCMD_REG);
spin_unlock_irqrestore(&db->lock, flags);
- wemac_msleep(db, 1); /* Wait write complete */
+// wemac_msleep(db, 1); /* Wait write complete */
+ udelay(150); /* 100 */
spin_lock_irqsave(&db->lock, flags);
/* push down the phy io line */
---------------------------------------------------------------------------------
Patch for ethernet initialisation failure:
--- a/drivers/net/sun4i/sun4i_wemac.c
+++ b/drivers/net/sun4i/sun4i_wemac.c
@@ -53,7 +53,7 @@
#define DRV_VERSION "1.01"
#define DMA_CPU_TRRESHOLD 2000
#define TOLOWER(x) ((x) | 0x20)
-#define PHY_POWER 0
+#define PHY_POWER 1
/*
* Transmit timeout, default 5 seconds.
*/
@@ -1563,7 +1563,8 @@ static int wemac_phy_read(struct net_device *dev, int phyaddr_unused, int reg)
writel(0x1, db->emac_vbase + EMAC_MAC_MCMD_REG);
spin_unlock_irqrestore(&db->lock, flags);
- wemac_msleep(db, 1); /* Wait read complete */
+ // wemac_msleep(db, 1); /* Wait read complete */
+ udelay(150); /* 100 */
/* push down the phy io line and read data */
spin_lock_irqsave(&db->lock, flags);
@@ -1596,7 +1597,8 @@ static void wemac_phy_write(struct net_device *dev,
writel(0x1, db->emac_vbase + EMAC_MAC_MCMD_REG);
spin_unlock_irqrestore(&db->lock, flags);
- wemac_msleep(db, 1); /* Wait write complete */
+// wemac_msleep(db, 1); /* Wait write complete */
+ udelay(150); /* 100 */
spin_lock_irqsave(&db->lock, flags);
/* push down the phy io line */