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

Difference between revisions of "Rock/Booting Linux"

Line 8: Line 8:
 
* a desktop/laptop running Linux(64bit preferred)
 
* a desktop/laptop running Linux(64bit preferred)
 
* a micro usb cable, one side plugged in to the OTG port of radxa rock, the other side plugged in to the usb port on desktop/laptop
 
* a micro usb cable, one side plugged in to the OTG port of radxa rock, the other side plugged in to the usb port on desktop/laptop
 +
 +
=== Install the packages ===
 +
 +
Install packages for building kernel if you don't have them on your host.
 +
 +
    sudo apt-get install build-essential lzop libncurses5-dev libssl-dev
  
 
=== Install the toolchain ===
 
=== Install the toolchain ===
  
Install ARM toolchain and building kernel related packages if you don't have them on your host.  
+
Download ARM toolchain if you don't have Android 4.2.2/4.4.2 SDK on your host.
  
     sudo apt-get install gcc-arm-linux-gnueabihf build-essential lzop libncurses5-dev libssl-dev
+
     git clone -b android-4.4.2_r1 --depth 1 https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6
 
     export ARCH=arm
 
     export ARCH=arm
     export CROSS_COMPILE=arm-linux-gnueabihf-
+
     export CROSS_COMPILE=`pwd`/arm-eabi-4.6/bin/arm-eabi-
  
 
=== Get the source code ===
 
=== Get the source code ===
Line 35: Line 41:
 
     make radxa_rock_linux_defconfig
 
     make radxa_rock_linux_defconfig
  
     make -j8
+
     make -j 8 kernel.img
 +
 
 +
The kernel will be at '''kernel.img''' (image for kernel partition) and '''arch/arm/boot/Image''' (raw binary)
 +
 
 +
if you want LZO compressed kernel, specify zkernel.img
 +
 
 +
    make -j 8 zkernel.img
  
The kernel will be at '''arch/arm/boot/Image'''
+
The kernel will be at '''kernel.img''' (image for kernel partition) and '''arch/arm/boot/zImage''' (compressed binary)
  
 
=== Build the kernel modules ===
 
=== Build the kernel modules ===
Line 64: Line 76:
 
     mkbootimg --kernel linux-rockchip/arch/arm/boot/Image --ramdisk initrd.img -o boot.img
 
     mkbootimg --kernel linux-rockchip/arch/arm/boot/Image --ramdisk initrd.img -o boot.img
  
Done. Now we have the kernel '''boot.img''' for RR.
+
Done. Now we have the '''boot.img''' (image for boot/recovery partition) for RR.
  
 
=== Modify the parameter ===
 
=== Modify the parameter ===

Revision as of 07:05, 9 November 2014

Requirement

  • a radxa rock board (check your hardware revision)
  • a desktop/laptop running Linux(64bit preferred)
  • a micro usb cable, one side plugged in to the OTG port of radxa rock, the other side plugged in to the usb port on desktop/laptop

Install the packages

Install packages for building kernel if you don't have them on your host.

   sudo apt-get install build-essential lzop libncurses5-dev libssl-dev

Install the toolchain

Download ARM toolchain if you don't have Android 4.2.2/4.4.2 SDK on your host.

   git clone -b android-4.4.2_r1 --depth 1 https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6
   export ARCH=arm
   export CROSS_COMPILE=`pwd`/arm-eabi-4.6/bin/arm-eabi-

Get the source code

   git clone -b radxa-stable-3.0 https://github.com/radxa/linux-rockchip.git

or download from this link and unzip it:

   https://codeload.github.com/radxa/linux-rockchip/zip/radxa-stable-3.0

Build the kernel

   cd linux-rockchip

if your Rock is pro(Mid 2014) or the new lite(Mid 2014), use radxa_rock_pro_linux_defconfig, check out hardware revision

   make radxa_rock_pro_linux_defconfig

if your rock is full version(2013) or the old lite(2013), use radxa_rock_linux_defconfig, check out hardware revision

   make radxa_rock_linux_defconfig
   make -j 8 kernel.img

The kernel will be at kernel.img (image for kernel partition) and arch/arm/boot/Image (raw binary)

if you want LZO compressed kernel, specify zkernel.img

   make -j 8 zkernel.img

The kernel will be at kernel.img (image for kernel partition) and arch/arm/boot/zImage (compressed binary)

Build the kernel modules

   mkdir modules
   export INSTALL_MOD_PATH=./modules
   make modules && make modules_install
   cd ..

Now you have all the kernel modules in modules/lib/modules/3.0.36+/.

Generate the ramdisk

   git clone https://github.com/radxa/initrd.git
   make -C initrd

Generate the boot.img

Install mkbootimg

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

Make boot.img

   mkbootimg --kernel linux-rockchip/arch/arm/boot/Image --ramdisk initrd.img -o boot.img

Done. Now we have the boot.img (image for boot/recovery partition) for RR.

Modify the parameter

The linux rootfs maybe in the different partition or media(nand or uSD card or USB disk), so you need to tell the kernel which is the right rootfs to mount. So change the root= command line in your parameter to the rootfs you want to mount. The examples are:

   root=/dev/block/mtd/by-name/linuxroot        # rootfs in the nand partition named "linuxroot"
   root=/dev/mmcblk0p1          # rootfs in the uSD card first partition
   root=/dev/sda1                # rootfs in the U disk or the USB hard drive first partition
   root=LABEL=linuxroot         # rootfs in the partition with label "linuxroot", can be in uSD, U disk or USB hard drive.

Next step

Now you refer flash the image to flash the generated boot.img to "boot" partition parameter to "parameter" partition of your radxa rock board. And download a prebuilt rootfs or make your own rootfs. You will get linux system boot into ramdisk and then switch root to real rootfs.