Difference between revisions of "Rock/Booting Linux/zh cn"
< Rock | Booting Linux
(→生成 ramdisk) |
|||
(5 intermediate revisions by 3 users not shown) | |||
Line 5: | Line 5: | ||
* 5V/2A的电源 | * 5V/2A的电源 | ||
− | === | + | === Install the toolchain === |
− | + | ||
− | + | 下载交叉编译工具链 | |
− | + | ||
+ | 64bit 主机 | ||
+ | |||
+ | git clone -b kitkat-release --depth 1 https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6 | ||
+ | |||
+ | 或者从这里下载 | ||
+ | |||
+ | [http://dl.radxa.com/rock/source/x86_64_arm-eabi-4.6.zip http://dl.radxa.com/rock/source/x86_64_arm-eabi-4.6.zip ] | ||
+ | |||
+ | |||
+ | 32bit主机 | ||
+ | |||
+ | git clone -b jb-release --depth 1 https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6 | ||
+ | |||
+ | 或者在这里下载 | ||
+ | |||
+ | [http://dl.radxa.com/rock/source/x86_32_arm-eabi-4.6.zip http://dl.radxa.com/rock/source/x86_32_arm-eabi-4.6.zip] | ||
+ | |||
+ | |||
+ | 设置环境变量 | ||
+ | |||
export ARCH=arm | export ARCH=arm | ||
− | export CROSS_COMPILE=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 here | ||
+ | http://pan.baidu.com/s/1jfOTo (china) | ||
=== 编译内核 === | === 编译内核 === | ||
− | cd | + | cd linux-rockchip |
− | make | + | |
+ | if your Rock is pro(Mid 2014) or the new lite(Mid 2014), use radxa_rock_pro_linux_defconfig, check out [[Rock/hardware_revision| 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 [[Rock/hardware_revision| hardware revision]] | ||
+ | make radxa_rock_linux_defconfig | ||
+ | |||
make -j8 | make -j8 | ||
+ | |||
生成的内核文件位置是在 '''arch/arm/boot/Image'''。 | 生成的内核文件位置是在 '''arch/arm/boot/Image'''。 | ||
Line 38: | Line 70: | ||
git clone https://github.com/radxa/initrd.git | git clone https://github.com/radxa/initrd.git | ||
− | + | find . ! -path "./.git*" | cpio -H newc -ov > initrd.img | |
=== 生成 boot.img === | === 生成 boot.img === | ||
Line 44: | Line 76: | ||
sudo apt-get install lib32stdc++6 | sudo apt-get install lib32stdc++6 | ||
chmod +x mkbootimg | chmod +x mkbootimg | ||
− | ./mkbootimg --kernel | + | ./mkbootimg --kernel linux-rockchip/arch/arm/boot/Image --ramdisk initrd.img -o boot.img |
完成。现在已经生成了RR的“boot.img”文件了。 | 完成。现在已经生成了RR的“boot.img”文件了。 |
Latest revision as of 09:19, 17 July 2015
Contents
开发要求
- radxa rock (全版或者简版)
- 64bit Linux (e.g. Ubuntu) 开发环境
- micro USB 数据线
- 5V/2A的电源
Install the toolchain
下载交叉编译工具链
64bit 主机
git clone -b kitkat-release --depth 1 https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6
或者从这里下载
http://dl.radxa.com/rock/source/x86_64_arm-eabi-4.6.zip
32bit主机
git clone -b jb-release --depth 1 https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6
或者在这里下载
http://dl.radxa.com/rock/source/x86_32_arm-eabi-4.6.zip
设置环境变量
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 here http://pan.baidu.com/s/1jfOTo (china)
编译内核
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 -j8
生成的内核文件位置是在 arch/arm/boot/Image。
编译内核模块
mkdir modules export INSTALL_MOD_PATH=./modules make modules && make modules_install cd ..
现在所以的内核模块都在 modules/lib/modules/3.0.36+/文件夹中。
生成 ramdisk
git clone https://github.com/radxa/initrd.git find . ! -path "./.git*" | cpio -H newc -ov > initrd.img
生成 boot.img
wget http://dl.radxa.com/rock/tools/linux/mkbootimg sudo apt-get install lib32stdc++6 chmod +x mkbootimg ./mkbootimg --kernel linux-rockchip/arch/arm/boot/Image --ramdisk initrd.img -o boot.img
完成。现在已经生成了RR的“boot.img”文件了。
修改 parameter 文件
linux的根文件系统(rootfs)可能处于不同的分区或者媒介中(比如nand、SD卡或者U盘 ),所以你需要告诉内核应该加载哪一个根文件系统。修改你的parameter文件的“root= ”这一行,指向你想加载的那个根文件系统所存放的分区。比如:
root=/dev/block/mtd/by-name/linuxroot # rootfs 在名叫“linuxroot”的nand分区中 root=/dev/mmcblk0p1 # rootfs 在SD卡第一分区中 root=/dev/sda1 # rootfs 在U盘或者移动硬盘第一分区 root=LABEL=linuxroot # rootfs在标签为“linuxroot”分区,这个分区可能是SD卡、U盘或者移动硬盘。