作者:付漢杰 hankf@amd.com
在PetaLinux工程中,與單板相關的UBoot、Linux等模塊,經常需要編輯、調試。
在舊版本中,可以為UBoot、Linux選擇“ext-local-src”, 指定UBoot、Linux的代碼,從而使PetaLinux使用工程師修改后帶調試信息的代碼。現在已經不建議這種模式。
對于新的的PetaLinux,建議使用命令“petalinux-devtool modify?
對于2020等舊版本,沒有命令“petalinux-devtool”。建議先導入yocto的環境,從而得到工具“devtool”,使用“devtool”替代“petalinux-devtool”。可以參考下列命令。
source /opt/pkg/petalinux/settings.sh
source /components/yocto/environment-setup-aarch64-xilinx-linux
source /components/yocto/layers/core/oe-init-build-env
在PetaLinux工程中導出所有關鍵模塊代碼?提供了統一的腳本,可以在PetaLinux 2020、2022中,導出代碼。
比如最近在u-boot-xlnx/common/usb.c的開始處,定義宏DEBUG,使能uboot的usb調試信息。其它usb相關文件也可以增加“#define DEBUG”。再編譯PetaLinux工程,運行新的boot.bin,執行命令“usb stop && usb start && fatls usb 0 && usb stop”,就會有usb調試信息。
/*
* How it works:
*
* Since this is a bootloader, the devices will not be automatic
* (re)configured on hotplug, but after a restart of the USB the
* device should work.
*
* For each transfer (except "Interrupt") we wait for completion.
*/// Hank, debug_usb#define DEBUG#include #include #include
調試完成后,執行命令下列命令,還可以給原來的recipe,創建patch。
git add <filename>
git commit -s
petalinux-devtool finish <recipe-name> <destination layer path>
調試完成后,執行命令下列命令,刪除對應的recipe。
petalinux-devtool reset to remove the source directory for the recipe from workspace.
X86 Ubuntu 18.04
PetaLinux 2022.1
PetaLinux 2021.1
PetaLinux 2020.1

