Differenze tra le versioni di "Compile the Linux kernel for Chip: my personal HOWTO"
m (→My config file) |
|||
Riga 146: | Riga 146: | ||
Otherwise it is possible to set my kernel as the default kernel: | Otherwise it is possible to set my kernel as the default kernel: | ||
− | '''Warning: | + | '''Warning: in this way if chip does not boot you need a USB console cable to reboot using /boot/zImage.bak (or you must reflash chip)''' |
<pre> | <pre> | ||
cd /boot | cd /boot | ||
cp vmlinuz-4.3.0rd235+ zImage | cp vmlinuz-4.3.0rd235+ zImage | ||
<pre> | <pre> |
Versione delle 18:32, 12 feb 2016
This is my personal "How to compile a new kernel for CHIP on Debian". (My laptop is debian SID)
pre-requisites
You'll need a number of packets. I don't know if this list is complete. It you are used to compiling kernels you already have all what you need.
apt-get install git build-essential fakeroot kernel-package zlib1g-dev libncurses5-dev
You'll need the cross compiling toolchain.
apt-get install gcc-arm-linux-gnueabihf binutils-arm-linux-gnueabihf
CHIP-linux
Create a working dir and enter it. Mine is /extra/tmp/chip/LINUX. Then clone git repositories from NTC.
cd /extra/tmp/chip/LINUX git clone https://github.com/NextThingCo/CHIP-linux.git
checkout the same version provided by NTC's Debian repo.
cd CHIP-linux git checkout -b debian/4.3.0-ntc-4 origin/debian/4.3.0-ntc-4
Copy the config file from your chip. My chip is connected as 10.1.1.2:
scp 10.1.1.2:/boot/config-4.3.0 .
Configure the kernel:
make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabihf- menuconfig
IMPORTANT: add a local version suffix. Follow the menus:
General setup ---> () Local version - append to kernel release
my personal suffix is rd235.
You may want to pass through the menus and add a lot of modules. (As a first experiment I suggest to compile the same standard configuration and test if everything is stable, then in a second time I'd add the modules).
Now it is possible to compile the kernel. The parameter -j should be set to the number of cores of your computer + 1. I have an 8-core (4 real cores + 4 hyperthreads), so I use 9.
make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabihf- -j 9
I install the modules on /tmp/lib (just to have a fake hierarchy to be copied on chip).
mkdir /tmp/lib make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabihf- INSTALL_MOD_PATH=/tmp/lib modules_install
RTL8723BS is an out-of-tree module
Everything is provided by the CHIP-linux tree but the RTL8723BS module. This is a bit harder.
Clone the repository.
cd /extra/tmp/chip/LINUX git clone https://github.com/NextThingCo/RTL8723BS.git
switch to the debian branch:
git checkout -b debian origin/debian
apply debian patches:
for i in debian/patches/0*; do echo $i; patch -p 1 <$i ; done
compile the module:
make -j 9 CONFIG_PLATFORM_ARM_SUNxI=y ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabihf- -C /extra/tmp/chip/LINUX/CHIP-linux/ M=$PWD CONFIG_RTL8723BS=m INSTALL_MOD_PATH=/tmp/lib make -j 9 CONFIG_PLATFORM_ARM_SUNxI=y ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabihf- -C /extra/tmp/chip/LINUX/CHIP-linux/ M=$PWD CONFIG_RTL8723BS=m INSTALL_MOD_PATH=/tmp/lib modules_install
Move everything on chip
It is a jigsaw-puzzle.
scp /extra/tmp/chip/LINUX/CHIP-linux/arch/arm/boot/zImage root@10.1.1.2:/boot/vmlinuz-4.3.0rd235+ scp /extra/tmp/chip/LINUX/CHIP-linux/.config root@10.1.1.2:/boot/config-4.3.0rd235+ scp /extra/tmp/chip/LINUX/CHIP-linux/System.map root@10.1.1.2:/boot/System.map-4.3.0rd235+ cd /tmp/lib/lib/modules tar cf - 4.3.0rd235+ | ssh root@10.1.1.2 'cd /lib/modules; tar xf -' cd ../firmware/ tar cf - . | ssh root@10.1.1.2 'mkdir /lib/firmware/4.3.0rd235+; cd /lib/firmware/4.3.0rd235+; tar xf -'
boot your new kernel
Use this previous howto of mine to boot your new kernel. The image name in this example is:
/boot/vmlinuz-4.3.0rd235+
The command to run the new kernel is:
sunxi# setenv bootcmd 'source ${scriptaddr}; nand slc-mode on; mtdparts; ubi part UBI; ubifsmount ubi0:rootfs; ubifsload $fdt_addr_r /boot/sun5i-r8-chip.dtb; ubifsload $kernel_addr_r /boot/vmlinuz-4.3.0rd235+; bootz $kernel_addr_r - $fdt_addr_r'
(i.e. copy the entire output of "printenv bootcmd" changing "/boot/zImage" in "/boot/vmlinuz-4.3.0rd235+")
When you are confident enough to use your new kernel as th default one copy /boot/vmlinuz-4.3.0rd235+ to /boot/zImage.
clean up after a failed test
In case you want to delete your kernel on chip:
rm -rf /boot/vmlinuz-4.3.0rd235+ /boot/config-4.3.0rd/boot235+ boot/System.map-4.3.0rd235+ /lib/modules/4.3.0rd235+ /lib/firmware/4.3.0rd235+
My config file
This is a config file providing about 1300 modules. Among the others support for NAT for IPV4, all USB-gadget submodules, USB dongles for networking and multimedia. config-4.3.0rd235+
... if you want to test my kernel
THIS IS AN EXPERIMENTAL KERNEL. TRY IT AT YOUR OWN RISK!
Login as root (or run "sudo bash" in a terminal). Download chiplinux4.3.0rd235+.tgz in the /tmp direactory of your chip.
cd / tar zxf chiplinux4.3.0rd235+.tgz
Now if you have a USB console cable you can test my kernel as explained above.
Otherwise it is possible to set my kernel as the default kernel: Warning: in this way if chip does not boot you need a USB console cable to reboot using /boot/zImage.bak (or you must reflash chip)
cd /boot cp vmlinuz-4.3.0rd235+ zImage