rk3288-独立uboot+kernel文档

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/zxr1521904712/article/details/89236569
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 = <GIC_SPI 153 IRQ_TYPE_LEVEL_HIGH>;
// 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 /rk3288-firefly.dtb
append earlyprintk console=ttyS2,115200n8 rw root=PARTUUID=69dad710-2c rootwait rootfstype=ext4 init=/sbin/init

#创建boot.img镜像(ext2文件系统,另外还有fat32文件系统这里不在列出)

$genext2fs -b 10240 -B 4096 -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

在u-boot的shell中查看分区表:

setenv  partitions "uuid_disk=${uuid_gpt_disk};name=loader1,start=32K,size=4000K,uuid=${uuid_gpt_loader1};name=loader2,start=8MB,size=4MB,uuid=${uuid_gpt_loader2};name=trust,size=4M,uuid=${uuid_gpt_atf};name=boot,size=112M,bootable,uuid=${uuid_gpt_boot};name=rootfs,size=-,uuid=69DAD710-2CE4-4E3C-B16C-21A1D49ABED3;"

=> echo $partitions
uuid_disk=;
name=loader1,start=32K,size=4000K,uuid=;
name=loader2,start=8MB,size=4MB,uuid=;
name=trust,size=4M,uuid=;
name=boot,size=112M,bootable,uuid=;
name=rootfs,size=-,uuid=69DAD710-2CE4-4E3C-B16C-21A1D49ABED3;
=> 

在Ubuntu中用gdisk查看sd卡分区表:

Command (? for help): p
Disk /dev/sdb: 15523840 sectors, 7.4 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 08992135-13C6-084B-9322-3391FF571E19
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 15523806
Partitions will be aligned on 64-sector boundaries
Total free space is 8350 sectors (4.1 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1              64            8063   3.9 MiB        0700  loader1
   2           16384           24575   4.0 MiB        0700  loader2
   3           24576           32767   4.0 MiB        0700  trust
   4           32768          262143   112.0 MiB      0700  boot
   5          262144        15523806   7.3 GiB        0700  rootfs
  • 2
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值