Yocto Jethro 2.0+meta-altera:Cyclone V SOC设备树与文件系统配置求助
Hey there, let's work through your issues step by step—this is a super common pitfall when getting started with Yocto's kernel and device tree workflow!
为什么修改./tmp/work-shared/cyclone5/kernel-source/.../socfpga_cyclone5_sockit.dts没效果?
The tmp/work-shared directory is a temporary build artifact—Yocto extracts kernel sources here during builds, but any changes you make here will either get overwritten on the next bitbake run, or won't be picked up by the build system at all. Yocto relies on its layer-based recipe system to track persistent modifications to kernel sources (including device trees), so you need to make changes through the proper channels.
正确的设备树修改方法
You have two solid options to customize the device tree permanently:
Add a patch via your custom meta-layer
- First, use
devtoolto create a persistent workspace for kernel modifications:
This clones the kernel source intodevtool modify linux-alterabuild/workspace/sources/linux-altera—this is where you'll make your changes. - Edit the
socfpga_cyclone5_sockit.dtsfile in this workspace directory. - Generate a patch from your changes:
cd workspace/sources/linux-altera git diff > 0001-custom-cyclone5-sockit-dts.patch - Move this patch to your custom meta-layer's kernel recipe folder (e.g.,
meta-custom/recipes-kernel/linux/linux-altera/). - Create a
linux-altera_%.bbappendfile in the same folder with this content:FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" SRC_URI += "file://0001-custom-cyclone5-sockit-dts.patch" - Rebuild the kernel with
bitbake linux-alterato apply your changes.
- First, use
Replace the entire DTS file
- Copy your modified
socfpga_cyclone5_sockit.dtsto your custom meta-layer's kernel recipe directory. - Update your
linux-altera_%.bbappendto override the original file:FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" SRC_URI += "file://socfpga_cyclone5_sockit.dts" do_configure_append() { cp ${WORKDIR}/socfpga_cyclone5_sockit.dts ${S}/arch/arm/boot/dts/ } - Rebuild the kernel with
bitbake linux-altera.
- Copy your modified
关于bootargs中的波特率问题
The console baud rate in bootargs is usually set in one of three places:
- U-Boot configuration: If your board uses U-Boot, the bootargs might be hardcoded in the U-Boot environment or config. You can customize U-Boot using the same bbappend approach for your meta-layer.
- Device tree
chosennode: Add or modify this node in your DTS to set the baud rate directly:chosen { bootargs = "console=ttyS0,115200 root=/dev/mmcblk0p2 rootwait"; }; - Yocto
local.conf: Override the default bootargs globally by adding this line tobuild/conf/local.conf:
Adjust the root device path to match your board's storage setup.KERNEL_BOOTARGS = "console=ttyS0,115200 root=/dev/mmcblk0p2 rootwait"
Don't forget to rebuild the relevant components (kernel or U-Boot) after making changes, then reflash your image to the board.
内容的提问来源于stack exchange,提问作者Paddler

