├── Chapter01 ├── 01_01 │ └── commands.README ├── 01_02 │ └── commands.README ├── 01_03 │ └── commands.README ├── 01_04 │ └── commands.README ├── 01_06 │ └── commands.README ├── 01_07 │ ├── commands.README │ └── conf │ │ ├── bblayers.conf │ │ └── local.conf ├── 01_08 │ └── commands.README ├── 01_09 │ ├── commands.README │ └── conf │ │ ├── bblayers.conf │ │ └── local.conf ├── 01_10 │ └── commands.README ├── 01_11 │ ├── Dockerfile │ └── commands.README ├── 01_12 │ └── commands.README ├── 01_13 │ ├── commands.README │ └── conf │ │ ├── bblayers.conf │ │ └── local.conf ├── 01_14 │ ├── commands.README │ └── conf │ │ ├── bblayers.conf │ │ └── local.conf ├── 01_15 │ └── commands.README ├── 01_16 │ └── commands.README ├── 01_17 │ └── commands.README └── README ├── Chapter02 ├── 02_01 │ ├── commands.README │ ├── conf │ │ ├── bblayers.conf │ │ └── local.conf │ ├── meta-bsp-custom │ │ ├── COPYING.MIT │ │ ├── README │ │ ├── conf │ │ │ ├── layer.conf │ │ │ └── machine │ │ │ │ └── wandboard-custom.conf │ │ ├── recipes-bsp │ │ │ ├── formfactor │ │ │ │ ├── formfactor │ │ │ │ │ └── wandboard-custom │ │ │ │ │ │ └── machconfig │ │ │ │ └── formfactor_0.0.bbappend │ │ │ └── u-boot │ │ │ │ ├── u-boot-fslc │ │ │ │ └── 0001-02_01-Add-a-custom-wandboard-custom-machine.patch │ │ │ │ └── u-boot-fslc_%.bbappend │ │ └── recipes-kernel │ │ │ └── linux │ │ │ ├── linux-wandboard-4.1-2.0.x │ │ │ └── wandboard-custom │ │ │ │ └── defconfig │ │ │ └── linux-wandboard_4.1-2.0.x.bbappend │ └── u-boot-add-a-custom-wandboard-custom-machine.patch ├── 02_02 │ ├── commands.README │ ├── linux-add-a-custom-device-tree-and-configuration.patch │ └── meta-bsp-custom │ │ └── recipes-kernel │ │ └── linux │ │ └── linux-wandboard_4.1-2.0.x.bbappend ├── 02_03 │ └── commands.README ├── 02_04 │ └── commands.README ├── 02_05 │ └── commands.README ├── 02_06 │ └── commands.README ├── 02_07 │ ├── commands.README │ └── meta-bsp-custom │ │ └── recipes-kernel │ │ ├── hello-world │ │ ├── files │ │ │ ├── Makefile │ │ │ └── hello_world.c │ │ └── hello-world.bb │ │ └── linux │ │ └── linux-wandboard_4.1-2.0.x.bbappend ├── 02_08 │ └── commands.README ├── 02_09 │ └── commands.README ├── 02_10 │ └── commands.README ├── 02_11 │ └── commands.README └── 02_12 │ └── commands.README ├── Chapter03 ├── 03_01 │ └── commands.README ├── 03_02 │ ├── commands.README │ ├── conf │ │ ├── bblayers.conf │ │ └── local.conf │ └── meta-custom │ │ ├── COPYING.MIT │ │ ├── README │ │ └── conf │ │ └── layer.conf ├── 03_03 │ └── commands.README ├── 03_04 │ ├── commands.README │ ├── conf │ │ ├── bblayers.conf │ │ └── local.conf │ └── meta-custom │ │ └── recipes-core │ │ ├── busybox │ │ ├── busybox │ │ │ └── fragment.cfg │ │ └── busybox_1.24.1.bbappend │ │ ├── images │ │ └── custom-image.bb │ │ └── packagegroups │ │ └── packagegroup-debug-utils.bb ├── 03_05 │ ├── commands.README │ └── meta-custom │ │ └── recipes-example │ │ └── helloworld │ │ ├── helloworld │ │ └── helloworld.c │ │ └── helloworld_1.0.bb ├── 03_06 │ ├── commands.README │ ├── conf │ │ ├── bblayers.conf │ │ └── local.conf │ └── meta-custom │ │ └── recipes-example │ │ ├── example-data │ │ └── example.data │ │ └── example-data_1.0.bb ├── 03_07 │ ├── commands.README │ ├── conf │ │ ├── bblayers.conf │ │ └── local.conf │ └── meta-custom │ │ ├── files │ │ ├── group │ │ └── passwd │ │ ├── recipes-core │ │ └── images │ │ │ └── custom-image.bb │ │ └── recipes-example │ │ └── example-user_1.0.bb ├── 03_08 │ ├── commands.README │ └── meta-custom │ │ └── recipes-example │ │ ├── sysvinit-mount-1.0 │ │ └── mount.sh │ │ └── sysvinit-mount_1.0.bb ├── 03_09 │ ├── commands.README │ ├── conf │ │ ├── bblayers.conf │ │ └── local.conf │ ├── meta-bsp-custom │ │ └── recipes-kernel │ │ │ └── linux │ │ │ └── linux-wandboard-4.1-2.0.x │ │ │ └── wandboard-custom │ │ │ └── defconfig │ └── meta-custom │ │ └── recipes-example │ │ └── systemd-example │ │ ├── systemd-example-1.0 │ │ ├── simple-service.c │ │ └── systemd-example.service │ │ └── systemd-example_1.0.bb ├── 03_10 │ └── commands.README ├── 03_11 │ ├── commands.README │ ├── conf │ │ ├── bblayers.conf │ │ └── local.conf │ └── meta-bsp-custom │ │ └── recipes-kernel │ │ └── linux │ │ └── linux-wandboard-4.1-2.0.x │ │ └── wandboard-custom │ │ └── defconfig ├── 03_12 │ ├── commands.README │ ├── conf │ │ ├── bblayers.conf │ │ └── local.conf │ └── meta-custom │ │ ├── conf │ │ └── distro │ │ │ └── poky-tiny-custom.conf │ │ └── recipes-core │ │ └── images │ │ └── image-small.bb ├── 03_13 │ ├── commands.README │ └── meta-custom │ │ └── recipes-core │ │ └── images │ │ └── image-small-initramfs.bb ├── 03_14 │ ├── commands.README │ ├── conf-selinux │ │ ├── bblayers.conf │ │ └── local.conf │ ├── conf-smack │ │ ├── bblayers.conf │ │ └── local.conf │ └── meta-custom │ │ ├── recipes-core │ │ └── base-files │ │ │ └── base-files_%.bbappend │ │ └── recipes-kernel │ │ └── linux │ │ ├── linux-wandboard-4.1-2.0.x │ │ └── wandboard │ │ │ ├── defconfig │ │ │ └── defconfig-smack │ │ └── linux-wandboard_4.1-2.0.x.bbappend ├── 03_15 │ ├── commands.README │ └── conf │ │ ├── bblayers.conf │ │ └── local.conf ├── 03_16 │ └── commands.README └── 03_17 │ └── commands.README ├── Chapter04 ├── 04_01 │ └── commands.README ├── 04_02 │ └── commands.README ├── 04_03 │ └── commands.README ├── 04_04 │ └── commands.README ├── 04_05 │ ├── commands.README │ └── gtk_hello_world.c ├── 04_06 │ └── commands.README ├── 04_07 │ ├── commands.README │ ├── meta-custom │ │ └── recipes-sato │ │ │ └── images │ │ │ └── core-image-sato.bbappend │ └── qt_hello_world.cpp ├── 04_08 │ ├── commands.README │ └── meta-custom │ │ └── recipes-example │ │ └── helloworld │ │ ├── helloworld-1.0 │ │ └── 0001-Change-greeting-message.patch │ │ ├── helloworld │ │ └── helloworld.c │ │ └── helloworld_1.0.bb ├── 04_10 │ ├── commands.README │ └── meta-custom │ │ └── recipes-example │ │ ├── example-data │ │ ├── example-data │ │ │ └── example.data │ │ └── example-data_1.0.bb │ │ ├── example-user │ │ └── example-user_1.0.bb │ │ ├── hello │ │ └── hello_2.10.bb │ │ ├── helloworld │ │ ├── helloworld-1.0 │ │ │ └── 0001-Change-greeting-message.patch │ │ ├── helloworld │ │ │ └── helloworld.c │ │ └── helloworld_1.0.bb │ │ ├── systemd-example │ │ ├── systemd-example-1.0 │ │ │ ├── simple-service.c │ │ │ └── systemd-example.service │ │ └── systemd-example_1.0.bb │ │ └── sysvinit-mount │ │ ├── sysvinit-mount-1.0 │ │ └── mount.sh │ │ └── sysvinit-mount_1.0.bb ├── 04_11 │ └── meta-custom │ │ └── recipes-example │ │ └── helloworld-cmake │ │ ├── helloworld-cmake-1.0 │ │ ├── CMakeLists.txt │ │ └── helloworld.c │ │ └── helloworld-cmake_1.0.bb ├── 04_12 │ └── meta-custom │ │ └── recipes-example │ │ └── helloworld-scons │ │ ├── helloworld-scons-1.0 │ │ ├── SConstruct │ │ └── helloworld.c │ │ └── helloworld-scons_1.0.bb ├── 04_13 │ ├── commands.README │ └── meta-custom │ │ └── recipes-example │ │ ├── helloworld-dyn │ │ ├── helloworld-dyn-1.0 │ │ │ └── helloworld.c │ │ └── helloworld-dyn_1.0.bb │ │ ├── helloworld-static │ │ ├── helloworld-static-1.0 │ │ │ └── helloworld.c │ │ └── helloworld-static_1.0.bb │ │ ├── libhelloworld-dyn │ │ ├── libhelloworld-dyn-1.0 │ │ │ ├── hello.c │ │ │ ├── helloworld.h │ │ │ ├── helloworld.pc │ │ │ └── world.c │ │ └── libhelloworld-dyn_1.0.bb │ │ └── libhelloworld-static │ │ ├── libhelloworld-static-1.0 │ │ ├── hello.c │ │ ├── helloworld.h │ │ ├── helloworld.pc │ │ └── world.c │ │ └── libhelloworld-static_1.0.bb ├── 04_14 │ ├── commands.README │ ├── conf │ │ ├── bblayers.conf │ │ └── local.conf │ └── meta-custom │ │ └── recipes-qt │ │ ├── packagegroups │ │ └── packagegroup-qt5-examples.bb │ │ └── qt-helloworld │ │ ├── qt-helloworld-1.0 │ │ ├── qt_hello_world.cpp │ │ └── qt_hello_world.pro │ │ └── qt-helloworld_1.0.bb ├── 04_15 │ ├── commands.README │ └── meta-custom │ │ └── recipes-graphics │ │ └── gtk-helloworld │ │ ├── gtk-helloworld-1.0 │ │ └── gtk_hello_world.c │ │ └── gtk-helloworld_1.0.bb ├── 04_16 │ └── commands.README ├── 04_17 │ └── commands.README ├── 04_18 │ ├── commands.README │ ├── conf │ │ ├── bblayers.conf │ │ └── local.conf │ └── meta-custom │ │ └── recipes-python │ │ └── python-helloworld │ │ ├── python-helloworld-1.0 │ │ ├── helloworld │ │ │ ├── __init__.py │ │ │ └── main.py │ │ ├── python-helloworld.py │ │ └── setup.py │ │ └── python-helloworld_1.0.bb ├── 04_19 │ ├── HelloWorld.class │ ├── HelloWorld.java │ ├── commands.README │ └── conf │ │ ├── bblayers.conf │ │ └── local.conf ├── 04_20 │ ├── commands.README │ ├── conf │ │ ├── bblayers.conf │ │ └── local.conf │ └── meta-custom │ │ └── recipes-java │ │ └── java-helloworld │ │ ├── java-helloworld-1.0 │ │ └── HelloWorldSwing.java │ │ └── java-helloworld_1.0.bb ├── 04_21 │ ├── commands.README │ ├── conf │ │ ├── bblayers.conf │ │ └── local.conf │ ├── helloworld.js │ ├── meta-custom │ │ ├── recipes-devtools │ │ │ └── nodejs │ │ │ │ ├── nodejs-6.10.3 │ │ │ │ └── v8_fix_build_errors_with_g++_7.patch │ │ │ │ └── nodejs_6.10.3.bbappend │ │ └── recipes-example │ │ │ └── nodejs-helloworld │ │ │ ├── nodejs-helloworld │ │ │ ├── lockdown.json │ │ │ └── npm-shrinkwrap.json │ │ │ └── nodejs-helloworld_1.0.1.bb │ └── package.json └── 04_22 │ ├── commands.README │ ├── conf │ ├── bblayers.conf │ └── local.conf │ └── meta-custom │ └── recipes-kernel │ └── linux │ └── linux-wandboard-4.1-2.0.x │ └── wandboard │ └── defconfig ├── Chapter05 ├── 05_01 │ ├── commands.README │ └── conf │ │ ├── bblayers.conf │ │ └── local.conf ├── 05_02 │ ├── commands.README │ └── conf │ │ ├── bblayers.conf │ │ └── local.conf ├── 05_03 │ ├── commands.README │ └── conf │ │ ├── bblayers.conf │ │ └── local.conf ├── 05_04 │ └── commands.README ├── 05_05 │ ├── commands.README │ ├── conf │ │ ├── bblayers.conf │ │ └── local.conf │ └── perf_example.c ├── 05_06 │ ├── commands.README │ ├── conf │ │ ├── bblayers.conf │ │ └── local.conf │ └── meta-bsp-custom │ │ └── recipes-kernel │ │ └── hello-world-tracepoint │ │ └── hello-world-tracepoint │ │ ├── files │ │ ├── Makefile │ │ ├── hello_world.c │ │ └── trace.h │ │ └── hello-world-tracepoint.bb ├── 05_07 │ ├── commands.README │ ├── conf │ │ ├── bblayers.conf │ │ └── local.conf │ └── meta-bsp-custom │ │ └── recipes-kernel │ │ ├── open-jprobe │ │ ├── files │ │ │ ├── Makefile │ │ │ └── jprobe_open.c │ │ └── open-jprobe.bb │ │ ├── open-kprobe │ │ ├── files │ │ │ ├── Makefile │ │ │ └── kprobe_open.c │ │ └── open-kprobe.bb │ │ └── open-kretprobe │ │ ├── files │ │ ├── Makefile │ │ └── kretprobe_open.c │ │ └── open-kretprobe.bb ├── 05_08 │ └── commands.README ├── 05_09 │ └── commands.README ├── 05_10 │ ├── commands.README │ └── conf │ │ ├── bblayers.conf │ │ └── local.conf ├── 05_11 │ ├── commands.README │ ├── conf │ │ ├── bblayers.conf │ │ └── local.conf │ └── sys_open.stp ├── 05_12 │ ├── commands.README │ ├── conf │ │ ├── bblayers.conf │ │ └── local.conf │ ├── helloworld.c │ ├── hw.tp │ └── meta-custom │ │ └── recipes-example │ │ └── helloworld │ │ ├── helloworld-1.0 │ │ ├── 0001-Change-greeting-message.patch │ │ └── helloworld.c │ │ ├── helloworld │ │ └── helloworld.c │ │ └── helloworld_1.0.bb └── 05_13 │ ├── commands.README │ └── conf │ ├── bblayers.conf │ └── local.conf ├── LICENSE └── README.md /Chapter01/01_01/commands.README: -------------------------------------------------------------------------------- 1 | sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat libsdl1.2-dev xterm bmap-tools make xsltproc docbook-utils fop dblatex xmlto cpio python python3 python3-pip python3-pexpect xz-utils debianutils iputils-ping python-git python3-git curl parted dosfstools mtools gnupg autoconf automake libtool libglib2.0-dev python-gtk2 bsdmainutils screen libstdc++-5-dev libx11-dev 2 | 3 | git config --global user.email "your.email.address@somewhere.com" 4 | git config --global user.name "Your Name" 5 | 6 | noatime,barrier=0,commit=6000 7 | -------------------------------------------------------------------------------- /Chapter01/01_02/commands.README: -------------------------------------------------------------------------------- 1 | sudo install -o $(id -u) -g $(id -g) -d /opt/yocto 2 | cd /opt/yocto 3 | git clone --branch rocko git://git.yoctoproject.org/poky 4 | -------------------------------------------------------------------------------- /Chapter01/01_03/commands.README: -------------------------------------------------------------------------------- 1 | cd /opt/yocto/poky 2 | source oe-init-build-env qemuarm 3 | 4 | BB_SERVER_TIMEOUT = "n" 5 | 6 | cd /opt/yocto/poky/qemuarm 7 | rm -Rf tmp sstate-cache 8 | 9 | TEMPLATECONF=meta-custom/config source oe-init-build-env 10 | -------------------------------------------------------------------------------- /Chapter01/01_04/commands.README: -------------------------------------------------------------------------------- 1 | cd /opt/yocto/poky 2 | ls meta*/recipes*/images/*.bb 3 | 4 | cd /opt/yocto/poky/ 5 | source /opt/yocto/poky/oe-init-build-env qemuarm 6 | MACHINE=qemuarm bitbake core-image-minimal 7 | 8 | export MACHINE=qemuarm 9 | 10 | MACHINE ?= "qemuarm" 11 | 12 | bitbake core-image-minimal 13 | 14 | INHERIT += "rm_work" 15 | RM_WORK_EXCLUDE += "linux-wandboard u-boot-fslc" 16 | 17 | INHIBIT_PACKAGE_DEBUG_SPLIT = "1" 18 | 19 | runqemu qemuarm core-image-minimal 20 | -------------------------------------------------------------------------------- /Chapter01/01_06/commands.README: -------------------------------------------------------------------------------- 1 | mkdir -p ${HOME}/bin/ 2 | curl https://storage.googleapis.com/git-repo-downloads/repo > ${HOME}/bin/repo 3 | chmod a+x ${HOME}/bin/repo 4 | 5 | mkdir /opt/yocto/fsl-community-bsp 6 | cd /opt/yocto/fsl-community-bsp 7 | repo init -u https://github.com/Freescale/fsl-community-bsp-platform -b rocko 8 | repo sync 9 | 10 | ls sources/meta-freescale*/conf/machine/*.conf 11 | ls sources/meta-freescale*/recipes*/images/*.bb 12 | 13 | sudo apt-get install libfreetype6-dev libjpeg8-dev python3-dev python3-pip python3-sphinx texlive-fonts-recommended texlive-latex-extra zlib1g-dev fonts-liberation 14 | sudo pip3 install reportlab sphinxcontrib-blockdiag 15 | 16 | make singlehtml 17 | make latexpdf 18 | 19 | cd /opt/yocto/fsl-community-bsp/sources/Documentation/release-notes 20 | make latexpdf singlehtml 21 | 22 | -------------------------------------------------------------------------------- /Chapter01/01_07/commands.README: -------------------------------------------------------------------------------- 1 | cd /opt/yocto/fsl-community-bsp 2 | MACHINE=wandboard DISTRO=poky source setup-environment wandboard 3 | bitbake core-image-minimal 4 | 5 | ACCEPT_FSL_EULA = "1" 6 | 7 | cd /opt/yocto/fsl-community-bsp/ 8 | source setup-environment wandboard 9 | 10 | cd /opt/yocto/fsl-community-bsp/wandboard/tmp/deploy/images/wandboard/ 11 | sudo bmaptool copy --nobmap core-image-minimal-wandboard.wic.gz /dev/sdN 12 | 13 | sudo apt-get install bmap-tools 14 | 15 | sudo umount /dev/sdN 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /Chapter01/01_07/conf/bblayers.conf: -------------------------------------------------------------------------------- 1 | LCONF_VERSION = "7" 2 | 3 | BBPATH = "${TOPDIR}" 4 | BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../..')}" 5 | 6 | BBFILES ?= "" 7 | BBLAYERS = " \ 8 | ${BSPDIR}/sources/poky/meta \ 9 | ${BSPDIR}/sources/poky/meta-poky \ 10 | ${BSPDIR}/sources/meta-openembedded/meta-oe \ 11 | ${BSPDIR}/sources/meta-openembedded/meta-multimedia \ 12 | ${BSPDIR}/sources/meta-freescale \ 13 | ${BSPDIR}/sources/meta-freescale-3rdparty \ 14 | ${BSPDIR}/sources/meta-freescale-distro \ 15 | " 16 | -------------------------------------------------------------------------------- /Chapter01/01_07/conf/local.conf: -------------------------------------------------------------------------------- 1 | MACHINE ??= 'wandboard' 2 | DISTRO ?= 'poky' 3 | PACKAGE_CLASSES ?= "package_rpm" 4 | EXTRA_IMAGE_FEATURES ?= "debug-tweaks" 5 | USER_CLASSES ?= "buildstats image-mklibs image-prelink" 6 | PATCHRESOLVE = "noop" 7 | BB_DISKMON_DIRS = "\ 8 | STOPTASKS,${TMPDIR},1G,100K \ 9 | STOPTASKS,${DL_DIR},1G,100K \ 10 | STOPTASKS,${SSTATE_DIR},1G,100K \ 11 | STOPTASKS,/tmp,100M,100K \ 12 | ABORT,${TMPDIR},100M,1K \ 13 | ABORT,${DL_DIR},100M,1K \ 14 | ABORT,${SSTATE_DIR},100M,1K \ 15 | ABORT,/tmp,10M,1K" 16 | PACKAGECONFIG_append_pn-qemu-native = " sdl" 17 | PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl" 18 | CONF_VERSION = "1" 19 | 20 | DL_DIR ?= "${BSPDIR}/downloads/" 21 | ACCEPT_FSL_EULA = "1" 22 | 23 | INHERIT += "rm_work" 24 | RM_WORK_EXCLUDE += "linux-wandboard u-boot-fslc" 25 | INHIBIT_PACKAGE_DEBUG_SPLIT = "1" 26 | -------------------------------------------------------------------------------- /Chapter01/01_08/commands.README: -------------------------------------------------------------------------------- 1 | sudo apt-get install python3-pip 2 | pip3 install --user -r /opt/yocto/poky/bitbake/toaster-requirements.txt 3 | 4 | cd /opt/yocto/poky 5 | source oe-init-build-env 6 | source toaster start 7 | 8 | source toaster start webport=: 9 | 10 | cd /opt/yocto/poky/build 11 | ../bitbake/lib/toaster/manage.py createsuperuser 12 | 13 | core-image-base:populate_sdk 14 | core-image-base:populate_sdk_ext 15 | 16 | cd /opt/yocto/poky/build 17 | /opt/yocto/poky/bitbake/lib/toaster/manage.py [] 18 | 19 | -------------------------------------------------------------------------------- /Chapter01/01_09/commands.README: -------------------------------------------------------------------------------- 1 | curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - 2 | 3 | sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" 4 | 5 | sudo apt-get update 6 | sudo apt-get install docker-ce 7 | 8 | sudo usermod -aG docker ${USER} 9 | su - ${USER} 10 | 11 | docker run hello-world 12 | mkdir /opt/yocto/docker-toaster 13 | 14 | docker run -it --rm -p 127.0.0.1:18000:8000 -v /opt/yocto/docker-toaster:/workdir crops/toaster 15 | docker ps 16 | docker stop 17 | 18 | 19 | -------------------------------------------------------------------------------- /Chapter01/01_09/conf/bblayers.conf: -------------------------------------------------------------------------------- 1 | LCONF_VERSION = "7" 2 | 3 | BBPATH = "${TOPDIR}" 4 | BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../..')}" 5 | 6 | BBFILES ?= "" 7 | BBLAYERS = " \ 8 | ${BSPDIR}/sources/poky/meta \ 9 | ${BSPDIR}/sources/poky/meta-poky \ 10 | ${BSPDIR}/sources/meta-openembedded/meta-oe \ 11 | ${BSPDIR}/sources/meta-openembedded/meta-multimedia \ 12 | ${BSPDIR}/sources/meta-freescale \ 13 | ${BSPDIR}/sources/meta-freescale-3rdparty \ 14 | ${BSPDIR}/sources/meta-freescale-distro \ 15 | " 16 | -------------------------------------------------------------------------------- /Chapter01/01_09/conf/local.conf: -------------------------------------------------------------------------------- 1 | MACHINE ??= 'wandboard' 2 | DISTRO ?= 'poky' 3 | PACKAGE_CLASSES ?= "package_rpm" 4 | EXTRA_IMAGE_FEATURES ?= "debug-tweaks" 5 | USER_CLASSES ?= "buildstats image-mklibs image-prelink" 6 | PATCHRESOLVE = "noop" 7 | BB_DISKMON_DIRS = "\ 8 | STOPTASKS,${TMPDIR},1G,100K \ 9 | STOPTASKS,${DL_DIR},1G,100K \ 10 | STOPTASKS,${SSTATE_DIR},1G,100K \ 11 | STOPTASKS,/tmp,100M,100K \ 12 | ABORT,${TMPDIR},100M,1K \ 13 | ABORT,${DL_DIR},100M,1K \ 14 | ABORT,${SSTATE_DIR},100M,1K \ 15 | ABORT,/tmp,10M,1K" 16 | PACKAGECONFIG_append_pn-qemu-native = " sdl" 17 | PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl" 18 | CONF_VERSION = "1" 19 | 20 | DL_DIR ?= "${BSPDIR}/downloads/" 21 | ACCEPT_FSL_EULA = "1" 22 | 23 | INHERIT += "rm_work" 24 | RM_WORK_EXCLUDE += "linux-wandboard u-boot-fslc" 25 | INHIBIT_PACKAGE_DEBUG_SPLIT = "1" 26 | 27 | IMAGE_FSTYPES = "wic.gz tar.bz2" 28 | -------------------------------------------------------------------------------- /Chapter01/01_10/commands.README: -------------------------------------------------------------------------------- 1 | sudo apt-get install tftpd-hpa 2 | sudo chmod 1777 /var/lib/tftpboot 3 | cd /opt/yocto/fsl-community-bsp/wandboard/tmp/deploy/images/wandboard/ 4 | cp zImage-wandboard.bin zImage-imx6qp-wandboard-revd1.dtb /var/lib/tftpboot 5 | 6 | sudo apt-get install nfs-kernel-server 7 | cd /opt/yocto/fsl-community-bsp/wandboard 8 | 9 | IMAGE_FSTYPES = "wic.gz tar.bz2" 10 | 11 | sudo mkdir /nfsroot 12 | cd /nfsroot 13 | sudo tar --numeric-owner -x -v -f /opt/yocto/fsl-community-bsp/wandboard/tmp/deploy/images/wandboard/core-image-minimal-wandboard.tar.bz2 14 | 15 | cd /opt/yocto/fsl-community-bsp/wandboard 16 | bitbake meta-ide-support 17 | runqemu-extract-sdk tmp/deploy/images/wandboard/core-image-minimal-wandboard.tar.bz2 /nfsroot/rootfs/ 18 | 19 | /nfsroot/ *(rw,no_root_squash,async,no_subtree_check) 20 | 21 | sudo service nfs-kernel-server restart 22 | 23 | env set netload 'tftpboot ${loadaddr} ${image};tftpboot ${fdt_addr} ${fdt_file}' 24 | env set netargs 'setenv bootargs console=${console} ${optargs} root=/dev/nfs ip=${ipaddr} nfsroot=${serverip}:${nfsroot},v3,tcp' 25 | env set netboot 'echo Booting from net ...;run netargs;run netload;bootz ${loadaddr} - ${fdt_addr}' 26 | 27 | env set ipaddr 28 | env set serverip 29 | env set nfsroot /nfsroot 30 | env set image zImage-wandboard.bin 31 | env set fdt_file zImage-imx6qp-wandboard-revd1.dtb 32 | env save 33 | run netboot 34 | 35 | cat /proc/cmdline 36 | 37 | -------------------------------------------------------------------------------- /Chapter01/01_11/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | MAINTAINER Alex Gonzalez 3 | 4 | # Upgrade system and Yocto Proyect basic dependencies 5 | RUN apt-get update && apt-get -y upgrade && apt-get -y install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat cpio python python3 python3-pip python3-pexpect xz-utils debianutils iputils-ping libsdl1.2-dev xterm curl 6 | 7 | # Set up locales 8 | RUN apt-get -y install locales apt-utils sudo && dpkg-reconfigure locales && locale-gen en_US.UTF-8 && update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 9 | ENV LANG en_US.utf8 10 | 11 | # Clean up APT when done. 12 | RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* 13 | 14 | # Replace dash with bash 15 | RUN rm /bin/sh && ln -s /bin/bash /bin/sh 16 | 17 | # User management 18 | RUN groupadd -g 1000 build && useradd -u 1000 -g 1000 -ms /bin/bash build && usermod -a -G sudo build && usermod -a -G users build 19 | 20 | # Install repo 21 | RUN curl -o /usr/local/bin/repo https://storage.googleapis.com/git-repo-downloads/repo && chmod a+x /usr/local/bin/repo 22 | 23 | # Run as build user from the installation path 24 | ENV YOCTO_INSTALL_PATH "/opt/yocto" 25 | RUN install -o 1000 -g 1000 -d $YOCTO_INSTALL_PATH 26 | USER build 27 | WORKDIR ${YOCTO_INSTALL_PATH} 28 | 29 | # Set the Yocto release 30 | ENV YOCTO_RELEASE "pyro" 31 | 32 | # Install Poky 33 | RUN git clone --branch ${YOCTO_RELEASE} git://git.yoctoproject.org/poky 34 | 35 | # Install FSL community BSP 36 | RUN mkdir -p ${YOCTO_INSTALL_PATH}/fsl-community-bsp && cd ${YOCTO_INSTALL_PATH}/fsl-community-bsp && repo init -u https://github.com/Freescale/fsl-community-bsp-platform -b ${YOCTO_RELEASE} && repo sync 37 | 38 | # Create a build directory for the FSL community BSP 39 | RUN mkdir -p ${YOCTO_INSTALL_PATH}/fsl-community-bsp/build 40 | 41 | # Make /home/build the working directory 42 | WORKDIR /home/build 43 | -------------------------------------------------------------------------------- /Chapter01/01_11/commands.README: -------------------------------------------------------------------------------- 1 | docker build 2 | sudo install -o 1000 -g 1000 -d /opt/yocto/docker-yocto-builder 3 | cd /opt/yocto/docker-yocto-builder 4 | docker run -it --rm -v $PWD:/home/build yoctocookbook2ndedition/docker-yocto-builder 5 | 6 | # Inside the container 7 | source /opt/yocto/poky/oe-init-build-env qemuarm 8 | MACHINE=qemuarm bitbake core-image-minimal 9 | 10 | docker run -it --rm -v $PWD:/opt/yocto/fsl-community-bsp/build yoctocookbook2ndedition/docker-yocto-builder 11 | 12 | # Inside the container 13 | cd /opt/yocto/fsl-community-bsp/ 14 | mkdir -p wandboard 15 | MACHINE=wandboard DISTRO=poky source setup-environment build 16 | bitbake core-image-minimal 17 | 18 | 19 | -------------------------------------------------------------------------------- /Chapter01/01_12/commands.README: -------------------------------------------------------------------------------- 1 | DL_DIR ?= "${BSPDIR}/downloads/" 2 | 3 | INHERIT += "own-mirrors" 4 | SOURCE_MIRROR_URL = "http://example.com/my-source-mirror" 5 | 6 | BB_GENERATE_MIRROR_TARBALLS = "1" 7 | 8 | BB_FETCH_PREMIRRORONLY = "1" 9 | -------------------------------------------------------------------------------- /Chapter01/01_13/commands.README: -------------------------------------------------------------------------------- 1 | SSTATE_MIRRORS ?= "\ 2 | file://.* file:///nfs/local/mount/sstate/PATH" 3 | 4 | SSTATE_MIRRORS ?= "file://.* http://example.com/some_path/sstate-cache/PATH" 5 | -------------------------------------------------------------------------------- /Chapter01/01_13/conf/bblayers.conf: -------------------------------------------------------------------------------- 1 | LCONF_VERSION = "7" 2 | 3 | BBPATH = "${TOPDIR}" 4 | BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../..')}" 5 | 6 | BBFILES ?= "" 7 | BBLAYERS = " \ 8 | ${BSPDIR}/sources/poky/meta \ 9 | ${BSPDIR}/sources/poky/meta-poky \ 10 | ${BSPDIR}/sources/meta-openembedded/meta-oe \ 11 | ${BSPDIR}/sources/meta-openembedded/meta-multimedia \ 12 | ${BSPDIR}/sources/meta-freescale \ 13 | ${BSPDIR}/sources/meta-freescale-3rdparty \ 14 | ${BSPDIR}/sources/meta-freescale-distro \ 15 | " 16 | -------------------------------------------------------------------------------- /Chapter01/01_13/conf/local.conf: -------------------------------------------------------------------------------- 1 | MACHINE ??= 'wandboard' 2 | DISTRO ?= 'poky' 3 | PACKAGE_CLASSES ?= "package_rpm" 4 | EXTRA_IMAGE_FEATURES ?= "debug-tweaks" 5 | USER_CLASSES ?= "buildstats image-mklibs image-prelink" 6 | PATCHRESOLVE = "noop" 7 | BB_DISKMON_DIRS = "\ 8 | STOPTASKS,${TMPDIR},1G,100K \ 9 | STOPTASKS,${DL_DIR},1G,100K \ 10 | STOPTASKS,${SSTATE_DIR},1G,100K \ 11 | STOPTASKS,/tmp,100M,100K \ 12 | ABORT,${TMPDIR},100M,1K \ 13 | ABORT,${DL_DIR},100M,1K \ 14 | ABORT,${SSTATE_DIR},100M,1K \ 15 | ABORT,/tmp,10M,1K" 16 | PACKAGECONFIG_append_pn-qemu-native = " sdl" 17 | PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl" 18 | CONF_VERSION = "1" 19 | 20 | DL_DIR ?= "${BSPDIR}/downloads/" 21 | ACCEPT_FSL_EULA = "1" 22 | 23 | INHERIT += "rm_work" 24 | RM_WORK_EXCLUDE += "linux-wandboard u-boot-fslc" 25 | INHIBIT_PACKAGE_DEBUG_SPLIT = "1" 26 | 27 | IMAGE_FSTYPES = "wic.gz tar.bz2" 28 | 29 | EXTRA_IMAGE_FEATURES += "package-management" 30 | PRSERV_HOST = "localhost:0" 31 | 32 | PACKAGE_FEED_URIS = "http://192.168.1.115/" 33 | PACKAGE_FEED_BASE_PATHS = "rpm" 34 | INHERIT += "sign_rpm" 35 | RPM_GPG_NAME = "DC621B51" 36 | RPM_GPG_PASSPHRASE = "pw" 37 | INHERIT += "sign_package_feed" 38 | PACKAGE_FEED_GPG_NAME = "DC621B51" 39 | PACKAGE_FEED_GPG_PASSPHRASE_FILE = "/opt/yocto/rpm-feed-passphrase" 40 | -------------------------------------------------------------------------------- /Chapter01/01_14/commands.README: -------------------------------------------------------------------------------- 1 | EXTRA_IMAGE_FEATURES += "package-management" 2 | 3 | PRSERV_HOST = "localhost:0" 4 | 5 | bitbake-prserv --host --port --start 6 | 7 | PRSERV_HOST = ":" 8 | 9 | sudo apt-get install lighttpd 10 | sudo ln -s /opt/yocto/fsl-community-bsp/wandboard/tmp/deploy/rpm /var/www/html/rpm 11 | sudo service lighttpd reload 12 | 13 | cd /opt/yocto/fsl-community-bsp/wandboard/tmp/deploy/rpm 14 | sudo python -m SimpleHTTPServer 80 15 | 16 | bitbake package-index 17 | 18 | rsync -r -u /opt/yocto/fsl-community-bsp/wandboard/tmp/deploy/rpm/* / 19 | sudo apt-get install createrepo 20 | createrepo 21 | 22 | bitbake createrepo-c-native -c addto_recipe_sysroot 23 | oe-run-native createrepo-c-native createrepo_c 24 | 25 | mkdir -p /etc/yum.repos.d 26 | vi /etc/yum.repos.d/yocto.repo 27 | 28 | dnf --nogpgcheck makecache 29 | dnf --nogpgcheck search 30 | dnf --nogpgcheck install 31 | 32 | gpgcheck=0 33 | 34 | PACKAGE_FEED_URIS = "http:///" 35 | PACKAGE_FEED_BASE_PATHS = "rpm" 36 | 37 | INHERIT += "sign_rpm" 38 | 39 | INHERIT += "sign_ipk" 40 | 41 | RPM_GPG_NAME = "" 42 | RPM_GPG_PASSPHRASE = "" 43 | 44 | IPK_GPG_NAME = "" 45 | IPK_GPG_PASSPHRASE_FILE = "" 46 | 47 | INHERIT += "sign_package_feed" 48 | PACKAGE_FEED_GPG_NAME = "" 49 | PACKAGE_FEED_GPG_PASSPHRASE_FILE = "" 50 | 51 | sudo apt-get install gnupg 52 | gpg --gen-key 53 | gpg --list-keys 54 | 55 | gpg --output rpm-feed.gpg --export 56 | 57 | bitbake package-index 58 | 59 | gpg --output rpm-feed.pub --armor --export 60 | gpg --output rpm-feed.sec --armor --export-secret-key 61 | 62 | gpg --import rpm-feed.pub 63 | gpg --allow-secret-key-import --import rpm-feed.sec 64 | 65 | 66 | -------------------------------------------------------------------------------- /Chapter01/01_14/conf/bblayers.conf: -------------------------------------------------------------------------------- 1 | LCONF_VERSION = "7" 2 | 3 | BBPATH = "${TOPDIR}" 4 | BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../..')}" 5 | 6 | BBFILES ?= "" 7 | BBLAYERS = " \ 8 | ${BSPDIR}/sources/poky/meta \ 9 | ${BSPDIR}/sources/poky/meta-poky \ 10 | ${BSPDIR}/sources/meta-openembedded/meta-oe \ 11 | ${BSPDIR}/sources/meta-openembedded/meta-multimedia \ 12 | ${BSPDIR}/sources/meta-freescale \ 13 | ${BSPDIR}/sources/meta-freescale-3rdparty \ 14 | ${BSPDIR}/sources/meta-freescale-distro \ 15 | " 16 | -------------------------------------------------------------------------------- /Chapter01/01_14/conf/local.conf: -------------------------------------------------------------------------------- 1 | MACHINE ??= 'wandboard' 2 | DISTRO ?= 'poky' 3 | PACKAGE_CLASSES ?= "package_rpm" 4 | EXTRA_IMAGE_FEATURES ?= "debug-tweaks" 5 | USER_CLASSES ?= "buildstats image-mklibs image-prelink" 6 | PATCHRESOLVE = "noop" 7 | BB_DISKMON_DIRS = "\ 8 | STOPTASKS,${TMPDIR},1G,100K \ 9 | STOPTASKS,${DL_DIR},1G,100K \ 10 | STOPTASKS,${SSTATE_DIR},1G,100K \ 11 | STOPTASKS,/tmp,100M,100K \ 12 | ABORT,${TMPDIR},100M,1K \ 13 | ABORT,${DL_DIR},100M,1K \ 14 | ABORT,${SSTATE_DIR},100M,1K \ 15 | ABORT,/tmp,10M,1K" 16 | PACKAGECONFIG_append_pn-qemu-native = " sdl" 17 | PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl" 18 | CONF_VERSION = "1" 19 | 20 | DL_DIR ?= "${BSPDIR}/downloads/" 21 | ACCEPT_FSL_EULA = "1" 22 | 23 | INHERIT += "rm_work" 24 | RM_WORK_EXCLUDE += "linux-wandboard u-boot-fslc" 25 | INHIBIT_PACKAGE_DEBUG_SPLIT = "1" 26 | 27 | IMAGE_FSTYPES = "wic.gz tar.bz2" 28 | 29 | INHERIT += "buildhistory" 30 | BUILDHISTORY_COMMIT = "1" 31 | -------------------------------------------------------------------------------- /Chapter01/01_15/commands.README: -------------------------------------------------------------------------------- 1 | INHERIT += "buildhistory" 2 | 3 | BUILDHISTORY_COMMIT = "1" 4 | 5 | BUILDHISTORY_FEATURES = "image" 6 | 7 | BUILDHISTORY_IMAGE_FILES += "/path/to/file" 8 | 9 | sudo apt-get install python3-django 10 | sudo apt-get install python-django-registration 11 | 12 | cd /opt/yocto/fsl-community-bsp/sources 13 | git clone git://git.yoctoproject.org/buildhistory-web 14 | cd buildhistory-web/ 15 | 16 | python manage.py migrate 17 | python3 warningmgr/import.py /opt/yocto/fsl-community-bsp/sources/poky/ /opt/yocto/fsl-community-bsp/wandboard/buildhistory/ 18 | 19 | python manage.py runserver 20 | 21 | sudo mkdir /run/workspace 22 | sudo chown ${USER} /run/workspace/ 23 | cp -r /opt/yocto/fsl-community-bsp/wandboard/buildhistory/ /run/workspace/ 24 | cd /run/workspace/buildhistory/ 25 | 26 | git rev-parse "HEAD@{1 month ago}" > .git/info/grafts 27 | git filter-branch 28 | git clone file://${tmpfs}/buildhistory buildhistory.new 29 | 30 | rm -rf buildhistory 31 | mv buildhistory.new /opt/yocto/fsl-community-bsp/wandboard/buildhistory/ 32 | rm -rf /run/workspace/ 33 | -------------------------------------------------------------------------------- /Chapter01/01_16/commands.README: -------------------------------------------------------------------------------- 1 | USER_CLASSES ?= "buildstats" 2 | 3 | cd /opt/yocto/fsl-community-bsp/wandboard/ 4 | /opt/yocto/fsl-community-bsp/sources/poky/scripts/pybootchartgui/pybootchartgui.py tmp/buildstats/ -o /tmp 5 | 6 | 7 | -------------------------------------------------------------------------------- /Chapter01/01_17/commands.README: -------------------------------------------------------------------------------- 1 | cd /opt/yocto/fsl-community-bsp/sources 2 | find -name "*busybox*" 3 | 4 | find -name "*busybox*.bb*" 5 | bitbake-layers show-recipes "" 6 | 7 | bitbake-layers show-recipes gdb* 8 | 9 | devtool search 10 | 11 | cd /opt/yocto/fsl-community-bsp 12 | source setup-environment wandboard 13 | bitbake 14 | devtool search gdb 15 | 16 | bitbake -e | grep -w DISTRO_FEATURES 17 | 18 | bitbake -e busybox | grep ^S= 19 | 20 | bitbake -e | grep ^WORKDIR= 21 | 22 | bitbake -c devshell 23 | 24 | bitbake -c devpyshell 25 | 26 | OE_TERMINAL = "screen" 27 | 28 | bitbake -c listtasks 29 | bitbake -f 30 | bitbake -c compile -f 31 | 32 | bitbake --show-versions 33 | bitbake -v 34 | bitbake -g 35 | bitbake -g -I glibc 36 | 37 | dot -Tps filename.dot -o outfile.ps 38 | 39 | bitbake -g -u taskexp 40 | 41 | bitbake -DDD 42 | 43 | INHERIT += "report-error" 44 | 45 | send-error-report ${LOG_DIR}/error-report/error-report_${TSTAMP} 46 | 47 | -------------------------------------------------------------------------------- /Chapter01/README: -------------------------------------------------------------------------------- 1 | This code bundle should be used in conjuntion with the "Embedded Linux Projects 2 | Using Yocto Project Cookbook" 2nd edition published by Packt Publising. 3 | 4 | The directories are named with the chapter and recipe number they belong to: 5 | 6 | CH_N 7 | 8 | where, 9 | 10 | CH is the chapter number 11 | N is the recipe number 12 | 13 | Inside the chapter directories there is: 14 | 15 | * Source code 16 | * Metadata inside the meta-bsp-custom and meta-custom directories 17 | * Command line and configuration lines inside the 'commands.README' file 18 | * local.conf and bblayers.conf files when applicable inside the conf/ directory 19 | 20 | Please forward erratas to http://www.packtpub.com/submit-errata 21 | -------------------------------------------------------------------------------- /Chapter02/02_01/commands.README: -------------------------------------------------------------------------------- 1 | source setup-environment wandboard 2 | 3 | yocto-layer create bsp-custom 4 | 5 | ${BSPDIR}/sources/meta-bsp-custom \ 6 | 7 | cd /opt/yocto/fsl-community-bsp/ 8 | MACHINE=wandboard-custom DISTRO=poky source setup-environment wandboard-custom 9 | 10 | bitbake-layers add-layer /opt/yocto/fsl-community-bsp/sources/meta-bsp-custom/ 11 | 12 | bitbake core-image-minimal 13 | -------------------------------------------------------------------------------- /Chapter02/02_01/conf/bblayers.conf: -------------------------------------------------------------------------------- 1 | LCONF_VERSION = "7" 2 | 3 | BBPATH = "${TOPDIR}" 4 | BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../..')}" 5 | 6 | BBFILES ?= "" 7 | BBLAYERS = " \ 8 | ${BSPDIR}/sources/poky/meta \ 9 | ${BSPDIR}/sources/poky/meta-poky \ 10 | ${BSPDIR}/sources/meta-openembedded/meta-oe \ 11 | ${BSPDIR}/sources/meta-openembedded/meta-multimedia \ 12 | ${BSPDIR}/sources/meta-freescale \ 13 | ${BSPDIR}/sources/meta-freescale-3rdparty \ 14 | ${BSPDIR}/sources/meta-freescale-distro \ 15 | ${BSPDIR}/sources/meta-bsp-custom \ 16 | " 17 | -------------------------------------------------------------------------------- /Chapter02/02_01/conf/local.conf: -------------------------------------------------------------------------------- 1 | MACHINE ??= 'wandboard-custom' 2 | DISTRO ?= 'poky' 3 | PACKAGE_CLASSES ?= "package_rpm" 4 | EXTRA_IMAGE_FEATURES ?= "debug-tweaks" 5 | USER_CLASSES ?= "buildstats image-mklibs image-prelink" 6 | PATCHRESOLVE = "noop" 7 | BB_DISKMON_DIRS = "\ 8 | STOPTASKS,${TMPDIR},1G,100K \ 9 | STOPTASKS,${DL_DIR},1G,100K \ 10 | STOPTASKS,${SSTATE_DIR},1G,100K \ 11 | STOPTASKS,/tmp,100M,100K \ 12 | ABORT,${TMPDIR},100M,1K \ 13 | ABORT,${DL_DIR},100M,1K \ 14 | ABORT,${SSTATE_DIR},100M,1K \ 15 | ABORT,/tmp,10M,1K" 16 | PACKAGECONFIG_append_pn-qemu-native = " sdl" 17 | PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl" 18 | CONF_VERSION = "1" 19 | 20 | DL_DIR ?= "${BSPDIR}/downloads/" 21 | ACCEPT_FSL_EULA = "1" 22 | 23 | INHERIT += "rm_work" 24 | RM_WORK_EXCLUDE += "linux-wandboard u-boot-fslc" 25 | INHIBIT_PACKAGE_DEBUG_SPLIT = "1" 26 | 27 | IMAGE_FSTYPES = "wic.gz tar.bz2" 28 | 29 | INHERIT += "buildhistory" 30 | BUILDHISTORY_COMMIT = "1" 31 | -------------------------------------------------------------------------------- /Chapter02/02_01/meta-bsp-custom/COPYING.MIT: -------------------------------------------------------------------------------- 1 | Permission is hereby granted, free of charge, to any person obtaining a copy 2 | of this software and associated documentation files (the "Software"), to deal 3 | in the Software without restriction, including without limitation the rights 4 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 5 | copies of the Software, and to permit persons to whom the Software is 6 | furnished to do so, subject to the following conditions: 7 | 8 | The above copyright notice and this permission notice shall be included in 9 | all copies or substantial portions of the Software. 10 | 11 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 12 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 13 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 14 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 15 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 16 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 17 | THE SOFTWARE. 18 | -------------------------------------------------------------------------------- /Chapter02/02_01/meta-bsp-custom/README: -------------------------------------------------------------------------------- 1 | This README file contains information on the contents of the 2 | bsp-custom layer as introduced in the "Creating a custom BSP layer" on the 3 | "Embedded Linux Projects Using Yocto Project Cookbook" 2nd edition published 4 | by Packt Publishing. 5 | 6 | Please see the corresponding sections below for details. 7 | 8 | 9 | Dependencies 10 | ============ 11 | 12 | This layer depends on: 13 | 14 | URI: git://git.yoctoproject.org/meta-freescale 15 | branch: rocko 16 | 17 | 18 | Patches 19 | ======= 20 | 21 | Please submit any patches against the bsp-custom layer to Packt Publishing 22 | via http://www.packtpub.com/submit-errata, or to the author Alex Gonzalez at 23 | alexlindusembedded.com 24 | 25 | Table of Contents 26 | ================= 27 | 28 | I. Adding the bsp-custom layer to your build 29 | II. Misc 30 | 31 | 32 | I. Adding the bsp-custom layer to your build 33 | ================================================= 34 | 35 | In order to use this layer, you need to make the build system aware of 36 | it. 37 | 38 | Assuming the bsp-custom layer exists at the top-level of your 39 | yocto build tree, you can add it to the build system by adding the 40 | location of the bsp-custom layer to bblayers.conf, along with any 41 | other layers needed. e.g.: 42 | 43 | BBLAYERS = " \ 44 | ${BSPDIR}/sources/poky/meta \ 45 | ${BSPDIR}/sources/poky/meta-poky \ 46 | ${BSPDIR}/sources/meta-openembedded/meta-oe \ 47 | ${BSPDIR}/sources/meta-openembedded/meta-multimedia \ 48 | ${BSPDIR}/sources/meta-freescale \ 49 | ${BSPDIR}/sources/meta-freescale-3rdparty \ 50 | ${BSPDIR}/sources/meta-freescale-distro \ 51 | ${BSPDIR}/sources/meta-bsp-custom \ 52 | " 53 | 54 | II. Misc 55 | ======== 56 | 57 | This layer should be used in conjuntion with the "Embedded Linux Projects 58 | Using Yocto Project Cookbook" 2nd edition published by Packt Publising. 59 | 60 | The commits are named with the chapter and recipe number they belong to: 61 | 62 | CH_N: Recipe title 63 | 64 | where, 65 | 66 | CH is the chapter number 67 | N is the recipe number according to the list below. 68 | -------------------------------------------------------------------------------- /Chapter02/02_01/meta-bsp-custom/conf/layer.conf: -------------------------------------------------------------------------------- 1 | # We have a conf and classes directory, add to BBPATH 2 | BBPATH .= ":${LAYERDIR}" 3 | 4 | # We have recipes-* directories, add to BBFILES 5 | BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ 6 | ${LAYERDIR}/recipes-*/*/*.bbappend" 7 | 8 | BBFILE_COLLECTIONS += "bsp-custom" 9 | BBFILE_PATTERN_bsp-custom = "^${LAYERDIR}/" 10 | BBFILE_PRIORITY_bsp-custom = "6" 11 | -------------------------------------------------------------------------------- /Chapter02/02_01/meta-bsp-custom/conf/machine/wandboard-custom.conf: -------------------------------------------------------------------------------- 1 | #@TYPE: Machine 2 | #@NAME: Wandboard i.MX6 Wandboard Quad Customized machine 3 | #@SOC: i.MX6Q 4 | #@DESCRIPTION: Custom Machine configuration for i.MX6 Wandboard Quad 5 | #@MAINTAINER: 6 | 7 | require conf/machine/wandboard.conf 8 | 9 | UBOOT_MACHINE = "wandboard-custom_defconfig" 10 | KERNEL_DEVICETREE = "imx6qp-wandboard-custom-revd1.dtb" 11 | -------------------------------------------------------------------------------- /Chapter02/02_01/meta-bsp-custom/recipes-bsp/formfactor/formfactor/wandboard-custom/machconfig: -------------------------------------------------------------------------------- 1 | HAVE_TOUCHSCREEN=1 2 | -------------------------------------------------------------------------------- /Chapter02/02_01/meta-bsp-custom/recipes-bsp/formfactor/formfactor_0.0.bbappend: -------------------------------------------------------------------------------- 1 | FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" 2 | -------------------------------------------------------------------------------- /Chapter02/02_01/meta-bsp-custom/recipes-bsp/u-boot/u-boot-fslc_%.bbappend: -------------------------------------------------------------------------------- 1 | FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:" 2 | 3 | SRC_URI_append = " file://0001-02_01-Add-a-custom-wandboard-custom-machine.patch" 4 | 5 | COMPATIBLE_MACHINE = "(wandboard|wandboard-custom)" 6 | -------------------------------------------------------------------------------- /Chapter02/02_01/meta-bsp-custom/recipes-kernel/linux/linux-wandboard_4.1-2.0.x.bbappend: -------------------------------------------------------------------------------- 1 | FILESEXTRAPATHS_prepend := "${THISDIR}/${BP}:" 2 | 3 | SRC_URI_append = " file://0001-01_02-Add-a-custom-device-tree-and-configuration.patch" 4 | COMPATIBLE_MACHINE = "(wandboard|wandboard-custom)" 5 | -------------------------------------------------------------------------------- /Chapter02/02_02/commands.README: -------------------------------------------------------------------------------- 1 | cd /opt/yocto/fsl-community-bsp/sources 2 | find -name wandboard.conf ./meta-freescale-3rdparty/conf/machine/wandboard.conf 3 | 4 | bitbake-layers show-recipes linux-wandboard 5 | 6 | find tmp/work -type d -name "linux-wandboard" tmp/work/wandboard-poky-linux-gnueabi/linux-wandboard 7 | 8 | cd /opt/yocto/fsl-community-bsp/ 9 | source setup-environment wandboard 10 | bitbake-layers show-recipes 'linux*' 11 | 12 | bitbake-layers show-recipes u-boot-fslc 13 | 14 | 15 | -------------------------------------------------------------------------------- /Chapter02/02_02/meta-bsp-custom/recipes-kernel/linux/linux-wandboard_4.1-2.0.x.bbappend: -------------------------------------------------------------------------------- 1 | FILESEXTRAPATHS_prepend := "${THISDIR}/${BP}:" 2 | 3 | WANDBOARD_GITHUB_MIRROR = "git://github.com/yoctocookbook2ndedition/linux.git" 4 | SRCBRANCH = "4.1-2.0.x-imx-dev" 5 | SRCREV = "${AUTOREV}" 6 | SRC_URI = "${WANDBOARD_GITHUB_MIRROR};protocol=https;branch=${SRCBRANCH} \ 7 | file://defconfig \ 8 | " 9 | 10 | COMPATIBLE_MACHINE = "(wandboard|wandboard-custom)" 11 | -------------------------------------------------------------------------------- /Chapter02/02_03/commands.README: -------------------------------------------------------------------------------- 1 | cd /opt/yocto/fsl-community-bsp 2 | source setup-environment wandboard 3 | bitbake core-image-minimal -c populate_sdk 4 | 5 | cd /opt/yocto/fsl-community-bsp/wandboard/tmp/deploy/sdk/ 6 | ./poky-glibc-x86_64-core-image-minimal-cortexa9hf-neon-toolchain-2.4.sh 7 | 8 | bitbake -e u-boot-fslc | grep ^SRC_URI= 9 | 10 | cd /opt/yocto/ 11 | git clone git://github.com/Freescale/u-boot-fslc.git 12 | cd u-boot-fslc 13 | 14 | git checkout -b 2017.11+fslc origin/2017.11+fslc 15 | 16 | make wandboard_config 17 | make xconfig 18 | source /opt/poky/2.4/environment-setup-cortexa9hf-neon-poky-linux-gnueabi 19 | make -jN 20 | 21 | unset LDFLAGS CFLAGS CPPFLAGS 22 | make CC="${CC}" 23 | 24 | sudo dd if=SPL of=/dev/sdN bs=1k seek=1 && sync 25 | sudo dd if=u-boot.img of=/dev/sdN bs=1k seek=69 && sync 26 | 27 | env set ipaddr 28 | env set serverip 29 | tftp ${loadaddr} SPL 30 | 31 | mmc dev 0 32 | mmc part 33 | 34 | setexpr filesizeblks $filesize / 0x200 35 | setexpr filesizeblks $filesizeblks + 1 36 | 37 | mmc write ${loadaddr} 0x2 ${filesizeblks} 38 | 39 | tftp ${loadaddr} u-boot.img 40 | 41 | setexpr filesizeblks $filesize / 0x200 42 | setexpr filesizeblks $filesizeblks + 1 43 | 44 | mmc write ${loadaddr} 0x8A ${filesizeblks} 45 | 46 | git add --all . 47 | git commit -s -m "Well thought commit message" 48 | 49 | git format-patch -1 -o /opt/yocto/fsl-community-bsp/sources/meta-bsp-custom/recipes-bsp/u-boot/u-boot-fslc-v2017.11/ 50 | -------------------------------------------------------------------------------- /Chapter02/02_04/commands.README: -------------------------------------------------------------------------------- 1 | make ARCH=arm _defconfig 2 | make ARCH=arm imx_v6_v7_defconfig 3 | 4 | make ARCH=arm help 5 | 6 | make ARCH=arm savedefconfig 7 | 8 | -------------------------------------------------------------------------------- /Chapter02/02_05/commands.README: -------------------------------------------------------------------------------- 1 | cd /opt/yocto/fsl-community-bsp/sources 2 | mkdir -p meta-bsp-custom/recipes-kernel/linux/linux-wandboard-4.1-2.0.x/wandboard-custom/ 3 | 4 | cp meta-freescale-3rdparty/recipes-kernel/linux/linux-wandboard/defconfig meta-bsp-custom/recipes-kernel/linux/linux-wandboard-4.1-2.0.x/wandboard-custom/defconfig 5 | 6 | bitbake -e virtual/kernel | grep ^SRC_URI= 7 | 8 | cd /opt/yocto/ 9 | git clone https://github.com/wandboard-org/linux.git linux-wandboard 10 | cd linux-wandboard 11 | 12 | git checkout -b 4.1-2.0.x-imx origin/4.1-2.0.x-imx 13 | cp /opt/yocto/fsl-community-bsp/sources/meta-bsp-custom/recipes-kernel/linux/linux-wandboard-4.1-2.0.x/wandboard-custom/defconfig arch/arm/configs/wandboard_defconfig 14 | 15 | make ARCH=arm wandboard_defconfig 16 | make ARCH=arm xconfig 17 | 18 | cd /opt/yocto/fsl-community-bsp/ 19 | source setup-environment wandboard 20 | bitbake -c configure virtual/kernel 21 | 22 | bitbake -c menuconfig virtual/kernel 23 | sudo apt-get install libncurses5-dev 24 | 25 | cd /opt/yocto/fsl-community-bsp/wandboard/tmp/work/wandboard-poky-linux-gnueabi/linux-wandboard/4.1-2.0.x-r0/build 26 | make ARCH=arm savedefconfig 27 | 28 | cp defconfig /opt/yocto/fsl-community-bsp/sources/meta-bsp-custom/recipes-kernel/linux/linux-wandboard-4.1-2.0.x/wandboard-custom 29 | bitbake -c savedefconfig virtual/kernel 30 | 31 | 32 | -------------------------------------------------------------------------------- /Chapter02/02_06/commands.README: -------------------------------------------------------------------------------- 1 | source /opt/poky/2.4/environment-setup-cortexa9hf-neon-poky-linux-gnueabi 2 | cd /opt/yocto/linux-wandboard 3 | cp /opt/yocto/fsl-community-bsp/sources/meta-bsp-custom/recipes-kernel/linux/linux-wandboard-4.1-2.0.x/wandboard-custom/defconfig arch/arm/configs/wandboard_defconfig 4 | make wandboard_defconfig 5 | make -jN 6 | 7 | unset LDFLAGS 8 | 9 | make modules 10 | make dtbs 11 | 12 | cp arch/arm/boot/zImage arch/arm/boot/dts/imx6qp-wandboard-revd1.dtb /var/lib/tftpboot 13 | 14 | make LOADADDR=0x10800000 uImage 15 | 16 | sudo apt-get install u-boot-tools 17 | 18 | cd /opt/yocto/fsl-community-bsp/ 19 | source setup-environment wandboard 20 | bitbake -c cleanall virtual/kernel 21 | 22 | bitbake -c configure virtual/kernel 23 | bitbake -c menuconfig virtual/kernel 24 | bitbake -c devshell virtual/kernel 25 | 26 | bitbake -C compile virtual/kernel 27 | 28 | cd tmp/deploy/images/wandboard/ 29 | cp zImage-wandboard.bin zImage-imx6qp-wandboard-revd1.dtb /var/lib/tftpboot 30 | 31 | bootz - 32 | 33 | tftp ${loadaddr} ${image} 34 | tftp ${fdt_addr} ${fdtfile} 35 | bootz ${loadaddr} - ${fdt_addr} 36 | 37 | env set bootargs 'root=PARTUUID= rootwait rw console=ttymxc0,115200' 38 | bootm - 39 | 40 | git add --all . 41 | git commit -s -m "Well thought commit message" 42 | 43 | git format-patch -1 -o /opt/yocto/fsl-community-bsp/sources/meta-bsp-custom/recipes-kernel/linux/linux-wandboard-4.1-2.0.x 44 | 45 | -------------------------------------------------------------------------------- /Chapter02/02_07/commands.README: -------------------------------------------------------------------------------- 1 | source /opt/poky/2.4/environment-setup-cortexa9hf-neon-poky-linux-gnueabi 2 | KERNEL_SRC=/opt/yocto/linux-wandboard make 3 | 4 | TOOLCHAIN_TARGET_TASK_append = " kernel-devsrc" 5 | 6 | make wandboard_defconfig 7 | make modules_prepare 8 | 9 | bitbake hello-world 10 | 11 | -------------------------------------------------------------------------------- /Chapter02/02_07/meta-bsp-custom/recipes-kernel/hello-world/files/Makefile: -------------------------------------------------------------------------------- 1 | obj-m:= hello_world.o 2 | 3 | SRC := $(shell pwd) 4 | all: 5 | $(MAKE) -C $(KERNEL_SRC) M=$(SRC) 6 | 7 | modules_install: 8 | $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install 9 | 10 | clean: 11 | rm -f *.o *~ core .depend .*.cmd *.ko *.mod.c 12 | rm -f Module.markers Module.symvers modules.order 13 | rm -rf .tmp_versions Modules.symvers 14 | -------------------------------------------------------------------------------- /Chapter02/02_07/meta-bsp-custom/recipes-kernel/hello-world/files/hello_world.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This program is free software; you can redistribute it and/or modify 3 | * it under the terms of the GNU General Public License as published by 4 | * the Free Software Foundation; either version 2 of the License, or 5 | * (at your option) any later version. 6 | * 7 | * This program is distributed in the hope that it will be useful, 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | * GNU General Public License for more details. 11 | * 12 | * You should have received a copy of the GNU General Public License 13 | * along with this program. If not, see . 14 | */ 15 | 16 | #include 17 | 18 | static int hello_world_init(void) 19 | { 20 | printk("Hello world\n"); 21 | return 0; 22 | } 23 | 24 | static void hello_world_exit(void) 25 | { 26 | printk("Bye world\n"); 27 | } 28 | module_init(hello_world_init); 29 | module_exit(hello_world_exit); 30 | 31 | MODULE_LICENSE("GPL v2"); 32 | -------------------------------------------------------------------------------- /Chapter02/02_07/meta-bsp-custom/recipes-kernel/hello-world/hello-world.bb: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2017 Packt Publishing. 2 | 3 | SUMMARY = "Simplest hello world kernel module." 4 | LICENSE = "GPLv2" 5 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" 6 | 7 | inherit module 8 | 9 | SRC_URI = " \ 10 | file://hello_world.c \ 11 | file://Makefile \ 12 | " 13 | 14 | S = "${WORKDIR}" 15 | 16 | COMPATIBLE_MACHINE = "(wandboard)" 17 | -------------------------------------------------------------------------------- /Chapter02/02_07/meta-bsp-custom/recipes-kernel/linux/linux-wandboard_4.1-2.0.x.bbappend: -------------------------------------------------------------------------------- 1 | FILESEXTRAPATHS_prepend := "${THISDIR}/${BP}:" 2 | 3 | WANDBOARD_GITHUB_MIRROR = "git://github.com/yoctocookbook2ndedition/linux.git" 4 | SRCBRANCH = "4.1-2.0.x-imx-dev" 5 | SRCREV = "${AUTOREV}" 6 | SRC_URI = "${WANDBOARD_GITHUB_MIRROR};protocol=https;branch=${SRCBRANCH} \ 7 | file://defconfig \ 8 | " 9 | 10 | KERNEL_MODULE_AUTOLOAD += "g_ether" 11 | KERNEL_MODULE_PROBECONF += "g_ether" 12 | module_conf_g_ether = "options g_ether iProduct=Wandboard iManufacturer=Technexion" 13 | 14 | COMPATIBLE_MACHINE = "(wandboard|wandboard-custom)" 15 | -------------------------------------------------------------------------------- /Chapter02/02_08/commands.README: -------------------------------------------------------------------------------- 1 | echo 8 > /proc/sys/kernel/printk 2 | 3 | dmesg -n 8 4 | 5 | #define DEBUG 6 | 7 | mount -t debugfs nodev /sys/kernel/debug 8 | 9 | echo -n 'file +p' > /sys/kernel/debug/dynamic_debug/control 10 | echo -n 'file line nnnn +p' > /sys/kernel/debug/dynamic_debug/control 11 | 12 | awk '$3 != "=_"' /sys/kernel/debug/dynamic_debug/control 13 | 14 | env set bootargs 'dyndbg=\\"file one.c +pfl\; file two.c +pfl\; file three.c +pfl\; file four.c +pfl\\"' 15 | 16 | -------------------------------------------------------------------------------- /Chapter02/02_09/commands.README: -------------------------------------------------------------------------------- 1 | extern void printascii(const char *); 2 | printascii("Literal string\n"); 3 | 4 | early_print("%08x\t%s\n", p->nr, p->name); 5 | 6 | grep __log_buf System.map 7 | 8 | echo b > /proc/sysrq-trigger 9 | 10 | md.l 0x10c37864 11 | 12 | ramoops.mem_address=0x30000000 ramoops.mem_size=0x200000 13 | 14 | pstore /pstore pstore defaults 0 0 15 | 16 | mkdir /pstore 17 | mount /pstore 18 | 19 | echo b > /proc/sysrq-trigger 20 | 21 | -------------------------------------------------------------------------------- /Chapter02/02_10/commands.README: -------------------------------------------------------------------------------- 1 | mount -t debugfs nodev /sys/kernel/debug 2 | 3 | cat /sys/kernel/debug/tracing/available_tracers 4 | 5 | cat /sys/kernel/debug/tracing/current_tracer 6 | 7 | echo -n nop > /sys/kernel/debug/tracing/current_tracer 8 | 9 | echo -n function > /sys/kernel/debug/tracing/current_tracer 10 | 11 | echo -n function_graph > /sys/kernel/debug/tracing/current_tracer 12 | 13 | cat /sys/kernel/debug/tracing/trace_pipe 14 | 15 | echo 0 > /sys/kernel/debug/tracing/tracing_on 16 | echo 1 > /sys/kernel/debug/tracing/tracing_on 17 | 18 | cat /sys/kernel/debug/tracing/available_filter_functions 19 | 20 | echo -n >> /sys/kernel/debug/tracing/set_ftrace_filter 21 | 22 | echo -n '!' >> /sys/kernel/debug/tracing/set_ftrace_filter 23 | 24 | echo > /sys/kernel/debug/tracing/set_ftrace_filter 25 | 26 | echo -n 'ipu_*:mod:ipu' > /sys/kernel/debug/tracing/set_ftrace_filter 27 | echo -n 'suspend_enter:dump' > /sys/kernel/debug/tracing/set_ftrace_filter 28 | echo -n 'suspend_enter:traceon' > /sys/kernel/debug/tracing/set_ftrace_filter 29 | 30 | echo 1 > /proc/sys/kernel/ftrace_dump_on_oops 31 | 32 | echo -n > /sys/kernel/debug/tracing/set_ftrace_filter 33 | echo -n function > /sys/kernel/debug/tracing/current_tracer 34 | echo 1 > /sys/kernel/debug/tracing/options/func_stack_trace 35 | cat /sys/kernel/debug/tracing/trace 36 | echo 0 > /sys/kernel/debug/tracing/options/func_stack_trace 37 | echo > /sys/kernel/debug/tracing/set_ftrace_filter 38 | 39 | ftrace=function_graph ftrace_filter=mxc_hdmi*,fb_show* 40 | 41 | -------------------------------------------------------------------------------- /Chapter02/02_11/commands.README: -------------------------------------------------------------------------------- 1 | cd /opt/yocto/fsl-community-bsp/ 2 | source setup-environment wandboard 3 | bitbake -c devshell virtual/kernel 4 | 5 | make dtbs 6 | 7 | DTC_FLAGS="-p 1024" make dtbs 8 | 9 | bitbake -c deploy -f virtual/kernel 10 | 11 | -------------------------------------------------------------------------------- /Chapter02/02_12/commands.README: -------------------------------------------------------------------------------- 1 | tftp ${fdt_addr} ${fdtfile} 2 | 3 | fdt addr ${fdt_addr} 4 | 5 | fdt list /cpus 6 | 7 | fdt print /cpus 8 | 9 | fdt mknode / new-node 10 | fdt list /new-node 11 | 12 | fdt set /new-node testprop testvalue 13 | fdt print /new-node 14 | 15 | fdt rm /new-node testprop 16 | fdt print /new-node 17 | 18 | ls /proc/device-tree/cpus/ 19 | 20 | -------------------------------------------------------------------------------- /Chapter03/03_01/commands.README: -------------------------------------------------------------------------------- 1 | bitbake -e | grep ^WORKDIR= 2 | 3 | FILES_${PN} += "${bindir}/file.bin" 4 | 5 | FILES_${PN}-dev += "${libdir}/lib.so" 6 | 7 | bitbake -e core-image-minimal | grep ^IMAGE_ROOTFS= 8 | 9 | -------------------------------------------------------------------------------- /Chapter03/03_02/commands.README: -------------------------------------------------------------------------------- 1 | yocto-layer create custom 2 | 3 | bitbake-layers layerindex-fetch 4 | 5 | bitbake-layers layerindex-show-depends 6 | 7 | SRC_URI_append_wandboard = " file://mypatch.patch" 8 | 9 | SRC_URI_append_mx6 = " file://mypatch.patch" 10 | 11 | -------------------------------------------------------------------------------- /Chapter03/03_02/conf/bblayers.conf: -------------------------------------------------------------------------------- 1 | LCONF_VERSION = "7" 2 | 3 | BBPATH = "${TOPDIR}" 4 | BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../..')}" 5 | 6 | BBFILES ?= "" 7 | BBLAYERS = " \ 8 | ${BSPDIR}/sources/poky/meta \ 9 | ${BSPDIR}/sources/poky/meta-poky \ 10 | ${BSPDIR}/sources/meta-openembedded/meta-oe \ 11 | ${BSPDIR}/sources/meta-openembedded/meta-multimedia \ 12 | ${BSPDIR}/sources/meta-freescale \ 13 | ${BSPDIR}/sources/meta-freescale-3rdparty \ 14 | ${BSPDIR}/sources/meta-freescale-distro \ 15 | ${BSPDIR}/sources/meta-custom \ 16 | " 17 | -------------------------------------------------------------------------------- /Chapter03/03_02/conf/local.conf: -------------------------------------------------------------------------------- 1 | MACHINE ??= 'wandboard-custom' 2 | DISTRO ?= 'poky' 3 | PACKAGE_CLASSES ?= "package_rpm" 4 | EXTRA_IMAGE_FEATURES ?= "debug-tweaks" 5 | USER_CLASSES ?= "buildstats image-mklibs image-prelink" 6 | PATCHRESOLVE = "noop" 7 | BB_DISKMON_DIRS = "\ 8 | STOPTASKS,${TMPDIR},1G,100K \ 9 | STOPTASKS,${DL_DIR},1G,100K \ 10 | STOPTASKS,${SSTATE_DIR},1G,100K \ 11 | STOPTASKS,/tmp,100M,100K \ 12 | ABORT,${TMPDIR},100M,1K \ 13 | ABORT,${DL_DIR},100M,1K \ 14 | ABORT,${SSTATE_DIR},100M,1K \ 15 | ABORT,/tmp,10M,1K" 16 | PACKAGECONFIG_append_pn-qemu-native = " sdl" 17 | PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl" 18 | CONF_VERSION = "1" 19 | 20 | DL_DIR ?= "${BSPDIR}/downloads/" 21 | ACCEPT_FSL_EULA = "1" 22 | 23 | INHERIT += "rm_work" 24 | RM_WORK_EXCLUDE += "linux-wandboard u-boot-fslc" 25 | INHIBIT_PACKAGE_DEBUG_SPLIT = "1" 26 | 27 | IMAGE_FSTYPES = "wic.gz tar.bz2" 28 | 29 | INHERIT += "buildhistory" 30 | BUILDHISTORY_COMMIT = "1" 31 | -------------------------------------------------------------------------------- /Chapter03/03_02/meta-custom/COPYING.MIT: -------------------------------------------------------------------------------- 1 | Permission is hereby granted, free of charge, to any person obtaining a copy 2 | of this software and associated documentation files (the "Software"), to deal 3 | in the Software without restriction, including without limitation the rights 4 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 5 | copies of the Software, and to permit persons to whom the Software is 6 | furnished to do so, subject to the following conditions: 7 | 8 | The above copyright notice and this permission notice shall be included in 9 | all copies or substantial portions of the Software. 10 | 11 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 12 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 13 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 14 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 15 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 16 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 17 | THE SOFTWARE. 18 | -------------------------------------------------------------------------------- /Chapter03/03_02/meta-custom/README: -------------------------------------------------------------------------------- 1 | This README file contains information on the contents of the custom layer as 2 | introduced in the "" on the "Embedded Linux Projects Using Yocto Project 3 | Cookbook" 2nd edition published by Packt Publishing. 4 | 5 | Please see the corresponding sections below for details. 6 | 7 | 8 | Dependencies 9 | ============ 10 | 11 | This layer depends on: 12 | 13 | URI: git://git.yoctoproject.org/meta-freescale 14 | branch: TBD 15 | 16 | Patches 17 | ======= 18 | 19 | Please submit any patches against the custom layer to Packt Publishing 20 | via http://www.packtpub.com/submit-errata, or to the author Alex Gonzalez at 21 | alexlindusembedded.com 22 | 23 | Table of Contents 24 | ================= 25 | 26 | I. Adding the custom layer to your build 27 | II. Misc 28 | 29 | 30 | I. Adding the custom layer to your build 31 | ================================================= 32 | 33 | In order to use this layer, you need to make the build system aware of 34 | it. 35 | 36 | Assuming the custom layer exists at the top-level of your 37 | yocto build tree, you can add it to the build system by adding the 38 | location of the custom layer to bblayers.conf, along with any 39 | other layers needed. e.g.: 40 | 41 | BBLAYERS = " \ 42 | ${BSPDIR}/sources/poky/meta \ 43 | ${BSPDIR}/sources/poky/meta-yocto \ 44 | \ 45 | ${BSPDIR}/sources/meta-openembedded/meta-oe \ 46 | ${BSPDIR}/sources/meta-openembedded/meta-multimedia \ 47 | \ 48 | ${BSPDIR}/sources/meta-freescale \ 49 | ${BSPDIR}/sources/meta-freescale-3rdparty \ 50 | ${BSPDIR}/sources/meta-custom \ 51 | " 52 | 53 | 54 | II. Misc 55 | ======== 56 | 57 | This layer should be used in conjuntion with the "Embedded Linux Projects 58 | Using Yocto Project Cookbook" 2nd edition published by Packt Publising. 59 | 60 | The commits are named with the chapter and recipe number they belong to: 61 | 62 | CH_N: Recipe title 63 | 64 | where, 65 | 66 | CH is the chapter number 67 | N is the recipe number 68 | -------------------------------------------------------------------------------- /Chapter03/03_02/meta-custom/conf/layer.conf: -------------------------------------------------------------------------------- 1 | # We have a conf and classes directory, add to BBPATH 2 | BBPATH .= ":${LAYERDIR}" 3 | 4 | # We have recipes-* directories, add to BBFILES 5 | BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ 6 | ${LAYERDIR}/recipes-*/*/*.bbappend" 7 | 8 | BBFILE_COLLECTIONS += "custom" 9 | BBFILE_PATTERN_custom = "^${LAYERDIR}/" 10 | BBFILE_PRIORITY_custom = "6" 11 | -------------------------------------------------------------------------------- /Chapter03/03_03/commands.README: -------------------------------------------------------------------------------- 1 | PREFERRED_PROVIDER_virtual/kernel = "linux-fslc" 2 | 3 | PREFERRED_VERSION_linux-fslc_mx6 = "4.9" 4 | 5 | PREFERRED_VERSION_linux-fslc_mx6 = "4.9%" 6 | 7 | DEFAULT_PREFERENCE = "-1" 8 | -------------------------------------------------------------------------------- /Chapter03/03_04/commands.README: -------------------------------------------------------------------------------- 1 | bitbake-layers show-recipes htop 2 | 3 | bitbake -s | grep htop 4 | 5 | find /opt/yocto/fsl-community-bsp/sources -type f -name "htop*.bb" 6 | 7 | IMAGE_INSTALL_append = " htop" 8 | 9 | IMAGE_INSTALL_append_pn-core-image-minimal = " htop" 10 | 11 | FEATURE_PACKAGES_debug-utils = "trace-cmd perf" 12 | 13 | EXTRA_IMAGE_FEATURES += "debug-utils" 14 | 15 | bitbake custom-image 16 | 17 | ROOTFS_POSTPROCESS_COMMAND += "function1;...;functionN" 18 | 19 | bitbake -c menuconfig busybox 20 | bitbake -c diffconfig busybox 21 | 22 | recipetool appendsrcfile busybox 23 | 24 | bitbake -e busybox | grep ^WORKDIR= 25 | scp ${WORKDIR}/deploy-rpms/cortexa9hf_neon/busybox-1.24.1-r0.cortexa9hf_neon.rpm root@:/tmp 26 | rpm --force -U /tmp/busybox-1.24.1-r0.cortexa9hf_neon.rpm 27 | -------------------------------------------------------------------------------- /Chapter03/03_04/conf/bblayers.conf: -------------------------------------------------------------------------------- 1 | LCONF_VERSION = "7" 2 | 3 | BBPATH = "${TOPDIR}" 4 | BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../..')}" 5 | 6 | BBFILES ?= "" 7 | BBLAYERS = " \ 8 | ${BSPDIR}/sources/poky/meta \ 9 | ${BSPDIR}/sources/poky/meta-poky \ 10 | ${BSPDIR}/sources/meta-openembedded/meta-oe \ 11 | ${BSPDIR}/sources/meta-openembedded/meta-multimedia \ 12 | ${BSPDIR}/sources/meta-freescale \ 13 | ${BSPDIR}/sources/meta-freescale-3rdparty \ 14 | ${BSPDIR}/sources/meta-freescale-distro \ 15 | ${BSPDIR}/sources/meta-custom \ 16 | " 17 | -------------------------------------------------------------------------------- /Chapter03/03_04/conf/local.conf: -------------------------------------------------------------------------------- 1 | MACHINE ??= 'wandboard' 2 | DISTRO ?= 'poky' 3 | PACKAGE_CLASSES ?= "package_rpm" 4 | EXTRA_IMAGE_FEATURES ?= "debug-tweaks" 5 | USER_CLASSES ?= "buildstats image-mklibs image-prelink" 6 | PATCHRESOLVE = "noop" 7 | BB_DISKMON_DIRS = "\ 8 | STOPTASKS,${TMPDIR},1G,100K \ 9 | STOPTASKS,${DL_DIR},1G,100K \ 10 | STOPTASKS,${SSTATE_DIR},1G,100K \ 11 | STOPTASKS,/tmp,100M,100K \ 12 | ABORT,${TMPDIR},100M,1K \ 13 | ABORT,${DL_DIR},100M,1K \ 14 | ABORT,${SSTATE_DIR},100M,1K \ 15 | ABORT,/tmp,10M,1K" 16 | PACKAGECONFIG_append_pn-qemu-native = " sdl" 17 | PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl" 18 | CONF_VERSION = "1" 19 | 20 | DL_DIR ?= "${BSPDIR}/downloads/" 21 | ACCEPT_FSL_EULA = "1" 22 | 23 | INHERIT += "rm_work" 24 | RM_WORK_EXCLUDE += "core-image-minimal" 25 | INHIBIT_PACKAGE_DEBUG_SPLIT = "1" 26 | 27 | IMAGE_INSTALL_append = " htop" 28 | FEATURE_PACKAGES_debug-utils = "trace-cmd perf" 29 | EXTRA_IMAGE_FEATURES += "debug-utils" 30 | -------------------------------------------------------------------------------- /Chapter03/03_04/meta-custom/recipes-core/busybox/busybox/fragment.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_PGREP=y 2 | -------------------------------------------------------------------------------- /Chapter03/03_04/meta-custom/recipes-core/busybox/busybox_1.24.1.bbappend: -------------------------------------------------------------------------------- 1 | FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" 2 | 3 | SRC_URI += "file://fragment.cfg" 4 | -------------------------------------------------------------------------------- /Chapter03/03_04/meta-custom/recipes-core/images/custom-image.bb: -------------------------------------------------------------------------------- 1 | require recipes-core/images/core-image-minimal.bb 2 | IMAGE_FEATURES += "ssh-server-dropbear package-management" 3 | -------------------------------------------------------------------------------- /Chapter03/03_04/meta-custom/recipes-core/packagegroups/packagegroup-debug-utils.bb: -------------------------------------------------------------------------------- 1 | SUMMARY = "Debug applications packagegroup" 2 | 3 | inherit packagegroup 4 | 5 | RDEPENDS_${PN} = "\ 6 | trace-cmd \ 7 | perf \ 8 | " 9 | -------------------------------------------------------------------------------- /Chapter03/03_05/commands.README: -------------------------------------------------------------------------------- 1 | recipetool create -o helloworld.bb helloworld.c 2 | 3 | do_task[noexec] = "1" 4 | 5 | PACKAGECONFIG ??= "feature" 6 | PACKAGECONFIG[feature] = "--with-feature,--without-feature,build-deps-feature,rt-deps-feature" 7 | 8 | PACKAGECONFIG_append = " feature1 feature2" 9 | 10 | PACKAGECONFIG_pn- = "feature1 feature2" 11 | PACKAGECONFIG_append_pn- = " feature1 feature2" 12 | 13 | PACKAGE_ARCH = "${MACHINE_ARCH}" 14 | 15 | COMPATIBLE_MACHINE = "(mxs|mx5|mx6)" 16 | 17 | -------------------------------------------------------------------------------- /Chapter03/03_05/meta-custom/recipes-example/helloworld/helloworld/helloworld.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) 4 | { 5 | return printf("Hello World"); 6 | } 7 | -------------------------------------------------------------------------------- /Chapter03/03_05/meta-custom/recipes-example/helloworld/helloworld_1.0.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Simple helloworld application" 2 | SECTION = "examples" 3 | LICENSE = "MIT" 4 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" 5 | 6 | SRC_URI = "file://helloworld.c" 7 | 8 | S = "${WORKDIR}" 9 | 10 | do_compile() { 11 | ${CC} ${LDFLAGS} helloworld.c -o helloworld 12 | } 13 | 14 | do_install() { 15 | install -d ${D}${bindir} 16 | install -m 0755 helloworld ${D}${bindir} 17 | } 18 | -------------------------------------------------------------------------------- /Chapter03/03_06/commands.README: -------------------------------------------------------------------------------- 1 | recipetool appendfile 2 | 3 | recipetool appendfile /opt/yocto/fsl-community-bsp/sources/meta-custom/ /etc/network/interfaces interfaces-new 4 | 5 | -------------------------------------------------------------------------------- /Chapter03/03_06/conf/bblayers.conf: -------------------------------------------------------------------------------- 1 | LCONF_VERSION = "7" 2 | 3 | BBPATH = "${TOPDIR}" 4 | BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../..')}" 5 | 6 | BBFILES ?= "" 7 | BBLAYERS = " \ 8 | ${BSPDIR}/sources/poky/meta \ 9 | ${BSPDIR}/sources/poky/meta-poky \ 10 | ${BSPDIR}/sources/meta-openembedded/meta-oe \ 11 | ${BSPDIR}/sources/meta-openembedded/meta-multimedia \ 12 | ${BSPDIR}/sources/meta-freescale \ 13 | ${BSPDIR}/sources/meta-freescale-3rdparty \ 14 | ${BSPDIR}/sources/meta-freescale-distro \ 15 | ${BSPDIR}/sources/meta-custom \ 16 | " 17 | -------------------------------------------------------------------------------- /Chapter03/03_06/conf/local.conf: -------------------------------------------------------------------------------- 1 | MACHINE ??= 'wandboard' 2 | DISTRO ?= 'poky' 3 | PACKAGE_CLASSES ?= "package_rpm" 4 | EXTRA_IMAGE_FEATURES ?= "debug-tweaks" 5 | USER_CLASSES ?= "buildstats image-mklibs image-prelink" 6 | PATCHRESOLVE = "noop" 7 | BB_DISKMON_DIRS = "\ 8 | STOPTASKS,${TMPDIR},1G,100K \ 9 | STOPTASKS,${DL_DIR},1G,100K \ 10 | STOPTASKS,${SSTATE_DIR},1G,100K \ 11 | STOPTASKS,/tmp,100M,100K \ 12 | ABORT,${TMPDIR},100M,1K \ 13 | ABORT,${DL_DIR},100M,1K \ 14 | ABORT,${SSTATE_DIR},100M,1K \ 15 | ABORT,/tmp,10M,1K" 16 | PACKAGECONFIG_append_pn-qemu-native = " sdl" 17 | PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl" 18 | CONF_VERSION = "1" 19 | 20 | DL_DIR ?= "${BSPDIR}/downloads/" 21 | ACCEPT_FSL_EULA = "1" 22 | 23 | INHERIT += "rm_work" 24 | RM_WORK_EXCLUDE += "core-image-minimal" 25 | INHIBIT_PACKAGE_DEBUG_SPLIT = "1" 26 | 27 | IMAGE_INSTALL_append = " htop example-data" 28 | FEATURE_PACKAGES_debug-utils = "trace-cmd perf" 29 | EXTRA_IMAGE_FEATURES += "debug-utils" 30 | -------------------------------------------------------------------------------- /Chapter03/03_06/meta-custom/recipes-example/example-data/example.data: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Embedded-Linux-Development-Using-Yocto-Project-Cookbook-Second-Edition/b2cdef039f5ca73bbd0b3e1554828381fdbb5193/Chapter03/03_06/meta-custom/recipes-example/example-data/example.data -------------------------------------------------------------------------------- /Chapter03/03_06/meta-custom/recipes-example/example-data_1.0.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Example of data or configuration recipe" 2 | SECTION = "examples" 3 | 4 | LICENSE = "GPLv2" 5 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" 6 | 7 | SRCREV = "${AUTOREV}" 8 | SRC_URI = "git://github.com/yoctocookbook2ndedition/examples.git \ 9 | file://example.data" 10 | 11 | S = "${WORKDIR}/git" 12 | 13 | inherit allarch 14 | 15 | do_compile[noexec] = "1" 16 | 17 | do_install() { 18 | install -d ${D}${sysconfdir} 19 | install -d ${D}${sbindir} 20 | install -m 0755 ${WORKDIR}/example.data ${D}/${sysconfdir}/ 21 | install -m 0755 ${S}/python-scripts/* ${D}/${sbindir} 22 | } 23 | -------------------------------------------------------------------------------- /Chapter03/03_07/commands.README: -------------------------------------------------------------------------------- 1 | mkpasswd password 2 | 3 | USERADDEXTENSION = "useradd-staticids" 4 | 5 | USERADD_ERROR_DYNAMIC = "error" 6 | 7 | -------------------------------------------------------------------------------- /Chapter03/03_07/conf/bblayers.conf: -------------------------------------------------------------------------------- 1 | LCONF_VERSION = "7" 2 | 3 | BBPATH = "${TOPDIR}" 4 | BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../..')}" 5 | 6 | BBFILES ?= "" 7 | BBLAYERS = " \ 8 | ${BSPDIR}/sources/poky/meta \ 9 | ${BSPDIR}/sources/poky/meta-poky \ 10 | ${BSPDIR}/sources/meta-openembedded/meta-oe \ 11 | ${BSPDIR}/sources/meta-openembedded/meta-multimedia \ 12 | ${BSPDIR}/sources/meta-freescale \ 13 | ${BSPDIR}/sources/meta-freescale-3rdparty \ 14 | ${BSPDIR}/sources/meta-freescale-distro \ 15 | ${BSPDIR}/sources/meta-custom \ 16 | " 17 | -------------------------------------------------------------------------------- /Chapter03/03_07/conf/local.conf: -------------------------------------------------------------------------------- 1 | MACHINE ??= 'wandboard' 2 | DISTRO ?= 'poky' 3 | PACKAGE_CLASSES ?= "package_rpm" 4 | EXTRA_IMAGE_FEATURES ?= "debug-tweaks" 5 | USER_CLASSES ?= "buildstats image-mklibs image-prelink" 6 | PATCHRESOLVE = "noop" 7 | BB_DISKMON_DIRS = "\ 8 | STOPTASKS,${TMPDIR},1G,100K \ 9 | STOPTASKS,${DL_DIR},1G,100K \ 10 | STOPTASKS,${SSTATE_DIR},1G,100K \ 11 | STOPTASKS,/tmp,100M,100K \ 12 | ABORT,${TMPDIR},100M,1K \ 13 | ABORT,${DL_DIR},100M,1K \ 14 | ABORT,${SSTATE_DIR},100M,1K \ 15 | ABORT,/tmp,10M,1K" 16 | PACKAGECONFIG_append_pn-qemu-native = " sdl" 17 | PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl" 18 | CONF_VERSION = "1" 19 | 20 | DL_DIR ?= "${BSPDIR}/downloads/" 21 | ACCEPT_FSL_EULA = "1" 22 | 23 | INHERIT += "rm_work" 24 | RM_WORK_EXCLUDE += "core-image-minimal custom-image" 25 | INHIBIT_PACKAGE_DEBUG_SPLIT = "1" 26 | 27 | IMAGE_INSTALL_append = " htop example-data example-user" 28 | FEATURE_PACKAGES_debug-utils = "trace-cmd perf" 29 | EXTRA_IMAGE_FEATURES += "debug-utils" 30 | 31 | USERADDEXTENSION = "useradd-staticids" 32 | USERADD_ERROR_DYNAMIC = "error" 33 | -------------------------------------------------------------------------------- /Chapter03/03_07/meta-custom/files/group: -------------------------------------------------------------------------------- 1 | root:x:0: 2 | daemon:x:1: 3 | bin:x:2: 4 | sys:x:3: 5 | adm:x:4: 6 | tty:x:5:helloworld 7 | disk:x:6: 8 | lp:x:7: 9 | mail:x:8: 10 | news:x:9: 11 | uucp:x:10: 12 | man:x:12: 13 | proxy:x:13: 14 | kmem:x:15: 15 | input:x:19: 16 | dialout:x:20: 17 | fax:x:21: 18 | voice:x:22: 19 | cdrom:x:24: 20 | floppy:x:25: 21 | tape:x:26: 22 | sudo:x:27: 23 | audio:x:29: 24 | dip:x:30: 25 | www-data:x:33: 26 | backup:x:34: 27 | operator:x:37: 28 | list:x:38: 29 | irc:x:39: 30 | src:x:40: 31 | gnats:x:41: 32 | shadow:x:42: 33 | utmp:x:43: 34 | video:x:44: 35 | sasl:x:45: 36 | plugdev:x:46: 37 | staff:x:50: 38 | games:x:60: 39 | shutdown:x:70: 40 | users:x:100: 41 | netdev:x:104: 42 | messagebus:x:105: 43 | nogroup:x:65534: 44 | newuser:x:999: 45 | -------------------------------------------------------------------------------- /Chapter03/03_07/meta-custom/files/passwd: -------------------------------------------------------------------------------- 1 | root:x:0:0:root:/home/root:/bin/sh 2 | daemon:x:1:1:daemon:/usr/sbin:/bin/sh 3 | bin:x:2:2:bin:/bin:/bin/sh 4 | sys:x:3:3:sys:/dev:/bin/sh 5 | sync:x:4:65534:sync:/bin:/bin/sync 6 | games:x:5:60:games:/usr/games:/bin/sh 7 | man:x:6:12:man:/var/cache/man:/bin/sh 8 | lp:x:7:7:lp:/var/spool/lpd:/bin/sh 9 | mail:x:8:8:mail:/var/mail:/bin/sh 10 | news:x:9:9:news:/var/spool/news:/bin/sh 11 | uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh 12 | proxy:x:13:13:proxy:/bin:/bin/sh 13 | www-data:x:33:33:www-data:/var/www:/bin/sh 14 | backup:x:34:34:backup:/var/backups:/bin/sh 15 | list:x:38:38:Mailing List Manager:/var/list:/bin/sh 16 | irc:x:39:39:ircd:/var/run/ircd:/bin/sh 17 | gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh 18 | nobody:x:65534:65534:nobody:/nonexistent:/bin/sh 19 | messagebus:x:102:105::/var/run/dbus:/bin/false 20 | newuser:x:999:999::/home/newuser:/bin/sh 21 | -------------------------------------------------------------------------------- /Chapter03/03_07/meta-custom/recipes-core/images/custom-image.bb: -------------------------------------------------------------------------------- 1 | require recipes-core/images/core-image-minimal.bb 2 | IMAGE_FEATURES += "ssh-server-dropbear package-management" 3 | 4 | inherit extrausers 5 | 6 | EXTRA_USERS_PARAMS = "\ 7 | usermod -p 9PfNy0O1z0O5g root; \ 8 | " 9 | -------------------------------------------------------------------------------- /Chapter03/03_07/meta-custom/recipes-example/example-user_1.0.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Example of user add" 2 | SECTION = "examples" 3 | 4 | LICENSE = "GPLv2" 5 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" 6 | 7 | inherit useradd 8 | 9 | PASSWORD ?= "miDBHFo2hJSAA" 10 | USERADD_PACKAGES = "${PN}" 11 | USERADD_PARAM_${PN} = "--system --create-home \ 12 | --groups tty \ 13 | --password ${PASSWORD} \ 14 | --user-group newuser" 15 | 16 | ALLOW_EMPTY_${PN} = "1" 17 | -------------------------------------------------------------------------------- /Chapter03/03_08/commands.README: -------------------------------------------------------------------------------- 1 | INITSCRIPT_PACKAGES = "${PN}-httpd ${PN}-ftpd" 2 | INITSCRIPT_NAME_${PN}-httpd = "httpd.sh" 3 | INITSCRIPT_NAME_${PN}-ftpd = "ftpd.sh" 4 | INITSCRIPT_PARAMS_${PN}-httpd = "defaults" 5 | INITSCRIPT_PARAMS_${PN}-ftpd = "start 99 5 2 . stop 20 0 1 6 ." 6 | 7 | -------------------------------------------------------------------------------- /Chapter03/03_08/meta-custom/recipes-example/sysvinit-mount-1.0/mount.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Empty example init script 4 | -------------------------------------------------------------------------------- /Chapter03/03_08/meta-custom/recipes-example/sysvinit-mount_1.0.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Initscripts for mounting filesystems" 2 | 3 | LICENSE = "MIT" 4 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" 5 | 6 | SRC_URI = "file://mount.sh" 7 | 8 | INITSCRIPT_NAME = "mount.sh" 9 | INITSCRIPT_PARAMS = "start 09 S ." 10 | 11 | inherit update-rc.d 12 | 13 | S = "${WORKDIR}" 14 | 15 | do_install () { 16 | install -d ${D}${sysconfdir}/init.d/ 17 | install -c -m 755 ${WORKDIR}/${INITSCRIPT_NAME} ${D}${sysconfdir}/init.d/${INITSCRIPT_NAME} 18 | } 19 | -------------------------------------------------------------------------------- /Chapter03/03_09/commands.README: -------------------------------------------------------------------------------- 1 | DISTRO_FEATURES_append = " systemd" 2 | 3 | VIRTUAL-RUNTIME_init_manager = "systemd" 4 | 5 | DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit" 6 | VIRTUAL-RUNTIME_initscripts = "" 7 | 8 | SYSTEMD_PACKAGES = "${PN}-syslog" 9 | SYSTEMD_SERVICE_${PN}-syslog = "busybox-syslog.service" 10 | SYSTEMD_AUTO_ENABLE = "disabled" 11 | 12 | -------------------------------------------------------------------------------- /Chapter03/03_09/conf/bblayers.conf: -------------------------------------------------------------------------------- 1 | LCONF_VERSION = "7" 2 | 3 | BBPATH = "${TOPDIR}" 4 | BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../..')}" 5 | 6 | BBFILES ?= "" 7 | BBLAYERS = " \ 8 | ${BSPDIR}/sources/poky/meta \ 9 | ${BSPDIR}/sources/poky/meta-poky \ 10 | ${BSPDIR}/sources/meta-openembedded/meta-oe \ 11 | ${BSPDIR}/sources/meta-openembedded/meta-multimedia \ 12 | ${BSPDIR}/sources/meta-freescale \ 13 | ${BSPDIR}/sources/meta-freescale-3rdparty \ 14 | ${BSPDIR}/sources/meta-freescale-distro \ 15 | ${BSPDIR}/sources/meta-custom \ 16 | " 17 | -------------------------------------------------------------------------------- /Chapter03/03_09/conf/local.conf: -------------------------------------------------------------------------------- 1 | MACHINE ??= 'wandboard' 2 | DISTRO ?= 'poky' 3 | PACKAGE_CLASSES ?= "package_rpm" 4 | EXTRA_IMAGE_FEATURES ?= "debug-tweaks" 5 | USER_CLASSES ?= "buildstats image-mklibs image-prelink" 6 | PATCHRESOLVE = "noop" 7 | BB_DISKMON_DIRS = "\ 8 | STOPTASKS,${TMPDIR},1G,100K \ 9 | STOPTASKS,${DL_DIR},1G,100K \ 10 | STOPTASKS,${SSTATE_DIR},1G,100K \ 11 | STOPTASKS,/tmp,100M,100K \ 12 | ABORT,${TMPDIR},100M,1K \ 13 | ABORT,${DL_DIR},100M,1K \ 14 | ABORT,${SSTATE_DIR},100M,1K \ 15 | ABORT,/tmp,10M,1K" 16 | PACKAGECONFIG_append_pn-qemu-native = " sdl" 17 | PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl" 18 | CONF_VERSION = "1" 19 | 20 | DL_DIR ?= "${BSPDIR}/downloads/" 21 | ACCEPT_FSL_EULA = "1" 22 | 23 | INHERIT += "rm_work" 24 | RM_WORK_EXCLUDE += "core-image-minimal custom-image" 25 | INHIBIT_PACKAGE_DEBUG_SPLIT = "1" 26 | 27 | IMAGE_INSTALL_append = " htop example-data systemd-example" 28 | FEATURE_PACKAGES_debug-utils = "trace-cmd perf" 29 | EXTRA_IMAGE_FEATURES += "debug-utils" 30 | 31 | DISTRO_FEATURES_append = " systemd" 32 | VIRTUAL-RUNTIME_init_manager = "systemd" 33 | DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit" 34 | VIRTUAL-RUNTIME_initscripts = "" 35 | -------------------------------------------------------------------------------- /Chapter03/03_09/meta-bsp-custom/recipes-kernel/linux/linux-wandboard-4.1-2.0.x/wandboard-custom/defconfig: -------------------------------------------------------------------------------- 1 | CONFIG_LOCALVERSION="-1.1.0-ga-wandboard" 2 | CONFIG_KERNEL_XZ=y 3 | # CONFIG_SWAP is not set 4 | CONFIG_FHANDLE=y 5 | CONFIG_NO_HZ=y 6 | CONFIG_HIGH_RES_TIMERS=y 7 | CONFIG_CGROUPS=y 8 | CONFIG_CC_OPTIMIZE_FOR_SIZE=y 9 | # CONFIG_KALLSYMS is not set 10 | # CONFIG_PRINTK is not set 11 | # CONFIG_BUG is not set 12 | # CONFIG_ELF_CORE is not set 13 | # CONFIG_BASE_FULL is not set 14 | CONFIG_EMBEDDED=y 15 | CONFIG_SLOB=y 16 | CONFIG_ARCH_MXC=y 17 | CONFIG_SOC_IMX6Q=y 18 | CONFIG_SOC_IMX6SL=y 19 | CONFIG_SMP=y 20 | CONFIG_VMSPLIT_2G=y 21 | CONFIG_AEABI=y 22 | CONFIG_SECCOMP=y 23 | CONFIG_CPU_FREQ=y 24 | CONFIG_CPU_IDLE=y 25 | CONFIG_VFP=y 26 | CONFIG_NEON=y 27 | CONFIG_NET=y 28 | CONFIG_UNIX=y 29 | CONFIG_INET=y 30 | CONFIG_DEVTMPFS=y 31 | CONFIG_DEVTMPFS_MOUNT=y 32 | # CONFIG_INPUT_MOUSEDEV is not set 33 | # CONFIG_INPUT_KEYBOARD is not set 34 | # CONFIG_INPUT_MOUSE is not set 35 | CONFIG_SERIAL_IMX=y 36 | CONFIG_SERIAL_IMX_CONSOLE=y 37 | # CONFIG_HWMON is not set 38 | CONFIG_REGULATOR=y 39 | CONFIG_REGULATOR_ANATOP=y 40 | # CONFIG_USB_SUPPORT is not set 41 | CONFIG_MMC=y 42 | CONFIG_MMC_SDHCI=y 43 | CONFIG_MMC_SDHCI_PLTFM=y 44 | CONFIG_MMC_SDHCI_ESDHC_IMX=y 45 | CONFIG_DMADEVICES=y 46 | CONFIG_IMX_SDMA=y 47 | CONFIG_EXT3_FS=y 48 | # CONFIG_EXT3_FS_XATTR is not set 49 | CONFIG_EXT4_FS=y 50 | CONFIG_AUTOFS4_FS=y 51 | CONFIG_TMPFS=y 52 | CONFIG_TMPFS_POSIX_ACL=y 53 | CONFIG_CONFIGFS_FS=y 54 | # CONFIG_ENABLE_WARN_DEPRECATED is not set 55 | # CONFIG_ENABLE_MUST_CHECK is not set 56 | CONFIG_SCHEDSTATS=y 57 | # CONFIG_FTRACE is not set 58 | # CONFIG_ARM_UNWIND is not set 59 | -------------------------------------------------------------------------------- /Chapter03/03_09/meta-custom/recipes-example/systemd-example/systemd-example-1.0/simple-service.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #define DAEMON_NAME "simpledaemon" 5 | 6 | int main() 7 | { 8 | setlogmask(LOG_UPTO(LOG_INFO)); 9 | openlog(DAEMON_NAME, LOG_CONS | LOG_PERROR, LOG_USER); 10 | 11 | daemon(0,0); 12 | 13 | while (1) 14 | { 15 | syslog(LOG_INFO, "daemon running"); 16 | sleep(10); 17 | } 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /Chapter03/03_09/meta-custom/recipes-example/systemd-example/systemd-example-1.0/systemd-example.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Example service 3 | 4 | [Service] 5 | Type=forking 6 | ExecStart=@BINDIR@/simple-service 7 | 8 | [Install] 9 | WantedBy=multi-user.target 10 | -------------------------------------------------------------------------------- /Chapter03/03_09/meta-custom/recipes-example/systemd-example/systemd-example_1.0.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Example systemd service" 2 | 3 | LICENSE = "MIT" 4 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" 5 | 6 | SRC_URI = "\ 7 | file://systemd-example.service \ 8 | file://simple-service.c \ 9 | " 10 | 11 | inherit systemd 12 | 13 | S = "${WORKDIR}" 14 | 15 | SYSTEMD_SERVICE_${PN} = "systemd-example.service" 16 | 17 | do_compile () { 18 | ${CC} ${LDFLAGS} simple-service.c -o simple-service 19 | } 20 | 21 | do_install () { 22 | install -d ${D}${bindir} 23 | install -m 0755 ${WORKDIR}/simple-service ${D}${bindir} 24 | install -d ${D}${systemd_unitdir}/system 25 | install -m 0644 ${WORKDIR}/systemd-example.service ${D}${systemd_unitdir}/system 26 | sed -i -e 's,@BINDIR@,${bindir},g' ${D}${systemd_unitdir}/system/systemd-example.service 27 | } 28 | -------------------------------------------------------------------------------- /Chapter03/03_10/commands.README: -------------------------------------------------------------------------------- 1 | pkg_preinst_${PN} () { 2 | # Shell commands 3 | } 4 | 5 | pkg_postinst_${PN} () { 6 | if [ x"$D" = "x" ]; then 7 | # Commands to execute on device 8 | else 9 | # Commands to execute on host 10 | fi 11 | } 12 | 13 | if test -n "$D"; then 14 | # Running on host 15 | else 16 | # Running on target 17 | fi 18 | -------------------------------------------------------------------------------- /Chapter03/03_11/commands.README: -------------------------------------------------------------------------------- 1 | cd /opt/yocto/linux-wandboard 2 | /opt/yocto/fsl-community-bsp/sources/poky/scripts/tiny/ksum.py 3 | 4 | cd /opt/yocto/linux-wandboard 5 | python2.7 /opt/yocto/fsl-community-bsp/sources/poky/scripts/tiny/ksize.py -d > ksize.log 6 | 7 | nm --size-sort --print-size -r vmlinux | head 8 | 9 | dmesg | grep -A 3 "text" 10 | 11 | -------------------------------------------------------------------------------- /Chapter03/03_11/conf/bblayers.conf: -------------------------------------------------------------------------------- 1 | LCONF_VERSION = "7" 2 | 3 | BBPATH = "${TOPDIR}" 4 | BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../..')}" 5 | 6 | BBFILES ?= "" 7 | BBLAYERS = " \ 8 | ${BSPDIR}/sources/poky/meta \ 9 | ${BSPDIR}/sources/poky/meta-poky \ 10 | ${BSPDIR}/sources/meta-openembedded/meta-oe \ 11 | ${BSPDIR}/sources/meta-openembedded/meta-multimedia \ 12 | ${BSPDIR}/sources/meta-freescale \ 13 | ${BSPDIR}/sources/meta-freescale-3rdparty \ 14 | ${BSPDIR}/sources/meta-freescale-distro \ 15 | ${BSPDIR}/sources/meta-custom \ 16 | " 17 | -------------------------------------------------------------------------------- /Chapter03/03_11/conf/local.conf: -------------------------------------------------------------------------------- 1 | MACHINE ??= 'wandboard' 2 | DISTRO ?= 'poky' 3 | PACKAGE_CLASSES ?= "package_rpm" 4 | EXTRA_IMAGE_FEATURES ?= "debug-tweaks" 5 | USER_CLASSES ?= "buildstats image-mklibs image-prelink" 6 | PATCHRESOLVE = "noop" 7 | BB_DISKMON_DIRS = "\ 8 | STOPTASKS,${TMPDIR},1G,100K \ 9 | STOPTASKS,${DL_DIR},1G,100K \ 10 | STOPTASKS,${SSTATE_DIR},1G,100K \ 11 | STOPTASKS,/tmp,100M,100K \ 12 | ABORT,${TMPDIR},100M,1K \ 13 | ABORT,${DL_DIR},100M,1K \ 14 | ABORT,${SSTATE_DIR},100M,1K \ 15 | ABORT,/tmp,10M,1K" 16 | PACKAGECONFIG_append_pn-qemu-native = " sdl" 17 | PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl" 18 | CONF_VERSION = "1" 19 | 20 | DL_DIR ?= "${BSPDIR}/downloads/" 21 | ACCEPT_FSL_EULA = "1" 22 | 23 | INHERIT += "rm_work" 24 | RM_WORK_EXCLUDE += "core-image-minimal custom-image" 25 | INHIBIT_PACKAGE_DEBUG_SPLIT = "1" 26 | 27 | IMAGE_INSTALL_append = " htop example-data" 28 | FEATURE_PACKAGES_debug-utils = "trace-cmd perf" 29 | EXTRA_IMAGE_FEATURES += "debug-utils" 30 | -------------------------------------------------------------------------------- /Chapter03/03_11/meta-bsp-custom/recipes-kernel/linux/linux-wandboard-4.1-2.0.x/wandboard-custom/defconfig: -------------------------------------------------------------------------------- 1 | CONFIG_LOCALVERSION="-1.1.0-ga-wandboard" 2 | CONFIG_KERNEL_XZ=y 3 | # CONFIG_SWAP is not set 4 | CONFIG_NO_HZ=y 5 | CONFIG_HIGH_RES_TIMERS=y 6 | CONFIG_CC_OPTIMIZE_FOR_SIZE=y 7 | # CONFIG_KALLSYMS is not set 8 | # CONFIG_PRINTK is not set 9 | # CONFIG_BUG is not set 10 | # CONFIG_ELF_CORE is not set 11 | # CONFIG_BASE_FULL is not set 12 | CONFIG_EMBEDDED=y 13 | CONFIG_SLOB=y 14 | CONFIG_ARCH_MXC=y 15 | CONFIG_SOC_IMX6Q=y 16 | CONFIG_SOC_IMX6SL=y 17 | CONFIG_SMP=y 18 | CONFIG_VMSPLIT_2G=y 19 | CONFIG_AEABI=y 20 | CONFIG_CPU_FREQ=y 21 | CONFIG_CPU_IDLE=y 22 | CONFIG_VFP=y 23 | CONFIG_NEON=y 24 | CONFIG_DEVTMPFS=y 25 | CONFIG_DEVTMPFS_MOUNT=y 26 | # CONFIG_INPUT_MOUSEDEV is not set 27 | # CONFIG_INPUT_KEYBOARD is not set 28 | # CONFIG_INPUT_MOUSE is not set 29 | CONFIG_SERIAL_IMX=y 30 | CONFIG_SERIAL_IMX_CONSOLE=y 31 | # CONFIG_HWMON is not set 32 | CONFIG_REGULATOR=y 33 | CONFIG_REGULATOR_ANATOP=y 34 | # CONFIG_USB_SUPPORT is not set 35 | CONFIG_MMC=y 36 | CONFIG_MMC_SDHCI=y 37 | CONFIG_MMC_SDHCI_PLTFM=y 38 | CONFIG_MMC_SDHCI_ESDHC_IMX=y 39 | CONFIG_DMADEVICES=y 40 | CONFIG_IMX_SDMA=y 41 | CONFIG_EXT3_FS=y 42 | # CONFIG_EXT3_FS_XATTR is not set 43 | CONFIG_EXT4_FS=y 44 | # CONFIG_PROC_SYSCTL is not set 45 | # CONFIG_PROC_PAGE_MONITOR is not set 46 | # CONFIG_SYSFS is not set 47 | # CONFIG_ENABLE_WARN_DEPRECATED is not set 48 | # CONFIG_ENABLE_MUST_CHECK is not set 49 | # CONFIG_FTRACE is not set 50 | # CONFIG_ARM_UNWIND is not set 51 | -------------------------------------------------------------------------------- /Chapter03/03_12/commands.README: -------------------------------------------------------------------------------- 1 | DISTRO = "poky-tiny" 2 | 3 | IMAGE_INSTALL_remove = "sysvinit" 4 | 5 | sort -r -g -k 4,4 files-in-image.txt -o sorted-files-in-image.txt 6 | 7 | cd /opt/yocto/fsl-community-bsp/wandboard/tmp/work/wandboard-poky-linux-gnueabi/core-image-minimal/1.0-r0/rootfs 8 | /opt/yocto/fsl-community-bsp/sources/poky/scripts/tiny/dirsize.py 9 | 10 | VIRTUAL-RUNTIME_dev_manager = "busybox-mdev" 11 | 12 | TCLIBC = "musl" 13 | -------------------------------------------------------------------------------- /Chapter03/03_12/conf/bblayers.conf: -------------------------------------------------------------------------------- 1 | LCONF_VERSION = "7" 2 | 3 | BBPATH = "${TOPDIR}" 4 | BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../..')}" 5 | 6 | BBFILES ?= "" 7 | BBLAYERS = " \ 8 | ${BSPDIR}/sources/poky/meta \ 9 | ${BSPDIR}/sources/poky/meta-poky \ 10 | ${BSPDIR}/sources/meta-openembedded/meta-oe \ 11 | ${BSPDIR}/sources/meta-openembedded/meta-multimedia \ 12 | ${BSPDIR}/sources/meta-freescale \ 13 | ${BSPDIR}/sources/meta-freescale-3rdparty \ 14 | ${BSPDIR}/sources/meta-freescale-distro \ 15 | ${BSPDIR}/sources/meta-custom \ 16 | " 17 | -------------------------------------------------------------------------------- /Chapter03/03_12/conf/local.conf: -------------------------------------------------------------------------------- 1 | MACHINE ??= 'wandboard' 2 | DISTRO ?= 'poky-tiny-custom' 3 | PACKAGE_CLASSES ?= "package_rpm" 4 | EXTRA_IMAGE_FEATURES ?= "debug-tweaks" 5 | USER_CLASSES ?= "buildstats image-mklibs image-prelink" 6 | PATCHRESOLVE = "noop" 7 | BB_DISKMON_DIRS = "\ 8 | STOPTASKS,${TMPDIR},1G,100K \ 9 | STOPTASKS,${DL_DIR},1G,100K \ 10 | STOPTASKS,${SSTATE_DIR},1G,100K \ 11 | STOPTASKS,/tmp,100M,100K \ 12 | ABORT,${TMPDIR},100M,1K \ 13 | ABORT,${DL_DIR},100M,1K \ 14 | ABORT,${SSTATE_DIR},100M,1K \ 15 | ABORT,/tmp,10M,1K" 16 | PACKAGECONFIG_append_pn-qemu-native = " sdl" 17 | PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl" 18 | CONF_VERSION = "1" 19 | 20 | DL_DIR ?= "${BSPDIR}/downloads/" 21 | ACCEPT_FSL_EULA = "1" 22 | 23 | INHERIT += "rm_work" 24 | RM_WORK_EXCLUDE += "core-image-minimal custom-image image-small" 25 | INHIBIT_PACKAGE_DEBUG_SPLIT = "1" 26 | 27 | IMAGE_INSTALL_remove = "sysvinit" 28 | -------------------------------------------------------------------------------- /Chapter03/03_12/meta-custom/conf/distro/poky-tiny-custom.conf: -------------------------------------------------------------------------------- 1 | require conf/distro/poky-tiny.conf 2 | PREFERRED_PROVIDER_virtual/kernel = "linux-wandboard" 3 | -------------------------------------------------------------------------------- /Chapter03/03_12/meta-custom/recipes-core/images/image-small.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Minimal console-only image." 2 | 3 | IMAGE_INSTALL= "\ 4 | base-files \ 5 | base-passwd \ 6 | busybox \ 7 | sysvinit \ 8 | initscripts \ 9 | " 10 | 11 | IMAGE_LINGUAS = " " 12 | 13 | LICENSE = "MIT" 14 | 15 | inherit image 16 | 17 | IMAGE_ROOTFS_SIZE = "8192" 18 | -------------------------------------------------------------------------------- /Chapter03/03_13/commands.README: -------------------------------------------------------------------------------- 1 | env set ipaddr 2 | env set serverip 3 | 4 | env set image 5 | env set fdtfile 6 | env set initrd_file 7 | 8 | tftpboot ${loadaddr} ${image} 9 | tftpboot ${fdt_addr} ${fdtfile} 10 | tftpboot ${ramdisk_addr} ${initrd_file} 11 | 12 | bootz ${loadaddr} ${ramdiskaddr} ${fdt_addr} 13 | 14 | INITRAMFS_IMAGE = "" 15 | 16 | INITRAMFS_IMAGE_BUNDLE = "1" 17 | 18 | env set ipaddr 19 | env set serverip 20 | 21 | env set image 22 | env set fdtfile 23 | 24 | tftpboot ${loadaddr} ${image} 25 | tftpboot ${fdt_addr} ${fdtfile} 26 | 27 | bootz ${loadaddr} - ${fdt_addr} 28 | 29 | -------------------------------------------------------------------------------- /Chapter03/03_13/meta-custom/recipes-core/images/image-small-initramfs.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Minimal console-only initramfs image." 2 | 3 | PACKAGE_INSTALL= "\ 4 | base-files \ 5 | base-passwd \ 6 | busybox \ 7 | sysvinit \ 8 | initscripts \ 9 | ${ROOTFS_BOOTSTRAP_INSTALL} \ 10 | " 11 | 12 | IMAGE_LINGUAS = " " 13 | 14 | LICENSE = "MIT" 15 | 16 | IMAGE_FEATURES = "" 17 | 18 | export IMAGE_BASENAME = "image-small-initramfs" 19 | 20 | IMAGE_FSTYPES = "${INITRAMFS_FSTYPES} ${INITRAMFS_FSTYPES}.u-boot" 21 | inherit image 22 | 23 | IMAGE_ROOTFS_SIZE = "8192" 24 | -------------------------------------------------------------------------------- /Chapter03/03_14/commands.README: -------------------------------------------------------------------------------- 1 | cd /opt/yocto/fsl-community-bsp/sources 2 | git clone git://git.yoctoproject.org/meta-selinux 3 | 4 | git clone https://github.com/yoctocookbook2ndedition/meta-selinux.git -b rocko 5 | 6 | ${BSPDIR}/sources/meta-selinux \ 7 | ${BSPDIR}/sources/meta-openembedded/meta-python \ 8 | 9 | DISTRO_FEATURES_append = " pam selinux" 10 | 11 | PREFERRED_PROVIDER_virtual/refpolicy ?= "refpolicy-minimum" 12 | 13 | IMAGE_INSTALL_append = " packagegroup-core-selinux" 14 | 15 | DISTRO_FEATURES_remove = "wayland" 16 | 17 | fixfiles -f -F relabel 18 | 19 | sestatus 20 | 21 | cd /opt/yocto/fsl-community-bsp/sources 22 | git clone git://github.com/01org/meta-intel-iot-security 23 | 24 | ${BSPDIR}/sources/meta-intel-iot-security/meta-security-smack \ 25 | 26 | OVERRIDES .= ":smack" 27 | DISTRO_FEATURES_append = " smack" 28 | 29 | CORE_IMAGE_EXTRA_INSTALL += "coreutils smack-userspace" 30 | 31 | chsmack /bin/cat 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /Chapter03/03_14/conf-selinux/bblayers.conf: -------------------------------------------------------------------------------- 1 | LCONF_VERSION = "7" 2 | 3 | BBPATH = "${TOPDIR}" 4 | BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../..')}" 5 | 6 | BBFILES ?= "" 7 | BBLAYERS = " \ 8 | ${BSPDIR}/sources/poky/meta \ 9 | ${BSPDIR}/sources/poky/meta-poky \ 10 | ${BSPDIR}/sources/meta-openembedded/meta-oe \ 11 | ${BSPDIR}/sources/meta-openembedded/meta-multimedia \ 12 | ${BSPDIR}/sources/meta-freescale \ 13 | ${BSPDIR}/sources/meta-freescale-3rdparty \ 14 | ${BSPDIR}/sources/meta-freescale-distro \ 15 | ${BSPDIR}/sources/meta-custom \ 16 | ${BSPDIR}/sources/meta-selinux \ 17 | ${BSPDIR}/sources/meta-openembedded/meta-python \ 18 | " 19 | -------------------------------------------------------------------------------- /Chapter03/03_14/conf-selinux/local.conf: -------------------------------------------------------------------------------- 1 | MACHINE ??= 'wandboard' 2 | DISTRO ?= 'poky' 3 | PACKAGE_CLASSES ?= "package_rpm" 4 | EXTRA_IMAGE_FEATURES ?= "debug-tweaks" 5 | USER_CLASSES ?= "buildstats image-mklibs image-prelink" 6 | PATCHRESOLVE = "noop" 7 | BB_DISKMON_DIRS = "\ 8 | STOPTASKS,${TMPDIR},1G,100K \ 9 | STOPTASKS,${DL_DIR},1G,100K \ 10 | STOPTASKS,${SSTATE_DIR},1G,100K \ 11 | STOPTASKS,/tmp,100M,100K \ 12 | ABORT,${TMPDIR},100M,1K \ 13 | ABORT,${DL_DIR},100M,1K \ 14 | ABORT,${SSTATE_DIR},100M,1K \ 15 | ABORT,/tmp,10M,1K" 16 | PACKAGECONFIG_append_pn-qemu-native = " sdl" 17 | PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl" 18 | CONF_VERSION = "1" 19 | 20 | DL_DIR ?= "${BSPDIR}/downloads/" 21 | ACCEPT_FSL_EULA = "1" 22 | 23 | INHERIT += "rm_work" 24 | RM_WORK_EXCLUDE += "core-image-minimal custom-image image-small" 25 | INHIBIT_PACKAGE_DEBUG_SPLIT = "1" 26 | 27 | DISTRO_FEATURES_append = " acl xattr pam selinux" 28 | PREFERRED_PROVIDER_virtual/refpolicy ?= "refpolicy-minimum" 29 | 30 | DISTRO_FEATURES_remove = "wayland" 31 | 32 | -------------------------------------------------------------------------------- /Chapter03/03_14/conf-smack/bblayers.conf: -------------------------------------------------------------------------------- 1 | LCONF_VERSION = "7" 2 | 3 | BBPATH = "${TOPDIR}" 4 | BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../..')}" 5 | 6 | BBFILES ?= "" 7 | BBLAYERS = " \ 8 | ${BSPDIR}/sources/poky/meta \ 9 | ${BSPDIR}/sources/poky/meta-poky \ 10 | ${BSPDIR}/sources/meta-openembedded/meta-oe \ 11 | ${BSPDIR}/sources/meta-openembedded/meta-multimedia \ 12 | ${BSPDIR}/sources/meta-freescale \ 13 | ${BSPDIR}/sources/meta-freescale-3rdparty \ 14 | ${BSPDIR}/sources/meta-freescale-distro \ 15 | ${BSPDIR}/sources/meta-custom \ 16 | ${BSPDIR}/sources/meta-intel-iot-security/meta-security-smack \ 17 | " 18 | -------------------------------------------------------------------------------- /Chapter03/03_14/conf-smack/local.conf: -------------------------------------------------------------------------------- 1 | MACHINE ??= 'wandboard' 2 | DISTRO ?= 'poky' 3 | PACKAGE_CLASSES ?= "package_rpm" 4 | EXTRA_IMAGE_FEATURES ?= "debug-tweaks" 5 | USER_CLASSES ?= "buildstats image-mklibs image-prelink" 6 | PATCHRESOLVE = "noop" 7 | BB_DISKMON_DIRS = "\ 8 | STOPTASKS,${TMPDIR},1G,100K \ 9 | STOPTASKS,${DL_DIR},1G,100K \ 10 | STOPTASKS,${SSTATE_DIR},1G,100K \ 11 | STOPTASKS,/tmp,100M,100K \ 12 | ABORT,${TMPDIR},100M,1K \ 13 | ABORT,${DL_DIR},100M,1K \ 14 | ABORT,${SSTATE_DIR},100M,1K \ 15 | ABORT,/tmp,10M,1K" 16 | PACKAGECONFIG_append_pn-qemu-native = " sdl" 17 | PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl" 18 | CONF_VERSION = "1" 19 | 20 | DL_DIR ?= "${BSPDIR}/downloads/" 21 | ACCEPT_FSL_EULA = "1" 22 | 23 | INHERIT += "rm_work" 24 | RM_WORK_EXCLUDE += "core-image-minimal custom-image image-small" 25 | INHIBIT_PACKAGE_DEBUG_SPLIT = "1" 26 | 27 | DISTRO_FEATURES_append = " acl xattr pam selinux" 28 | PREFERRED_PROVIDER_virtual/refpolicy ?= "refpolicy-minimum" 29 | 30 | DISTRO_FEATURES_remove = "wayland" 31 | 32 | -------------------------------------------------------------------------------- /Chapter03/03_14/meta-custom/recipes-core/base-files/base-files_%.bbappend: -------------------------------------------------------------------------------- 1 | do_install_append () { 2 | cat >> ${D}${sysconfdir}/fstab < 2 | 3 | SDK_EXT_TYPE = "minimal" 4 | SDK_INCLUDE_TOOLCHAIN = "1" 5 | SDK_INCLUDE_PKGDATA = "1" 6 | 7 | EXCLUDE_FROM_WORLD_pn-ffmpeg = "1" 8 | 9 | SDK_LOCAL_CONF_WHITELIST = "SSTATE_MIRRORS" 10 | 11 | ./poky-glibc-x86_64-core-image-minimal-cortexa9hf-neon-toolchain-ext-2.4.sh 12 | 13 | . environment-setup-cortexa9hf-neon-poky-linux-gnueabi 14 | 15 | devtool add helloworld 16 | 17 | devtool edit-recipe helloworld 18 | 19 | devtool build helloworld 20 | devtool deploy-target helloworld root@:/bin 21 | devtool build-image core-image-base 22 | devtool finish helloworld meta-custom 23 | 24 | devtool create-workspace 25 | devtool add 26 | devtool search 27 | devtool modify 28 | devtool upgrade 29 | devtool upgrade --srcrev --srcbranch 30 | devtool status 31 | devtool reset devtool deploy-target @[:] 32 | devtool edit-recipe 33 | devtool build 34 | devtool deploy-target @[:] 35 | devtool undeploy-target @[:] 36 | devtool build-image -p 37 | devtool update-recipe 38 | devtool update-recipe --append 39 | devtool finish 40 | 41 | SDK_UPDATE_URL = "http://example.com/sdk" 42 | 43 | oe-publish-sdk tmp/deploy/sdk/poky-glibc-x86_64-core-image-sato-cortexa9hf-neon-toolchain-ext-2.4.sh /path/to/web/root 44 | devtool sdk-update 45 | -------------------------------------------------------------------------------- /Chapter04/04_04/commands.README: -------------------------------------------------------------------------------- 1 | sudo add-apt-repository ppa:webupd8team/java 2 | sudo apt-get update 3 | sudo apt-get install oracle-java8-installer 4 | 5 | java -version 6 | 7 | wget -O eclipse-cpp-oxygen-1a-linux-gtk-x86_64.tar.gz "http://mirror.kumi.systems/eclipse/technology/epp/downloads/release/oxygen/1a/eclipse-cpp-oxygen-1a-linux-gtk-x86_64.tar.gz" 8 | 9 | tar xvf eclipse-cpp-neon-3-linux-gtk-x86_64.tar.gz 10 | 11 | nohup eclipse/eclipse & 12 | 13 | http://downloads.yoctoproject.org/releases/eclipse-plugin/2.4/oxygen 14 | 15 | /opt/poky/2.4 16 | /opt/poky/2.4/sysroots/armv5e-poky-linux-gnueabi 17 | armv5e-poky-linux-gnueabi 18 | 19 | /opt/poky/2.4/sysroots/armv5e-poky-linux-gnueabi/zImage-qemuarm.bin 20 | 21 | http://downloads.yoctoproject.org/releases/yocto/yocto-2.4/machines/qemu/qemuarm/core-image-sato-sdk-qemuarm.qemuboot.conf 22 | http://downloads.yoctoproject.org/releases/yocto/yocto-2.4/machines/qemu/qemuarm/zImage-qemuarm.bin 23 | http://downloads.yoctoproject.org/releases/yocto/yocto-2.4/machines/qemu/qemuarm/zImage-versatile-pb.dtb 24 | http://downloads.yoctoproject.org/releases/yocto/yocto-2.4/machines/qemu/qemuarm/core-image-sato-sdk-qemuarm.ext4 25 | 26 | cd /opt/yocto/fsl-community-bsp 27 | source setup-environment wandboard 28 | bitbake meta-ide-support 29 | 30 | /opt/yocto/fsl-community-bsp/wandboard 31 | /opt/yocto/fsl-community-bsp/wandboard/tmp/sysroots/wandboard 32 | 33 | EXTRA_IMAGE_FEATURES += "eclipse-debug" 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /Chapter04/04_05/commands.README: -------------------------------------------------------------------------------- 1 | EXTRA_IMAGE_FEATURES += "eclipse-debug" 2 | 3 | cd /opt/yocto/fsl-community-bsp/ 4 | source setup-environment wandboard 5 | bitbake core-image-sato 6 | 7 | bitbake -c populate_sdk core-image-sato 8 | 9 | cd tmp/deploy/sdk 10 | ./poky-glibc-x86_64-core-image-sato-cortexa9hf-neon-toolchain-2.4.sh 11 | 12 | source /opt/poky/2.4/environment-setup-cortexa9hf-neon-poky-linux-gnueabi 13 | ${CC} gtk_hello_world.c -o helloworld `pkg-config --cflags --libs gtk+-3.0` 14 | 15 | DISPLAY=:0 helloworld 16 | 17 | PKG_CHECK_MODULES(helloworld, glib-2.0 gtk+-3.0) 18 | 19 | export DISPLAY=:0 20 | 21 | ps w | grep tcf 22 | 23 | /opt/poky/2.4/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gdb 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Chapter04/04_05/gtk_hello_world.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int argc, char *argv[]) 4 | { 5 | GtkWidget *window; 6 | 7 | gtk_init (&argc, &argv); 8 | window = gtk_window_new (GTK_WINDOW_TOPLEVEL); 9 | gtk_widget_show (window); 10 | gtk_main (); 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /Chapter04/04_06/commands.README: -------------------------------------------------------------------------------- 1 | wget http://download.qt.io/official_releases/qtcreator/4.5/4.5.0/qt-creator-opensource-linux-x86_64-4.5.0.run 2 | chmod u+x qt-creator-opensource-linux-x86_64-4.5.0.run 3 | ./qt-creator-opensource-linux-x86_64-4.5.0.run 4 | 5 | cd /opt/yocto/fsl-community-bsp/sources/ 6 | git clone https://github.com/meta-qt5/meta-qt5 -b rocko 7 | 8 | ${BSPDIR}/sources/meta-qt5 \ 9 | 10 | cd /opt/yocto/fsl-community-bsp/ 11 | source setup-environment wandboard 12 | bitbake meta-toolchain-qt5 13 | 14 | inherit populate_sdk_qt5 15 | 16 | bitbake -c populate_sdk core-image-sato 17 | 18 | PACKAGE_CLASSES = "package_ipk" 19 | 20 | RDEPENDS_nativesdk-packagegroup-sdk-host_remove = "nativesdk-cmake" 21 | 22 | cd tmp/deploy/sdk 23 | ./poky-glibc-x86_64-core-image-sato-cortexa9hf-neon-toolchain-2.4.sh 24 | 25 | . /opt/poky/2.4/environment-setup-cortexa9hf-neon-poky-linux-gnueabi 26 | ./bin/qtcreator.sh & 27 | 28 | /opt/poky/2.4/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc 29 | /opt/poky/2.4/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++ 30 | /opt/poky/2.4/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++ 31 | /opt/poky/2.4/sysroots/x86_64-pokysdk-linux/usr/bin/qt5/qmake 32 | 33 | /opt/poky/2.4/sysroots/cortexa9hf-neon-poky-linux-gnueabi 34 | linux-oe-g++ 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /Chapter04/04_07/commands.README: -------------------------------------------------------------------------------- 1 | . /opt/poky/2.4/environment-setup-cortexa9hf-neon-poky-linux-gnueabi 2 | qmake -project 3 | qmake 4 | make 5 | 6 | QT += widgets 7 | 8 | cd /opt/yocto/fsl-community-bsp/ 9 | source setup-environment wandboard 10 | 11 | PACKAGECONFIG_append_pn-qtbase = " fontconfig examples" 12 | IMAGE_INSTALL_append = " qtbase-examples" 13 | 14 | bitbake core-image-sato 15 | 16 | DISPLAY=:0 qt_hello_world 17 | 18 | IMAGE_INSTALL_append = " openssh-sftp-server" 19 | 20 | EXTRA_IMAGE_FEATURES += "qtcreator-debug" 21 | 22 | EXTRA_IMAGE_FEATURES += "qtcreator-debug ssh-serveropenssh " 23 | 24 | -------------------------------------------------------------------------------- /Chapter04/04_07/meta-custom/recipes-sato/images/core-image-sato.bbappend: -------------------------------------------------------------------------------- 1 | inherit populate_sdk_qt5 2 | -------------------------------------------------------------------------------- /Chapter04/04_07/qt_hello_world.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | QApplication app(argc, argv); 7 | 8 | QPushButton hello("Hello world!"); 9 | 10 | hello.show(); 11 | return app.exec(); 12 | } 13 | -------------------------------------------------------------------------------- /Chapter04/04_08/commands.README: -------------------------------------------------------------------------------- 1 | cd /opt/yocto/fsl-community-bsp/ 2 | source setup-environment wandboard 3 | bitbake -c cleanall helloworld 4 | 5 | bitbake -c devshell helloworld 6 | 7 | git init 8 | git add helloworld.c 9 | git commit -s -m "Original revision" 10 | 11 | bitbake -C compile helloworld 12 | 13 | bitbake -e helloworld | grep ^WORKDIR= 14 | 15 | scp ${WORKDIR_PATH}/deploy-rpms/cortexa9hf_neon/helloworld-1.0-r0.cortexa9hf_neon.rpm root@:/ 16 | 17 | dnf install /helloworld-1.0-r0.cortexa9hf_neon.rpm 18 | 19 | bitbake -c devshell helloworld 20 | git add helloworld.c 21 | git commit -s -m "Change greeting message" 22 | 23 | git format-patch -1 -o /opt/yocto/fsl-community-bsp/sources/meta-custom/recipes-example/helloworld/helloworld-1.0 24 | 25 | SRC_URI = "file://helloworld.c \ 26 | file://0001-Change-greeting-message.patch" 27 | 28 | cd /opt/yocto/ 29 | git clone git://github.com/yoctocookbook2ndedition/helloworld 30 | 31 | mkdir -p /opt/yocto/helloworld 32 | cd /opt/yocto/helloworld 33 | git init 34 | 35 | git add helloworld.c 36 | 37 | git commit -s -m "Original revision" 38 | 39 | INHERIT += "externalsrc" 40 | EXTERNALSRC_pn-helloworld = "/opt/yocto/helloworld" 41 | EXTERNALSRC_BUILD_pn-helloworld = "/opt/yocto/helloworld" 42 | 43 | cd /opt/yocto/fsl-community-bsp/ 44 | source setup-environment wandboard 45 | bitbake helloworld 46 | 47 | 48 | -------------------------------------------------------------------------------- /Chapter04/04_08/meta-custom/recipes-example/helloworld/helloworld-1.0/0001-Change-greeting-message.patch: -------------------------------------------------------------------------------- 1 | From fefab08e7f046b5bf52ed0306163b1820463e3af Mon Sep 17 00:00:00 2001 2 | From: Alex Gonzalez 3 | Date: Thu, 12 Oct 2017 23:02:29 +0200 4 | Subject: [PATCH] Change greeting message 5 | 6 | Signed-off-by: Alex Gonzalez 7 | --- 8 | helloworld.c | 2 +- 9 | 1 file changed, 1 insertion(+), 1 deletion(-) 10 | 11 | diff --git a/helloworld.c b/helloworld.c 12 | index 71d94b7dab47..323ed6202980 100644 13 | --- a/helloworld.c 14 | +++ b/helloworld.c 15 | @@ -2,5 +2,5 @@ 16 | 17 | int main(void) 18 | { 19 | - return printf("Hello World"); 20 | + return printf("Howdy World"); 21 | } 22 | -------------------------------------------------------------------------------- /Chapter04/04_08/meta-custom/recipes-example/helloworld/helloworld/helloworld.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) 4 | { 5 | return printf("Hello World"); 6 | } 7 | -------------------------------------------------------------------------------- /Chapter04/04_08/meta-custom/recipes-example/helloworld/helloworld_1.0.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Simple helloworld application" 2 | SECTION = "examples" 3 | LICENSE = "MIT" 4 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" 5 | 6 | SRCREV = "${AUTOREV}" 7 | SRC_URI = "git://github.com/yoctocookbook2ndedition/helloworld.git" 8 | 9 | S = "${WORKDIR}/git" 10 | 11 | do_compile() { 12 | ${CC} ${LDFLAGS} helloworld.c -o helloworld 13 | } 14 | 15 | do_install() { 16 | install -d ${D}${bindir} 17 | install -m 0755 helloworld ${D}${bindir} 18 | } 19 | -------------------------------------------------------------------------------- /Chapter04/04_10/commands.README: -------------------------------------------------------------------------------- 1 | wget http://ftp.gnu.org/gnu/hello/hello-2.10.tar.gz 2 | tar xvf hello-2.10.tar.gz 3 | 4 | source /opt/poky/2.4/environment-setup-cortexa9hf-neon-poky-linuxgnueabi 5 | ./configure ${CONFIGURE_FLAGS} 6 | 7 | echo $CONFIGURE_FLAGS 8 | 9 | make 10 | make install DESTDIR= 11 | 12 | -------------------------------------------------------------------------------- /Chapter04/04_10/meta-custom/recipes-example/example-data/example-data/example.data: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Embedded-Linux-Development-Using-Yocto-Project-Cookbook-Second-Edition/b2cdef039f5ca73bbd0b3e1554828381fdbb5193/Chapter04/04_10/meta-custom/recipes-example/example-data/example-data/example.data -------------------------------------------------------------------------------- /Chapter04/04_10/meta-custom/recipes-example/example-data/example-data_1.0.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Example of data or configuration recipe" 2 | SECTION = "examples" 3 | 4 | LICENSE = "GPLv2" 5 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" 6 | 7 | SRCREV = "${AUTOREV}" 8 | SRC_URI = "git://github.com/yoctocookbook2ndedition/examples.git \ 9 | file://example.data" 10 | 11 | S = "${WORKDIR}/git" 12 | 13 | inherit allarch 14 | 15 | do_compile[noexec] = "1" 16 | 17 | do_install() { 18 | install -d ${D}${sysconfdir} 19 | install -d ${D}${sbindir} 20 | install -m 0755 ${WORKDIR}/example.data ${D}/${sysconfdir}/ 21 | install -m 0755 ${S}/python-scripts/* ${D}/${sbindir} 22 | } 23 | -------------------------------------------------------------------------------- /Chapter04/04_10/meta-custom/recipes-example/example-user/example-user_1.0.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Example of user add" 2 | SECTION = "examples" 3 | 4 | LICENSE = "GPLv2" 5 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" 6 | 7 | inherit useradd 8 | 9 | PASSWORD ?= "miDBHFo2hJSAA" 10 | USERADD_PACKAGES = "${PN}" 11 | USERADD_PARAM_${PN} = "--system --create-home \ 12 | --groups tty \ 13 | --password ${PASSWORD} \ 14 | --user-group newuser" 15 | 16 | ALLOW_EMPTY_${PN} = "1" 17 | -------------------------------------------------------------------------------- /Chapter04/04_10/meta-custom/recipes-example/hello/hello_2.10.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "GNU helloworld autotools recipe" 2 | SECTION = "examples" 3 | 4 | LICENSE = "GPLv3" 5 | LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-3.0;md5=c79ff39f19dfec6d293b95dea7b07891" 6 | 7 | SRC_URI = "${GNU_MIRROR}/hello/hello-${PV}.tar.gz" 8 | SRC_URI[md5sum] = "6cd0ffea3884a4e79330338dcc2987d6" 9 | SRC_URI[sha256sum] = "31e066137a962676e89f69d1b65382de95a7ef7d914b8cb956f41ea72e0f516b" 10 | 11 | inherit autotools gettext 12 | -------------------------------------------------------------------------------- /Chapter04/04_10/meta-custom/recipes-example/helloworld/helloworld-1.0/0001-Change-greeting-message.patch: -------------------------------------------------------------------------------- 1 | From fefab08e7f046b5bf52ed0306163b1820463e3af Mon Sep 17 00:00:00 2001 2 | From: Alex Gonzalez 3 | Date: Thu, 12 Oct 2017 23:02:29 +0200 4 | Subject: [PATCH] Change greeting message 5 | 6 | Signed-off-by: Alex Gonzalez 7 | --- 8 | helloworld.c | 2 +- 9 | 1 file changed, 1 insertion(+), 1 deletion(-) 10 | 11 | diff --git a/helloworld.c b/helloworld.c 12 | index 71d94b7dab47..323ed6202980 100644 13 | --- a/helloworld.c 14 | +++ b/helloworld.c 15 | @@ -2,5 +2,5 @@ 16 | 17 | int main(void) 18 | { 19 | - return printf("Hello World"); 20 | + return printf("Howdy World"); 21 | } 22 | -------------------------------------------------------------------------------- /Chapter04/04_10/meta-custom/recipes-example/helloworld/helloworld/helloworld.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) 4 | { 5 | return printf("Hello World"); 6 | } 7 | -------------------------------------------------------------------------------- /Chapter04/04_10/meta-custom/recipes-example/helloworld/helloworld_1.0.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Simple helloworld application" 2 | SECTION = "examples" 3 | LICENSE = "MIT" 4 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" 5 | 6 | SRCREV = "${AUTOREV}" 7 | SRC_URI = "git://github.com/yoctocookbook2ndedition/helloworld.git" 8 | 9 | S = "${WORKDIR}/git" 10 | 11 | do_compile() { 12 | ${CC} ${LDFLAGS} helloworld.c -o helloworld 13 | } 14 | 15 | do_install() { 16 | install -d ${D}${bindir} 17 | install -m 0755 helloworld ${D}${bindir} 18 | } 19 | -------------------------------------------------------------------------------- /Chapter04/04_10/meta-custom/recipes-example/systemd-example/systemd-example-1.0/simple-service.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #define DAEMON_NAME "simpledaemon" 5 | 6 | int main() 7 | { 8 | setlogmask(LOG_UPTO(LOG_INFO)); 9 | openlog(DAEMON_NAME, LOG_CONS | LOG_PERROR, LOG_USER); 10 | 11 | daemon(0,0); 12 | 13 | while (1) 14 | { 15 | syslog(LOG_INFO, "daemon running"); 16 | sleep(10); 17 | } 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /Chapter04/04_10/meta-custom/recipes-example/systemd-example/systemd-example-1.0/systemd-example.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Example service 3 | 4 | [Service] 5 | Type=forking 6 | ExecStart=@BINDIR@/simple-service 7 | 8 | [Install] 9 | WantedBy=multi-user.target 10 | -------------------------------------------------------------------------------- /Chapter04/04_10/meta-custom/recipes-example/systemd-example/systemd-example_1.0.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Example systemd service" 2 | 3 | LICENSE = "MIT" 4 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" 5 | 6 | SRC_URI = "\ 7 | file://systemd-example.service \ 8 | file://simple-service.c \ 9 | " 10 | 11 | inherit systemd 12 | 13 | S = "${WORKDIR}" 14 | 15 | SYSTEMD_SERVICE_${PN} = "systemd-example.service" 16 | 17 | do_compile () { 18 | ${CC} ${LDFLAGS} simple-service.c -o simple-service 19 | } 20 | 21 | do_install () { 22 | install -d ${D}${bindir} 23 | install -m 0755 ${WORKDIR}/simple-service ${D}${bindir} 24 | install -d ${D}${systemd_unitdir}/system 25 | install -m 0644 ${WORKDIR}/systemd-example.service ${D}${systemd_unitdir}/system 26 | sed -i -e 's,@BINDIR@,${bindir},g' ${D}${systemd_unitdir}/system/systemd-example.service 27 | } 28 | -------------------------------------------------------------------------------- /Chapter04/04_10/meta-custom/recipes-example/sysvinit-mount/sysvinit-mount-1.0/mount.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Empty example init script 4 | -------------------------------------------------------------------------------- /Chapter04/04_10/meta-custom/recipes-example/sysvinit-mount/sysvinit-mount_1.0.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Initscripts for mounting filesystems" 2 | 3 | LICENSE = "MIT" 4 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" 5 | 6 | SRC_URI = "file://mount.sh" 7 | 8 | INITSCRIPT_NAME = "mount.sh" 9 | INITSCRIPT_PARAMS = "start 09 S ." 10 | 11 | inherit update-rc.d 12 | 13 | S = "${WORKDIR}" 14 | 15 | do_install () { 16 | install -d ${D}${sysconfdir}/init.d/ 17 | install -c -m 755 ${WORKDIR}/${INITSCRIPT_NAME} ${D}${sysconfdir}/init.d/${INITSCRIPT_NAME} 18 | } 19 | -------------------------------------------------------------------------------- /Chapter04/04_11/meta-custom/recipes-example/helloworld-cmake/helloworld-cmake-1.0/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.10) 2 | project(helloworld) 3 | add_executable(helloworld helloworld.c) 4 | install(TARGETS helloworld RUNTIME DESTINATION bin) 5 | -------------------------------------------------------------------------------- /Chapter04/04_11/meta-custom/recipes-example/helloworld-cmake/helloworld-cmake-1.0/helloworld.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) 4 | { 5 | return printf("Hello World"); 6 | } 7 | 8 | -------------------------------------------------------------------------------- /Chapter04/04_11/meta-custom/recipes-example/helloworld-cmake/helloworld-cmake_1.0.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Simple helloworld cmake application" 2 | SECTION = "examples" 3 | LICENSE = "MIT" 4 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" 5 | 6 | SRC_URI = "file://CMakeLists.txt \ 7 | file://helloworld.c" 8 | S = "${WORKDIR}" 9 | 10 | inherit cmake 11 | 12 | EXTRA_OECMAKE = "" 13 | -------------------------------------------------------------------------------- /Chapter04/04_12/meta-custom/recipes-example/helloworld-scons/helloworld-scons-1.0/SConstruct: -------------------------------------------------------------------------------- 1 | import os 2 | env = Environment(CC = os.environ['CC'], LINKFLAGS = os.environ['LDFLAGS'], ENV = {'PATH': os.environ['PATH']}) 3 | env.Program("helloworld", "helloworld.c") 4 | -------------------------------------------------------------------------------- /Chapter04/04_12/meta-custom/recipes-example/helloworld-scons/helloworld-scons-1.0/helloworld.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) 4 | { 5 | return printf("Hello World"); 6 | } 7 | -------------------------------------------------------------------------------- /Chapter04/04_12/meta-custom/recipes-example/helloworld-scons/helloworld-scons_1.0.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Simple helloworld scons application" 2 | SECTION = "examples" 3 | LICENSE = "MIT" 4 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" 5 | 6 | SRC_URI = "file://SConstruct \ 7 | file://helloworld.c" 8 | 9 | S = "${WORKDIR}" 10 | 11 | inherit scons 12 | 13 | EXTRA_OESCONS = "" 14 | 15 | do_install() { 16 | install -d ${D}/${bindir} 17 | install -m 0755 helloworld ${D}${bindir} 18 | } 19 | -------------------------------------------------------------------------------- /Chapter04/04_13/commands.README: -------------------------------------------------------------------------------- 1 | source /opt/poky/2.4/environment-setup-cortexa9hf-neon-poky-linux-gnueabi 2 | 3 | ${CC} -c hello.c world.c 4 | ${AR} -cvq libhelloworld.a hello.o world.o 5 | 6 | ${AR} -t libhelloworld.a 7 | ${CC} -o helloworld helloworld.c -l helloworld -L libs/ -I inc/ 8 | 9 | readelf -d helloworld 10 | 11 | ${CC} -fPIC -g -c hello.c world.c 12 | ${CC} -shared -Wl,-soname,libhelloworld.so.1 -o libhelloworld.so hello.o world.o 13 | 14 | ${CC} -o helloworld helloworld.c -l helloworld -L libs/ -I inc/ 15 | 16 | readelf -d helloworld 17 | 18 | -------------------------------------------------------------------------------- /Chapter04/04_13/meta-custom/recipes-example/helloworld-dyn/helloworld-dyn-1.0/helloworld.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "helloworld.h" 3 | 4 | int main (void) 5 | { 6 | return printf("%s %s\n",hello(),world()); 7 | } 8 | -------------------------------------------------------------------------------- /Chapter04/04_13/meta-custom/recipes-example/helloworld-dyn/helloworld-dyn_1.0.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Simple helloworld example" 2 | SECTION = "examples" 3 | LICENSE = "MIT" 4 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" 5 | 6 | DEPENDS = "libhelloworld-dyn" 7 | 8 | SRC_URI = "file://helloworld.c" 9 | 10 | S = "${WORKDIR}" 11 | 12 | do_compile() { 13 | ${CC} ${LDFLAGS} -o helloworld helloworld.c -lhelloworld 14 | } 15 | 16 | do_install() { 17 | install -d ${D}${bindir} 18 | install -m 0755 helloworld ${D}${bindir} 19 | } 20 | -------------------------------------------------------------------------------- /Chapter04/04_13/meta-custom/recipes-example/helloworld-static/helloworld-static-1.0/helloworld.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "helloworld.h" 3 | 4 | int main (void) 5 | { 6 | return printf("%s %s\n",hello(),world()); 7 | } 8 | -------------------------------------------------------------------------------- /Chapter04/04_13/meta-custom/recipes-example/helloworld-static/helloworld-static_1.0.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Simple helloworld example" 2 | SECTION = "examples" 3 | LICENSE = "MIT" 4 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" 5 | 6 | DEPENDS = "libhelloworld-static" 7 | 8 | SRC_URI = "file://helloworld.c" 9 | 10 | S = "${WORKDIR}" 11 | 12 | do_compile() { 13 | ${CC} ${LDFLAGS} -o helloworld helloworld.c -l helloworld 14 | } 15 | 16 | do_install() { 17 | install -d ${D}${bindir} 18 | install -m 0755 helloworld ${D}${bindir} 19 | } 20 | -------------------------------------------------------------------------------- /Chapter04/04_13/meta-custom/recipes-example/libhelloworld-dyn/libhelloworld-dyn-1.0/hello.c: -------------------------------------------------------------------------------- 1 | char * hello (void) 2 | { 3 | return "Hello"; 4 | } 5 | -------------------------------------------------------------------------------- /Chapter04/04_13/meta-custom/recipes-example/libhelloworld-dyn/libhelloworld-dyn-1.0/helloworld.h: -------------------------------------------------------------------------------- 1 | #ifndef HELLOWORLD_H 2 | #define HELLOWORLD_H 3 | char * hello (void); 4 | char * world (void); 5 | #endif 6 | -------------------------------------------------------------------------------- /Chapter04/04_13/meta-custom/recipes-example/libhelloworld-dyn/libhelloworld-dyn-1.0/helloworld.pc: -------------------------------------------------------------------------------- 1 | prefix=/usr/local 2 | exec_prefix=${prefix} 3 | includedir=${prefix}/include 4 | libdir=${exec_prefix}/lib 5 | 6 | Name: helloworld 7 | Description: The helloworld library 8 | Version: 1.0.0 9 | Cflags: -I${includedir}/helloworld 10 | Libs: -L${libdir} -lhelloworld 11 | -------------------------------------------------------------------------------- /Chapter04/04_13/meta-custom/recipes-example/libhelloworld-dyn/libhelloworld-dyn-1.0/world.c: -------------------------------------------------------------------------------- 1 | char * world (void) 2 | { 3 | return "World"; 4 | } 5 | -------------------------------------------------------------------------------- /Chapter04/04_13/meta-custom/recipes-example/libhelloworld-dyn/libhelloworld-dyn_1.0.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Simple helloworld example dynamic library" 2 | SECTION = "libs" 3 | LICENSE = "MIT" 4 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" 5 | 6 | SRC_URI = "file://hello.c \ 7 | file://world.c \ 8 | file://helloworld.h \ 9 | file://helloworld.pc" 10 | 11 | S = "${WORKDIR}" 12 | 13 | do_compile() { 14 | ${CC} ${LDFLAGS} -fPIC -g -c hello.c world.c 15 | ${CC} ${LDFLAGS} -shared -Wl,-soname,libhelloworld.so.1 -o libhelloworld.so.1.0 hello.o world.o 16 | } 17 | 18 | do_install() { 19 | install -d ${D}${includedir} 20 | install -d ${D}${libdir} 21 | install -m 0755 helloworld.h ${D}${includedir} 22 | install -m 0755 libhelloworld.so.1.0 ${D}${libdir} 23 | ln -s libhelloworld.so.1.0 ${D}/${libdir}/libhelloworld.so.1 24 | ln -s libhelloworld.so.1 ${D}/${libdir}/libhelloworld.so 25 | } 26 | -------------------------------------------------------------------------------- /Chapter04/04_13/meta-custom/recipes-example/libhelloworld-static/libhelloworld-static-1.0/hello.c: -------------------------------------------------------------------------------- 1 | char * hello (void) 2 | { 3 | return "Hello"; 4 | } 5 | -------------------------------------------------------------------------------- /Chapter04/04_13/meta-custom/recipes-example/libhelloworld-static/libhelloworld-static-1.0/helloworld.h: -------------------------------------------------------------------------------- 1 | #ifndef HELLOWORLD_H 2 | #define HELLOWORLD_H 3 | char * hello (void); 4 | char * world (void); 5 | #endif 6 | -------------------------------------------------------------------------------- /Chapter04/04_13/meta-custom/recipes-example/libhelloworld-static/libhelloworld-static-1.0/helloworld.pc: -------------------------------------------------------------------------------- 1 | prefix=/usr/local 2 | exec_prefix=${prefix} 3 | includedir=${prefix}/include 4 | libdir=${exec_prefix}/lib 5 | 6 | Name: helloworld 7 | Description: The helloworld library 8 | Version: 1.0.0 9 | Cflags: -I${includedir}/helloworld 10 | Libs: -L${libdir} libhelloworld.a 11 | -------------------------------------------------------------------------------- /Chapter04/04_13/meta-custom/recipes-example/libhelloworld-static/libhelloworld-static-1.0/world.c: -------------------------------------------------------------------------------- 1 | char * world (void) 2 | { 3 | return "World"; 4 | } 5 | -------------------------------------------------------------------------------- /Chapter04/04_13/meta-custom/recipes-example/libhelloworld-static/libhelloworld-static_1.0.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Simple helloworld example static library" 2 | SECTION = "libs" 3 | LICENSE = "MIT" 4 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" 5 | 6 | SRC_URI = "file://hello.c \ 7 | file://world.c \ 8 | file://helloworld.h \ 9 | file://helloworld.pc" 10 | 11 | S = "${WORKDIR}" 12 | 13 | do_compile() { 14 | ${CC} -c hello.c world.c 15 | ${AR} -cvq libhelloworld.a hello.o world.o 16 | } 17 | 18 | do_install() { 19 | install -d ${D}${includedir} 20 | install -d ${D}${libdir} 21 | install -m 0755 helloworld.h ${D}${includedir} 22 | install -m 0755 libhelloworld.a ${D}${libdir} 23 | } 24 | -------------------------------------------------------------------------------- /Chapter04/04_14/commands.README: -------------------------------------------------------------------------------- 1 | DISTRO_FEATURES_remove = "x11 directfb wayland vulkan" 2 | 3 | cd /opt/yocto/fsl-community-bsp/ 4 | source setup-environment wandboard 5 | bitbake fsl-image-multimedia 6 | 7 | cd /home/root 8 | wget http://mirror.cessen.com/blender.org/peach/trailer/trailer_1080p.mov 9 | gst-launch-1.0 playbin uri=file:///home/root/trailer_1080p.mov 10 | 11 | gst-inspect-1.0 | grep imx 12 | 13 | export FRAMEBUFFER=/dev/fb1 14 | 15 | cat /dev/zero > /dev/fb0 16 | cat /dev/fb0 > fb.raw 17 | cat fb.raw > /dev/fb0 18 | 19 | fbset -fb /dev/fb0 20 | 21 | UBOOT_EXTLINUX_KERNEL_ARGS = "video=mxcfb0:dev=hdmi,1920x1080M@60" 22 | 23 | echo 0 > /sys/class/graphics/fb0/blank 24 | 25 | IMAGE_INSTALL_append = " qt-helloworld" 26 | 27 | bitbake fsl-image-multimedia 28 | 29 | export QT_QPA_PLATFORM="eglfs" 30 | /usr/bin/qt_hello_world 31 | 32 | PACKAGECONFIG_append_pn-qtbase = " accessibility examples fontconfig sql-sqlite icu" 33 | PACKAGECONFIG_append_pn-qtmultimedia = " gstreamer" 34 | 35 | -------------------------------------------------------------------------------- /Chapter04/04_14/conf/bblayers.conf: -------------------------------------------------------------------------------- 1 | LCONF_VERSION = "7" 2 | 3 | BBPATH = "${TOPDIR}" 4 | BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../..')}" 5 | 6 | BBFILES ?= "" 7 | BBLAYERS = " \ 8 | ${BSPDIR}/sources/poky/meta \ 9 | ${BSPDIR}/sources/poky/meta-poky \ 10 | ${BSPDIR}/sources/meta-openembedded/meta-oe \ 11 | ${BSPDIR}/sources/meta-openembedded/meta-multimedia \ 12 | ${BSPDIR}/sources/meta-openembedded/meta-networking \ 13 | ${BSPDIR}/sources/meta-openembedded/meta-python \ 14 | ${BSPDIR}/sources/meta-openembedded/meta-filesystems \ 15 | ${BSPDIR}/sources/meta-freescale \ 16 | ${BSPDIR}/sources/meta-freescale-3rdparty \ 17 | ${BSPDIR}/sources/meta-freescale-distro \ 18 | ${BSPDIR}/sources/meta-custom \ 19 | ${BSPDIR}/sources/meta-bsp-custom \ 20 | ${BSPDIR}/sources/meta-qt5 \ 21 | ${BSPDIR}/sources/meta-java \ 22 | ${BSPDIR}/sources/meta-nodejs \ 23 | " 24 | -------------------------------------------------------------------------------- /Chapter04/04_14/conf/local.conf: -------------------------------------------------------------------------------- 1 | MACHINE ??= 'wandboard' 2 | DISTRO ?= 'fslc-framebuffer' 3 | PACKAGE_CLASSES ?= "package_rpm" 4 | EXTRA_IMAGE_FEATURES ?= "debug-tweaks" 5 | USER_CLASSES ?= "buildstats image-mklibs image-prelink" 6 | PATCHRESOLVE = "noop" 7 | BB_DISKMON_DIRS = "\ 8 | STOPTASKS,${TMPDIR},1G,100K \ 9 | STOPTASKS,${DL_DIR},1G,100K \ 10 | STOPTASKS,${SSTATE_DIR},1G,100K \ 11 | STOPTASKS,/tmp,100M,100K \ 12 | ABORT,${TMPDIR},100M,1K \ 13 | ABORT,${DL_DIR},100M,1K \ 14 | ABORT,${SSTATE_DIR},100M,1K \ 15 | ABORT,/tmp,10M,1K" 16 | PACKAGECONFIG_append_pn-qemu-native = " sdl" 17 | PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl" 18 | CONF_VERSION = "1" 19 | 20 | DL_DIR ?= "${BSPDIR}/downloads/" 21 | ACCEPT_FSL_EULA = "1" 22 | 23 | INHERIT += "rm_work" 24 | 25 | IMAGE_INSTALL_append = " qt-helloworld" 26 | PACKAGECONFIG_append_pn-qtbase = " accessibility examples fontconfig sql-sqlite icu" 27 | -------------------------------------------------------------------------------- /Chapter04/04_14/meta-custom/recipes-qt/packagegroups/packagegroup-qt5-examples.bb: -------------------------------------------------------------------------------- 1 | SUMMARY = "QT5 examples packagegroup" 2 | 3 | inherit packagegroup 4 | 5 | RDEPENDS_${PN} = " \ 6 | liberation-fonts \ 7 | icu \ 8 | qtbase-examples \ 9 | qt3d-examples \ 10 | qtconnectivity-examples \ 11 | qtdeclarative-examples \ 12 | qtdeclarative-tools \ 13 | qtmultimedia-examples \ 14 | qtsvg-examples \ 15 | cinematicexperience \ 16 | qt5-demo-extrafiles \ 17 | qt5everywheredemo \ 18 | qtsmarthome \ 19 | " 20 | -------------------------------------------------------------------------------- /Chapter04/04_14/meta-custom/recipes-qt/qt-helloworld/qt-helloworld-1.0/qt_hello_world.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | QApplication app(argc, argv); 7 | 8 | QPushButton hello("Hello world!"); 9 | 10 | hello.show(); 11 | return app.exec(); 12 | } 13 | -------------------------------------------------------------------------------- /Chapter04/04_14/meta-custom/recipes-qt/qt-helloworld/qt-helloworld-1.0/qt_hello_world.pro: -------------------------------------------------------------------------------- 1 | SOURCES += \ 2 | qt_hello_world.cpp 3 | 4 | QT += widgets 5 | -------------------------------------------------------------------------------- /Chapter04/04_14/meta-custom/recipes-qt/qt-helloworld/qt-helloworld_1.0.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Simple QT helloworld example" 2 | SECTION = "examples" 3 | LICENSE = "MIT" 4 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" 5 | 6 | SRC_URI = "file://qt_hello_world.cpp \ 7 | file://qt_hello_world.pro" 8 | 9 | DEPENDS += "qtbase fontconfig" 10 | 11 | S = "${WORKDIR}" 12 | 13 | inherit qmake5 14 | 15 | do_install() { 16 | install -d ${D}${bindir} 17 | install -m 0755 qt_hello_world ${D}${bindir} 18 | } 19 | -------------------------------------------------------------------------------- /Chapter04/04_15/commands.README: -------------------------------------------------------------------------------- 1 | DISTRO_FEATURES_remove = "wayland" 2 | 3 | IMAGE_INSTALL_append = " gtk-helloworld" 4 | 5 | cd /opt/yocto/fsl-community-bsp/ 6 | source setup-environment wandboard 7 | bitbake core-image-sato 8 | 9 | export DISPLAY=:0 10 | /usr/bin/helloworld 11 | 12 | IMAGE_INSTALL_append = " qt-helloworld" 13 | 14 | bitbake core-image-sato 15 | 16 | export DISPLAY=:0 17 | /usr/bin/qt_hello_world 18 | 19 | -------------------------------------------------------------------------------- /Chapter04/04_15/meta-custom/recipes-graphics/gtk-helloworld/gtk-helloworld-1.0/gtk_hello_world.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int argc, char *argv[]) 4 | { 5 | GtkWidget *window; 6 | gtk_init (&argc, &argv); 7 | window = gtk_window_new (GTK_WINDOW_TOPLEVEL); 8 | gtk_widget_show (window); 9 | gtk_main (); 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /Chapter04/04_15/meta-custom/recipes-graphics/gtk-helloworld/gtk-helloworld_1.0.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Simple GTK helloworld application" 2 | SECTION = "examples" 3 | LICENSE = "MIT" 4 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" 5 | 6 | SRC_URI = "file://gtk_hello_world.c" 7 | 8 | S = "${WORKDIR}" 9 | 10 | DEPENDS = "gtk+3" 11 | 12 | inherit pkgconfig 13 | 14 | do_compile() { 15 | ${CC} ${LDFLAGS} gtk_hello_world.c -o helloworld `pkg-config --cflags --libs gtk+-3.0` 16 | } 17 | 18 | do_install() { 19 | install -d ${D}${bindir} 20 | install -m 0755 helloworld ${D}${bindir} 21 | } 22 | -------------------------------------------------------------------------------- /Chapter04/04_16/commands.README: -------------------------------------------------------------------------------- 1 | DISTRO_FEATURES_remove = "x11 directfb" 2 | 3 | IMAGE_INSTALL_append = " qtwayland qt-helloworld" 4 | 5 | cd /opt/yocto/fsl-community-bsp/ 6 | source setup-environment wandboard 7 | bitbake core-image-weston 8 | 9 | qt_hello_world -platform wayland 10 | 11 | DISTRO = "fslc-xwayland" 12 | 13 | qt_hello_world 14 | 15 | IMAGE_INSTALL_append = " gtk-helloworld" 16 | 17 | export XDG_RUNTIME_DIR=/var/run/user/root 18 | helloworld 19 | 20 | -------------------------------------------------------------------------------- /Chapter04/04_17/commands.README: -------------------------------------------------------------------------------- 1 | IMAGE_INSTALL_append = " epiphany" 2 | 3 | cd /opt/yocto/fsl-community-bsp/sources 4 | git clone https://github.com/OSSystems/meta-browser.git 5 | cd /opt/yocto/fsl-community-bsp/ 6 | source setup-environment wandboard 7 | bitbake-layers add-layer /opt/yocto/fsl-community-bsp/sources/meta-browser 8 | 9 | IMAGE_INSTALL_append = " firefox" 10 | 11 | bitbake-layers add-layer /opt/yocto/fsl-community-bsp/sources/meta-openembedded/meta-python 12 | bitbake-layers add-layer /opt/yocto/fsl-community-bsp/sources/meta-openembedded/meta-networking 13 | bitbake-layers add-layer /opt/yocto/fsl-community-bsp/sources/meta-openembedded/meta-gnome 14 | 15 | IMAGE_INSTALL_append = " chromium" 16 | 17 | BBMASK .= "dynamic-layers/browser-layer/recipes-browser" 18 | 19 | -------------------------------------------------------------------------------- /Chapter04/04_18/commands.README: -------------------------------------------------------------------------------- 1 | mkdir -p meta-custom/recipes-python/python-helloworld/python-helloworld-1.0/helloworld/ 2 | touch meta-custom/recipes-python/python-helloworld/python-helloworld-1.0/helloworld/__init__.py 3 | 4 | IMAGE_INSTALL_append = " python-helloworld" 5 | 6 | cd /opt/yocto/fsl-community-bsp/ 7 | source setup-environment wandboard 8 | bitbake core-image-minimal 9 | 10 | /usr/bin/python-helloworld.py 11 | 12 | IMAGE_INSTALL_append = " python3-pip" 13 | 14 | cd /opt/yocto/fsl-community-bsp/ 15 | source setup-environment wandboard 16 | bitbake core-image-minimal 17 | 18 | pip search 19 | pip install 20 | 21 | -------------------------------------------------------------------------------- /Chapter04/04_18/conf/bblayers.conf: -------------------------------------------------------------------------------- 1 | LCONF_VERSION = "7" 2 | 3 | BBPATH = "${TOPDIR}" 4 | BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../..')}" 5 | 6 | BBFILES ?= "" 7 | BBLAYERS = " \ 8 | ${BSPDIR}/sources/poky/meta \ 9 | ${BSPDIR}/sources/poky/meta-poky \ 10 | ${BSPDIR}/sources/meta-openembedded/meta-oe \ 11 | ${BSPDIR}/sources/meta-openembedded/meta-multimedia \ 12 | ${BSPDIR}/sources/meta-freescale \ 13 | ${BSPDIR}/sources/meta-freescale-3rdparty \ 14 | ${BSPDIR}/sources/meta-freescale-distro \ 15 | ${BSPDIR}/sources/meta-qt5 \ 16 | ${BSPDIR}/sources/meta-custom \ 17 | ${BSPDIR}/sources/meta-intel-iot-security/meta-security-smack \ 18 | ${BSPDIR}/sources/meta-openembedded/meta-python \ 19 | " 20 | -------------------------------------------------------------------------------- /Chapter04/04_18/conf/local.conf: -------------------------------------------------------------------------------- 1 | MACHINE ??= 'wandboard' 2 | DISTRO ?= 'poky' 3 | PACKAGE_CLASSES ?= "package_rpm" 4 | EXTRA_IMAGE_FEATURES ?= "debug-tweaks" 5 | USER_CLASSES ?= "buildstats image-mklibs image-prelink" 6 | PATCHRESOLVE = "noop" 7 | BB_DISKMON_DIRS = "\ 8 | STOPTASKS,${TMPDIR},1G,100K \ 9 | STOPTASKS,${DL_DIR},1G,100K \ 10 | STOPTASKS,${SSTATE_DIR},1G,100K \ 11 | STOPTASKS,/tmp,100M,100K \ 12 | ABORT,${TMPDIR},100M,1K \ 13 | ABORT,${DL_DIR},100M,1K \ 14 | ABORT,${SSTATE_DIR},100M,1K \ 15 | ABORT,/tmp,10M,1K" 16 | PACKAGECONFIG_append_pn-qemu-native = " sdl" 17 | PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl" 18 | CONF_VERSION = "1" 19 | 20 | DL_DIR ?= "${BSPDIR}/downloads/" 21 | ACCEPT_FSL_EULA = "1" 22 | 23 | INHERIT += "rm_work" 24 | RM_WORK_EXCLUDE += "core-image-minimal custom-image image-small" 25 | INHIBIT_PACKAGE_DEBUG_SPLIT = "1" 26 | 27 | IMAGE_INSTALL_append = " python-helloworld" 28 | IMAGE_INSTALL_append = " python-pip python3-pip" 29 | 30 | 31 | -------------------------------------------------------------------------------- /Chapter04/04_18/meta-custom/recipes-python/python-helloworld/python-helloworld-1.0/helloworld/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Embedded-Linux-Development-Using-Yocto-Project-Cookbook-Second-Edition/b2cdef039f5ca73bbd0b3e1554828381fdbb5193/Chapter04/04_18/meta-custom/recipes-python/python-helloworld/python-helloworld-1.0/helloworld/__init__.py -------------------------------------------------------------------------------- /Chapter04/04_18/meta-custom/recipes-python/python-helloworld/python-helloworld-1.0/helloworld/main.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | def main(argv=None): 4 | if argv is None: 5 | argv = sys.argv 6 | print "Hello world!" 7 | return 0 8 | -------------------------------------------------------------------------------- /Chapter04/04_18/meta-custom/recipes-python/python-helloworld/python-helloworld-1.0/python-helloworld.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import sys 3 | import helloworld.main 4 | 5 | if __name__ == '__main__': 6 | sys.exit(helloworld.main.main()) 7 | -------------------------------------------------------------------------------- /Chapter04/04_18/meta-custom/recipes-python/python-helloworld/python-helloworld-1.0/setup.py: -------------------------------------------------------------------------------- 1 | import sys 2 | from setuptools import setup 3 | 4 | setup( 5 | name = "helloworld", 6 | version = "0.1", 7 | packages=["helloworld"], 8 | author="Alex Gonzalez", 9 | author_email = "alex@example.com", 10 | description = "Hello World packaging example", 11 | license = "MIT", 12 | keywords= "example", 13 | url = "", 14 | ) 15 | -------------------------------------------------------------------------------- /Chapter04/04_18/meta-custom/recipes-python/python-helloworld/python-helloworld_1.0.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Simple Python setuptools hello world application" 2 | SECTION = "examples" 3 | LICENSE = "MIT" 4 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" 5 | 6 | SRC_URI = "file://setup.py \ 7 | file://python-helloworld.py \ 8 | file://helloworld/__init__.py \ 9 | file://helloworld/main.py" 10 | 11 | S = "${WORKDIR}" 12 | 13 | inherit setuptools 14 | 15 | do_install_append () { 16 | install -d ${D}${bindir} 17 | install -m 0755 python-helloworld.py ${D}${bindir} 18 | } 19 | -------------------------------------------------------------------------------- /Chapter04/04_19/HelloWorld.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Embedded-Linux-Development-Using-Yocto-Project-Cookbook-Second-Edition/b2cdef039f5ca73bbd0b3e1554828381fdbb5193/Chapter04/04_19/HelloWorld.class -------------------------------------------------------------------------------- /Chapter04/04_19/HelloWorld.java: -------------------------------------------------------------------------------- 1 | class HelloWorld { 2 | public static void main(String[] args) { 3 | System.out.println("Hello World!"); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Chapter04/04_19/commands.README: -------------------------------------------------------------------------------- 1 | cd /opt/yocto/fsl-community-bsp/sources/ 2 | git clone git://git.yoctoproject.org/meta-java 3 | 4 | bitbake-layers add-layer /opt/yocto/fsl-community-bsp/sources/meta-java 5 | 6 | PREFERRED_PROVIDER_virtual/java-initial-native = "cacao-initial-native" 7 | PREFERRED_PROVIDER_virtual/java-native = "jamvm-native" 8 | PREFERRED_PROVIDER_virtual/javac-native = "ecj-bootstrap-native" 9 | 10 | IMAGE_INSTALL_append = " openjre-8" 11 | 12 | cd /opt/yocto/fsl-community-bsp/ 13 | source setup-environment wandboard 14 | bitbake core-image-minimal 15 | 16 | java -version 17 | 18 | sudo apt-get install openjdk-8-jdk 19 | javac HelloWorld.java 20 | java HelloWorld 21 | 22 | -------------------------------------------------------------------------------- /Chapter04/04_19/conf/bblayers.conf: -------------------------------------------------------------------------------- 1 | LCONF_VERSION = "7" 2 | 3 | BBPATH = "${TOPDIR}" 4 | BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../..')}" 5 | 6 | BBFILES ?= "" 7 | BBLAYERS = " \ 8 | ${BSPDIR}/sources/poky/meta \ 9 | ${BSPDIR}/sources/poky/meta-poky \ 10 | ${BSPDIR}/sources/meta-openembedded/meta-oe \ 11 | ${BSPDIR}/sources/meta-openembedded/meta-multimedia \ 12 | ${BSPDIR}/sources/meta-freescale \ 13 | ${BSPDIR}/sources/meta-freescale-3rdparty \ 14 | ${BSPDIR}/sources/meta-freescale-distro \ 15 | ${BSPDIR}/sources/meta-qt5 \ 16 | ${BSPDIR}/sources/meta-custom \ 17 | ${BSPDIR}/sources/meta-intel-iot-security/meta-security-smack \ 18 | ${BSPDIR}/sources/meta-openembedded/meta-python \ 19 | ${BSPDIR}/sources/meta-java \ 20 | " 21 | -------------------------------------------------------------------------------- /Chapter04/04_19/conf/local.conf: -------------------------------------------------------------------------------- 1 | MACHINE ??= 'wandboard' 2 | DISTRO ?= 'poky' 3 | PACKAGE_CLASSES ?= "package_rpm" 4 | EXTRA_IMAGE_FEATURES ?= "debug-tweaks" 5 | USER_CLASSES ?= "buildstats image-mklibs image-prelink" 6 | PATCHRESOLVE = "noop" 7 | BB_DISKMON_DIRS = "\ 8 | STOPTASKS,${TMPDIR},1G,100K \ 9 | STOPTASKS,${DL_DIR},1G,100K \ 10 | STOPTASKS,${SSTATE_DIR},1G,100K \ 11 | STOPTASKS,/tmp,100M,100K \ 12 | ABORT,${TMPDIR},100M,1K \ 13 | ABORT,${DL_DIR},100M,1K \ 14 | ABORT,${SSTATE_DIR},100M,1K \ 15 | ABORT,/tmp,10M,1K" 16 | PACKAGECONFIG_append_pn-qemu-native = " sdl" 17 | PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl" 18 | CONF_VERSION = "1" 19 | 20 | DL_DIR ?= "${BSPDIR}/downloads/" 21 | ACCEPT_FSL_EULA = "1" 22 | 23 | INHERIT += "rm_work" 24 | RM_WORK_EXCLUDE += "core-image-minimal custom-image image-small" 25 | INHIBIT_PACKAGE_DEBUG_SPLIT = "1" 26 | 27 | IMAGE_INSTALL_append = " python-helloworld" 28 | IMAGE_INSTALL_append = " python-pip python3-pip" 29 | 30 | PREFERRED_PROVIDER_virtual/java-initial-native = "cacao-initial-native" 31 | PREFERRED_PROVIDER_virtual/java-native = "jamvm-native" 32 | PREFERRED_PROVIDER_virtual/javac-native = "ecj-bootstrap-native" 33 | 34 | IMAGE_INSTALL_append = " openjre-8" 35 | DISTRO_FEATURES_remove = "wayland" 36 | -------------------------------------------------------------------------------- /Chapter04/04_20/commands.README: -------------------------------------------------------------------------------- 1 | IMAGE_INSTALL_append = " libjava-helloworld-java" 2 | 3 | PREFERRED_PROVIDER_java2-runtime = "openjre-8" 4 | 5 | IMAGE_INSTALL_append = " openjre-8" 6 | 7 | cd /opt/yocto/fsl-community-bsp/ 8 | source setup-environment wandboard-quad 9 | bitbake core-image-sato 10 | 11 | export DISPLAY=:0 12 | java -cp /usr/share/java/java-helloworld.jar 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Chapter04/04_20/conf/bblayers.conf: -------------------------------------------------------------------------------- 1 | LCONF_VERSION = "7" 2 | 3 | BBPATH = "${TOPDIR}" 4 | BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../..')}" 5 | 6 | BBFILES ?= "" 7 | BBLAYERS = " \ 8 | ${BSPDIR}/sources/poky/meta \ 9 | ${BSPDIR}/sources/poky/meta-poky \ 10 | ${BSPDIR}/sources/meta-openembedded/meta-oe \ 11 | ${BSPDIR}/sources/meta-openembedded/meta-multimedia \ 12 | ${BSPDIR}/sources/meta-freescale \ 13 | ${BSPDIR}/sources/meta-freescale-3rdparty \ 14 | ${BSPDIR}/sources/meta-freescale-distro \ 15 | ${BSPDIR}/sources/meta-qt5 \ 16 | ${BSPDIR}/sources/meta-custom \ 17 | ${BSPDIR}/sources/meta-bsp-custom \ 18 | ${BSPDIR}/sources/meta-intel-iot-security/meta-security-smack \ 19 | ${BSPDIR}/sources/meta-openembedded/meta-python \ 20 | ${BSPDIR}/sources/meta-java \ 21 | " 22 | -------------------------------------------------------------------------------- /Chapter04/04_20/conf/local.conf: -------------------------------------------------------------------------------- 1 | MACHINE ??= 'wandboard' 2 | DISTRO ?= 'poky' 3 | PACKAGE_CLASSES ?= "package_rpm" 4 | EXTRA_IMAGE_FEATURES ?= "debug-tweaks" 5 | USER_CLASSES ?= "buildstats image-mklibs image-prelink" 6 | PATCHRESOLVE = "noop" 7 | BB_DISKMON_DIRS = "\ 8 | STOPTASKS,${TMPDIR},1G,100K \ 9 | STOPTASKS,${DL_DIR},1G,100K \ 10 | STOPTASKS,${SSTATE_DIR},1G,100K \ 11 | STOPTASKS,/tmp,100M,100K \ 12 | ABORT,${TMPDIR},100M,1K \ 13 | ABORT,${DL_DIR},100M,1K \ 14 | ABORT,${SSTATE_DIR},100M,1K \ 15 | ABORT,/tmp,10M,1K" 16 | PACKAGECONFIG_append_pn-qemu-native = " sdl" 17 | PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl" 18 | CONF_VERSION = "1" 19 | 20 | DL_DIR ?= "${BSPDIR}/downloads/" 21 | ACCEPT_FSL_EULA = "1" 22 | 23 | INHERIT += "rm_work" 24 | RM_WORK_EXCLUDE += "core-image-minimal custom-image image-small core-image-sato" 25 | INHIBIT_PACKAGE_DEBUG_SPLIT = "1" 26 | 27 | IMAGE_INSTALL_append = " python-helloworld" 28 | IMAGE_INSTALL_append = " python-pip python3-pip" 29 | 30 | PREFERRED_PROVIDER_virtual/java-initial-native = "cacao-initial-native" 31 | PREFERRED_PROVIDER_virtual/java-native = "jamvm-native" 32 | PREFERRED_PROVIDER_virtual/javac-native = "ecj-bootstrap-native" 33 | 34 | IMAGE_INSTALL_append = " openjre-8" 35 | DISTRO_FEATURES_remove = "wayland" 36 | 37 | IMAGE_INSTALL_append = " libjava-helloworld-java" 38 | PREFERRED_RPROVIDER_java2-runtime = "openjre-8" 39 | -------------------------------------------------------------------------------- /Chapter04/04_20/meta-custom/recipes-java/java-helloworld/java-helloworld-1.0/HelloWorldSwing.java: -------------------------------------------------------------------------------- 1 | import javax.swing.JFrame; 2 | import javax.swing.JLabel; 3 | 4 | public class HelloWorldSwing { 5 | private static void createAndShowGUI() { 6 | JFrame frame = new JFrame("Hello World!"); 7 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 8 | 9 | JLabel label = new JLabel("Hello World!"); 10 | frame.getContentPane().add(label); 11 | 12 | frame.pack(); 13 | frame.setVisible(true); 14 | } 15 | 16 | public static void main(String[] args) { 17 | javax.swing.SwingUtilities.invokeLater(new Runnable() { 18 | public void run() { 19 | createAndShowGUI(); 20 | } 21 | }); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Chapter04/04_20/meta-custom/recipes-java/java-helloworld/java-helloworld_1.0.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Simple Java Swing hello world application" 2 | SECTION = "examples" 3 | LICENSE = "MIT" 4 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" 5 | 6 | RDEPENDS_${PN} = "java2-runtime" 7 | 8 | SRC_URI = "file://HelloWorldSwing.java" 9 | 10 | S = "${WORKDIR}" 11 | 12 | inherit java-library 13 | 14 | do_compile() { 15 | mkdir -p build 16 | javac -d build `find . -name "*.java"` 17 | fastjar cf ${JARFILENAME} -C build . 18 | } 19 | 20 | BBCLASSEXTEND = "native" 21 | -------------------------------------------------------------------------------- /Chapter04/04_21/commands.README: -------------------------------------------------------------------------------- 1 | npm init 2 | npm install -g . 3 | nodejs helloworld.js 4 | 5 | npm adduser 6 | npm publish 7 | 8 | IMAGE_INSTALL_append = " nodejs" 9 | 10 | node --version 11 | 12 | node 13 | 14 | IMAGE_INSTALL_append = " nodejs-npm" 15 | 16 | npm search 17 | npm install 18 | npm install -g 19 | 20 | devtool add "npm://registry.npmjs.org;name=nodejs-helloworld;version=1.0.1" 21 | devtool add https://github.com/yoctocookbook2ndedition/nodejs-helloworld.git 22 | 23 | IMAGE_INSTALL_append = " nodejs-helloworld" 24 | 25 | cd /opt/yocto/fsl-community-bsp/sources 26 | git clone https://github.com/imyller/meta-nodejs.git 27 | 28 | bitbake-layers add-layer /opt/yocto/fsl-community-bsp/sources/meta-nodejs 29 | 30 | sudo dpkg --add-architecture i386 31 | sudo apt-get update 32 | sudo apt-get install g++-multilib libssl-dev:i386 libcrypto++-dev:i386 zlib1g-dev:i386 33 | 34 | IMAGE_INSTALL_append = " nodejs" 35 | 36 | node --version 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /Chapter04/04_21/conf/bblayers.conf: -------------------------------------------------------------------------------- 1 | LCONF_VERSION = "7" 2 | 3 | BBPATH = "${TOPDIR}" 4 | BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../..')}" 5 | 6 | BBFILES ?= "" 7 | BBLAYERS = " \ 8 | ${BSPDIR}/sources/poky/meta \ 9 | ${BSPDIR}/sources/poky/meta-poky \ 10 | ${BSPDIR}/sources/meta-openembedded/meta-oe \ 11 | ${BSPDIR}/sources/meta-openembedded/meta-multimedia \ 12 | ${BSPDIR}/sources/meta-freescale \ 13 | ${BSPDIR}/sources/meta-freescale-3rdparty \ 14 | ${BSPDIR}/sources/meta-freescale-distro \ 15 | ${BSPDIR}/sources/meta-custom \ 16 | ${BSPDIR}/sources/meta-qt5 \ 17 | ${BSPDIR}/sources/meta-java \ 18 | ${BSPDIR}/sources/meta-nodejs \ 19 | " 20 | -------------------------------------------------------------------------------- /Chapter04/04_21/conf/local.conf: -------------------------------------------------------------------------------- 1 | MACHINE ??= 'wandboard' 2 | DISTRO ?= 'poky' 3 | PACKAGE_CLASSES ?= "package_rpm" 4 | EXTRA_IMAGE_FEATURES ?= "debug-tweaks" 5 | USER_CLASSES ?= "buildstats image-mklibs image-prelink" 6 | PATCHRESOLVE = "noop" 7 | BB_DISKMON_DIRS = "\ 8 | STOPTASKS,${TMPDIR},1G,100K \ 9 | STOPTASKS,${DL_DIR},1G,100K \ 10 | STOPTASKS,${SSTATE_DIR},1G,100K \ 11 | STOPTASKS,/tmp,100M,100K \ 12 | ABORT,${TMPDIR},100M,1K \ 13 | ABORT,${DL_DIR},100M,1K \ 14 | ABORT,${SSTATE_DIR},100M,1K \ 15 | ABORT,/tmp,10M,1K" 16 | PACKAGECONFIG_append_pn-qemu-native = " sdl" 17 | PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl" 18 | CONF_VERSION = "1" 19 | 20 | DL_DIR ?= "${BSPDIR}/downloads/" 21 | ACCEPT_FSL_EULA = "1" 22 | 23 | INHERIT += "rm_work" 24 | RM_WORK_EXCLUDE += "core-image-minimal custom-image image-small core-image-sato core-image-weston" 25 | INHIBIT_PACKAGE_DEBUG_SPLIT = "1" 26 | 27 | IMAGE_INSTALL_append = " nodejs nodejs-npm" 28 | -------------------------------------------------------------------------------- /Chapter04/04_21/helloworld.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | var http = require('http'); 3 | 4 | http.createServer(function (request, response) { 5 | response.writeHead(200, {'Content-Type': 'text/plain'}); 6 | response.end('Hello World\n'); 7 | }).listen(8080); 8 | 9 | console.log('Server started'); 10 | -------------------------------------------------------------------------------- /Chapter04/04_21/meta-custom/recipes-devtools/nodejs/nodejs-6.10.3/v8_fix_build_errors_with_g++_7.patch: -------------------------------------------------------------------------------- 1 | From 11c7e0164af7f6b33df13a658fc1c0effb502662 Mon Sep 17 00:00:00 2001 2 | From: Zuzana Svetlikova 3 | Date: Fri, 9 Jun 2017 14:07:19 +0200 4 | Subject: [PATCH] v8: fix build errors with g++ 7 5 | 6 | This is a local patch because upstream fixed it differently by moving 7 | large chunks of code out of objects.h. We cannot easily back-port 8 | those changes due to their size and invasiveness. 9 | 10 | Fixes: https://github.com/nodejs/node/issues/10388 11 | PR-URL: https://github.com/nodejs/node/pull/12392 12 | Backport-PR-URL: https://github.com/nodejs/node/pull/13574 13 | Reviewed-By: Anna Henningsen 14 | Reviewed-By: Benjamin Gruenbaum 15 | Reviewed-By: Daniel Bevenius 16 | Reviewed-By: James M Snell 17 | --- 18 | deps/v8/src/objects-body-descriptors.h | 2 +- 19 | deps/v8/src/objects-inl.h | 21 +++++++++++++++++++++ 20 | deps/v8/src/objects.h | 20 ++++---------------- 21 | 3 files changed, 26 insertions(+), 17 deletions(-) 22 | 23 | diff --git a/deps/v8/src/objects-body-descriptors.h b/deps/v8/src/objects-body-descriptors.h 24 | index 91cb8883be8..a1c3634bd76 100644 25 | --- a/deps/v8/src/objects-body-descriptors.h 26 | +++ b/deps/v8/src/objects-body-descriptors.h 27 | @@ -99,7 +99,7 @@ class FixedBodyDescriptor final : public BodyDescriptorBase { 28 | 29 | template 30 | static inline void IterateBody(HeapObject* obj, int object_size) { 31 | - IterateBody(obj); 32 | + IterateBody(obj); 33 | } 34 | }; 35 | 36 | diff --git a/deps/v8/src/objects-inl.h b/deps/v8/src/objects-inl.h 37 | index 11f4d7498d7..72208c2f00f 100644 38 | --- a/deps/v8/src/objects-inl.h 39 | +++ b/deps/v8/src/objects-inl.h 40 | @@ -36,6 +36,27 @@ 41 | namespace v8 { 42 | namespace internal { 43 | 44 | +template 45 | +uint32_t HashTable::Hash(Key key) { 46 | + if (Shape::UsesSeed) { 47 | + return Shape::SeededHash(key, GetHeap()->HashSeed()); 48 | + } else { 49 | + return Shape::Hash(key); 50 | + } 51 | +} 52 | + 53 | + 54 | +template 55 | +uint32_t HashTable::HashForObject(Key key, 56 | + Object* object) { 57 | + if (Shape::UsesSeed) { 58 | + return Shape::SeededHashForObject(key, GetHeap()->HashSeed(), object); 59 | + } else { 60 | + return Shape::HashForObject(key, object); 61 | + } 62 | +} 63 | + 64 | + 65 | PropertyDetails::PropertyDetails(Smi* smi) { 66 | value_ = smi->value(); 67 | } 68 | diff --git a/deps/v8/src/objects.h b/deps/v8/src/objects.h 69 | index d1632c9deb2..47b02dadcff 100644 70 | --- a/deps/v8/src/objects.h 71 | +++ b/deps/v8/src/objects.h 72 | @@ -3261,22 +3261,10 @@ class HashTableBase : public FixedArray { 73 | template 74 | class HashTable : public HashTableBase { 75 | public: 76 | - // Wrapper methods 77 | - inline uint32_t Hash(Key key) { 78 | - if (Shape::UsesSeed) { 79 | - return Shape::SeededHash(key, GetHeap()->HashSeed()); 80 | - } else { 81 | - return Shape::Hash(key); 82 | - } 83 | - } 84 | - 85 | - inline uint32_t HashForObject(Key key, Object* object) { 86 | - if (Shape::UsesSeed) { 87 | - return Shape::SeededHashForObject(key, GetHeap()->HashSeed(), object); 88 | - } else { 89 | - return Shape::HashForObject(key, object); 90 | - } 91 | - } 92 | + // Wrapper methods. Defined in src/objects-inl.h 93 | + // to break a cycle with src/heap/heap.h. 94 | + inline uint32_t Hash(Key key); 95 | + inline uint32_t HashForObject(Key key, Object* object); 96 | 97 | // Returns a new HashTable object. 98 | MUST_USE_RESULT static Handle New( 99 | -------------------------------------------------------------------------------- /Chapter04/04_21/meta-custom/recipes-devtools/nodejs/nodejs_6.10.3.bbappend: -------------------------------------------------------------------------------- 1 | FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}-${PV}:" 2 | SRC_URI_append = " file://v8_fix_build_errors_with_g++_7.patch" 3 | -------------------------------------------------------------------------------- /Chapter04/04_21/meta-custom/recipes-example/nodejs-helloworld/nodejs-helloworld/lockdown.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /Chapter04/04_21/meta-custom/recipes-example/nodejs-helloworld/nodejs-helloworld/npm-shrinkwrap.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nodejs-helloworld", 3 | "version": "1.0.1", 4 | "lockfileVersion": 1 5 | } 6 | -------------------------------------------------------------------------------- /Chapter04/04_21/meta-custom/recipes-example/nodejs-helloworld/nodejs-helloworld_1.0.1.bb: -------------------------------------------------------------------------------- 1 | SUMMARY = "An example node.js hello world server" 2 | LICENSE = "MIT" 3 | LIC_FILES_CHKSUM = "file://LICENSE;md5=2459e4101d5fabab9d291bde6cdc5a56" 4 | 5 | SRC_URI = "npm://registry.npmjs.org;name=nodejs-helloworld;version=${PV}" 6 | 7 | NPM_SHRINKWRAP := "${THISDIR}/${PN}/npm-shrinkwrap.json" 8 | NPM_LOCKDOWN := "${THISDIR}/${PN}/lockdown.json" 9 | 10 | inherit npm 11 | 12 | # Must be set after inherit npm since that itself sets S 13 | S = "${WORKDIR}/npmpkg" 14 | LICENSE_${PN} = "MIT" 15 | 16 | RDEPENDS_${PN} = "nodejs" 17 | 18 | -------------------------------------------------------------------------------- /Chapter04/04_21/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nodejs-helloworld", 3 | "version": "1.0.1", 4 | "description": "An example node.js hello world server", 5 | "main": "helloworld.js", 6 | "author": "Alex Gonzalez ", 7 | "license": "MIT", 8 | "repository": { 9 | "type": "git", 10 | "url": "https://github.com/yoctocookbook2ndedition/nodejs-helloworld.git" 11 | }, 12 | "keywords": [ 13 | "example" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /Chapter04/04_22/commands.README: -------------------------------------------------------------------------------- 1 | cd /opt/yocto/fsl-community-bsp/sources/ 2 | git clone git://git.yoctoproject.org/meta-virtualization 3 | 4 | bitbake-layers add-layer /opt/yocto/fsl-community-bsp/sources/meta-virtualization 5 | git checkout -b rocko origin/rocko 6 | 7 | DISTRO_FEATURES_append = " virtualization" 8 | 9 | IMAGE_ROOTFS_EXTRA_SPACE = "10000" 10 | 11 | IMAGE_INSTALL_append = " docker" 12 | 13 | bitbake core-image-minimal 14 | docker run hello-world 15 | docker run -it --rm busybox sh 16 | 17 | docker info 18 | docker ps -a 19 | docker attach 20 | docker stop 21 | docker rm 22 | 23 | 24 | -------------------------------------------------------------------------------- /Chapter04/04_22/conf/bblayers.conf: -------------------------------------------------------------------------------- 1 | LCONF_VERSION = "7" 2 | 3 | BBPATH = "${TOPDIR}" 4 | BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../..')}" 5 | 6 | BBFILES ?= "" 7 | BBLAYERS = " \ 8 | ${BSPDIR}/sources/poky/meta \ 9 | ${BSPDIR}/sources/poky/meta-poky \ 10 | ${BSPDIR}/sources/meta-openembedded/meta-oe \ 11 | ${BSPDIR}/sources/meta-openembedded/meta-multimedia \ 12 | ${BSPDIR}/sources/meta-openembedded/meta-networking \ 13 | ${BSPDIR}/sources/meta-openembedded/meta-python \ 14 | ${BSPDIR}/sources/meta-openembedded/meta-filesystems \ 15 | ${BSPDIR}/sources/meta-freescale \ 16 | ${BSPDIR}/sources/meta-freescale-3rdparty \ 17 | ${BSPDIR}/sources/meta-freescale-distro \ 18 | ${BSPDIR}/sources/meta-virtualization \ 19 | ${BSPDIR}/sources/meta-custom \ 20 | ${BSPDIR}/sources/meta-qt5 \ 21 | ${BSPDIR}/sources/meta-java \ 22 | ${BSPDIR}/sources/meta-nodejs \ 23 | " 24 | -------------------------------------------------------------------------------- /Chapter04/04_22/conf/local.conf: -------------------------------------------------------------------------------- 1 | MACHINE ??= 'wandboard' 2 | DISTRO ?= 'fslc-xwayland' 3 | PACKAGE_CLASSES ?= "package_rpm" 4 | EXTRA_IMAGE_FEATURES ?= "debug-tweaks" 5 | USER_CLASSES ?= "buildstats image-mklibs image-prelink" 6 | PATCHRESOLVE = "noop" 7 | BB_DISKMON_DIRS = "\ 8 | STOPTASKS,${TMPDIR},1G,100K \ 9 | STOPTASKS,${DL_DIR},1G,100K \ 10 | STOPTASKS,${SSTATE_DIR},1G,100K \ 11 | STOPTASKS,/tmp,100M,100K \ 12 | ABORT,${TMPDIR},100M,1K \ 13 | ABORT,${DL_DIR},100M,1K \ 14 | ABORT,${SSTATE_DIR},100M,1K \ 15 | ABORT,/tmp,10M,1K" 16 | PACKAGECONFIG_append_pn-qemu-native = " sdl" 17 | PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl" 18 | CONF_VERSION = "1" 19 | 20 | DL_DIR ?= "${BSPDIR}/downloads/" 21 | ACCEPT_FSL_EULA = "1" 22 | 23 | INHERIT += "rm_work" 24 | 25 | DISTRO_FEATURES_append = " virtualization" 26 | 27 | DISTRO_FEATURES_append = " systemd" 28 | VIRTUAL-RUNTIME_init_manager = "systemd" 29 | DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit" 30 | VIRTUAL-RUNTIME_initscripts = "systemd-compat-units" 31 | 32 | IMAGE_ROOTFS_EXTRA_SPACE = "100000" 33 | 34 | IMAGE_INSTALL_append = " docker" 35 | -------------------------------------------------------------------------------- /Chapter05/05_01/commands.README: -------------------------------------------------------------------------------- 1 | EXTRA_IMAGE_FEATURES += "dbg-pkgs" 2 | 3 | IMAGE_INSTALL_append = " -dbg" 4 | 5 | ulimit -c unlimited 6 | ulimit -a 7 | 8 | wvdial -c 9 | kill -SEGV 10 | 11 | echo /coredumps/core.%e.%t > /proc/sys/kernel/core_pattern 12 | 13 | source /opt/poky/2.4/environment-setup-cortexa9hf-neon-poky-linux-gnueabi 14 | ${GDB} /opt/poky/2.4/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/bin/.debug/wvdial core 15 | set sysroot /opt/poky/2.4/sysroots/cortexa9hf-neon-poky-linux-gnueabi/ 16 | bt 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /Chapter05/05_01/conf/bblayers.conf: -------------------------------------------------------------------------------- 1 | LCONF_VERSION = "7" 2 | 3 | BBPATH = "${TOPDIR}" 4 | BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../..')}" 5 | 6 | BBFILES ?= "" 7 | BBLAYERS = " \ 8 | ${BSPDIR}/sources/poky/meta \ 9 | ${BSPDIR}/sources/poky/meta-poky \ 10 | ${BSPDIR}/sources/meta-openembedded/meta-oe \ 11 | ${BSPDIR}/sources/meta-openembedded/meta-multimedia \ 12 | ${BSPDIR}/sources/meta-openembedded/meta-networking \ 13 | ${BSPDIR}/sources/meta-openembedded/meta-python \ 14 | ${BSPDIR}/sources/meta-openembedded/meta-filesystems \ 15 | ${BSPDIR}/sources/meta-freescale \ 16 | ${BSPDIR}/sources/meta-freescale-3rdparty \ 17 | ${BSPDIR}/sources/meta-freescale-distro \ 18 | " 19 | -------------------------------------------------------------------------------- /Chapter05/05_01/conf/local.conf: -------------------------------------------------------------------------------- 1 | MACHINE ??= 'wandboard' 2 | DISTRO ?= 'poky' 3 | PACKAGE_CLASSES ?= "package_rpm" 4 | EXTRA_IMAGE_FEATURES ?= "debug-tweaks" 5 | USER_CLASSES ?= "buildstats image-mklibs image-prelink" 6 | PATCHRESOLVE = "noop" 7 | BB_DISKMON_DIRS = "\ 8 | STOPTASKS,${TMPDIR},1G,100K \ 9 | STOPTASKS,${DL_DIR},1G,100K \ 10 | STOPTASKS,${SSTATE_DIR},1G,100K \ 11 | STOPTASKS,/tmp,100M,100K \ 12 | ABORT,${TMPDIR},100M,1K \ 13 | ABORT,${DL_DIR},100M,1K \ 14 | ABORT,${SSTATE_DIR},100M,1K \ 15 | ABORT,/tmp,10M,1K" 16 | PACKAGECONFIG_append_pn-qemu-native = " sdl" 17 | PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl" 18 | CONF_VERSION = "1" 19 | 20 | DL_DIR ?= "${BSPDIR}/downloads/" 21 | ACCEPT_FSL_EULA = "1" 22 | 23 | INHERIT += "rm_work" 24 | 25 | DISTRO_FEATURES_remove = "wayland" 26 | IMAGE_INSTALL_append = "wvdial openssh-sshd" 27 | 28 | EXTRA_IMAGE_FEATURES += "dbg-pkgs" 29 | 30 | -------------------------------------------------------------------------------- /Chapter05/05_02/commands.README: -------------------------------------------------------------------------------- 1 | EXTRA_IMAGE_FEATURES += "dbg-pkgs tools-debug" 2 | 3 | EXTRA_IMAGE_FEATURES += "tools-sdk dbg-pkgs tools-debug" 4 | 5 | PACKAGE_DEBUG_SPLIT_STYLE = "debug-without-src" 6 | 7 | cd /opt/yocto/fsl-community-bsp/ 8 | source setup-environment wandboard 9 | bitbake core-image-minimal-dev 10 | 11 | gdb --args wvdial -c 12 | run 13 | info inferiors 14 | bt 15 | c 16 | 17 | kill -SEGV 18 | 19 | bt 20 | 21 | DEBUG_BUILD = "1" 22 | 23 | 24 | -------------------------------------------------------------------------------- /Chapter05/05_02/conf/bblayers.conf: -------------------------------------------------------------------------------- 1 | LCONF_VERSION = "7" 2 | 3 | BBPATH = "${TOPDIR}" 4 | BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../..')}" 5 | 6 | BBFILES ?= "" 7 | BBLAYERS = " \ 8 | ${BSPDIR}/sources/poky/meta \ 9 | ${BSPDIR}/sources/poky/meta-poky \ 10 | ${BSPDIR}/sources/meta-openembedded/meta-oe \ 11 | ${BSPDIR}/sources/meta-openembedded/meta-multimedia \ 12 | ${BSPDIR}/sources/meta-openembedded/meta-networking \ 13 | ${BSPDIR}/sources/meta-openembedded/meta-python \ 14 | ${BSPDIR}/sources/meta-openembedded/meta-filesystems \ 15 | ${BSPDIR}/sources/meta-freescale \ 16 | ${BSPDIR}/sources/meta-freescale-3rdparty \ 17 | ${BSPDIR}/sources/meta-freescale-distro \ 18 | " 19 | -------------------------------------------------------------------------------- /Chapter05/05_02/conf/local.conf: -------------------------------------------------------------------------------- 1 | MACHINE ??= 'wandboard' 2 | DISTRO ?= 'poky' 3 | PACKAGE_CLASSES ?= "package_rpm" 4 | EXTRA_IMAGE_FEATURES ?= "debug-tweaks" 5 | USER_CLASSES ?= "buildstats image-mklibs image-prelink" 6 | PATCHRESOLVE = "noop" 7 | BB_DISKMON_DIRS = "\ 8 | STOPTASKS,${TMPDIR},1G,100K \ 9 | STOPTASKS,${DL_DIR},1G,100K \ 10 | STOPTASKS,${SSTATE_DIR},1G,100K \ 11 | STOPTASKS,/tmp,100M,100K \ 12 | ABORT,${TMPDIR},100M,1K \ 13 | ABORT,${DL_DIR},100M,1K \ 14 | ABORT,${SSTATE_DIR},100M,1K \ 15 | ABORT,/tmp,10M,1K" 16 | PACKAGECONFIG_append_pn-qemu-native = " sdl" 17 | PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl" 18 | CONF_VERSION = "1" 19 | 20 | DL_DIR ?= "${BSPDIR}/downloads/" 21 | ACCEPT_FSL_EULA = "1" 22 | 23 | INHERIT += "rm_work" 24 | 25 | DISTRO_FEATURES_remove = "wayland" 26 | IMAGE_INSTALL_append = "wvdial openssh-sshd" 27 | 28 | EXTRA_IMAGE_FEATURES += "tools-sdk dbg-pkgs tools-debug" 29 | -------------------------------------------------------------------------------- /Chapter05/05_03/commands.README: -------------------------------------------------------------------------------- 1 | EXTRA_IMAGE_FEATURES += "tools-debug" 2 | 3 | EXTRA_IMAGE_FEATURES += "dbg-pkgs" 4 | 5 | bitbake -c populate_sdk core-image-minimal 6 | 7 | gdbserver localhost:1234 /usr/bin/wvdial -c 8 | 9 | cd /opt/poky/2.4/ 10 | source environment-setup-cortexa9hf-neon-poky-linux-gnueabi 11 | 12 | ${GDB} /opt/poky/2.4/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/bin/.debug/wvdial 13 | set auto-load safe-path / 14 | handle SIGILL nostop 15 | 16 | target remote :1234 17 | set sysroot /opt/poky/2.4/sysroots/cortexa9hf-neon-poky-linux-gnueabi/ 18 | 19 | kill -SEGV 20 | bt 21 | 22 | DEBUG_BUILD = "1" 23 | 24 | -------------------------------------------------------------------------------- /Chapter05/05_03/conf/bblayers.conf: -------------------------------------------------------------------------------- 1 | LCONF_VERSION = "7" 2 | 3 | BBPATH = "${TOPDIR}" 4 | BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../..')}" 5 | 6 | BBFILES ?= "" 7 | BBLAYERS = " \ 8 | ${BSPDIR}/sources/poky/meta \ 9 | ${BSPDIR}/sources/poky/meta-poky \ 10 | ${BSPDIR}/sources/meta-openembedded/meta-oe \ 11 | ${BSPDIR}/sources/meta-openembedded/meta-multimedia \ 12 | ${BSPDIR}/sources/meta-openembedded/meta-networking \ 13 | ${BSPDIR}/sources/meta-openembedded/meta-python \ 14 | ${BSPDIR}/sources/meta-openembedded/meta-filesystems \ 15 | ${BSPDIR}/sources/meta-freescale \ 16 | ${BSPDIR}/sources/meta-freescale-3rdparty \ 17 | ${BSPDIR}/sources/meta-freescale-distro \ 18 | " 19 | -------------------------------------------------------------------------------- /Chapter05/05_03/conf/local.conf: -------------------------------------------------------------------------------- 1 | MACHINE ??= 'wandboard' 2 | DISTRO ?= 'poky' 3 | PACKAGE_CLASSES ?= "package_rpm" 4 | EXTRA_IMAGE_FEATURES ?= "debug-tweaks" 5 | USER_CLASSES ?= "buildstats image-mklibs image-prelink" 6 | PATCHRESOLVE = "noop" 7 | BB_DISKMON_DIRS = "\ 8 | STOPTASKS,${TMPDIR},1G,100K \ 9 | STOPTASKS,${DL_DIR},1G,100K \ 10 | STOPTASKS,${SSTATE_DIR},1G,100K \ 11 | STOPTASKS,/tmp,100M,100K \ 12 | ABORT,${TMPDIR},100M,1K \ 13 | ABORT,${DL_DIR},100M,1K \ 14 | ABORT,${SSTATE_DIR},100M,1K \ 15 | ABORT,/tmp,10M,1K" 16 | PACKAGECONFIG_append_pn-qemu-native = " sdl" 17 | PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl" 18 | CONF_VERSION = "1" 19 | 20 | DL_DIR ?= "${BSPDIR}/downloads/" 21 | ACCEPT_FSL_EULA = "1" 22 | 23 | INHERIT += "rm_work" 24 | 25 | DISTRO_FEATURES_remove = "wayland" 26 | IMAGE_INSTALL_append = "wvdial openssh-sshd" 27 | DEBUG_BUILD = "1" 28 | 29 | EXTRA_IMAGE_FEATURES += "tools-debug dbg-pkgs" 30 | -------------------------------------------------------------------------------- /Chapter05/05_04/commands.README: -------------------------------------------------------------------------------- 1 | IMAGE_INSTALL_append = " strace" 2 | 3 | EXTRA_IMAGE_FEATURES += "tools-debug" 4 | 5 | IMAGE_INSTALL_append = " procps" 6 | 7 | strace -f -t -e sendto /bin/sh -c "ping -c 1 127.0.0.1" 8 | 9 | strace -p $( pgrep ) 10 | 11 | strace $( pgrep | sed 's/^/-p' ) 12 | 13 | -------------------------------------------------------------------------------- /Chapter05/05_05/commands.README: -------------------------------------------------------------------------------- 1 | UBOOT_EXTLINUX_KERNEL_ARGS += "maxcpus=1" 2 | 3 | source /opt/poky/2.4/environment-setup-cortexa9hf-neon-poky-linux-gnueabi 4 | ${CC} ${CFLAGS} ${LDFLAGS} perf_example.c -o perf_example 5 | 6 | chmod a+x perf_example 7 | ./perf_example 8 | 9 | -------------------------------------------------------------------------------- /Chapter05/05_05/conf/bblayers.conf: -------------------------------------------------------------------------------- 1 | LCONF_VERSION = "7" 2 | 3 | BBPATH = "${TOPDIR}" 4 | BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../..')}" 5 | 6 | BBFILES ?= "" 7 | BBLAYERS = " \ 8 | ${BSPDIR}/sources/poky/meta \ 9 | ${BSPDIR}/sources/poky/meta-poky \ 10 | ${BSPDIR}/sources/meta-openembedded/meta-oe \ 11 | ${BSPDIR}/sources/meta-openembedded/meta-multimedia \ 12 | ${BSPDIR}/sources/meta-openembedded/meta-networking \ 13 | ${BSPDIR}/sources/meta-openembedded/meta-python \ 14 | ${BSPDIR}/sources/meta-openembedded/meta-filesystems \ 15 | ${BSPDIR}/sources/meta-freescale \ 16 | ${BSPDIR}/sources/meta-freescale-3rdparty \ 17 | ${BSPDIR}/sources/meta-freescale-distro \ 18 | ${BSPDIR}/sources/meta-custom \ 19 | ${BSPDIR}/sources/meta-bsp-custom \ 20 | ${BSPDIR}/sources/meta-qt5 \ 21 | ${BSPDIR}/sources/meta-java \ 22 | ${BSPDIR}/sources/meta-nodejs \ 23 | " 24 | -------------------------------------------------------------------------------- /Chapter05/05_05/conf/local.conf: -------------------------------------------------------------------------------- 1 | MACHINE ??= 'wandboard' 2 | DISTRO ?= 'poky' 3 | PACKAGE_CLASSES ?= "package_rpm" 4 | EXTRA_IMAGE_FEATURES ?= "debug-tweaks" 5 | USER_CLASSES ?= "buildstats image-mklibs image-prelink" 6 | PATCHRESOLVE = "noop" 7 | BB_DISKMON_DIRS = "\ 8 | STOPTASKS,${TMPDIR},1G,100K \ 9 | STOPTASKS,${DL_DIR},1G,100K \ 10 | STOPTASKS,${SSTATE_DIR},1G,100K \ 11 | STOPTASKS,/tmp,100M,100K \ 12 | ABORT,${TMPDIR},100M,1K \ 13 | ABORT,${DL_DIR},100M,1K \ 14 | ABORT,${SSTATE_DIR},100M,1K \ 15 | ABORT,/tmp,10M,1K" 16 | PACKAGECONFIG_append_pn-qemu-native = " sdl" 17 | PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl" 18 | CONF_VERSION = "1" 19 | 20 | DL_DIR ?= "${BSPDIR}/downloads/" 21 | ACCEPT_FSL_EULA = "1" 22 | 23 | INHERIT += "rm_work" 24 | 25 | UBOOT_EXTLINUX_KERNEL_ARGS += "maxcpus=1" 26 | -------------------------------------------------------------------------------- /Chapter05/05_05/perf_example.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | static long perf_event_open(struct perf_event_attr *hw_event, pid_t pid, 10 | int cpu, int group_fd, unsigned long flags) 11 | { 12 | int ret; 13 | 14 | ret = syscall(__NR_perf_event_open, hw_event, pid, cpu, 15 | group_fd, flags); 16 | return ret; 17 | } 18 | 19 | int main(int argc, char **argv) 20 | { 21 | struct perf_event_attr pe; 22 | long long count; 23 | int fd; 24 | 25 | memset(&pe, 0, sizeof(struct perf_event_attr)); 26 | pe.type = PERF_TYPE_HARDWARE; 27 | pe.size = sizeof(struct perf_event_attr); 28 | pe.config = PERF_COUNT_HW_INSTRUCTIONS; 29 | pe.disabled = 1; 30 | 31 | fd = perf_event_open(&pe, 0, -1, -1, 0); 32 | if (fd == -1) { 33 | fprintf(stderr, "Error opening leader %llx\n", pe.config); 34 | exit(EXIT_FAILURE); 35 | } 36 | 37 | ioctl(fd, PERF_EVENT_IOC_RESET, 0); 38 | ioctl(fd, PERF_EVENT_IOC_ENABLE, 0); 39 | 40 | printf("Measuring instruction count for this printf\n"); 41 | 42 | ioctl(fd, PERF_EVENT_IOC_DISABLE, 0); 43 | read(fd, &count, sizeof(long long)); 44 | 45 | printf("Used %lld instructions\n", count); 46 | 47 | close(fd); 48 | 49 | return 0; 50 | } 51 | -------------------------------------------------------------------------------- /Chapter05/05_06/commands.README: -------------------------------------------------------------------------------- 1 | ls /sys/kernel/debug/tracing/events/ 2 | 3 | grep 'net' /sys/kernel/debug/tracing/available_events 4 | 5 | cat /sys/kernel/debug/tracing/events/net/netif_receive_skb/format 6 | 7 | echo 1 > /sys/kernel/debug/tracing/events/net/netif_receive_skb/enable 8 | echo 1 > /sys/kernel/debug/tracing/events/net/enable 9 | 10 | echo netif_receive_skb >> /sys/kernel/debug/tracing/set_event 11 | echo '!netif_receive_skb' >> /sys/kernel/debug/tracing/set_event 12 | echo 'net:*' > /sys/kernel/debug/tracing/set_event 13 | echo > /sys/kernel/debug/tracing/set_event 14 | echo 1 > /sys/kernel/debug/tracing/tracing_on 15 | 16 | cd /sys/kernel/debug/tracing 17 | echo 1 > events/net/netif_receive_skb/enable 18 | echo netif_receive_* > set_ftrace_filter 19 | echo function > current_tracer 20 | cat trace 21 | 22 | cd /opt/yocto/fsl-community-bsp/sources/meta-bsp-custom/recipes-kernel/hello-world-tracepoint/files/ 23 | source /opt/poky/2.4/environment-setup-cortexa9hf-neon-poky-linux-gnueabi 24 | KERNEL_SRC=/opt/yocto/linux-wandboard make 25 | 26 | KERNEL_SRC=/opt/yocto/fsl-community-bsp/wandboard/tmp/work-shared/wandboard/kernel-build-artifacts/ make 27 | 28 | insmod hello_world.ko 29 | 30 | cat /sys/kernel/debug/tracing/events/log_dbg/log_dbg/format 31 | 32 | cd /sys/kernel/debug/tracing 33 | echo 1 > events/log_dbg/log_dbg/enable 34 | echo 1 > /sys/kernel/debug/tracing/tracing_on 35 | cat trace 36 | 37 | echo "a == \"Hello\"" > /sys/kernel/debug/tracing/events/log_dbg/log_dbg/filter 38 | 39 | -------------------------------------------------------------------------------- /Chapter05/05_06/conf/bblayers.conf: -------------------------------------------------------------------------------- 1 | LCONF_VERSION = "7" 2 | 3 | BBPATH = "${TOPDIR}" 4 | BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../..')}" 5 | 6 | BBFILES ?= "" 7 | BBLAYERS = " \ 8 | ${BSPDIR}/sources/poky/meta \ 9 | ${BSPDIR}/sources/poky/meta-poky \ 10 | ${BSPDIR}/sources/meta-openembedded/meta-oe \ 11 | ${BSPDIR}/sources/meta-openembedded/meta-multimedia \ 12 | ${BSPDIR}/sources/meta-openembedded/meta-networking \ 13 | ${BSPDIR}/sources/meta-openembedded/meta-python \ 14 | ${BSPDIR}/sources/meta-openembedded/meta-filesystems \ 15 | ${BSPDIR}/sources/meta-freescale \ 16 | ${BSPDIR}/sources/meta-freescale-3rdparty \ 17 | ${BSPDIR}/sources/meta-freescale-distro \ 18 | ${BSPDIR}/sources/meta-custom \ 19 | ${BSPDIR}/sources/meta-bsp-custom \ 20 | ${BSPDIR}/sources/meta-qt5 \ 21 | ${BSPDIR}/sources/meta-java \ 22 | ${BSPDIR}/sources/meta-nodejs \ 23 | " 24 | -------------------------------------------------------------------------------- /Chapter05/05_06/conf/local.conf: -------------------------------------------------------------------------------- 1 | MACHINE ??= 'wandboard' 2 | DISTRO ?= 'poky' 3 | PACKAGE_CLASSES ?= "package_rpm" 4 | EXTRA_IMAGE_FEATURES ?= "debug-tweaks" 5 | USER_CLASSES ?= "buildstats image-mklibs image-prelink" 6 | PATCHRESOLVE = "noop" 7 | BB_DISKMON_DIRS = "\ 8 | STOPTASKS,${TMPDIR},1G,100K \ 9 | STOPTASKS,${DL_DIR},1G,100K \ 10 | STOPTASKS,${SSTATE_DIR},1G,100K \ 11 | STOPTASKS,/tmp,100M,100K \ 12 | ABORT,${TMPDIR},100M,1K \ 13 | ABORT,${DL_DIR},100M,1K \ 14 | ABORT,${SSTATE_DIR},100M,1K \ 15 | ABORT,/tmp,10M,1K" 16 | PACKAGECONFIG_append_pn-qemu-native = " sdl" 17 | PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl" 18 | CONF_VERSION = "1" 19 | 20 | DL_DIR ?= "${BSPDIR}/downloads/" 21 | ACCEPT_FSL_EULA = "1" 22 | 23 | INHERIT += "rm_work" 24 | 25 | IMAGE_INSTALL_append += "hello-world-tracepoint" 26 | -------------------------------------------------------------------------------- /Chapter05/05_06/meta-bsp-custom/recipes-kernel/hello-world-tracepoint/hello-world-tracepoint/files/Makefile: -------------------------------------------------------------------------------- 1 | obj-m := hello_world.o 2 | CFLAGS_hello_world.o += -I$(src) 3 | 4 | SRC := $(shell pwd) 5 | 6 | all: 7 | $(MAKE) -C "$(KERNEL_SRC)" M="$(SRC)" 8 | 9 | modules_install: 10 | $(MAKE) -C "$(KERNEL_SRC)" M="$(SRC)" modules_install 11 | 12 | clean: 13 | rm -f *.o *~ core .depend .*.cmd *.ko *.mod.c 14 | rm -f Module.markers Module.symvers modules.order 15 | rm -rf .tmp_versions Modules.symvers 16 | -------------------------------------------------------------------------------- /Chapter05/05_06/meta-bsp-custom/recipes-kernel/hello-world-tracepoint/hello-world-tracepoint/files/hello_world.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "linux/timer.h" 3 | #define CREATE_TRACE_POINTS 4 | #include "trace.h" 5 | 6 | static struct timer_list hello_timer; 7 | 8 | void hello_timer_callback(unsigned long data) 9 | { 10 | char a[] = "Hello"; 11 | char b[] = "World"; 12 | printk("%s %s\n",a,b); 13 | /* Insert the static tracepoint */ 14 | trace_log_dbg(a, b); 15 | /* Trigger the timer again in 8 seconds */ 16 | mod_timer(&hello_timer, jiffies + msecs_to_jiffies(8000)); 17 | } 18 | 19 | static int hello_world_init(void) 20 | { 21 | /* Setup a timer to fire in 2 seconds */ 22 | setup_timer(&hello_timer, hello_timer_callback, 0); 23 | mod_timer(&hello_timer, jiffies + msecs_to_jiffies(2000)); 24 | return 0; 25 | } 26 | 27 | static void hello_world_exit(void) 28 | { 29 | /* Delete the timer */ 30 | del_timer(&hello_timer); 31 | } 32 | 33 | module_init(hello_world_init); 34 | module_exit(hello_world_exit); 35 | 36 | MODULE_LICENSE("GPL v2"); 37 | -------------------------------------------------------------------------------- /Chapter05/05_06/meta-bsp-custom/recipes-kernel/hello-world-tracepoint/hello-world-tracepoint/files/trace.h: -------------------------------------------------------------------------------- 1 | #undef TRACE_SYSTEM 2 | #define TRACE_SYSTEM log_dbg 3 | 4 | #if !defined(_HELLOWORLD_TRACE) || defined(TRACE_HEADER_MULTI_READ) 5 | #define _HELLOWORLD_TRACE 6 | 7 | #include 8 | 9 | TRACE_EVENT(log_dbg, 10 | TP_PROTO(char *a, char *b), 11 | TP_ARGS(a, b), 12 | TP_STRUCT__entry( 13 | __string(a, a) 14 | __string(b, b)), 15 | TP_fast_assign( 16 | __assign_str(a, a); 17 | __assign_str(b, b);), 18 | TP_printk("log_dbg: a %s b %s", 19 | __get_str(a), __get_str(b)) 20 | ); 21 | #endif 22 | 23 | /* This part must be outside protection */ 24 | #undef TRACE_INCLUDE_PATH 25 | #undef TRACE_INCLUDE_FILE 26 | #define TRACE_INCLUDE_PATH . 27 | #define TRACE_INCLUDE_FILE trace 28 | #include 29 | -------------------------------------------------------------------------------- /Chapter05/05_06/meta-bsp-custom/recipes-kernel/hello-world-tracepoint/hello-world-tracepoint/hello-world-tracepoint.bb: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2014 Packt Publishing. 2 | 3 | SUMMARY = "Simplest hello world kernel module." 4 | LICENSE = "GPLv2" 5 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" 6 | 7 | inherit module 8 | 9 | PV = "0.1" 10 | 11 | SRC_URI = " \ 12 | file://hello_world.c \ 13 | file://Makefile \ 14 | file://trace.h \ 15 | " 16 | 17 | S = "${WORKDIR}" 18 | -------------------------------------------------------------------------------- /Chapter05/05_07/commands.README: -------------------------------------------------------------------------------- 1 | arm-poky-linux-gnueabi-objdump -d -l vmlinux | grep 2 | 3 | cat /sys/kernel/debug/kprobes/list 4 | 5 | echo 0/1 > /sys/kernel/debug/kprobes/enabled 6 | 7 | insmod kprobe_open.ko 8 | 9 | -------------------------------------------------------------------------------- /Chapter05/05_07/conf/bblayers.conf: -------------------------------------------------------------------------------- 1 | LCONF_VERSION = "7" 2 | 3 | BBPATH = "${TOPDIR}" 4 | BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../..')}" 5 | 6 | BBFILES ?= "" 7 | BBLAYERS = " \ 8 | ${BSPDIR}/sources/poky/meta \ 9 | ${BSPDIR}/sources/poky/meta-poky \ 10 | ${BSPDIR}/sources/meta-openembedded/meta-oe \ 11 | ${BSPDIR}/sources/meta-openembedded/meta-multimedia \ 12 | ${BSPDIR}/sources/meta-openembedded/meta-networking \ 13 | ${BSPDIR}/sources/meta-openembedded/meta-python \ 14 | ${BSPDIR}/sources/meta-openembedded/meta-filesystems \ 15 | ${BSPDIR}/sources/meta-freescale \ 16 | ${BSPDIR}/sources/meta-freescale-3rdparty \ 17 | ${BSPDIR}/sources/meta-freescale-distro \ 18 | ${BSPDIR}/sources/meta-custom \ 19 | ${BSPDIR}/sources/meta-bsp-custom \ 20 | ${BSPDIR}/sources/meta-qt5 \ 21 | ${BSPDIR}/sources/meta-java \ 22 | ${BSPDIR}/sources/meta-nodejs \ 23 | " 24 | -------------------------------------------------------------------------------- /Chapter05/05_07/conf/local.conf: -------------------------------------------------------------------------------- 1 | MACHINE ??= 'wandboard' 2 | DISTRO ?= 'poky' 3 | PACKAGE_CLASSES ?= "package_rpm" 4 | EXTRA_IMAGE_FEATURES ?= "debug-tweaks" 5 | USER_CLASSES ?= "buildstats image-mklibs image-prelink" 6 | PATCHRESOLVE = "noop" 7 | BB_DISKMON_DIRS = "\ 8 | STOPTASKS,${TMPDIR},1G,100K \ 9 | STOPTASKS,${DL_DIR},1G,100K \ 10 | STOPTASKS,${SSTATE_DIR},1G,100K \ 11 | STOPTASKS,/tmp,100M,100K \ 12 | ABORT,${TMPDIR},100M,1K \ 13 | ABORT,${DL_DIR},100M,1K \ 14 | ABORT,${SSTATE_DIR},100M,1K \ 15 | ABORT,/tmp,10M,1K" 16 | PACKAGECONFIG_append_pn-qemu-native = " sdl" 17 | PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl" 18 | CONF_VERSION = "1" 19 | 20 | DL_DIR ?= "${BSPDIR}/downloads/" 21 | ACCEPT_FSL_EULA = "1" 22 | 23 | INHERIT += "rm_work" 24 | 25 | IMAGE_INSTALL_append += "open-kprobe open-jprobe open-kretprobe" 26 | -------------------------------------------------------------------------------- /Chapter05/05_07/meta-bsp-custom/recipes-kernel/open-jprobe/files/Makefile: -------------------------------------------------------------------------------- 1 | obj-m:= jprobe_open.o 2 | 3 | SRC := $(shell pwd) 4 | 5 | all: 6 | $(MAKE) -C "$(KERNEL_SRC)" M="$(SRC)" 7 | 8 | modules_install: 9 | $(MAKE) -C "$(KERNEL_SRC)" M="$(SRC)" modules_install 10 | 11 | clean: 12 | rm -f *.o *~ core .depend .*.cmd *.ko *.mod.c 13 | rm -f Module.markers Module.symvers modules.order 14 | rm -rf .tmp_versions Modules.symvers 15 | -------------------------------------------------------------------------------- /Chapter05/05_07/meta-bsp-custom/recipes-kernel/open-jprobe/files/jprobe_open.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | static long jdo_sys_open(int dfd, const char __user *filename, int 5 | flags, umode_t mode) 6 | { 7 | pr_info("jprobe: dfd = 0x%x, filename = 0xs " 8 | "flags = 0x%x mode umode %x\n", dfd, filename, flags, mode); 9 | 10 | /* Always end with a call to jprobe_return(). */ 11 | jprobe_return(); 12 | return 0; 13 | } 14 | 15 | static struct jprobe my_jprobe = { 16 | .entry = jdo_sys_open, 17 | .kp = { 18 | .symbol_name = "do_sys_open", 19 | }, 20 | }; 21 | 22 | static int jprobe_init(void) 23 | { 24 | int ret; 25 | 26 | ret = register_jprobe(&my_jprobe); 27 | if (ret < 0) { 28 | pr_err("register_jprobe failed, returned %d\n", ret); 29 | return -1; 30 | } 31 | pr_info("Planted jprobe at %p, handler addr %p\n", 32 | my_jprobe.kp.addr, my_jprobe.entry); 33 | return 0; 34 | } 35 | 36 | static void jprobe_exit(void) 37 | { 38 | unregister_jprobe(&my_jprobe); 39 | pr_info("jprobe at %p unregistered\n", my_jprobe.kp.addr); 40 | } 41 | 42 | module_init(jprobe_init) 43 | module_exit(jprobe_exit) 44 | MODULE_LICENSE("GPL"); 45 | -------------------------------------------------------------------------------- /Chapter05/05_07/meta-bsp-custom/recipes-kernel/open-jprobe/open-jprobe.bb: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2014 Packt Publishing. 2 | 3 | SUMMARY = "jprobe on do_sys_open kernel module." 4 | LICENSE = "GPLv2" 5 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" 6 | 7 | inherit module 8 | 9 | PR = "r0" 10 | PV = "0.1" 11 | 12 | SRC_URI = " \ 13 | file://jprobe_open.c \ 14 | file://Makefile \ 15 | " 16 | 17 | S = "${WORKDIR}" 18 | -------------------------------------------------------------------------------- /Chapter05/05_07/meta-bsp-custom/recipes-kernel/open-kprobe/files/Makefile: -------------------------------------------------------------------------------- 1 | obj-m := kprobe_open.o 2 | 3 | SRC := $(shell pwd) 4 | 5 | all: 6 | $(MAKE) -C "$(KERNEL_SRC)" M="$(SRC)" 7 | 8 | modules_install: 9 | $(MAKE) -C "$(KERNEL_SRC)" M="$(SRC)" modules_install 10 | 11 | clean: 12 | rm -f *.o *~ core .depend .*.cmd *.ko *.mod.c 13 | rm -f Module.markers Module.symvers modules.order 14 | rm -rf .tmp_versions Modules.symvers 15 | -------------------------------------------------------------------------------- /Chapter05/05_07/meta-bsp-custom/recipes-kernel/open-kprobe/files/kprobe_open.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | static struct kprobe kp = { 6 | .symbol_name = "do_sys_open", 7 | }; 8 | 9 | static int handler_pre(struct kprobe *p, struct pt_regs *regs) 10 | { 11 | pr_info("pre_handler: p->addr = 0x%p, lr = 0x%lx," 12 | " sp = 0x%lx\n", 13 | p->addr, regs->ARM_lr, regs->ARM_sp); 14 | 15 | /* A dump_stack() here will give a stack backtrace */ 16 | return 0; 17 | } 18 | 19 | static void handler_post(struct kprobe *p, struct pt_regs *regs, 20 | unsigned long flags) 21 | { 22 | pr_info("post_handler: p->addr = 0x%p, status = 0x%lx\n", 23 | p->addr, regs->ARM_cpsr); 24 | } 25 | 26 | static int handler_fault(struct kprobe *p, struct pt_regs *regs, 27 | int trapnr) 28 | { 29 | pr_info("fault_handler: p->addr = 0x%p, trap #%dn", 30 | p->addr, trapnr); 31 | /* Return 0 because we don't handle the fault. */ 32 | return 0; 33 | } 34 | 35 | static int kprobe_init(void) 36 | { 37 | int ret; 38 | kp.pre_handler = handler_pre; 39 | kp.post_handler = handler_post; 40 | kp.fault_handler = handler_fault; 41 | 42 | ret = register_kprobe(&kp); 43 | if (ret < 0) { 44 | pr_err("register_kprobe failed, returned %d\n", ret); 45 | return ret; 46 | } 47 | pr_info("Planted kprobe at %p\n", kp.addr); 48 | return 0; 49 | } 50 | 51 | static void kprobe_exit(void) 52 | { 53 | unregister_kprobe(&kp); 54 | pr_info("kprobe at %p unregistered\n", kp.addr); 55 | } 56 | 57 | module_init(kprobe_init) 58 | module_exit(kprobe_exit) 59 | MODULE_LICENSE("GPL"); 60 | -------------------------------------------------------------------------------- /Chapter05/05_07/meta-bsp-custom/recipes-kernel/open-kprobe/open-kprobe.bb: -------------------------------------------------------------------------------- 1 | SUMMARY = "kprobe on do_sys_open kernel module." 2 | LICENSE = "GPLv2" 3 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" 4 | 5 | inherit module 6 | 7 | PV = "0.1" 8 | 9 | SRC_URI = " \ 10 | file://kprobe_open.c \ 11 | file://Makefile \ 12 | " 13 | 14 | S = "${WORKDIR}" 15 | -------------------------------------------------------------------------------- /Chapter05/05_07/meta-bsp-custom/recipes-kernel/open-kretprobe/files/Makefile: -------------------------------------------------------------------------------- 1 | obj-m:= kretprobe_open.o 2 | 3 | SRC := $(shell pwd) 4 | 5 | all: 6 | $(MAKE) -C "$(KERNEL_SRC)" M="$(SRC)" 7 | 8 | modules_install: 9 | $(MAKE) -C "$(KERNEL_SRC)" M="$(SRC)" modules_install 10 | 11 | clean: 12 | rm -f *.o *~ core .depend .*.cmd *.ko *.mod.c 13 | rm -f Module.markers Module.symvers modules.order 14 | rm -rf .tmp_versions Modules.symvers 15 | -------------------------------------------------------------------------------- /Chapter05/05_07/meta-bsp-custom/recipes-kernel/open-kretprobe/files/kretprobe_open.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | /* per-instance private data */ 9 | struct my_data { 10 | ktime_t entry_stamp; 11 | }; 12 | 13 | static int entry_handler(struct kretprobe_instance *ri, struct 14 | pt_regs *regs) 15 | { 16 | struct my_data *data; 17 | 18 | if (!current->mm) 19 | return 1; /* Skip kernel threads */ 20 | 21 | data = (struct my_data *)ri->data; 22 | data->entry_stamp = ktime_get(); 23 | return 0; 24 | } 25 | 26 | static int ret_handler(struct kretprobe_instance *ri, struct 27 | pt_regs *regs) 28 | { 29 | int retval = regs_return_value(regs); 30 | struct my_data *data = (struct my_data *)ri->data; 31 | s64 delta; 32 | ktime_t now; 33 | 34 | now = ktime_get(); 35 | delta = ktime_to_ns(ktime_sub(now, data->entry_stamp)); 36 | pr_info("returned %d and took %lld ns to execute\n", 37 | retval, (long long)delta); 38 | return 0; 39 | } 40 | 41 | static struct kretprobe my_kretprobe = { 42 | .handler = ret_handler, 43 | .entry_handler = entry_handler, 44 | .data_size = sizeof(struct my_data), 45 | .maxactive = 20, 46 | }; 47 | 48 | static int kretprobe_init(void) 49 | { 50 | int ret; 51 | 52 | my_kretprobe.kp.symbol_name = "do_sys_open"; 53 | ret = register_kretprobe(&my_kretprobe); 54 | if (ret < 0) { 55 | pr_err("register_kretprobe failed, returned %d\n", 56 | ret); 57 | return -1; 58 | } 59 | pr_info("Planted return probe at %s: %p\n", 60 | my_kretprobe.kp.symbol_name, my_kretprobe.kp.addr); 61 | return 0; 62 | } 63 | 64 | static void kretprobe_exit(void) 65 | { 66 | unregister_kretprobe(&my_kretprobe); 67 | pr_info("kretprobe at %p unregistered\n", 68 | my_kretprobe.kp.addr); 69 | 70 | /* nmissed > 0 suggests that maxactive was set too low. */ 71 | pr_info("Missed probing %d instances of %s\n", 72 | my_kretprobe.nmissed, my_kretprobe.kp.symbol_name); 73 | } 74 | 75 | module_init(kretprobe_init) 76 | module_exit(kretprobe_exit) 77 | MODULE_LICENSE("GPL"); 78 | -------------------------------------------------------------------------------- /Chapter05/05_07/meta-bsp-custom/recipes-kernel/open-kretprobe/open-kretprobe.bb: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2014 Packt Publishing. 2 | 3 | SUMMARY = "kretprobe on do_sys_open kernel module." 4 | LICENSE = "GPLv2" 5 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" 6 | 7 | inherit module 8 | 9 | PR = "r0" 10 | PV = "0.1" 11 | 12 | SRC_URI = " \ 13 | file://kretprobe_open.c \ 14 | file://Makefile \ 15 | " 16 | 17 | S = "${WORKDIR}" 18 | -------------------------------------------------------------------------------- /Chapter05/05_08/commands.README: -------------------------------------------------------------------------------- 1 | echo 'p:example_probe do_sys_open dfd=%r0 filename=%r1 flags=%r2 mode=%r3' > /sys/kernel/debug/tracing/kprobe_events 2 | 3 | cat /sys/kernel/debug/tracing/kprobe_events 4 | 5 | cat /sys/kernel/debug/tracing/events/kprobes/example_probe/format 6 | 7 | echo 1 > /sys/kernel/debug/tracing/events/kprobes/example_probe/enable 8 | cat /sys/kernel/debug/tracing/trace 9 | 10 | echo '-:example_probe' >> /sys/kernel/debug/tracing/kprobe_events 11 | echo > /sys/kernel/debug/tracing/kprobe_events 12 | 13 | cat /sys/kernel/debug/tracing/kprobe_profile 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Chapter05/05_09/commands.README: -------------------------------------------------------------------------------- 1 | EXTRA_IMAGE_FEATURES += "tools-profile dbg-pkgs" 2 | -------------------------------------------------------------------------------- /Chapter05/05_10/commands.README: -------------------------------------------------------------------------------- 1 | IMAGE_INSTALL_append = " perf" 2 | 3 | EXTRA_IMAGE_FEATURES += "tools-profile" 4 | 5 | INHIBIT_PACKAGE_STRIP = "1" 6 | EXTRA_IMAGE_FEATURES += "dbg-pkgs" 7 | 8 | PACKAGE_DEBUG_SPLIT_STYLE = 'debug-file-directory' 9 | DEBUG_INFO = "1" 10 | 11 | perf stat 12 | perf stat ping -c 1 192.168.1.1 13 | 14 | perf record 15 | perf record -g -- ping -c 5 16 | 17 | perf report 18 | perf record --call-graph dwarf -- ping -c 5 19 | 20 | perf report --stdio 21 | 22 | perf annotate -d 23 | 24 | perf stat -a sleep 5 25 | 26 | perf record -a -g -- sleep 5 27 | 28 | perf list 29 | 30 | perf list ':*' 31 | 32 | perf stat -e r3 sleep 5 33 | 34 | perf script 35 | 36 | perf script -g python 37 | 38 | perf script -s perf-script.py 39 | 40 | IMAGE_INSTALL_append = " perf-python" 41 | 42 | perf probe --add "tcp_sendmsg" 43 | perf record -e probe:tcp_sendmsg -a -g -- wget http://downloads.yoctoproject.org/releases/yocto/yocto-2.4/RELEASENOTES 44 | 45 | perf report 46 | 47 | perf probe --del tcp_sendmsg 48 | 49 | perf timechart record -- 50 | 51 | perf timechart 52 | 53 | perf trace record 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /Chapter05/05_10/conf/bblayers.conf: -------------------------------------------------------------------------------- 1 | LCONF_VERSION = "7" 2 | 3 | BBPATH = "${TOPDIR}" 4 | BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../..')}" 5 | 6 | BBFILES ?= "" 7 | BBLAYERS = " \ 8 | ${BSPDIR}/sources/poky/meta \ 9 | ${BSPDIR}/sources/poky/meta-poky \ 10 | ${BSPDIR}/sources/meta-openembedded/meta-oe \ 11 | ${BSPDIR}/sources/meta-openembedded/meta-multimedia \ 12 | ${BSPDIR}/sources/meta-openembedded/meta-networking \ 13 | ${BSPDIR}/sources/meta-openembedded/meta-python \ 14 | ${BSPDIR}/sources/meta-openembedded/meta-filesystems \ 15 | ${BSPDIR}/sources/meta-freescale \ 16 | ${BSPDIR}/sources/meta-freescale-3rdparty \ 17 | ${BSPDIR}/sources/meta-freescale-distro \ 18 | ${BSPDIR}/sources/meta-custom \ 19 | ${BSPDIR}/sources/meta-bsp-custom \ 20 | ${BSPDIR}/sources/meta-qt5 \ 21 | ${BSPDIR}/sources/meta-java \ 22 | ${BSPDIR}/sources/meta-nodejs \ 23 | " 24 | -------------------------------------------------------------------------------- /Chapter05/05_10/conf/local.conf: -------------------------------------------------------------------------------- 1 | MACHINE ??= 'wandboard' 2 | DISTRO ?= 'poky' 3 | PACKAGE_CLASSES ?= "package_rpm" 4 | EXTRA_IMAGE_FEATURES ?= "debug-tweaks" 5 | USER_CLASSES ?= "buildstats image-mklibs image-prelink" 6 | PATCHRESOLVE = "noop" 7 | BB_DISKMON_DIRS = "\ 8 | STOPTASKS,${TMPDIR},1G,100K \ 9 | STOPTASKS,${DL_DIR},1G,100K \ 10 | STOPTASKS,${SSTATE_DIR},1G,100K \ 11 | STOPTASKS,/tmp,100M,100K \ 12 | ABORT,${TMPDIR},100M,1K \ 13 | ABORT,${DL_DIR},100M,1K \ 14 | ABORT,${SSTATE_DIR},100M,1K \ 15 | ABORT,/tmp,10M,1K" 16 | PACKAGECONFIG_append_pn-qemu-native = " sdl" 17 | PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl" 18 | CONF_VERSION = "1" 19 | 20 | DL_DIR ?= "${BSPDIR}/downloads/" 21 | ACCEPT_FSL_EULA = "1" 22 | 23 | INHERIT += "rm_work" 24 | 25 | EXTRA_IMAGE_FEATURES += "tools-profile dbg-pkgs ssh-server-openssh" 26 | IMAGE_INSTALL_append = " perf perf-python" 27 | INHIBIT_PACKAGE_STRIP = "1" 28 | PACKAGE_DEBUG_SPLIT_STYLE = 'debug-file-directory' 29 | DEBUG_BUILD = "1" 30 | -------------------------------------------------------------------------------- /Chapter05/05_11/commands.README: -------------------------------------------------------------------------------- 1 | IMAGE_INSTALL_append = " systemtap" 2 | 3 | EXTRA_IMAGE_FEATURES += "ssh-server-openssh" 4 | 5 | source setup-environment wandboard 6 | cd 7 | crosstap root@ sys_open.stp 8 | 9 | bitbake systemtap-native 10 | 11 | -------------------------------------------------------------------------------- /Chapter05/05_11/conf/bblayers.conf: -------------------------------------------------------------------------------- 1 | LCONF_VERSION = "7" 2 | 3 | BBPATH = "${TOPDIR}" 4 | BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../..')}" 5 | 6 | BBFILES ?= "" 7 | BBLAYERS = " \ 8 | ${BSPDIR}/sources/poky/meta \ 9 | ${BSPDIR}/sources/poky/meta-poky \ 10 | ${BSPDIR}/sources/meta-openembedded/meta-oe \ 11 | ${BSPDIR}/sources/meta-openembedded/meta-multimedia \ 12 | ${BSPDIR}/sources/meta-openembedded/meta-networking \ 13 | ${BSPDIR}/sources/meta-openembedded/meta-python \ 14 | ${BSPDIR}/sources/meta-openembedded/meta-filesystems \ 15 | ${BSPDIR}/sources/meta-freescale \ 16 | ${BSPDIR}/sources/meta-freescale-3rdparty \ 17 | ${BSPDIR}/sources/meta-freescale-distro \ 18 | ${BSPDIR}/sources/meta-custom \ 19 | ${BSPDIR}/sources/meta-bsp-custom \ 20 | ${BSPDIR}/sources/meta-qt5 \ 21 | ${BSPDIR}/sources/meta-java \ 22 | ${BSPDIR}/sources/meta-nodejs \ 23 | " 24 | -------------------------------------------------------------------------------- /Chapter05/05_11/conf/local.conf: -------------------------------------------------------------------------------- 1 | MACHINE ??= 'wandboard' 2 | DISTRO ?= 'poky' 3 | PACKAGE_CLASSES ?= "package_rpm" 4 | EXTRA_IMAGE_FEATURES ?= "debug-tweaks" 5 | USER_CLASSES ?= "buildstats image-mklibs image-prelink" 6 | PATCHRESOLVE = "noop" 7 | BB_DISKMON_DIRS = "\ 8 | STOPTASKS,${TMPDIR},1G,100K \ 9 | STOPTASKS,${DL_DIR},1G,100K \ 10 | STOPTASKS,${SSTATE_DIR},1G,100K \ 11 | STOPTASKS,/tmp,100M,100K \ 12 | ABORT,${TMPDIR},100M,1K \ 13 | ABORT,${DL_DIR},100M,1K \ 14 | ABORT,${SSTATE_DIR},100M,1K \ 15 | ABORT,/tmp,10M,1K" 16 | PACKAGECONFIG_append_pn-qemu-native = " sdl" 17 | PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl" 18 | CONF_VERSION = "1" 19 | 20 | DL_DIR ?= "${BSPDIR}/downloads/" 21 | ACCEPT_FSL_EULA = "1" 22 | 23 | INHERIT += "rm_work" 24 | 25 | EXTRA_IMAGE_FEATURES += "tools-profile ssh-server-openssh" 26 | -------------------------------------------------------------------------------- /Chapter05/05_11/sys_open.stp: -------------------------------------------------------------------------------- 1 | probe begin 2 | { 3 | print("Monitoring starts\n") 4 | printf("%6s %6s %16s\n", "UID", "PID", "NAME"); 5 | } 6 | 7 | probe kernel.function("sys_open") 8 | { 9 | printf("%6d %6d %16s\n", uid(), pid(), execname()); 10 | } 11 | 12 | probe timer.s(60) 13 | { 14 | print("Monitoring ends\n") 15 | exit() 16 | } 17 | -------------------------------------------------------------------------------- /Chapter05/05_12/commands.README: -------------------------------------------------------------------------------- 1 | IMAGE_INSTALL_append = " lttng-tools lttng-modules lttng-ust" 2 | 3 | EXTRA_IMAGE_FEATURES += "tools-profile" 4 | 5 | lttng create test-session 6 | lttng enable-event --kernel sched_switch,sched_process_fork 7 | lttng list --kernel 8 | lttng start 9 | ping -c 1 192.168.1.1 10 | lttng stop 11 | lttng destroy 12 | babeltrace /home/root/lttng-traces/test-session-20171213-201520 13 | 14 | lttng create test-user-session 15 | lttng enable-event -u -a 16 | lttng start 17 | helloworld 18 | lttng stop 19 | lttng view 20 | lttng destroy test-user-session 21 | 22 | lttng enable-event -k 23 | lttng enable-event -a -k --tracepoint 24 | lttng enable-event -a -k --syscall 25 | lttng enable-event -a -k 26 | 27 | lttng enable-event -k --probe + 28 | lttng enable-event -k --probe
29 | lttng enable-event -k --function 30 | 31 | lttng add-context -t perf:cpu:cpu-cycles -k 32 | 33 | EXTRA_IMAGE_FEATURES += "tools-sdk dev-pkgs" 34 | 35 | lttng-gen-tp hw.tp 36 | gcc -o hw helloworld.c hw.o -llttng-ust -ldl 37 | 38 | EXTRA_IMAGE_FEATURES = "tools-sdk dev-pkgs" 39 | 40 | lttng create test-session 41 | lttng enable-event --userspace 42 | lttng start 43 | ./hw 44 | lttng view 45 | lttng destroy test-session 46 | 47 | -------------------------------------------------------------------------------- /Chapter05/05_12/conf/bblayers.conf: -------------------------------------------------------------------------------- 1 | LCONF_VERSION = "7" 2 | 3 | BBPATH = "${TOPDIR}" 4 | BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../..')}" 5 | 6 | BBFILES ?= "" 7 | BBLAYERS = " \ 8 | ${BSPDIR}/sources/poky/meta \ 9 | ${BSPDIR}/sources/poky/meta-poky \ 10 | ${BSPDIR}/sources/meta-openembedded/meta-oe \ 11 | ${BSPDIR}/sources/meta-openembedded/meta-multimedia \ 12 | ${BSPDIR}/sources/meta-openembedded/meta-networking \ 13 | ${BSPDIR}/sources/meta-openembedded/meta-python \ 14 | ${BSPDIR}/sources/meta-openembedded/meta-filesystems \ 15 | ${BSPDIR}/sources/meta-freescale \ 16 | ${BSPDIR}/sources/meta-freescale-3rdparty \ 17 | ${BSPDIR}/sources/meta-freescale-distro \ 18 | ${BSPDIR}/sources/meta-custom \ 19 | ${BSPDIR}/sources/meta-bsp-custom \ 20 | ${BSPDIR}/sources/meta-qt5 \ 21 | ${BSPDIR}/sources/meta-java \ 22 | ${BSPDIR}/sources/meta-nodejs \ 23 | " 24 | -------------------------------------------------------------------------------- /Chapter05/05_12/conf/local.conf: -------------------------------------------------------------------------------- 1 | MACHINE ??= 'wandboard' 2 | DISTRO ?= 'poky' 3 | PACKAGE_CLASSES ?= "package_rpm" 4 | EXTRA_IMAGE_FEATURES ?= "debug-tweaks" 5 | USER_CLASSES ?= "buildstats image-mklibs image-prelink" 6 | PATCHRESOLVE = "noop" 7 | BB_DISKMON_DIRS = "\ 8 | STOPTASKS,${TMPDIR},1G,100K \ 9 | STOPTASKS,${DL_DIR},1G,100K \ 10 | STOPTASKS,${SSTATE_DIR},1G,100K \ 11 | STOPTASKS,/tmp,100M,100K \ 12 | ABORT,${TMPDIR},100M,1K \ 13 | ABORT,${DL_DIR},100M,1K \ 14 | ABORT,${SSTATE_DIR},100M,1K \ 15 | ABORT,/tmp,10M,1K" 16 | PACKAGECONFIG_append_pn-qemu-native = " sdl" 17 | PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl" 18 | CONF_VERSION = "1" 19 | 20 | DL_DIR ?= "${BSPDIR}/downloads/" 21 | ACCEPT_FSL_EULA = "1" 22 | 23 | INHERIT += "rm_work" 24 | 25 | EXTRA_IMAGE_FEATURES += "tools-profile tools-sdk dev-pkgs ssh-server-openssh" 26 | IMAGE_INSTALL_append = "helloworld lttng-ust-bin python3-subprocess" 27 | -------------------------------------------------------------------------------- /Chapter05/05_12/helloworld.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hw.h" 3 | 4 | main(void) 5 | { 6 | printf("Hello World"); 7 | tracepoint(hello_world_trace_provider, hw_tracepoint, 1, "I said: Hello World"); 8 | } 9 | -------------------------------------------------------------------------------- /Chapter05/05_12/hw.tp: -------------------------------------------------------------------------------- 1 | TRACEPOINT_EVENT( 2 | hello_world_trace_provider, 3 | hw_tracepoint, 4 | TP_ARGS( 5 | int, my_integer_arg, 6 | char*, my_string_arg 7 | ), 8 | TP_FIELDS( 9 | ctf_string(my_string_field, my_string_arg) 10 | ctf_integer(int, my_integer_field, my_integer_arg) 11 | ) 12 | ) 13 | -------------------------------------------------------------------------------- /Chapter05/05_12/meta-custom/recipes-example/helloworld/helloworld-1.0/0001-Change-greeting-message.patch: -------------------------------------------------------------------------------- 1 | From fefab08e7f046b5bf52ed0306163b1820463e3af Mon Sep 17 00:00:00 2001 2 | From: Alex Gonzalez 3 | Date: Thu, 12 Oct 2017 23:02:29 +0200 4 | Subject: [PATCH] Change greeting message 5 | 6 | Signed-off-by: Alex Gonzalez 7 | --- 8 | helloworld.c | 2 +- 9 | 1 file changed, 1 insertion(+), 1 deletion(-) 10 | 11 | diff --git a/helloworld.c b/helloworld.c 12 | index 71d94b7dab47..323ed6202980 100644 13 | --- a/helloworld.c 14 | +++ b/helloworld.c 15 | @@ -2,5 +2,5 @@ 16 | 17 | int main(void) 18 | { 19 | - return printf("Hello World"); 20 | + return printf("Howdy World"); 21 | } 22 | -------------------------------------------------------------------------------- /Chapter05/05_12/meta-custom/recipes-example/helloworld/helloworld-1.0/helloworld.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(void) 5 | { 6 | printf("Hello World"); 7 | tracef("I said: %s", "Hello World"); 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /Chapter05/05_12/meta-custom/recipes-example/helloworld/helloworld/helloworld.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) 4 | { 5 | return printf("Hello World"); 6 | } 7 | -------------------------------------------------------------------------------- /Chapter05/05_12/meta-custom/recipes-example/helloworld/helloworld_1.0.bb: -------------------------------------------------------------------------------- 1 | DESCRIPTION = "Simple helloworld application" 2 | SECTION = "examples" 3 | LICENSE = "MIT" 4 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" 5 | 6 | SRC_URI = "file://helloworld.c" 7 | DEPENDS = "lttng-ust" 8 | 9 | S = "${WORKDIR}" 10 | 11 | do_compile() { 12 | ${CC} ${LDFLAGS} helloworld.c -o helloworld -llttng-ust -ldl 13 | } 14 | 15 | do_install() { 16 | install -d ${D}${bindir} 17 | install -m 0755 helloworld ${D}${bindir} 18 | } 19 | -------------------------------------------------------------------------------- /Chapter05/05_13/commands.README: -------------------------------------------------------------------------------- 1 | IMAGE_INSTALL_append = " blktrace" 2 | 3 | IMAGE_INSTALL_append = " e2fsprogs-tune2fs e2fsprogs-e2fsck" 4 | 5 | e2fsck /dev/mmcblk2p1 6 | tune2fs -O ^has_journal /dev/mmcblk2p1 7 | 8 | mount /dev/mmcblk2p1 /mnt 9 | blktrace /dev/mmcblk2 10 | dd if=/dev/urandom of=/mnt/home/root/random-10k-file bs=1k 11 | 12 | blkparse mmcblk2 13 | blktrace /dev/mmcblk2 -o - | blkparse -i - 14 | btrace /dev/mmcblk2 15 | 16 | sudo blktrace -l 17 | blktrace -d /dev/mmcblk2 -h 18 | dd if=/dev/urandom of=/mnt/home/root/random-10k-file bs=1k count=10 conv=fsync 19 | 20 | blkparse -D mmcblk2 21 | 22 | -------------------------------------------------------------------------------- /Chapter05/05_13/conf/bblayers.conf: -------------------------------------------------------------------------------- 1 | LCONF_VERSION = "7" 2 | 3 | BBPATH = "${TOPDIR}" 4 | BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../..')}" 5 | 6 | BBFILES ?= "" 7 | BBLAYERS = " \ 8 | ${BSPDIR}/sources/poky/meta \ 9 | ${BSPDIR}/sources/poky/meta-poky \ 10 | ${BSPDIR}/sources/meta-openembedded/meta-oe \ 11 | ${BSPDIR}/sources/meta-openembedded/meta-multimedia \ 12 | ${BSPDIR}/sources/meta-openembedded/meta-networking \ 13 | ${BSPDIR}/sources/meta-openembedded/meta-python \ 14 | ${BSPDIR}/sources/meta-openembedded/meta-filesystems \ 15 | ${BSPDIR}/sources/meta-freescale \ 16 | ${BSPDIR}/sources/meta-freescale-3rdparty \ 17 | ${BSPDIR}/sources/meta-freescale-distro \ 18 | ${BSPDIR}/sources/meta-custom \ 19 | ${BSPDIR}/sources/meta-bsp-custom \ 20 | ${BSPDIR}/sources/meta-qt5 \ 21 | ${BSPDIR}/sources/meta-java \ 22 | ${BSPDIR}/sources/meta-nodejs \ 23 | " 24 | -------------------------------------------------------------------------------- /Chapter05/05_13/conf/local.conf: -------------------------------------------------------------------------------- 1 | MACHINE ??= 'wandboard' 2 | DISTRO ?= 'poky' 3 | PACKAGE_CLASSES ?= "package_rpm" 4 | EXTRA_IMAGE_FEATURES ?= "debug-tweaks" 5 | USER_CLASSES ?= "buildstats image-mklibs image-prelink" 6 | PATCHRESOLVE = "noop" 7 | BB_DISKMON_DIRS = "\ 8 | STOPTASKS,${TMPDIR},1G,100K \ 9 | STOPTASKS,${DL_DIR},1G,100K \ 10 | STOPTASKS,${SSTATE_DIR},1G,100K \ 11 | STOPTASKS,/tmp,100M,100K \ 12 | ABORT,${TMPDIR},100M,1K \ 13 | ABORT,${DL_DIR},100M,1K \ 14 | ABORT,${SSTATE_DIR},100M,1K \ 15 | ABORT,/tmp,10M,1K" 16 | PACKAGECONFIG_append_pn-qemu-native = " sdl" 17 | PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl" 18 | CONF_VERSION = "1" 19 | 20 | DL_DIR ?= "${BSPDIR}/downloads/" 21 | ACCEPT_FSL_EULA = "1" 22 | 23 | INHERIT += "rm_work" 24 | 25 | EXTRA_IMAGE_FEATURES_append = " tools-profile ssh-server-openssh" 26 | IMAGE_INSTALL_append = " e2fsprogs-tune2fs" 27 | IMAGE_FSTYPES_append = " tar.gz" 28 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 jovita1195 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Embedded Linux Development using Yocto Projects - Second Edition 2 | This is the code repository for [Embedded Linux Development using Yocto Projects - Second Edition](https://www.packtpub.com/virtualization-and-cloud/embedded-linux-development-using-yocto-projects-second-edition?utm_source=github&utm_medium=repository&utm_campaign=9781788470469), published by [Packt](https://www.packtpub.com/?utm_source=github). It contains all the supporting project files necessary to work through the book from start to finish. 3 | ## About the Book 4 | Yocto Project is turning out to be the best integration framework for creating reliable embedded Linux projects. It has the edge over other frameworks because of its features such as less development time and improved reliability and robustness. 5 | 6 | Embedded Linux Development using Yocto Project starts with an in-depth explanation of all Yocto Project tools, to help you perform different Linux-based tasks. The book then moves on to in-depth explanations of Poky and BitBake. It also includes some practical use cases for building a Linux subsystem project using Yocto Project tools available for embedded Linux. The book also covers topics such as SDK, recipetool, and others. 7 | 8 | By the end of the book, you will have learned how to generate and run an image for real hardware boards and will have gained hands-on experience at building efficient Linux systems using Yocto Project. 9 | 10 | ## Instructions and Navigation 11 | All of the code is organized into folders. Each folder starts with a number followed by the application name. For example, Chapter02. 12 | 13 | 14 | 15 | The code will look like the following: 16 | ``` 17 | #include "imx6q-wandboard-revd1.dts" 18 | #include "imx6qp.dtsi" 19 | / { 20 | model = "Wandboard i.MX6QuadPlus rev.D1"; 21 | }; 22 | ``` 23 | 24 | This books assumes some basic working knowledge of GNU/Linux systems and 25 | applications such as the bash shell and derivatives, as well as standard tools such as grep, 26 | patch, and diff. The examples have been tested with an Ubuntu 16.04 LTS system, but any 27 | Linux distribution supported by the Yocto project can be used. 28 | The book is structured to follow the usual development workflow of an embedded Linux 29 | product, but chapters, or even individual recipes, can be read independently. 30 | Recipes take a practical, hands-on approach using an NXP i.MX6-based system, the 31 | Wandboard Quad, as base hardware. However, any other i.MX-based hardware can be 32 | used to follow the examples. 33 | 34 | ## Related Products 35 | * [Embedded Linux Projects Using Yocto Project Cookbook](https://www.packtpub.com/virtualization-and-cloud/embedded-linux-projects-using-yocto-project-cookbook?utm_source=github&utm_medium=repository&utm_campaign=9781784395186) 36 | 37 | * [VMware vSphere 6.5 Cookbook - Third Edition](https://www.packtpub.com/virtualization-and-cloud/vmware-vsphere-65-cookbook-third-edition?utm_source=github&utm_medium=repository&utm_campaign=9781787127418) 38 | 39 | * [Mastering Linux Security and Hardening](https://www.packtpub.com/networking-and-servers/mastering-linux-security-and-hardening?utm_source=github&utm_medium=repository&utm_campaign=9781788620307) 40 | 41 | ### Suggestions and Feedback 42 | [Click here](https://docs.google.com/forms/d/e/1FAIpQLSe5qwunkGf6PUvzPirPDtuy1Du5Rlzew23UBp2S-P3wB-GcwQ/viewform) if you have any feedback or suggestions. 43 | --------------------------------------------------------------------------------