This guide provides instructions on how to customize U-Boot and the Linux kernel within the Yocto Project build system. It also covers creating patches and simple BitBake recipes. This is essential for adapting the system to specific hardware or software requirements for your TQ modules.
We assume you have a working Yocto Project build environment set up and are familiar with basic BitBake commands. For TQ-specific layers, please refer to our official repositories:
Before you begin, ensure you have:
Source your build environment:
source poky/oe-init-build-env <build-directory>
U-Boot (Das U-Boot Universal Boot Loader) is often the first piece of software that runs on your embedded device. Customizations might include changing boot commands, enabling/disabling drivers, or adjusting hardware initialization.
To modify U-Boot, use `devtool` to extract and prepare the source code. Replace `u-boot-tq` (or the specific U-Boot recipe name for your platform, often found in `meta-tq`) if it differs. You can find the recipe name by looking into your machine configuration file or by searching in your layers.
devtool modify u-boot-tq
This command will:
Navigate to the U-Boot source directory:
cd <build-directory>/workspace/sources/u-boot-tq
You can now make your changes. Common modifications include:
After making your changes, commit them using Git:
git add <changed-files> git commit -m "My U-Boot customization: <brief description>"
Build U-Boot with your changes:
bitbake u-boot-tq
Or, if you want to build only U-Boot and deploy it to your image for faster testing (this might skip some image generation steps):
devtool build u-boot-tq
Then, deploy the image containing your U-Boot to your target hardware and test thoroughly. The resulting U-Boot binary (e.g., `u-boot.imx`, `u-boot.bin`, `u-boot.img` depending on the platform) will be in `<build-directory>/tmp/deploy/images/<your-machine>/`.
Once you are satisfied with your changes, create a patch. Ensure you are in the U-Boot source directory (`<build-directory>/workspace/sources/u-boot-tq`).
If you have one commit:
git format-patch -1 -o <path-to-your-meta-layer>/recipes-bsp/u-boot/files/
If you have multiple commits, you might want to squash them or create multiple patches:
git format-patch HEAD~N -o <path-to-your-meta-layer>/recipes-bsp/u-boot/files/
(Replace `N` with the number of commits).
Name your patch descriptively, e.g., `0001-my-custom-u-boot-feature.patch`.
Create or edit the U-Boot append file (`.bbappend`) in your custom layer. This is typically located at `<your-meta-layer>/recipes-bsp/u-boot/u-boot-tq_%.bbappend` or a similar path.
Add your patch to `SRC_URI`:
FILESEXTRAPATHS_prepend := "${THISDIR}/files:" SRC_URI += " \ file://0001-my-custom-u-boot-feature.patch \ "
devtool reset u-boot-tq
This will remove the workspace version and the build system will use your patched recipe from your meta-layer.
Kernel customization allows you to change device drivers, enable kernel features, modify the device tree, and more.
Use `devtool` to prepare the kernel source. The recipe name is usually `virtual/kernel`.
devtool modify virtual/kernel
This command works similarly to the U-Boot one:
Navigate to the kernel source directory:
cd <build-directory>/workspace/sources/linux
Common kernel modifications:
To change kernel configuration options (`.config`), use `menuconfig`:
<code bash> bitbake virtual/kernel -c menuconfig </code> Or, using `devtool`: <code bash> devtool menuconfig virtual/kernel </code> Save your changes. This will typically create a `defconfig` file or a configuration fragment.
These are usually located in `arch/<your-arch>/boot/dts/`. For TQ modules, you might find them under a vendor-specific path (e.g., `arch/arm64/boot/dts/freescale/` for NXP i.MX based modules or `arch/arm64/boot/dts/st/` for STM32MP1 based modules). Edit the relevant device tree source file for your board.
Commit your changes using Git:
git add <changed-files-or-defconfig> git commit -m "My kernel customization: <brief description>"
Build the kernel with your changes:
bitbake virtual/kernel
Or:
devtool build virtual/kernel
The kernel image (e.g., `zImage`, `uImage`, `Image`) and device tree blobs (`.dtb`) will be in `<build-directory>/tmp/deploy/images/<your-machine>/`. Deploy and test on your hardware.
In the kernel source directory (`<build-directory>/workspace/sources/linux`):
git format-patch HEAD~N -o <path-to-your-meta-layer>/recipes-kernel/linux/files/
(Replace `N` with the number of commits). Name it descriptively, e.g., `0001-my-kernel-driver-fix.patch`.
After running `menuconfig` and saving, `devtool` often helps manage configuration fragments. Alternatively, you can generate a configuration fragment:
<code bash> bitbake virtual/kernel -c savedefconfig </code> This will create a `defconfig` file in `<build-directory>/tmp/work/<your-machine>-poky-linux-gnueabi/linux-yocto/<kernel-version>/linux-<your-machine>-standard-build/`. Rename this to something like `my_custom_config.cfg` and copy it to your layer: `<path-to-your-meta-layer>/recipes-kernel/linux/files/`.
Create or edit the kernel append file (`.bbappend`) in your layer. This is often `<your-meta-layer>/recipes-kernel/linux/linux-yocto_%.bbappend` or specific to the kernel version/type (e.g., `linux-imx_%.bbappend`).
Add your patch(es) and/or configuration fragment to `SRC_URI`:
FILESEXTRAPATHS_prepend := "${THISDIR}/files:" SRC_URI += " \ file://0001-my-kernel-driver-fix.patch \ file://my_custom_config.cfg \ "
devtool reset virtual/kernel
The process described for U-Boot and Kernel (using `git format-patch`) is the standard way to create patches for any software component modified via `devtool modify <recipe-name>`.
Key steps:
1. `devtool modify <recipe-name>` 2. Make changes in `<build-directory>/workspace/sources/<recipe-name>` 3. Commit changes with `git`. 4. Generate patch(es) with `git format-patch`. 5. Copy patch(es) to your layer, typically under `<your-meta-layer>/<category>/<recipe-name>/files/`. 6. Add `file://<patch-name>.patch` to `SRC_URI` in the recipe's `.bbappend` file. 7. `devtool reset <recipe-name>`
Let's say you want to add a custom script or a small, pre-compiled binary to your image.
Create a directory structure in your meta-layer:
<your-meta-layer>/ recipes-custom/ my-custom-app/ files/ my_script.sh # Your script or binary my-custom-app_0.1.bb # Your recipe file
1. Create your script: `<your-meta-layer>/recipes-custom/my-custom-app/files/my_script.sh`
#!/bin/sh echo "Hello from TQ Custom App!"
Make sure it's executable: `chmod +x my_script.sh`.
2. Create the recipe file: `<your-meta-layer>/recipes-custom/my-custom-app/my-custom-app_0.1.bb`
SUMMARY = "My Custom Application" DESCRIPTION = "A simple shell script example for TQ." LICENSE = "MIT" # Or your preferred license LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" # Point to the files directory within this recipe SRC_URI = "file://my_script.sh" # Source directory (where files from SRC_URI are unpacked) S = "${WORKDIR}" # Installation: Copy the script to /usr/bin in the target image do_install() { install -d ${D}${bindir} install -m 0755 ${S}/my_script.sh ${D}${bindir}/ } # If you have other files, like service files for systemd: # SRC_URI += " file://my-custom-app.service" # FILES_${PN} += "${systemd_system_unitdir}/my-custom-app.service" # SYSTEMD_SERVICE_${PN} = "my-custom-app.service" (if it's a systemd service)
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
This is a default callout.
This is a primary callout with icon.
This is a Success callout with icon.
This is a info callout with icon.
This is a warning callout with icon.
This is a danger callout with icon.
This is a question callout with icon.
This is a Tip callout with icon.
<form> Action mail me@example.com Thanks “Thanks for submitting your valuable data.” Fieldset “A set of fields” Textbox “Employee Name” “=Your Name” number “Your Age” >13 <99 email “Your E-Mail Address” textbox “Occupation (optional)” ! password “Some password” fieldset “even more fields” select “Please select an option” “Peaches|Apples|Oranges” static “Some static text that could be an agreement” yesno “Read the agreement?” radio “Radio Button Group” “Peaches|Apples|Oranges” fieldset “Date Field” date “Enter your date” textarea “Tell me about your self” textbox “You need to write 'agree' here” /^agree$/ fieldset submit “Submit Query” </form>
default primary success info warning danger
primary success info warning danger
Lorem ipsum dolor sit amet, consectetur adipisici elit, sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Lorem ipsum dolor sit amet, consectetur adipisici elit, sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Basic panel example
Panel content
Panel content
Panel content
Panel content
Panel content
Panel content
Panel content
# | First Name | Last Name | Username |
---|---|---|---|
1 | Mark | Otto | @mdo |
2 | Jacob | Thornton | @fat |
3 | Larry | the Bird |
# | First Name | Last Name | Username |
---|---|---|---|
1 | Mark | Otto | @mdo |
2 | Jacob | Thornton | @fat |
3 | Larry | the Bird |
Lorem ipsum dolor sit amet…
Lorem ipsum dolor sit amet…
Lorem ipsum dolor sit amet…
Lorem ipsum dolor sit amet…
Scroll the page!