Quad Core UDOO – Debian – compiling kernel 4.0.8

U-Boot 2015 http://www.igorpecovnik.com/2015/02/20/udoo-quad-debian-sd-image/

Download the software:

wget http://mirror.igorpecovnik.com/kernel/4.0.8-udoo-next.tar

extract it and only install the u-boot package:

dpkg -i linux-u-boot-4.0.8-udoo_1.8_armhf.deb


Kernel based on https://github.com/patrykk/linux-udoo

Install prerequisites:

apt-get install lzop kernel-package u-boot-tools dblatex docbook-utils \
 kernel-common libsgmls-perl libsp1c2 libtinfo-dev sgmlspl sp texlive \
 texlive-bibtex-extra texlive-math-extra xmlto xsltproc libncurses5-dev

Getting the kernel:

cd /tmp
mkdir kernel4.0.8
cd kernel4.0.8
wget https://github.com/patrykk/linux-udoo/archive/4.0.8.zip
unzip 4.0.8.zip

now change directory to the kernel folder and configure it:

make menuconfig

compile it – in my case it took approx 2 hours:

make uImage LOADADDR=0x10008000  modules

install the modules:

make modules_install

copy the kernel to /boot folder

cp arch/arm/boot/uImage /boot/
 cp arch/arm/boot/zImage /boot/

compile the dtb file:

make imx6q-udoo.dtb

copy dtb file
cp arch/arm/boot/dts/imx6q-udoo.dtb /boot/dts/
copy firmware
cp firmware/imx/sdma/sdma-imx6q.bin /lib/firmware/sdma/
configure your uboot
nano /boot/boot.cmd
then copy and paste this
setenv bootargs root=/dev/mmcblk0p1 rootfstype=ext4 rootwait console=ttymxc1,115200
ext2load mmc 0 0x18000000 /boot/dtb/imx6q-udoo.dtb
ext2load mmc 0 0x12000000 /boot/zImage
bootz 0x12000000 - 0x18000000

if you use graphical interface you will probably want to replace the first line with:

setenv bootargs root=/dev/mmcblk0p1 rootfstype=ext4 rootwait console=tty1 video=mxcfb0:dev=hdmi,1920x1080M@60,if=RGB24,bpp=32 ahci_imx.hotplug=1 quiet

then convert it to uboot format
mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr

Now cross fingers, connect console cable and restart the device


U-Boot 2015.04-dirty (Jul 13 2015 - 12:27:45)
CPU:   Freescale i.MX6Q rev1.2 at 792 MHz
 Reset cause: WDOG
 Board: Udoo
 DRAM:  1 GiB
 *** Warning - bad CRC, using default environment
In:    serial
 Out:   serial
 Err:   serial
 Net:   using phy at 6
 Hit any key to stop autoboot:  0
 switch to partitions #0, OK
 mmc0 is current device
 295 bytes read in 63 ms (3.9 KiB/s)
 Running bootscript from mmc ...
 ## Executing script at 12000000
 35681 bytes read in 138 ms (252 KiB/s)
 6491688 bytes read in 374 ms (16.6 MiB/s)
 Kernel image @ 0x12000000 [ 0x000000 - 0x630e28 ]
 ## Flattened Device Tree blob at 18000000
 Booting using the fdt blob at 0x18000000
 Using Device Tree in place at 18000000, end 1800bb60
Starting kernel ...
Booting Linux on physical CPU 0x0
 Linux version 4.0.8 (root@UDOO) (gcc version 4.9.2 (Debian 4.9.2-10) ) #3 SMP Fri
 Jul 31 19:05:40 BST 2015
 CPU: ARMv7 Processor [412fc09a] revision 10 (ARMv7), cr=10c5387d
 CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
 Machine model: Udoo i.MX6 Quad Board
 cma: Reserved 256 MiB at 0x40000000
 Memory policy: Data cache writealloc
 PERCPU: Embedded 11 pages/cpu @af731000 s12480 r8192 d24384 u45056
 Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 260096
 Kernel command line: root=/dev/mmcblk0p1 rootfstype=ext4 rootwait console=ttymxc
 1,115200 ahci_imx.hotplug=1
 PID hash table entries: 4096 (order: 2, 16384 bytes)
 Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
 Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
 Memory: 764764K/1048576K available (8251K kernel code, 298K rwdata, 2472K rodata
 , 352K init, 440K bss, 21668K reserved, 262144K cma-reserved, 0K highmem)
 Virtual kernel memory layout:
 vector  : 0xffff0000 - 0xffff1000   (   4 kB)
 fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
 vmalloc : 0xc0800000 - 0xff000000   (1000 MB)
 lowmem  : 0x80000000 - 0xc0000000   (1024 MB)
 pkmap   : 0x7fe00000 - 0x80000000   (   2 MB)
 modules : 0x7f000000 - 0x7fe00000   (  14 MB)
 .text : 0x80008000 - 0x80a811a8   (10725 kB)
 .init : 0x80a82000 - 0x80ada000   ( 352 kB)
 .data : 0x80ada000 - 0x80b24860   ( 299 kB)
 .bss : 0x80b24860 - 0x80b92b48   ( 441 kB)
 SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
 Hierarchical RCU implementation.
 NR_IRQS:16 nr_irqs:16 16
 L2C-310 erratum 769419 enabled
 L2C-310 enabling early BRESP for Cortex-A9
 L2C-310 full line of zeros enabled for Cortex-A9
 L2C-310 ID prefetch enabled, offset 1 lines
 L2C-310 dynamic clock gating enabled, standby mode enabled
 L2C-310 cache controller enabled, 16 ways, 1024 kB
 L2C-310: CACHE_ID 0x410000c7, AUX_CTRL 0x76070001
 VPU 352M is enabled!
 Switching to timer-based delay loop, resolution 333ns
 sched_clock: 32 bits at 3000kHz, resolution 333ns, wraps every 1431655765682ns
 Console: colour dummy device 80x30
 Calibrating delay loop (skipped), value calculated using timer frequency.. 6.00
 BogoMIPS (lpj=30000)
 pid_max: default: 32768 minimum: 301
 Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
 Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
 Initializing cgroup subsys net_cls
 CPU: Testing write buffer coherency: ok
 CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
 Setting up static identity map for 0x107da3e8 - 0x107da440
 CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
 CPU2: thread -1, cpu 2, socket 0, mpidr 80000002
 CPU3: thread -1, cpu 3, socket 0, mpidr 80000003
 Brought up 4 CPUs
 SMP: Total of 4 processors activated (24.00 BogoMIPS).
 CPU: All CPU(s) started in SVC mode.


Job Done.

Debian – compiling NGINX from source

Install software pre-requisites:

apt-get install libpcre3 libpcre3-dev libpcrecpp0 libssl-dev zlib1g-dev make gcc libgeoip-dev

Get latest nginx from: http://nginx.org/en/download.html

First stop nginx if it already installed then download and unpack the software:

cd /opt
wget http://nginx.org/download/nginx-1.9.11.tar.gz
tar -zxvf nginx-1.9.11.tar.gz
cd ./nginx-1.9.11
mkdir modules
cd modules
git clone https://github.com/FRiCKLE/ngx_cache_purge.git
cd ..

and then there is just one more important step – to customize your server name: http://www.nginxtips.com/customize-nginx-server-name/ but in essence it all boils down to this:

Edit this file right at line #49: src/http/ngx_http_header_filter_module.c

nano -w +49 src/http/ngx_http_header_filter_module.c

Find these lines:

static char ngx_http_server_string[] = "Server: nginx" CRLF;
static char ngx_http_server_full_string[] = "Server:" NGINX_VER CRLF;

Modify those to match these new ones:

static char ngx_http_server_string[] = "Server: YourCustomName" CRLF;
static char ngx_http_server_full_string[] = "Server: YourCustomName" CRLF;

Modify “YourCustomName” as you want. You can place anything there. It could be the name of your website, product, company, etc.

Configure NGINX:

The configuration I have here works on Debian and preserves default directory layouts, provides support for IPv6, SSL, HTTPv2, WebDAV, nginx-cache-purge module and GeoIP:

./configure --sbin-path=/usr/sbin --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log
--pid-path=/var/run/nginx.pid --lock-path=/var/lock/nginx.lock --http-log-path=/var/log/nginx/access.log 
--http-client-body-temp-path=/var/lib/nginx/body --http-proxy-temp-path=/var/lib/nginx/proxy 
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi --with-debug --with-http_stub_status_module 
--with-http_flv_module --with-http_ssl_module --with-http_dav_module --with-ipv6 
--with-http_geoip_module --with-http_v2_module --add-module=$(MODULESDIR)/ngx_cache_purge

Compile and install NGINX:

make && make install

when everything is done verify:

nginx -V

and you shoud get something like that:

nginx version: nginx/1.9.11
built by gcc 4.8.2 (Debian 4.8.2-21)
TLS SNI support enabled
configure arguments: --sbin-path=/usr/sbin --conf-path=/etc/nginx/nginx.conf 
--error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx.pid 
--lock-path=/var/lock/nginx.lock --http-log-path=/var/log/nginx/access.log 
--http-client-body-temp-path=/var/lib/nginx/body --http-proxy-temp-path=/var/lib/nginx/proxy 
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi --with-debug --with-http_stub_status_module 
--with-http_flv_module --with-http_ssl_module --with-http_dav_module --with-ipv6 
--with-http_geoip_module --with-http_v2_module