rk3288-独立uboot+kernel文档

1.考虑到灵活性,Firefly-rk3288的文件系统可以采用yocto方便获得,至于uboot和kernel则采用rockchip提供的独立包,虽然镜像使用独立源代包生成,然而一些生成工具还是使用rochchip的linux sdk比较方便。
构建主机环境:
$ sudo apt-get install repo git u-boot-tools device-tree-compiler mtools parted libudev-dev libusb-1.0-0-dev lib32gcc-7-dev python-linaro-image-tools linaro-image-tools gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu libstdc+±7-dev autoconf autotools-dev libsigsegv2 m4 intltool libdrm-dev curl sed make binutils build-essential gcc g++ bash patch gzip bzip2 perl tar cpio python unzip rsync file bc wget libncurses5 libqt4-dev libglib2.0-dev libgtk2.0-dev libglade2-dev cvs mercurial rsync openssh-client subversion asciidoc w3m dblatex graphviz python-matplotlib libssl-dev pv e2fsprogs fakeroot devscripts libi2c-dev libncurses5-dev texinfo

Rockchip linux sdk(仅利用其中的镜像工具和rockchip提供的一些板子固件,ddr、miniloader、trust相关等):

$mkdit /opt/rk3288-linux-sdk
$cd /opt/rk3288-linux-sdk
$git clone https://github.com/rockchip-linux/repo
$mkdir linux
$cd linux

$…/repo/repo init --repo-url=https://github.com/rockchip-linux/repo -u https://github.com/rockchip-linux/manifests -b master -m rk3288_linux_release.xml
$…/repo/repo sync
#对用到的目录建立软连接到rk3288-bsp目录
$mkdir /opt/rk3288-bsp/
$ln –s /opt/rk3288-linux-sdk/linux/prebuilts/ /opt/rk3288-bsp/
$ln –s /opt/rk3288-linux-sdk/linux/rkbin/ /opt/rk3288-bsp/

#Uboot:
$cd /opt/rk3288-bsp
#uboot的源码有三种获取途径:
#1. git://git.denx.de/u-boot.git(uboot主线)
#2. git://git.denx.de/u-boot-rockchip.git(rockchip支线)
#3. https://github.com/rockchip-linux/u-boot.git (github托管的rockchip支线)
#rockchip的uboot早期在git.denx.de维护,2015-10-r2之后的版本已迁移至github,所以这里使用github版本,github版目前最新uboot是基于主线2017-09的。
$ git clone https://github.com/rockchip-linux/u-boot.git

#修改源码
$vi configs/firefly-rk3288_defconfig#(默认是启动了静默的,不打印东西,关闭之)
CONFIG_SILENT_CONSOLE=n
$vi include/configs/firefly-rk3288.h
#define ROCKCHIP_DEVICE_SETTINGS
“stdin=serial,usbkbd\0”
“stdout=serial,vidconsole\0”
“stderr=serial,vidconsole\0”
“preboot=usb start\0”
#rockchip默认优先扫面usb设备从usb启动,会明显延长uboot启动时间,去掉之
#使用rockchip提供的脚本编译
./make.sh firefly-rk3288
#打包ddr和miniloader镜像
tools/mkimage -n rk3288 -T rksd -d …/rkbin/bin/rk32/rk3288_ddr_400MHz_v1.06.bin idbloader.img
cat …/rkbin/bin/rk32/rk3288_miniloader_v2.36.bin >> idbloader.img
#烧写
$sudo dd if= idbloader.img of=/dev/sdc seek=64
$sudo dd if=uboot.img of=/dev/sdc seek=16384
$sudo dd if=trust.img of=/dev/sdc seek=24576

#kernel:
$cd /opt/rk3288-bsp
$git clone https://github.com/rockchip-linux/kernel.git
#禁掉dts中的cmdline
$vi /arch/arm/boot/dts/rk3288-linux.dtsi
chosen {
/* bootargs = “earlyprintk console=ttyFIQ0 rw root=PARTUUID=614e0000-0000 rootfstype=ext4 rootwait”; /
};
#禁掉dts中的fiq-debug,否则会与ttyS2冲突
$vi /arch/arm/boot/dts/rk3288-linux.dtsi
// fiq-debugger {
// compatible = “rockchip,fiq-debugger”;
// interrupts = ;
// rockchip,serial-id = <2>;
// rockchip,wake-irq = <0>;
/
If enable uart uses irq instead of fiq /
// rockchip,irq-mode-enable = <0>;
// rockchip,baudrate = <115200>; /
Only 115200 and 1500000 */
// pinctrl-names = “default”;
// pinctrl-0 = <&uart2_xfer>;
// };

$make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- rockchip_linux_defconfig
$make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j4
$mkdir boot/extlinux
vi boot/extlinux/extlinux.conf
#输入以下内容:
label rockchip-kernel-4.4
kernel /zImage
fdt /firefly-rk3288.dtb
append earlyprintk console=ttyS2,115200n8 rw root=PARTUUID=69dad710-2c rootwait rootfstype=ext4 init=/sbin/init
#创建boot.img镜像(ext2文件系统,另外还有fat32文件系统这里不在列出)
$genext2fs -b 32768 -B $((3210241024/32768)) -d boot/ -i 8192 -U boot_rk3288.img
#烧写:
$sudo dd if=boot_rk3288.img of=/dev/sdc seek=32768
#通过uboot写入分区表
gpt write mmc 1 $partitions
#烧写rootfs
$pv –tpreb qt5-image-firefly-rk3288.ext4 | sudo dd of=/dev/sdc seek=262144 conv=notrunc

你可能感兴趣的:(bsp)