Code:

kernel:
https://github.com/rockchip-linux/kernel/tree/multi-os
u-boot:
https://github.com/rockchip-linux/u-boot/tree/multi-os

Usage

Fllowing linux-user-guide to build kernel and uboot

Build uboot with virtual-rk3288_defconfig:

CROSS_COMPILE=arm-linux-gnueabihf- make virtual-rk3288_defconfig all

Copy the u-boot-dtb.bin to fat partition

Add clk_ignore_unused to bootcmd(extlinux.conf)

append  earlyprintk console=tty1 console=ttyS2,115200n8 rw root=/dev/mmcblk2p7 rootfstype=ext4 init=/sbin/init clk_ignore_unused

Enter into the uboot shell and issue command:

dcache off;fatload mmc 0:6 0x50000000 u-boot-dtb.bin; rk_load_uboot 3 0x50000000; boot

dcache off; fatload mmc (sd or emmc):(part) (uboot_text_addr) (uboot file name) ; rk_load_uboot (cpu id)  (uboot_text_addr); boot

Now kernel log will output to uart2 and uboot log will output to uart1

You can run command "demo gic-timer" in uboot to evaluate it.

Patches

kernel:

Revert "pinctrl: rockchip: only enable gpio clock when it setting" 
virtual: leave cpu3 power alone
arm: dts: rk3288: disable cpu3 
arm: dts: rk3288: reserve memory for uboot 
arm: dts: board: leave resources for uboot (Refer to this commit and change your board dts)
multiple-os: add uboot helper
...
...

uboot:
rockchip: add rk3288-virtual device
rockchip: virtual: add rk_load_uboot command
...
...

Others

  • 使用的时候要多注意clk,regulator和pin,因为kernel不会管uboot在不在用,如果uboot下的device在kernel boot后不能用,需要检查这几个方面,可以在uboot helper里reserve掉这些资源
  • uboot的addr base和size都在virutal_rk3288.h里改,改完后要在kernel里reserve
  • 要自动启动的话可以在uboot里加入preboot环境变量,设置preboot为“dcache off;fatload mmc 0:6 0x50000000 u-boot-dtb.bin; rk_load_uboot 3 0x50000000;”
  • 其实可以让uboot把device init的动作delay到kernel boot之后,这样可以防止kernel boot的时候更改资源
  • kernel pm需要加hook去通知uboot, uboot自己开关设备和核,不然pm会工作不正常
  • ddr dvfs必须关闭
  • cpu频率是kernel调的,uboot负载不会影响,如果有需要这个速度,最好是用cpufreq-set设置一个比较高的最低频率