Please enable javascript, or click here to visit my ecommerce web site powered by Shopify.
Jump to: navigation, search

Difference between revisions of "Rock/Linux Mainline"

(Boot log: Update to version 3.13.6)
 
(11 intermediate revisions by 3 users not shown)
Line 1: Line 1:
= Build Linux Mainline =
+
{{rock_header}}
 +
{{Languages | rock/Linux_Mainline}}
  
== Download ==
+
= Linux Kernel 3.18-rc5 =
  
Get latest Linux stable version, default config and initramfs.cpio.
+
== Status ==
  
    wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.13.6.tar.xz
+
What currently works in Linux mainline:
    tar xJf linux-3.13.6.tar.xz
+
* UART
    cd linux-3.13.6
+
* SPI
    wget http://www.sntech.de/rockchip/rockchip_defconfig -O arch/arm/configs/rockchip_defconfig
+
* I2C
    wget http://www.sntech.de/rockchip/initramfs.cpio
+
* GPIOs / LEDs / IR
 +
* PWM
 +
* USB
 +
* SD/MMC
 +
* Ethernet
 +
* Wifi
 +
* BT
  
=== Apply latest patches from linux-next tree ===
+
What remains to be done:
 +
* DRM Display driver / LCD controller
 +
* HDMI drivers (ITE66121 / RK616)
 +
* TV OUT drivers (RK1000)
 +
* NAND flash support
  
These patches add snoop-control-unit, power-management-unit, smp bringup code, sram dt nodes and documentation (thanks to Heiko Stuebner).
+
== Requirements ==
  
    for i in f6f70cf7 de18e014 46b8219c5 a7a2b311 ; do curl -s https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/patch/?id=$i | patch -p1 ; done
+
Ubuntu 14.10 / GCC 4.9+ (GCC 4.8 is not supported)
  
== Build ==
+
sudo apt-get install git build-essential gcc-arm-linux-gnueabihf lzop libncurses5-dev libssl-dev bc
  
    export ARCH=arm && export CROSS_COMPILE=arm-linux-gnueabihf-
+
== Get the source code ==
    make rockchip_defconfig
+
    make -j8 rk3188-radxarock.dtb
+
    make -j8 zImage
+
  
== Flash boot image ==
+
Get '''linux-next''' kernel tree (stable branch), default config and updated device-tree.
  
    cat arch/arm/boot/zImage arch/arm/boot/dts/rk3188-radxarock.dtb > kernel.img
+
git clone -b stable --depth 1 git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
    mkbootimg --kernel kernel.img --ramdisk initramfs.cpio -o boot.img
+
cd linux-next
    upgrade_tool di -b boot.img
+
    upgrade_tool rd
+
  
The device will reboot and you will see the linux kernel booting with GPIO, UART and SMP support.
+
wget http://rockchip.fr/radxa/linux/rockchip_defconfig -O arch/arm/configs/rockchip_defconfig
 +
wget http://rockchip.fr/radxa/linux/rk3188-radxarock.dts -O arch/arm/boot/dts/rk3188-radxarock.dts
  
'''TODO:''' among things that are not working yet and remain to be implemented in mainline kernel: I2C, SPI, USB, framebuffer, HDMI driver, etc.
+
== Build kernel ==
  
= Boot log =
+
We have to build two files:
 +
* '''zImage''' (the kernel)
 +
* '''rk3188-radxarock.dtb''' (the device tree blob)
  
    DDR Version 1.04 20130517
+
 
    In
+
export ARCH=arm
    DDR3
+
export CROSS_COMPILE=arm-linux-gnueabihf-
    300MHz
+
 
    Bus Width=32 Col=10 Bank=8 Row=16 CS=1 Die Bus-Width=8 Size=2048MB
+
make rockchip_defconfig
    Memory OK
+
make -j8 zImage dtbs
    OUT
+
 
    BUILD=====2
+
== Create boot image ==
    SdmmcInit=0 0
+
 
    FwPartOffset=0 , 0
+
Install mkbootimg if you don't have it on your system.
    No.1 FLASH ID:ad de 94 eb 74 44
+
 
    No.2 FLASH ID:14 ff ff ff ff ff
+
     git clone https://github.com/neo-technologies/rockchip-mkbootimg.git
     OK! 312004
+
     cd rockchip-mkbootimg
    unsigned!
+
    make
    SecureBootEn = 0 0
+
     sudo make install
    Boot ver: 2013-12-27#2.10
+
     cd ..
     start_linux=====317529
+
 
    1903042 Starting kernel...@0x60408000
+
We need to append the device tree blob to zImage (CONFIG_ARM_APPENDED_DTB option) until we can use U-Boot device tree support.
      
+
 
     Uncompressing Linux... done, booting the kernel.
+
cat arch/arm/boot/zImage arch/arm/boot/dts/rk3188-radxarock.dtb > zImage-dtb
    Booting Linux on physical CPU 0x0
+
 
    Linux version 3.13.6+ (julien@julien-ubuntu) (gcc version 4.8.1 (Ubuntu/Linaro 4.8.1-10ubuntu7) ) #1 SMP Thu Mar 13 11:34:41 CET 2014
+
==get ramdisk==
    CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=10c53c7d
+
 
    CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
+
     git clone https://github.com/radxa/initrd.git
     Machine model: Radxa Rock
+
     find . ! -path "./.git*" | cpio -H newc -ov > initrd.img
    bootconsole [earlycon0] enabled
+
 
    Memory policy: Data cache writealloc
+
Create the '''boot.img''' using mkbootimg (Rockchip version).
    PERCPU: Embedded 7 pages/cpu @c18dd000 s7616 r8192 d12864 u32768
+
 
    Built 1 zonelists in Zone order, mobility grouping on. Total pages: 522768
+
  mkbootimg --kernel zImage-dtb --ramdisk initrd.img -o boot.img
    Kernel command line: console=ttyS2,115200 earlyprintk init=/init
+
 
     PID hash table entries: 4096 (order: 2, 16384 bytes)
+
== Flash parameter and boot image ==
    Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
+
 
    Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
+
Get a parameter file from http://dl.radxa.com/rock/images/parameter
    Memory: 2074164K/2097152K available (2491K kernel code, 128K rwdata, 728K rodata, 2011K init, 207K bss, 22988K reserved, 1318912K highmem)
+
 
    Virtual kernel memory layout:
+
wget http://dl.radxa.com/rock/images/parameter/parameter_linux_sd
        vector : 0xffff0000 - 0xffff1000  (  4 kB)
+
 
        fixmap : 0xfff00000 - 0xfffe0000  ( 896 kB)
+
Flash parameter and boot.img using [https://github.com/linux-rockchip/rkflashtool '''rkflashtool''']
        vmalloc : 0xf0000000 - 0xff000000  ( 240 MB)
+
 
        lowmem : 0xc0000000 - 0xef800000  ( 760 MB)
+
rkflashtool P < parameter_linux_sd
        pkmap  : 0xbfe00000 - 0xc0000000  (  2 MB)
+
rkflashtool w boot < boot.img
        modules : 0xbf000000 - 0xbfe00000  (  14 MB)
+
rkflashtool b
          .text : 0xc0008000 - 0xc032cf0c  (3220 kB)
+
 
          .init : 0xc032d000 - 0xc0523dc0  (2012 kB)
+
= Notes =
          .data : 0xc0524000 - 0xc05442c8  ( 129 kB)
+
 
          .bss : 0xc05442d0 - 0xc0578058  ( 208 kB)
+
== Install Rootfs in first partition of SD card ==
    Hierarchical RCU implementation.
+
 
    NR_IRQS:16 nr_irqs:16 16
+
Your rootfs should be in ext4 format. It will be loaded from '''/dev/mmcblk0p1''' by default.
    sched_clock: 32 bits at 150MHz, resolution 6ns, wraps every 28633115641ns
+
 
    Console: colour dummy device 80x30
+
== Wireless ==
    Calibrating delay loop... 1196.85 BogoMIPS (lpj=5984256)
+
 
    pid_max: default: 32768 minimum: 301
+
The Realtek wifi chipsets require firmwares to be installed in '''/lib/firmware/rtlwifi'''
    Mount-cache hash table entries: 512
+
 
    CPU: Testing write buffer coherency: ok
+
You can get them by installing the '''linux-firmware''' package from your Linux distribution
    Setting up static identity map for 0x60274fc8 - 0x60275020
+
sudo apt-get install linux-firmware
    CPU1: Booted secondary processor
+
 
    CPU2: Booted secondary processor
+
or download them from here: http://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/tree/rtlwifi
    CPU3: Booted secondary processor
+
 
    Brought up 4 CPUs
+
== BT ==
    SMP: Total of 4 processors activated.
+
 
    CPU: All CPU(s) started in SVC mode.
+
The '''rtl8723au_bt''' driver is not in the mainline kernel yet, but you can build it this way:
    devtmpfs: initialized
+
 
    VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4
+
git clone -b new https://github.com/lwfinger/rtl8723au_bt.git
    pinctrl core: initialized pinctrl subsystem
+
cd rtl8723au_bt/Linux_BT_USB_2.11.20140423_8723BE/
    regulator-dummy: no parameters
+
wget http://rockchip.fr/radxa/linux/patches/rtl8723au_bt/0001-Add-hci_recv_fragment-function.patch
    NET: Registered protocol family 16
+
git am 0001-Add-hci_recv_fragment-function.patch
    DMA: preallocated 256 KiB pool for atomic coherent allocations
+
make KDIR=../..
    cpuidle: using governor ladder
+
 
    cpuidle: using governor menu
+
Copy the firmware files and '''rtk_btusb.ko''' into your rootfs:
    L310 cache controller enabled
+
  8723A/rtl8723a_fw -> /lib/firmware/rtl8723a_fw
    l2x0: 16 ways, CACHE_ID 0x4100c0c8, AUX_CTRL 0x76050001, Cache size: 512 kB
+
8723B/rtl8723b_fw -> /lib/firmware/rtl8723b_fw
    hw-breakpoint: found 5 (+1 reserved) breakpoint and 1 watchpoint registers.
+
    hw-breakpoint: maximum watchpoint size is 4 bytes.
+
    bio: create slab <bio-0> at 0
+
    SCSI subsystem initialized
+
    Switched to clocksource arm_global_timer
+
    NET: Registered protocol family 2
+
    TCP established hash table entries: 8192 (order: 3, 32768 bytes)
+
    TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
+
    TCP: Hash tables configured (established 8192 bind 8192)
+
    TCP: reno registered
+
    UDP hash table entries: 512 (order: 2, 16384 bytes)
+
    UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
+
    NET: Registered protocol family 1
+
    bounce pool size: 64 pages
+
    msgmni has been set to 1475
+
    Block layer SCSI generic (bsg) driver version 0.4 loaded (major 253)
+
    io scheduler noop registered
+
    io scheduler deadline registered (default)
+
    Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
+
    10124000.serial: ttyS0 at MMIO 0x10124000 (irq = 66, base_baud = 1500000) is a 16550A
+
    dw-apb-uart 10126000.serial: Couldn't set LCR to 0
+
    dw-apb-uart 10126000.serial: Couldn't set LCR to 0
+
    10126000.serial: ttyS1 at MMIO 0x10126000 (irq = 67, base_baud = 1500000) is a 16550A
+
    20064000.serial: ttyS2 at MMIO 0x20064000 (irq = 68, base_baud = 1500000) is a 16550A
+
    console [ttyS2] enabled
+
    console [ttyS2] enabled
+
    bootconsole [earlycon0] disabled
+
    bootconsole [earlycon0] disabled
+
    dw-apb-uart 20068000.serial: Couldn't set LCR to 0
+
    dw-apb-uart 20068000.serial: Couldn't set LCR to 0
+
    20068000.serial: ttyS3 at MMIO 0x20068000 (irq = 69, base_baud = 1500000) is a 16550A
+
    brd: module loaded
+
    mousedev: PS/2 mouse device common for all mice
+
    Synopsys Designware Multimedia Card Interface Driver
+
    TCP: cubic registered
+
    NET: Registered protocol family 17
+
    input: gpio-keys.1 as /devices/soc.0/gpio-keys.1/input/input0
+
    Freeing unused kernel memory: 2008K (c032d000 - c0523000)
+
    mount: mounting /dev/mmcblk0p1 on /mnt failed: No such device or address
+
    total 0
+
    drwxr-xr-x    2 1000    1000            40 May 30  2013 .
+
    drwxr-xr-x  13 1000    1000          280 Jun  9  2013 ..
+
    umount: can't umount /mnt: Invalid argument
+
    processor : 0
+
    model name : ARMv7 Processor rev 0 (v7l)
+
    Features : swp half thumb fastmult vfp edsp neon vfpv3 tls vfpd32
+
    CPU implementer : 0x41
+
    CPU architecture: 7
+
    CPU variant : 0x3
+
    CPU part : 0xc09
+
    CPU revision : 0
+
   
+
    processor : 1
+
    model name : ARMv7 Processor rev 0 (v7l)
+
    Features : swp half thumb fastmult vfp edsp neon vfpv3 tls vfpd32
+
    CPU implementer : 0x41
+
    CPU architecture: 7
+
    CPU variant : 0x3
+
    CPU part : 0xc09
+
    CPU revision : 0
+
   
+
    processor : 2
+
    model name : ARMv7 Processor rev 0 (v7l)
+
    Features : swp half thumb fastmult vfp edsp neon vfpv3 tls vfpd32
+
    CPU implementer : 0x41
+
    CPU architecture: 7
+
    CPU variant : 0x3
+
    CPU part : 0xc09
+
    CPU revision : 0
+
   
+
    processor : 3
+
    model name : ARMv7 Processor rev 0 (v7l)
+
    Features : swp half thumb fastmult vfp edsp neon vfpv3 tls vfpd32
+
    CPU implementer : 0x41
+
    CPU architecture: 7
+
    CPU variant : 0x3
+
    CPU part : 0xc09
+
    CPU revision : 0
+
   
+
    Hardware : Rockchip Cortex-A9 (Device Tree)
+
    Revision : 0000
+
    Serial : 0000000000000000
+
   
+
   
+
    BusyBox v1.20.2 (Debian 1:1.20.0-8) built-in shell (ash)
+
    Enter 'help' for a list of built-in commands.
+
   
+
    /bin/sh: can't access tty; job control turned off
+
    / # ps
+
    PID  USER    COMMAND
+
        1 0        {init} /bin/sh /init
+
        2 0        [kthreadd]
+
        3 0        [ksoftirqd/0]
+
        4 0        [kworker/0:0]
+
        5 0        [kworker/0:0H]
+
        6 0        [kworker/u8:0]
+
        7 0        [rcu_sched]
+
        8 0        [rcu_bh]
+
        9 0        [migration/0]
+
      10 0        [migration/1]
+
      11 0        [ksoftirqd/1]
+
      12 0        [kworker/1:0]
+
      13 0        [kworker/1:0H]
+
      14 0        [migration/2]
+
      15 0        [ksoftirqd/2]
+
      16 0        [kworker/2:0]
+
      17 0        [kworker/2:0H]
+
      18 0        [migration/3]
+
      19 0        [ksoftirqd/3]
+
      20 0        [kworker/3:0]
+
      21 0        [kworker/3:0H]
+
      22 0        [khelper]
+
      23 0        [kdevtmpfs]
+
      24 0        [netns]
+
      25 0        [writeback]
+
      26 0        [bioset]
+
      27 0        [kblockd]
+
      28 0        [kworker/0:1]
+
      29 0        [kswapd0]
+
      30 0        [fsnotify_mark]
+
      31 0        [kworker/u8:1]
+
      34 0        [deferwq]
+
      39 0        [kworker/1:1]
+
      40 0        [kworker/2:1]
+
      57 0        /bin/sh
+
      58 0        [kworker/3:1]
+
      59 0        {busybox} ps
+
    / # help
+
    Built-in commands:
+
    ------------------
+
    . : [ [[ alias bg break cd chdir command continue echo eval exec
+
    exit export false fg getopts hash help jobs kill let local printf
+
    pwd read readonly return set shift source test times trap true
+
    type ulimit umask unalias unset wait [ [[ adjtimex ar arp arping
+
    ash awk basename blockdev brctl bunzip2 bzcat bzip2 cal cat chgrp
+
    chmod chown chroot chvt clear cmp cp cpio crond crontab cttyhack
+
    cut date dc dd deallocvt depmod df diff dirname dmesg dnsdomainname
+
    dos2unix dpkg dpkg-deb du dumpkmap dumpleases echo ed egrep env
+
    expand expr false fdisk fgrep find fold free freeramdisk ftpget
+
    ftpput getopt getty grep groups gunzip gzip halt head hexdump
+
    hostid hostname httpd hwclock id ifconfig ifdown ifup init insmod
+
    ionice ip ipcalc kill killall klogd last less ln loadfont loadkmap
+
    logger login logname logread losetup ls lsmod lzcat lzma md5sum
+
    mdev microcom mkdir mkfifo mknod mkswap mktemp modinfo modprobe
+
    more mount mt mv nameif nc netstat nslookup od openvt passwd
+
    patch pidof ping ping6 pivot_root poweroff printf ps pwd rdate
+
    readlink realpath reboot renice reset rev rm rmdir rmmod route
+
    rpm rpm2cpio run-parts sed seq setkeycodes setsid sh sha1sum
+
    sha256sum sha512sum sleep sort start-stop-daemon stat strings
+
    stty su sulogin swapoff swapon switch_root sync sysctl syslogd
+
    tac tail tar taskset tee telnet telnetd test tftp time timeout
+
    top touch tr traceroute traceroute6 true tty tunctl udhcpc udhcpd
+
    umount uname uncompress unexpand uniq unix2dos unlzma unxz unzip
+
    uptime usleep uudecode uuencode vconfig vi watch watchdog wc
+
    wget which who whoami xargs xz xzcat yes zcat
+
   
+
    / # mkdir /usr/bin /usr/sbin
+
    / # /bin/busybox --install
+
    / # ifconfig -a
+
    lo        Link encap:Local Loopback 
+
              LOOPBACK MTU:65536  Metric:1
+
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
+
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
+
              collisions:0 txqueuelen:0
+
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
+
   
+
    / # mount
+
    rootfs on / type rootfs (rw,size=1037080k,nr_inodes=188813)
+
    proc on /proc type proc (rw,relatime)
+
    sysfs on /sys type sysfs (rw,relatime)
+
    none on /debug type debugfs (rw,relatime)
+
    / # mount -t devtmpfs none /dev
+
    / # ls /dev
+
    console            tty17              tty37              tty57
+
    cpu_dma_latency    tty18              tty38              tty58
+
    full                tty19              tty39              tty59
+
    input              tty2                tty4                tty6
+
    kmsg                tty20              tty40              tty60
+
    mem                tty21              tty41              tty61
+
    network_latency    tty22              tty42              tty62
+
    network_throughput  tty23              tty43              tty63
+
    null                tty24              tty44              tty7
+
    ptmx                tty25              tty45              tty8
+
    ram0                tty26              tty46              tty9
+
    random              tty27              tty47              ttyS0
+
    tty                tty28              tty48              ttyS1
+
    tty0                tty29              tty49              ttyS2
+
    tty1                tty3                tty5                ttyS3
+
    tty10              tty30              tty50              urandom
+
    tty11              tty31              tty51              vcs
+
    tty12              tty32              tty52              vcs1
+
    tty13              tty33              tty53              vcsa
+
    tty14              tty34              tty54              vcsa1
+
    tty15              tty35              tty55              zero
+
    tty16              tty36              tty56
+
    / #
+

Latest revision as of 03:13, 29 September 2022

Linux Kernel 3.18-rc5

Status

What currently works in Linux mainline:

  • UART
  • SPI
  • I2C
  • GPIOs / LEDs / IR
  • PWM
  • USB
  • SD/MMC
  • Ethernet
  • Wifi
  • BT

What remains to be done:

  • DRM Display driver / LCD controller
  • HDMI drivers (ITE66121 / RK616)
  • TV OUT drivers (RK1000)
  • NAND flash support

Requirements

Ubuntu 14.10 / GCC 4.9+ (GCC 4.8 is not supported)

sudo apt-get install git build-essential gcc-arm-linux-gnueabihf lzop libncurses5-dev libssl-dev bc

Get the source code

Get linux-next kernel tree (stable branch), default config and updated device-tree.

git clone -b stable --depth 1 git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
cd linux-next
wget http://rockchip.fr/radxa/linux/rockchip_defconfig -O arch/arm/configs/rockchip_defconfig
wget http://rockchip.fr/radxa/linux/rk3188-radxarock.dts -O arch/arm/boot/dts/rk3188-radxarock.dts

Build kernel

We have to build two files:

  • zImage (the kernel)
  • rk3188-radxarock.dtb (the device tree blob)


export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-
make rockchip_defconfig
make -j8 zImage dtbs

Create boot image

Install mkbootimg if you don't have it on your system.

   git clone https://github.com/neo-technologies/rockchip-mkbootimg.git
   cd rockchip-mkbootimg
   make
   sudo make install
   cd ..

We need to append the device tree blob to zImage (CONFIG_ARM_APPENDED_DTB option) until we can use U-Boot device tree support.

cat arch/arm/boot/zImage arch/arm/boot/dts/rk3188-radxarock.dtb > zImage-dtb

get ramdisk

   git clone https://github.com/radxa/initrd.git
   find . ! -path "./.git*"  | cpio -H newc  -ov > initrd.img

Create the boot.img using mkbootimg (Rockchip version).

mkbootimg --kernel zImage-dtb --ramdisk initrd.img -o boot.img

Flash parameter and boot image

Get a parameter file from http://dl.radxa.com/rock/images/parameter

wget http://dl.radxa.com/rock/images/parameter/parameter_linux_sd

Flash parameter and boot.img using rkflashtool

rkflashtool P < parameter_linux_sd
rkflashtool w boot < boot.img
rkflashtool b

Notes

Install Rootfs in first partition of SD card

Your rootfs should be in ext4 format. It will be loaded from /dev/mmcblk0p1 by default.

Wireless

The Realtek wifi chipsets require firmwares to be installed in /lib/firmware/rtlwifi

You can get them by installing the linux-firmware package from your Linux distribution

sudo apt-get install linux-firmware

or download them from here: http://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/tree/rtlwifi

BT

The rtl8723au_bt driver is not in the mainline kernel yet, but you can build it this way:

git clone -b new https://github.com/lwfinger/rtl8723au_bt.git
cd rtl8723au_bt/Linux_BT_USB_2.11.20140423_8723BE/
wget http://rockchip.fr/radxa/linux/patches/rtl8723au_bt/0001-Add-hci_recv_fragment-function.patch
git am 0001-Add-hci_recv_fragment-function.patch
make KDIR=../..

Copy the firmware files and rtk_btusb.ko into your rootfs:

8723A/rtl8723a_fw -> /lib/firmware/rtl8723a_fw
8723B/rtl8723b_fw -> /lib/firmware/rtl8723b_fw