Differenze tra le versioni di "Compile the Linux kernel for Chip: my personal HOWTO"
Riga 96: | Riga 96: | ||
scp /extra/tmp/chip/LINUX/CHIP-linux/config-4.3.0rd/boot235+ root@10.1.1.2:/boot | scp /extra/tmp/chip/LINUX/CHIP-linux/config-4.3.0rd/boot235+ root@10.1.1.2:/boot | ||
scp /extra/tmp/chip/LINUX/CHIP-linux/System.map root@10.1.1.2:/boot/System.map-4.3.0rd235+ | scp /extra/tmp/chip/LINUX/CHIP-linux/System.map root@10.1.1.2:/boot/System.map-4.3.0rd235+ | ||
− | + | ||
− | + | # I am editing this part | |
− | |||
</pre> | </pre> | ||
Versione delle 16:24, 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-4.3.0rd/boot235+ root@10.1.1.2:/boot scp /extra/tmp/chip/LINUX/CHIP-linux/System.map root@10.1.1.2:/boot/System.map-4.3.0rd235+ # I am editing this part
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+ <pre> The command to run the new kernel is: <pre> 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+