1*4882a593Smuzhiyun# meta-rockchip 2*4882a593Smuzhiyun 3*4882a593SmuzhiyunYocto BSP layer for the Rockchip SOC boards 4*4882a593Smuzhiyun - wiki <http://opensource.rock-chips.com/wiki_Main_Page>. 5*4882a593Smuzhiyun 6*4882a593SmuzhiyunThis README file contains information on building and booting the meta-rockchip BSP layers. 7*4882a593Smuzhiyun 8*4882a593SmuzhiyunPlease see the corresponding sections below for details. 9*4882a593Smuzhiyun 10*4882a593Smuzhiyun## Dependencies 11*4882a593Smuzhiyun 12*4882a593SmuzhiyunThis layer depends on: 13*4882a593Smuzhiyun 14*4882a593Smuzhiyun* URI: git://git.yoctoproject.org/poky 15*4882a593Smuzhiyun* branch: kirkstone 16*4882a593Smuzhiyun 17*4882a593Smuzhiyun* URI: git://git.openembedded.org/meta-openembedded 18*4882a593Smuzhiyun* layers: meta-oe 19*4882a593Smuzhiyun* branch: kirkstone 20*4882a593Smuzhiyun 21*4882a593Smuzhiyun## Table of Contents 22*4882a593Smuzhiyun 23*4882a593SmuzhiyunI. Configure yocto/oe Environment 24*4882a593Smuzhiyun 25*4882a593SmuzhiyunII. Building meta-rockchip BSP Layers 26*4882a593Smuzhiyun 27*4882a593SmuzhiyunIII. Booting your Device 28*4882a593Smuzhiyun 29*4882a593SmuzhiyunIV. Tested Hardwares 30*4882a593Smuzhiyun 31*4882a593SmuzhiyunV. Supporting new Machine 32*4882a593Smuzhiyun 33*4882a593Smuzhiyun### I. Configure yocto/oe Environment 34*4882a593Smuzhiyun 35*4882a593SmuzhiyunIn order to build an image with BSP support for a given release, you need to download the corresponding layers described in the "Dependencies" section. Be sure that everything is in the same directory. 36*4882a593Smuzhiyun 37*4882a593Smuzhiyun```shell 38*4882a593Smuzhiyun~ $ mkdir yocto; cd yocto 39*4882a593Smuzhiyun~/yocto $ git clone git://git.yoctoproject.org/poky -b kirkstone 40*4882a593Smuzhiyun~/yocto $ git clone git://git.openembedded.org/meta-openembedded.git -b kirkstone 41*4882a593Smuzhiyun``` 42*4882a593Smuzhiyun 43*4882a593SmuzhiyunAnd put the meta-rockchip layer here too. 44*4882a593Smuzhiyun 45*4882a593SmuzhiyunThen you need to source the configuration script: 46*4882a593Smuzhiyun 47*4882a593Smuzhiyun```shell 48*4882a593Smuzhiyun~/yocto $ source poky/oe-init-build-env 49*4882a593Smuzhiyun``` 50*4882a593Smuzhiyun 51*4882a593SmuzhiyunHaving done that, you can build a image for a rockchip board by adding the location of the meta-rockchip layer to bblayers.conf, along with any other layers needed. 52*4882a593Smuzhiyun 53*4882a593SmuzhiyunFor example: 54*4882a593Smuzhiyun 55*4882a593Smuzhiyun```makefile 56*4882a593Smuzhiyun# build/conf/bblayers.conf 57*4882a593SmuzhiyunBBLAYERS ?= " \ 58*4882a593Smuzhiyun ${TOPDIR}/../meta-rockchip \ 59*4882a593Smuzhiyun ${TOPDIR}/../poky/meta \ 60*4882a593Smuzhiyun ${TOPDIR}/../poky/meta-poky \ 61*4882a593Smuzhiyun ${TOPDIR}/../poky/meta-yocto-bsp \ 62*4882a593Smuzhiyun ${TOPDIR}/../meta-openembedded/meta-oe \ 63*4882a593Smuzhiyun``` 64*4882a593Smuzhiyun 65*4882a593SmuzhiyunTo enable a particular machine, you need to add a MACHINE line naming the BSP to the local.conf file: 66*4882a593Smuzhiyun 67*4882a593Smuzhiyun```makefile 68*4882a593Smuzhiyun MACHINE = "xxx" 69*4882a593Smuzhiyun``` 70*4882a593Smuzhiyun 71*4882a593SmuzhiyunAll supported machines can be found in meta-rockchip/conf/machine. 72*4882a593Smuzhiyun 73*4882a593Smuzhiyun### II. Building meta-rockchip BSP Layers 74*4882a593Smuzhiyun 75*4882a593SmuzhiyunYou should then be able to build a image as such: 76*4882a593Smuzhiyun 77*4882a593Smuzhiyun```shell 78*4882a593Smuzhiyun$ bitbake core-image-minimal 79*4882a593Smuzhiyun``` 80*4882a593Smuzhiyun 81*4882a593SmuzhiyunAt the end of a successful build, you should have an .wic image in `/path/to/yocto/build/tmp/deploy/images/<MACHINE>/`, also with an rockchip firmware image: `update.img`. 82*4882a593Smuzhiyun 83*4882a593Smuzhiyun### III. Booting your Device 84*4882a593Smuzhiyun 85*4882a593SmuzhiyunUnder Linux, you can use upgrade_tool: <http://opensource.rock-chips.com/wiki_Upgradetool> to flash the image: 86*4882a593Smuzhiyun 87*4882a593Smuzhiyun1. Put your device into rockusb mode: <http://opensource.rock-chips.com/wiki_Rockusb> 88*4882a593Smuzhiyun 89*4882a593Smuzhiyun2. If it's maskrom rockusb mode, try to enter miniloader rockusb mode: 90*4882a593Smuzhiyun 91*4882a593Smuzhiyun```shell 92*4882a593Smuzhiyun$ sudo upgrade_tool db <IMAGE PATH>/loader.bin 93*4882a593Smuzhiyun``` 94*4882a593Smuzhiyun 95*4882a593Smuzhiyun3. Flash the image (wic image or rockchip firmware image) 96*4882a593Smuzhiyun 97*4882a593Smuzhiyun```shell 98*4882a593Smuzhiyun$ sudo upgrade_tool wl 0 <IMAGE PATH>/<IMAGE NAME>.wic # For wic image 99*4882a593Smuzhiyun``` 100*4882a593Smuzhiyun 101*4882a593Smuzhiyun```shell 102*4882a593Smuzhiyun$ sudo upgrade_tool uf <IMAGE PATH>/update.img # For rockchip firmware image 103*4882a593Smuzhiyun``` 104*4882a593Smuzhiyun 105*4882a593Smuzhiyun### IV. Tested Hardwares 106*4882a593Smuzhiyun 107*4882a593SmuzhiyunThe following undergo regular basic testing with their respective MACHINE types. 108*4882a593Smuzhiyun 109*4882a593Smuzhiyun* px3se evb board 110*4882a593Smuzhiyun 111*4882a593Smuzhiyun* rk3308 evb board 112*4882a593Smuzhiyun 113*4882a593Smuzhiyun* rk3326 evb board 114*4882a593Smuzhiyun 115*4882a593Smuzhiyun* px30 evb board 116*4882a593Smuzhiyun 117*4882a593Smuzhiyun* rk3328 evb board 118*4882a593Smuzhiyun 119*4882a593Smuzhiyun* rk3288 evb board 120*4882a593Smuzhiyun 121*4882a593Smuzhiyun* rk3399 sapphire excavator board 122*4882a593Smuzhiyun 123*4882a593Smuzhiyun* rk3399pro evb board 124*4882a593Smuzhiyun 125*4882a593Smuzhiyun### V. Supporting new Machine 126*4882a593Smuzhiyun 127*4882a593SmuzhiyunTo support new machine, you can either add new machine config in meta-rockchip/conf/machine, or choose a similar existing machine and override it's configurations in local config file. 128*4882a593Smuzhiyun 129*4882a593SmuzhiyunIn general, a new machine needs to specify it's u-boot config, kernel config, kernel device tree and wifi/bt firmware: 130*4882a593Smuzhiyun 131*4882a593SmuzhiyunFor example: 132*4882a593Smuzhiyun 133*4882a593Smuzhiyun```makefile 134*4882a593SmuzhiyunKBUILD_DEFCONFIG = "rk3326_linux_defconfig" 135*4882a593SmuzhiyunKERNEL_DEVICETREE = "rockchip/rk3326-evb-lp3-v10-linux.dtb" 136*4882a593SmuzhiyunUBOOT_MACHINE = "evb-rk3326_defconfig" 137*4882a593SmuzhiyunRK_WIFIBT_FIRMWARES = " \ 138*4882a593Smuzhiyun rkwifibt-firmware-ap6212a1-wifi \ 139*4882a593Smuzhiyun rkwifibt-firmware-ap6212a1-bt \ 140*4882a593Smuzhiyun brcm-tools \ 141*4882a593Smuzhiyun" 142*4882a593Smuzhiyun``` 143*4882a593Smuzhiyun 144*4882a593SmuzhiyunIf you want to use your own local u-boot and kernel sources, a simple way is to override related configurations in local config file. 145*4882a593Smuzhiyun 146*4882a593SmuzhiyunFor example using the kernel/ and u-boot/ in the same directory of meta-rockchip: 147*4882a593Smuzhiyun 148*4882a593Smuzhiyun```makefile 149*4882a593Smuzhiyun# build/conf/local.conf 150*4882a593SmuzhiyunSRC_URI:pn-linux-rockchip = " \ 151*4882a593Smuzhiyun git://${TOPDIR}/../kernel;protocol=file;usehead=1 \ 152*4882a593Smuzhiyun file://cgroups.cfg \ 153*4882a593Smuzhiyun" 154*4882a593SmuzhiyunSRCREV:pn-linux-rockchip = "${AUTOREV}" 155*4882a593SmuzhiyunKBRANCH = "HEAD" 156*4882a593Smuzhiyun 157*4882a593SmuzhiyunSRC_URI:pn-u-boot = " \ 158*4882a593Smuzhiyun git://${TOPDIR}/../u-boot;protocol=file;usehead=1 \ 159*4882a593Smuzhiyun" 160*4882a593SmuzhiyunSRCREV:pn-u-boot = "${AUTOREV}" 161*4882a593Smuzhiyun``` 162*4882a593Smuzhiyun 163*4882a593Smuzhiyun## Maintainers 164*4882a593Smuzhiyun 165*4882a593Smuzhiyun* Jeffy Chen `<jeffy.chen@rock-chips.com>` 166