Weitere ähnliche Inhalte Ähnlich wie Effective Linux Development Using PetaLinux Tools 2017.4 (20) Kürzlich hochgeladen (20) Effective Linux Development Using PetaLinux Tools 2017.41. Effective Linux Development
using PetaLinux Tools 2017.4
Presented by Zach Pfeffer
Owner of Centennial Software Solutions
Need help? Email zach@centswsols.com
or call +1-303-246-3297
©2018 Zach Pfeffer
2. pfefferz@plc2:~/plprj4/mtd_board/build$ bitbake virtual/dtb -c build
Loading cache: 100%
|###############################################################################################
###############################################| Time: 0:00:05
Loaded 3303 entries from dependency cache.
Parsing recipes: 100%
|###############################################################################################
#############################################| Time: 0:00:11
Parsing of 2512 .bb files complete (2474 cached, 38 parsed). 3307 targets, 227 skipped, 0 masked, 0 errors.
ERROR: Nothing PROVIDES ' – c'
Power Point auto-correct changes - to –
If you see something like:
…try typing the command instead of pasting it from the presentation
(I’ve cleaned this up, but if any snuck through)
Note
©2018 Zach Pfeffer
3. Why use PetaLinux Tools 2017.4
• It is _the_ tool Xilinx released in 2017.4 to develop Linux solutions on
Zynq-7000, Zynq UltraScale+ MPSoC and MicroBlaze
• It may be easier to get support
• You may not understand Yocto and need to get started quickly
©2018 Zach Pfeffer
4. Motivation for the Talk
PetaLinux Tools is complex
• How can I figure out what PetaLinux Tools is doing?
“PetaLinux Tools” is slow
• Can I do what I need to do faster?
• This is in quotes because we’ll see that it is slow due to Yocto
This presentation will cover these questions
©2018 Zach Pfeffer
5. Topics
• Passing Options to BitBake Through PetaLinux Tools
• List all the Tasks a Recipe Provides
• Figure Out What Commands a Task Runs
• Tools to Help Debug Build Issues
• Working with Device Trees
• Working with the Linux Kernel
• How to Actually Recompile the Linux Kernel
• The Commands that Build the Linux Kernel
• The Linux Kernel Build Output
• The Location of the New Linux Kernel Binary
• Configure the Kernel
• A Way to Update bootargs
©2018 Zach Pfeffer
6. Passing Options to BitBake
Through PetaLinux Tools
Passing Options to BitBake Through PetaLinux Tools
List all the Tasks a Recipe Provides
Figure Out What Commands a Task Runs
Tools to Help Debug Build Issues
Working with Device Trees
…
©2018 Zach Pfeffer
7. Passing Options to BitBake Through PetaLinux
Tools
• PetaLinux Tools passes commands to Yocto’s BitBake to execute
• Understanding how PetaLinux Tools drives Yocto can help you figure
out how to use it best – and can help you figure out Yocto
©2018 Zach Pfeffer
8. Execute a Single bitbake Task via petalinux-build -x
$ petalinux-build –help
-x, --execute <tasks of bitbake>
Specify a bitbake task of the component
To know the list tasks for a component:
E.g. -x do_listtasks
©2018 Zach Pfeffer
12. List all the Tasks a Recipe
Provides
Passing Options to BitBake Through PetaLinux Tools
List all the Tasks a Recipe Provides
Figure Out What Commands a Task Runs
Tools to Help Debug Build Issues
Working with Device Trees
…
©2018 Zach Pfeffer
13. List all the Tasks a Recipe Provides
• PetaLinux Tool commands run Yocto recipe tasks
• Listing all recipe tasks allows users to understand everything they can
do with a recipe
• These tasks can then be passed through PetaLinux Tools
©2018 Zach Pfeffer
15. do_build Default task for a recipe - depends on all other normal tasks required to 'build' a recipe
do_checkuri Validates the SRC_URI value
do_checkuriall Validates the SRC_URI value for all recipes required to build a target
do_clean Removes all output files for a target
do_cleanall Removes all output files, shared state cache, and downloaded source files for a target
do_cleansstate Removes all output files and shared state cache for a target
do_compile Compiles the source in the compilation directory
do_configure Configures the source by enabling and disabling any build-time and configuration
options for the software being built
listtasks Output
©2018 Zach Pfeffer
16. do_create_yaml
do_deploy Writes deployable output files to the deploy directory
do_deploy_setscene Writes deployable output files to the deploy directory (setscene version)
do_devpyshell Starts an interactive Python shell for development/debugging
do_devshell Starts a shell with the environment set up for development/debugging
do_fetch Fetches the source code
do_fetchall Fetches all remote sources required to build a target
do_install Copies files from the compilation directory to a holding area
listtasks Output
©2018 Zach Pfeffer
17. do_listtasks Lists all defined tasks for a target
do_package Analyzes the content of the holding area and splits it into subsets based
on available packages and files
do_package_qa Runs QA checks on packaged files
do_package_qa_setscene Runs QA checks on packaged files (setscene version)
do_package_setscene Analyzes the content of the holding area and splits it into subsets based
on available packages and files (setscene version)
do_package_write_rpm Creates the actual RPM packages and places them in the Package Feed
area
do_package_write_rpm_setscene Creates the actual RPM packages and places them in the Package Feed
area (setscene version)
do_packagedata Creates package metadata used by the build system to generate the final
packages
listtasks Output
©2018 Zach Pfeffer
18. do_packagedata_setscene Creates package metadata used by the build system to generate the final
packages (setscene version)
do_patch Locates patch files and applies them to the source code
do_populate_lic Writes license information for the recipe that is collected later when the
image is constructed
do_populate_lic_setscene Writes license information for the recipe that is collected later when the
image is constructed (setscene version)
do_populate_sysroot Copies a subset of files installed by do_install into the sysroot in order to
make them available to other recipes
do_populate_sysroot_setscene Copies a subset of files installed by do_install into the sysroot in order to
make them available to other recipes (setscene version)
do_rm_work Removes work files after the build system has finished with them
do_rm_work_all Top-level task for removing work files after the build system has finished
with them
listtasks Output
©2018 Zach Pfeffer
19. Figure Out What Commands a
Task Runs
Passing Options to BitBake Through PetaLinux Tools
List all the Tasks a Recipe Provides
Figure Out What Commands a Task Runs
Tools to Help Debug Build Issues
Working with Device Trees
…
©2018 Zach Pfeffer
20. Figure Out What Commands a Task Runs
• If something goes wrong you may need to figure out what commands
a recipe’s tasks ran
©2018 Zach Pfeffer
21. 1. Get the recipe and task from ./build/build.log:
NOTE: recipe device-tree-generation-
xilinx+gitAUTOINC+3c7407f6f8-r0: task
do_listtasks: Started
find . -name "log.task_order" -printf "%T+t%pn" | sort
2. Find log.task_order with:
2018-05-21+17:12:34.2737244000
./build/tmp/work/plnx_aarch64-xilinx-
linux/device-tree-
generation/xilinx+gitAUTOINC+3c7407f6f8-
r0/temp/log.task_order
Output:
Figure Out What Commands a Task Runs
What
virtual/dtb
turned into
We’ll
discus
s this
in a
few
slides
22. 4. Open log.task_order
…
do_populate_lic (10841): log.do_populate_lic.10841
do_rm_work (10872): log.do_rm_work.10872
do_rm_work_all (16290): log.do_rm_work_all.16290
do_listtasks (9952): log.do_listtasks.9952
do_package_write_rpm_setscene (10871):
log.do_package_write_rpm_setscene.10871
do_rm_work_all (13147): log.do_rm_work_all.13147
do_rm_work_all (14548): log.do_rm_work_all.14548
do_listtasks (16553): log.do_listtasks.16553
5. Find log.do_listtasks:
./build/tmp/work/plnx_aarch64-xilinx-linux/device-tree-
generation/xilinx+gitAUTOINC+3c7407f6f8-r0/temp/
3. Note log.task_order’s directory
Figure Out What Commands a Task Runs
23. 6. Open log.do_listtasks to see command output:
pfefferz@plc2:~/plprj4/mtd_board$ cat ./build/tmp/work/plnx_aarch64-xilinx-
linux/device-tree-generation/xilinx+gitAUTOINC+3c7407f6f8-
r0/temp/log.do_listtasks
DEBUG: Executing python function do_listtasks
do_build Default task for a recipe - depends on all
other normal tasks required to 'build’ a
recipe
do_checkuri Validates the SRC_URI value
do_checkuriall Validates the SRC_URI value for all recipes
required to build a target
do_clean Removes all output files for a target
…
Figure Out What Commands a Task Runs
©2018 Zach Pfeffer
25. Tools to Help Debug Build Issues
…
Figure Out What Commands a Task Runs
Tools to Help Debug Build Issues
Working with Device Trees
Working with the Linux Kernel
…
©2018 Zach Pfeffer
26. Tools to Help Debug Build Issues
• Linux provides some good command line tools to help navigate which
files the build is updating
• Since Yocto updates a _lot_ of files we can list the files in update
order to get a feel for what happened when a PetaLinux Tools
command runs.
©2018 Zach Pfeffer
27. Find every touched file from PetaLinux Prj dir
find . -cmin -12 -printf "%T+t%pn" | sort
File's status
was last
changed for
less than 12
minutes ago
(use greater
than the time
needed for
the last
command)
Print in the following
format:
%T file's last modification
time in
+ date and time separated
by `+', for example: `2004-
04-28+22:22:05.0'
t a tab
%p file's name
Find from
the
current
directory
Sort the
result (puts
the last
modified
result last)
28. A Better find
touch start
<Do operation>
find . -cnewer start -printf "%T+t%pn“ | sort
This is better because you can get an exact list of files that changed
– the time is relative to start
start can be named anything a file can be named
©2018 Zach Pfeffer
29. Find and Output Text from Updated Files
while read LINE
do
F=$(echo $LINE | awk -F ' ' '{print $2}')
echo $F
if [ -f $F ]
then
FILE_TYPE=$(file -b --mime-encoding $F)
echo "$FILE_TYPE"
if [ $FILE_TYPE == "us-ascii" ]
then
echo ">>>>>>>>>>>>>>>>"
echo "NAME: $F"
echo "CONTENTS FOLLOW"
cat $F
fi
fi
done < $1
©2018 Zach Pfeffer
While lines in the file, who’s name was passed as the first argument $1
Strip off the time stamp
Output the name of the file
Get the file encoding
If its ASCII
Output the contents
30. Working with Device Trees
…
Tools to Help Debug Build Issues
Working with Device Trees
Working with the Linux Kernel
How to Actually Recompile the Linux Kernel
…
©2018 Zach Pfeffer
31. Working with Device Trees
• Rebuidling device trees, the Linux kernel, the rootfs and passing
options to bootargs are some of the fundamental tasks developers do
all day
• Making this fast is a bottom-line developer efficiency improvement
©2018 Zach Pfeffer
32. Update a Device Tree
project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi
Edit system-user.dtsi @
Full
Overlay
Example
/include/ "system-conf.dtsi"
/ {
compatible = "xlnx,zynqmp-zcu102", "xlnx,zynqmp";
#address-cells = <0x2>;
#size-cells = <0x2>;
model = "ZynqMP ZCU102 RevA";
cpus {
#address-cells = <0x1>;
#size-cells = <0x0>;
...
};
};
©2018 Zach Pfeffer
33. Update a Device Tree
project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi
Edit system-user.dtsi @
Full
Overlay
Example
/include/ "system-conf.dtsi"
/ {
compatible = "xlnx,zynqmp-zcu102", "xlnx,zynqmp";
#address-cells = <0x2>;
#size-cells = <0x2>;
model = "ZynqMP ZCU102 RevA";
cpus {
#address-cells = <0x1>;
#size-cells = <0x0>;
...
};
};
12
Watchout! This is a .dtsi file (1). You’ll get a hard to debug compile-time error
if you don’t remove (would be at 2) the /dts-v1/; from the original dts file.
©2018 Zach Pfeffer
35. Recompile a Device Tree to BitBake
petalinux-build -c device-tree
bitbake virtual/dtb
©2018 Zach Pfeffer
36. Time to complete: 13 min 30 secs
[INFO] building device-tree
[INFO] sourcing bitbake
INFO: bitbake virtual/dtb
Loading cache: 100% |############################################| Time: 0:00:01
Loaded 723 entries from dependency cache.
Parsing recipes: 100% |##########################################| Time: 0:12:05
Parsing of 2512 .bb files complete (567 cached, 1945 parsed). 3307 targets, 227
skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies
Initialising tasks: 100% |#######################################| Time: 0:00:33
Checking sstate mirror object availability: 100% |###############| Time: 0:00:51
©2018 Zach Pfeffer
39. NOTE: recipe petalinux-user-image-1.0-r0: task do_image: Succeeded
NOTE: recipe petalinux-user-image-1.0-r0: task do_image_cpio: Succeeded
NOTE: recipe petalinux-user-image-1.0-r0: task do_image_jffs2: Succeeded
NOTE: recipe petalinux-user-image-1.0-r0: task do_image_ext3: Succeeded
NOTE: recipe petalinux-user-image-1.0-r0: task do_image_tar: Succeeded
NOTE: recipe petalinux-user-image-1.0-r0: task do_image_ext4: Succeeded
NOTE: recipe petalinux-user-image-1.0-r0: task do_image_complete: Succeeded
NOTE: recipe linux-xlnx-4.9-xilinx-v2017.4+gitAUTOINC+b450e900fd-r0: task do_bundle_initramfs: Succeeded
NOTE: recipe linux-xlnx-4.9-xilinx-v2017.4+gitAUTOINC+b450e900fd-r0: task do_deploy: Succeeded
NOTE: recipe petalinux-user-image-1.0-r0: task do_image_qa: Succeeded
NOTE: recipe linux-xlnx-4.9-xilinx-v2017.4+gitAUTOINC+b450e900fd-r0: task do_package_qa: Succeeded
NOTE: recipe linux-xlnx-4.9-xilinx-v2017.4+gitAUTOINC+b450e900fd-r0: task do_rm_work: Succeeded
NOTE: recipe iproute2-4.7.0-r0: task do_rm_work: Succeeded
NOTE: recipe canutils-4.0.6-r0: task do_rm_work: Succeeded
NOTE: recipe petalinux-user-image-1.0-r0: task do_xilinx_fitimage: Succeeded
NOTE: recipe device-tree-generation-xilinx+gitAUTOINC+3c7407f6f8-r0: task do_rm_work: Succeeded
NOTE: recipe u-boot-xlnx-v2017.01-xilinx-v2017.4+gitAUTOINC+5fa7d2ed06-r0: task do_rm_work: Succeeded
NOTE: recipe petalinux-user-image-1.0-r0: task do_rm_work: Succeeded
NOTE: recipe device-tree-generation-xilinx+gitAUTOINC+3c7407f6f8-r0: task do_rm_work_all: Succeeded
Look for “Succeeded” to Trace recipes
40. Errors You May See
/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/
games:/snap/bin"; export HOME="/home/pfefferz"; git -c
core.fsyncobjectfiles=0 ls-remote
https://github.com/sbabic/swupdate.git failed with exit code 128,
output:
fatal: unable to access 'https://github.com/sbabic/swupdate.git/':
Couldn't resolve host 'github.com'
Summary: There were 14 WARNING messages shown.
Summary: There was 1 ERROR message shown, returning a non-zero exit
code.
ERROR: Failed to build device-tree
webtalk failed:PetaLinux statistics:extra lines
detected:notsent_nofile!
webtalk failed:Failed to get PetaLinux usage statistics!
There may not be a network.
Check your network connection!
©2018 Zach Pfeffer
41. Find all the Device Trees
find . -name '*.dts' -or -name '*.dtsi'
Run this from the top of your PetaLinux Project:
Example output:
./project-spec/meta-user/recipes-bsp/device-
tree/files/system-user.dtsi
…
./components/plnx_workspace/device-tree/device-tree-
generation/system-top.dts
…
©2018 Zach Pfeffer
42. Working with the Linux Kernel
…
Working with Device Trees
Working with the Linux Kernel
How to Actually Recompile the Linux Kernel
The Commands that Build the Linux Kernel
…
©2018 Zach Pfeffer
43. Compile the Linux Kernel
petalinux-build -c kernel -x compile
bitbake virtual/kernel -c compile
©2018 Zach Pfeffer
44. Make a Change to a Kernel Source File
1. Find the source code
find . -name "kernel-source"
./build/tmp/work-shared/plnx_aarch64/kernel-source
2. Edit a source file
/* Do the rest non-__init'ed, we're now alive */
printk(KERN_ERR "######## Finished %s ########n", __func__);
rest_init();
}
"init/main.c" 1050L, 25628C written
45. Recompile the Linux Kernel
pfefferz@plc2:~/plprj4/mtd_board$ petalinux-build -c kernel -x
compile
[INFO] building kernel
[INFO] sourcing bitbake
INFO: bitbake virtual/kernel -c compile
…
NOTE: Tasks Summary: Attempted 284 tasks of which 284 didn't
need to be rerun and all succeeded.
INFO: Copying Images from deploy to images
NOTE: Failed to copy built images to tftp dir: /tftpboot
[INFO] successfully built kernel
webtalk failed:PetaLinux statistics:extra lines
detected:notsent_nofile!
webtalk failed:Failed to get PetaLinux usage statistics!
Huh...?
46. Compile the Linux Kernel
petalinux-build -c kernel -x compile
Does not recompile the kernel
©2018 Zach Pfeffer
47. How to Actually Recompile the
Linux Kernel
…
Working with the Linux Kernel
How to Actually Recompile the Linux Kernel
The Commands that Build the Linux Kernel
The Linux Kernel Build Output
…
©2018 Zach Pfeffer
48. petalinux-build -help
pfefferz@plc2:~/plprj4/mtd_board$ petalinux-build --help
…
Options:
…
-c, --component <COMPONENT> Specify the component
it will build the specified component and its
dependencies
E.g. -c rootfs
E.g. -c myapp
-x, --execute <tasks of bitbake> Specify a bitbake task of the component
To know the list tasks for a component:
E.g. -x do_listtasks
-f,--force Force run a specific task ignoring the stamps
Force run has to be for a component or its tasks
E.g. -c myapp -f
E.g. -c myapp -x compile -f
49. Look at -c CMD
$ bitbake -h
Usage: bitbake [options] [recipename/target recipe:do_task ...]
Executes the specified task (default is 'build') for a given set of target
recipes (.bb files).
It is assumed there is a conf/bblayers.conf available in cwd or in BBPATH which
will provide the layer, BBFILES and other configuration information.
Options:
…
-c CMD, --cmd=CMD Specify the task to execute. The exact options available
depend on the metadata. Some examples might be 'compile' or 'populate_sysroot'
or 'listtasks' may give a list of the tasks available.
-C INVALIDATE_STAMP, --clear-stamp=INVALIDATE_STAMP Invalidate the stamp for the
specified task such as 'compile' and then run the default task for the specified
target(s).
©2018 Zach Pfeffer
50. The Fastest Way to Compile the Linux Kernel
# get access to bitbake
source
$PETALINUX_TOOLS_INSTALL_DIR/components/yocto/source/aarch64/environment-
setup-aarch64-xilinx-linux
cd $PETALINUX_PROJS_DIR/$PETALINUX_PROJ_NAME
source
$PETALINUX_TOOLS_INSTALL_DIR/components/yocto/source/aarch64/layers/core/
oe-init-build-env
export BB_ENV_EXTRAWHITE="$BB_ENV_EXTRAWHITE PETALINUX"
1. Pull bitbake into your environment
©2018 Zach Pfeffer
51. bitbake virtual/kernel -C compile -c compile
2. Just run compile:
-c CMD
Specify the task to
execute. The exact
options available
depend on the
metadata. Some
examples might
be 'compile' or
'populate_sysroot' or
'listtasks' may
give a list of the
tasks available.
-C
INVALIDATE_STAMP,
Invalidate the
stamp for the
specified task
such as 'compile'
and then run the
default task for
the specified
target(s).
The Fastest Way to Compile the Linux
Kernel
©2018 Zach Pfeffer
52. 1. Update kernel-source/init/main.c and 2. build:
pfefferz@plc2:~/plprj4/mtd_board/build$ bitbake virtual/kernel -C compile -c compile
Loading cache: 100%
|#######################################################################################################|
Time: 0:00:05
Loaded 3303 entries from dependency cache.
Parsing recipes: 100%
|#####################################################################################################| Time:
0:00:12
Parsing of 2512 .bb files complete (2474 cached, 38 parsed). 3307 targets, 227 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies
NOTE: Tainting hash to force rebuild of task
/home/pfefferz/tools/opt/pkg/petalinux/components/yocto/source/aarch64/layers/meta-xilinx/recipes-
kernel/linux/linux-xlnx_4.9.bb, do_compile
WARNING: /home/pfefferz/tools/opt/pkg/petalinux/components/yocto/source/aarch64/layers/meta-xilinx/recipes-
kernel/linux/linux-xlnx_4.9.bb.do_compile is tainted from a forced run
Initialising tasks: 100%
|##################################################################################################| Time:
0:00:16
+Compile Time
The Fastest Way to Compile the Linux Kernel
©2018 Zach Pfeffer
53. The Commands that Build the
Linux Kernel
…
How to Actually Recompile the Linux Kernel
The Commands that Build the Linux Kernel
The Linux Kernel Build Output
The Location of the New Linux Kernel Binary
…
©2018 Zach Pfeffer
54. NAME: ./tmp/work/plnx_aarch64-xilinx-linux/linux-xlnx/4.9-xilinx-
v2017.4+gitAUTOINC+b450e900fd-r0/temp/run.do_compile.20819
CONTENTS FOLLOW
#!/bin/sh
...
set -e
export BUILD_CPPFLAGS="-
isystem/home/pfefferz/plprj4/mtd_board/build/tmp/sysroots/x86_64-linux/usr/include"
export base_prefix=""
export LOGNAME="pfefferz"
export BUILD_CFLAGS="-
isystem/home/pfefferz/plprj4/mtd_board/build/tmp/sysroots/x86_64-linux/usr/include
-O2 -pipe"
...
kernel_do_compile() {
...
for typeformake in Image ; do
oe_runmake ${typeformake} CC="aarch64-xilinx-linux-gcc -fuse-
ld=bfd --sysroot=/home/pfefferz/plprj4/mtd_board/build/tmp/sysroots/plnx_aarch64"
LD="aarch64-xilinx-linux-ld.bfd --
sysroot=/home/pfefferz/plprj4/mtd_board/build/tmp/sysroots/plnx_aarch64"
$use_alternate_initrd
The commands used to build the kernel
are listed in run.do_compile* files
The Commands that Build the Linux Kernel
55. The Linux Kernel Build Output
…
The Commands that Build the Linux Kernel
The Linux Kernel Build Output
The Location of the New Linux Kernel Binary
Configure the Kernel
…
©2018 Zach Pfeffer
56. NAME: ./tmp/work/plnx_aarch64-xilinx-linux/linux-xlnx/4.9-xilinx-
v2017.4+gitAUTOINC+b450e900fd-r0/temp/log.do_compile.20819
CONTENTS FOLLOW
DEBUG: Executing shell function do_compile
NOTE: make -j 1 HOSTCC=gcc HOSTCPP=gcc -E Image CC=aarch64-xilinx-linux-gcc -
fuse-ld=bfd --
sysroot=/home/pfefferz/plprj4/mtd_board/build/tmp/sysroots/plnx_aarch64 LD=aarch64-
xilinx-linux-ld.bfd --
sysroot=/home/pfefferz/plprj4/mtd_board/build/tmp/sysroots/plnx_aarch64
CHK include/config/kernel.release
Using /home/pfefferz/plprj4/mtd_board/build/tmp/work-shared/plnx_aarch64/kernel-
source as source for kernel
GEN ./Makefile
CHK include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
CHK include/generated/bounds.h
CHK include/generated/timeconst.h
CHK include/generated/asm-offsets.h
CALL /home/pfefferz/plprj4/mtd_board/build/tmp/work-
shared/plnx_aarch64/kernel-source/scripts/checksyscalls.sh
CC init/main.o
OBJCOPY arch/arm64/boot/Image
The output from the commands used to
build the kernel are listed in
log.do_compile* files
The Linux Kernel Build Output
©2018 Zach Pfeffer
57. The Location of the New Linux
Kernel Binary
…
The Linux Kernel Build Output
The Location of the New Linux Kernel Binary
Configure the Kernel
A Way to Update bootargs
©2018 Zach Pfeffer
58. ...
CHK include/generated/timeconst.h
CHK include/generated/asm-offsets.h
CALL /home/pfefferz/plprj4/mtd_board/build/tmp/work-
shared/plnx_aarch64/kernel-source/scripts/checksyscalls.sh
CC init/main.o
OBJCOPY arch/arm64/boot/Image
./build/tmp/work/plnx_aarch64-xilinx-linux/linux-xlnx/4.9-xilinx-
v2017.4+gitAUTOINC+b450e900fd-r0/linux-plnx_aarch64-standard-
build/arch/arm64/boot/Image
This path
…is here
The Location of the New Linux Kernel Binary
©2018 Zach Pfeffer
59. arch/arm64/boot/Image does not have an intramfs
images/linux/Image has an initramfs
Watch Out!
There is a kernel binary with a initramfs in arch/arm64/boot/:
Image.initramfs
If you usually boot images/linux/Image use
arch/arm64/boot/Image.initramfs
Build Image.initramfs with
bitbake virtual/kernel -C do_bundle_initramfs -c do_bundle_initramfs
The Location of the New Linux Kernel Binary
60. Boot arch/arm64/boot/Image
Package arch/arm/boot/Image for U-Boot with:
./build/tmp/sysroots/x86_64-linux/usr/bin/mkimage -A arm64 -T kernel -C none
-a 0x00080000 -e 00080000 -d ./build/tmp/work/plnx_aarch64-xilinx-
linux/linux-xlnx/4.9-xilinx-v2017.4+gitAUTOINC+b450e900fd-r0/linux-
plnx_aarch64-standard-build/arch/arm64/boot/Image ./images/linux/uImage
-A set architecture to arm64
-T set image to kernel
-C no compression
-a set load address to 0x80000
-e set entry point to 0x80000
-d image
U-Boot image
©2018 Zach Pfeffer
61. Configure the Kernel
…
The Location of the New Linux Kernel Binary
Configure the Kernel
A Way to Update bootargs
©2018 Zach Pfeffer
62. Get the configure Task Name
bitbake virtual/kernel -c listtasks
©2018 Zach Pfeffer
63. linux-xlnx-4.9-xilinx-v2017.4+gitAUTOINC+b450e900fd-r0 do_listtasks
do_build Default task for a recipe - depends on all other normal tasks required
to 'build' a recipe
do_bundle_initramfs Combines an initial ramdisk image and kernel together to form a single
image
do_checkuri Validates the SRC_URI value
do_checkuriall Validates the SRC_URI value for all recipes required to build a target
do_clean Removes all output files for a target
do_cleanall Removes all output files, shared state cache, and downloaded source
files for a target
©2018 Zach Pfeffer
64. linux-xlnx-4.9-xilinx-v2017.4+gitAUTOINC+b450e900fd-r0 do_listtasks
do_cleansstate Removes all output files and shared state cache for a target
do_compile Compiles the source in the compilation directory
do_compile_kernelmodules Compiles loadable modules for the Linux kernel
do_configure Configures the source by enabling and disabling any build-time
and configuration options for the software being built
do_deploy Writes deployable output files to the deploy directory
do_deploy_setscene Writes deployable output files to the deploy directory (setscene
version)
©2018 Zach Pfeffer
65. linux-xlnx-4.9-xilinx-v2017.4+gitAUTOINC+b450e900fd-r0 do_listtasks
do_devpyshell Starts an interactive Python shell for development/debugging
do_devshell Starts a shell with the environment set up for development/debugging
do_diffconfig Compares the old and new config files after running do_menuconfig for the
kernel
do_fetch Fetches the source code
do_fetchall Fetches all remote sources required to build a target
do_install Copies files from the compilation directory to a holding area
©2018 Zach Pfeffer
66. linux-xlnx-4.9-xilinx-v2017.4+gitAUTOINC+b450e900fd-r0 do_listtasks
do_kernel_checkout Checks out source/meta branches for a linux-yocto style
kernel
do_kernel_configcheck Validates the kernel configuration for a linux-yocto style
kernel
do_kernel_configme Assembles the kernel configuration for a linux-yocto style
kernel
do_kernel_link_images Creates a symbolic link in arch/$arch/boot for vmlinux and
vmlinuz kernel images
do_kernel_metadata
do_kernel_version_sanity_check
©2018 Zach Pfeffer
67. linux-xlnx-4.9-xilinx-v2017.4+gitAUTOINC+b450e900fd-r0 do_listtasks
do_listtasks Lists all defined tasks for a target
do_menuconfig Runs 'make menuconfig' for the kernel
do_package Analyzes the content of the holding area and splits it into subsets
based on available packages and files
do_package_qa Runs QA checks on packaged files
do_package_qa_setscene Runs QA checks on packaged files (setscene version)
do_package_setscene Analyzes the content of the holding area and splits it into subsets
based on available packages and files (setscene version)
©2018 Zach Pfeffer
68. linux-xlnx-4.9-xilinx-v2017.4+gitAUTOINC+b450e900fd-r0 do_listtasks
do_package_write_rpm Creates the actual RPM packages and places them in the
Package Feed area
do_package_write_rpm_setscene Creates the actual RPM packages and places them in the
Package Feed area (setscene version)
do_packagedata Creates package metadata used by the build system to
generate the final packages
do_packagedata_setscene Creates package metadata used by the build system to
generate the final packages (setscene version)
do_patch Locates patch files and applies them to the source code
do_populate_lic Writes license information for the recipe that is collected
later when the image is constructed
69. linux-xlnx-4.9-xilinx-v2017.4+gitAUTOINC+b450e900fd-r0 do_listtasks
do_populate_lic_setscene Writes license information for the recipe that is collected later when
the image is constructed (setscene version)
do_populate_sysroot Copies a subset of files installed by do_install into the sysroot in
order to make them available to other recipes
do_populate_sysroot_setscene Copies a subset of files installed by do_install into the sysroot in
order to make them available to other recipes (setscene version)
do_rm_work Removes work files after the build system has finished with them
do_rm_work_all Top-level task for removing work files after the build system has
finished with them
do_savedefconfig Creates a minimal Linux kernel configuration file
©2018 Zach Pfeffer
72. A Way to Update bootargs
…
Configure the Kernel
A Way to Update bootargs
©2018 Zach Pfeffer
73. Update bootargs in system-user.dtsi
File @ ./project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi
chosen {
bootargs = "earlycon";
stdout-path = "serial0:115200n8";
};
Change this
©2018 Zach Pfeffer
75. Where is the New DTB?
This file…
./tmp/work/plnx_aarc
h64-xilinx-
linux/device-tree-
generation/xilinx+gitA
UTOINC+3c7407f6f8-
r0/temp/run.do_com
pile says the file is at:
…here:
/home/pfefferz/plprj4/mt
d_board/build/../compon
ents/plnx_workspace/dev
ice-tree/device-tree-
generation/plnx_aarch64-
system.dtb
©2018 Zach Pfeffer
…says
the file
is…
76. “Package” the DTB without the recipe
cp
/home/pfefferz/plprj4/mtd_board/build/../components/plnx_works
pace/device-tree/device-tree-generation/plnx_aarch64-system.dtb
../images/linux/system.dtb
©2018 Zach Pfeffer
Copy …/plnx_aarch64-system.dtb to …images/linux/system.dtb
PetaLinux Tools expects output here
77. Summary
• You have seen how to understand some of PetaLinux Tools 2017.4
complexity
• You have learned a way to figure out what PetaLinux Tools 2017.4 and
Yocto do when building
• You have seen the most efficient ways to recompile kernels, device
trees and bootargs
©2018 Zach Pfeffer
78. Looking for more help with PetaLinux Tools?
Check out https://www.zachpfeffer.com
Enjoyed this?