Content
- YOCTO: Compile YOCTO for a custom board (or OpenRex)
- YOCTO: Make SD card
- YOCTO: Test your SD card with uBoot, Kernel and Filesystem
See also
YOCTO: Compile YOCTO for a custom board (or OpenRex)
We will create our build directory - everything about OpenRex will be happening there. It's going to be called "build-openrex" and it will be located in "~/fsl-community-bsp/":cd ~/fsl-community-bsp/ MACHINE=imx6q-openrex source setup-environment build-openrexCheck if you can see meta-openrex:
cd ~/fsl-community-bsp/build-openrex bitbake-layers show-layersThere should be a line similar to this:
meta-openrex /home/fedevel/fsl-community-bsp/sources/meta-openrex 6If you have more CPU cores, you may want to set BB_NUMBER_THREADS, so it runs faster (it can speed up the things):
gedit ~/fsl-community-bsp/build-openrex/conf/bblayers.confAdd BB_NUMBER_THREADS parameter (based on documentation "a good rule of thumb is to set this variable to twice the number of cores"), so the file may look like:
LCONF_VERSION = "6" BBPATH = "${TOPDIR}" BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../..')}" BBFILES ?= "" BBLAYERS = " \ ${BSPDIR}/sources/poky/meta \ ${BSPDIR}/sources/poky/meta-yocto \ \ ${BSPDIR}/sources/meta-openembedded/meta-oe \ ${BSPDIR}/sources/meta-openembedded/meta-multimedia \ \ ${BSPDIR}/sources/meta-fsl-arm \ ${BSPDIR}/sources/meta-fsl-arm-extra \ ${BSPDIR}/sources/meta-fsl-demos \ ${BSPDIR}/sources/meta-openrex \ " BB_NUMBER_THREADS = "4"Our currently supported machine is "imx6q-openrex.conf". That is the file which we created at "sources/meta-openrex/conf/machine" directory.
Let's try to compile it:
cd ~/fsl-community-bsp/build-openrex MACHINE=imx6q-openrex bitbake core-image-baseNow, you may need to be patient. It takes a long time (couple of hours) and it also can give you some errors which you will need to fix.
YOCTO: Make SD card
The output files will be located at "cd ~/fsl-community-bsp/build-openrex/tmp/deploy/images/imx6q-openrex/". Check the time & date of the files, just to be sure you have just generated them and they are the recent files:ls -la ~/fsl-community-bsp/build-openrex/tmp/deploy/images/imx6q-openrex/Insert an SD card into your host PC. Check how it’s mounted, run: ‘dmesg | tail’.
fedevel@ubuntu:~$ dmesg | tail [622632.386947] sd 33:0:0:0: Attached scsi generic sg3 type 0 [622632.408964] sd 33:0:0:0: [sdb] 15523840 512-byte logical blocks: (7.94 GB/7.40 GiB) [622632.472466] sd 33:0:0:0: [sdb] Write Protect is off [622632.472605] sd 33:0:0:0: [sdb] Mode Sense: 03 00 00 00 [622632.481326] sd 33:0:0:0: [sdb] No Caching mode page found [622632.481333] sd 33:0:0:0: [sdb] Assuming drive cache: write through [622632.664902] sdb: sdb1 sdb2 [622632.712255] sd 33:0:0:0: [sdb] Attached SCSI removable disk [623190.995120] sdb: detected capacity change from 7948206080 to 0 [646884.988206] hrtimer: interrupt took 11392215 ns fedevel@ubuntu:~$Use the correct "/dev/" (in our case "/dev/sdb") and copy the images to the SD card (be sure you use the files you have created … e.g. core image minimal vs base):
umount /dev/sdb? gunzip -c ~/fsl-community-bsp/build-openrex/tmp/deploy/images/imx6q-openrex/core-image-base-imx6q-openrex.sdcard.gz > ~/fsl-community-bsp/build-openrex/tmp/deploy/images/imx6q-openrex/core-image-base-imx6q-openrex.sdcard sudo dd if=~/fsl-community-bsp/build-openrex/tmp/deploy/images/imx6q-openrex/core-image-base-imx6q-openrex.sdcard of=/dev/sdb umount /dev/sdb?
YOCTO: Test your SD card with uBoot, Kernel and Filesystem
You have more options how to test your SD card. The very first initial SD card may have some settings wrong (especially the uBoot environmental parameters) and it may not fully boot up. Here are some ways how you can test your new codes.Quick test
To test your uBoot on SD card, plug in the card which you have just created into an OpenRex board. Reset the OpenRex board (press "Reset" button), interrupt the uBoot countdown (press "Spacebar" or the "Enter" key) and run following command:mw.l 0x020d8040 0x2840; mw.l 0x020d8044 0x10000000; reset*Note for myself: In case you would like to test reset from different SD card itnerfaces, use 0x2840 (SD2) / 0x3040 (SD3) / 0x3840 (SD4) .. this is nothing related to OpenRex, it is just a note for myself.
*Note for myself: To test booting from SATA, use:
mw.l 0x020d8040 0x20; mw.l 0x020d8044 0x10000000; resetThe command above will simulate behaviour of booting OpenRex from an SD card. After you run the "reset" command, the uBoot placed on SD card will start. You can simply check the uBoot date compilation, just to be sure it's the uBoot you have just compiled. This is what you will see after you press OpenRex "reset" button:
U-Boot 2015.10+fslc+g1b6aee7 (Mar 03 2016 - 23:55:53 -0800) CPU: Freescale i.MX6Q rev1.2 996 MHz (running at 792 MHz) CPU: Automotive temperature grade (-40C to 125C) at 44C Reset cause: POR Board: iMX6-OpenRex I2C: ready DRAM: 2 GiB MMC: FSL_SDHC: 0 SF: Detected SST26VF032B with page size 256 Bytes, erase size 4 KiB, total 4 MiB In: serial Out: serial Err: serial Net: FEC Hit any key to stop autoboot: 0 OpenRex U-Boot> mw.l 0x020d8040 0x2840; mw.l 0x020d8044 0x10000000; reset resetting ... U-Boot 2015.10+fslc+gb17a706 (Mar 08 2016 - 08:24:21 -0800) CPU: Freescale i.MX6Q rev1.2 996 MHz (running at 792 MHz) CPU: Automotive temperature grade (-40C to 125C) at 45C Reset cause: WDOG Board: iMX6-OpenRex I2C: ready DRAM: 2 GiB MMC: FSL_SDHC: 0 SF: Detected SST26VF032B with page size 256 Bytes, erase size 4 KiB, total 4 MiB In: serial Out: serial Err: serial Net: FEC Hit any key to stop autoboot: 0 OpenRex U-Boot>Notice the different uBoot dates - the first one is running from SPI, the other one from SD card.
If you would like to test the Kernel and filesystem, run the commands bellow. On the host machine (the computer where you compiled the source code), copy the generated zImage and dtb file into /tftp:
cp ~/fsl-community-bsp/build-openrex/tmp/deploy/images/imx6q-openrex/zImage-imx6q-openrex.bin /tftp/zImage-imx6q-openrex cp ~/fsl-community-bsp/build-openrex/tmp/deploy/images/imx6q-openrex/zImage-imx6q-openrex.dtb /tftp/imx6q-openrex-dtbThen go to OpenRex uBoot, download the kernel, download the dtb and start it:
tftp 0x10800000 zImage-imx6q-openrex tftp 0x18000000 imx6q-openrex-dtb bootz 0x10800000 - 0x18000000!IMPORTANT! If it doesn't work at the first time, do not panic! You may need to set the uBoot parameters properly before you will be able to boot up from SD card correctly.
Here is example of uBoot environmental parameters which I had to set to boot up from SD card:
Here is example of booting OpenRex: