yocto_user_manual

1.Default Build Parameters Configuration

  • open /meta-alb/nxp-setup-alb.sh
  • MACHINE="s32r45evb" can set the machine default
  • SOURCESDIR="NXP_R45_meta_test" can set the default user meta layer
  • LAYER_LIST="meta-test" can add your own meta layer into yocto project
  • you can replace DOWNLOADS="$ROOTDIR/downloads" to /home/user/resource/yocto/bsp37/downloads can set the download dependency resources(linux,bsp,and so on)

F2.loder Introduction and common methods to add hello.ko into image

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
rsdk-yocto-build-32 tree
|--NXP_R45_meta_test - user Repository
| |--meta-alb
| |--meta-freesale
| |--meta-linaro
| |--meta-openembedded
| |--meta-qoriq
| |--meta-rsdk
| |--meta-security
| |--meta-test
| | |--conf
| | | |--layer.conf
| | |--packagegroups
| | | |--packagegroup-test-drivers.bb
| | |--recipes-core
| | | |--packagegroup
| | | | |--fsl-image-auto.bbappend
| | |--recipes-kernel
| | | |--hello
| | | | |--files
| | | | | |--testhello.c
| | | | | |--Makefile
| | | | | |--COPYING
| | | | |--hello-test.bb
| | |--COPYING.MIT
| | |--README.md
| |--meta-virtualization
| |--poky
|--build_test - build template files
|--downloads - is null will be remove to common floder or delete
|--sstate-cache - build cache

layer.conf

1
2
3
# add next into layer.conf
IMAGE_INSTALL_append=" hello-test"`
IMAGE_OVERHEAD_FACTOR = "3"`

packagegroup-test-drivers.bb

1
2
3
4
5
6
7
8
9
10
11
12
# add next into packagegroup-test-drivers.bb
SUMMARY = "RSDK Linux Kernel Drivers"
LICENSE = "MIT"

inherit packagegroup

PROVIDES = "packagegroup-test-drivers"

# added all rsdk kernel drivers/modules
RDEPENDS_packagegroup-test-drivers = "\
hello-test \
"

fsl-image-auto.bbappend

1
2
3
4
5
# add next into fsl-image-auto.bbappend
DESCRIPTION = "CUstom list of packages for build RSDK package"

# drivers/modules package
IMAGE_INSTALL_append = " packagegroup-test-drivers"

bitbake hello-test can test the .bb file

basic command:

  • source nxp-setup-alb.sh will check the and generate the default build folder and enter build_test.-d option will generate new build folder and enter it. -b option will choose the special build folder and enter it.
  • bitbake fsl-image-auto will build the u-boot,kernel,rootfs,generate sd/flash image automatic.
  • u-boot and kernel compiler steps:
    • configure cross compile
    • excute make xx_menuconfig,Configure u-boot/kernel
    • excute make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-,Build u-boot/kernel

3.For example add a new Fdma driver into yocto project

| |–meta-test
| | |–conf
| | | |–layer.conf
| | |–packagegroups
| | | |–packagegroup-test-drivers.bb
| | |–recipes-core
| | | |–packagegroup
| | | | |–fsl-image-auto.bbappend
| | | |–rsdk_env.inc
| | |–recipes-kernel
| | | |–fdma
| | | | |–fdma-driver.bb
| | | |–rsdk - will be add into .bbappend
| | | | |–files
| | | | | |–fdma_driver.patch - and you can generate the patch for osal-kernel-lib.bbappend
| | | | |–osal-kernel-lib.bbappend
| | | | |–rsdk_kmod.inc
| | | |–hello
| | | | |–files
| | | | | |–testhello.c
| | | | | |–Makefile
| | | | | |–COPYING
| | | | |–hello-test.bb
| | |–COPYING.MIT
| | |–README.md

  • add your fdma_driver.patch into osal-kernel-lib.bbappend
  • add your fdma-driver.bb into packagegroup-test-drivers.bb
  • add your packagegroup-test-drivers.bb into fsl-image-auto.bbappend

above all, and you can generate/add a new driver into your yocto image and path is rootfs(lib/modules/xxx/extra/fdma-driver.ko)

if you want to debug your change ,you did not need to rebuild all the sd card image,and just compiler linux image and dtb, and then replace it in sd card

  • bitbake linux-s32 to generate the linux resources and you can add your changed into this,and if the debug is ok ,you can generate the patch
  • bitbake linux-s32 -c do_compile -f will generate the linux image and dtb only, and the image and the dtb the path is build/tmp/work/s32r45evb-fsl-linux/linux-s32/5.15.96-r0/build/arch/arm64/boot/Image and the build/tmp/work/s32r45evb-fsl-linux/linux-s32/5.15.96-r0/build/arch/arm64/boot/dts/freesacle/s32r45-evb.dtb
  • when you want to generate a patch by Yocto, i suggest you git add -all the patch apply changes and git commit -m "xxx"first, and then add your change into the resources.

Add a compressed package to Yocto’s rootfs

  • add recipes-test into meta-test
    1
    2
    3
    4
    5
    |--meta-test
    | |--recipes-test
    | | |--files
    | | | |--test.zip
    | | |--ziptest.bb
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    // ziptest.bb
    SUMMARY = "ziptest application"
    LICENSE = "CLOSED"
    SRC_URI = "file://test.zip"
    SRC_URI[md5sum] = "1234567890abcdef1234567890abcdef"

    S = "${WORKDIR}"

    do_fetch() {
    echo "--- file is in ${WORKDIR} during fetch ---"
    ls ${WORKDIR}
    echo "--- start load the file to ${WORKDIR} ---"
    cp ${FILE_DIRNAME}/files/test.zip ${WORKDIR}
    }

    do_unpack() {
    :
    }
    do_patch() {
    :
    }
    do_configure() {
    :
    }
    do_compile() {
    :
    }
    // the `etc` is user setting under `/`
    do_install() {
    install -d ${D}/etc
    install -m 0644 ${WORKDIR}/test.zip ${D}/etc
    }

Add a file to Yocto’s rootfs

1
2
3
4
5
6
// 0644 used for data file(only read/write)  0755 used for execute file(execute)
|--meta-test
| |--recipes-test
| | |--files
| | | |--test.txt
| | |--txttest.bb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
SUMMARY = "txttest application"
LICENSE = "CLOSED"

FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}-${PV}"

SRC_URI = "file://test.txt"
// SRC_URI[md5sum] = "1234567890abcdef1234567890abcdef"

S = "${WORKDIR}"


// do_fetch() {
// echo "--- file is in ${WORKDIR} during fetch ---"
// ls ${WORKDIR}
// echo "--- start load the file to ${WORKDIR} ---"
// cp ${FILE_DIRNAME}/files/test.zip ${WORKDIR}
// }

// do_unpack() {
// :
// }
// do_patch() {
// :
// }
// do_configure() {
// :
// }
// do_compile() {
// :
// }
// the `etc` is user setting under `/`
do_install() {
install -d ${D}/etc
install -m 0755 ${WORKDIR}/test.txt ${D}/etc
}