Generating Package Patch for Buildroot

Generating a Patch Using diff 1. Extract the Original Source Ensure you have a pristine copy of the original source for comparison. You can extract it from the tarball in the dl directory: tar -xf dl/<package>-<version>.tar.gz -C /tmp/ This will create a directory like /tmp/<package>-<version>/. Using buildroot’s mechanism Clean the build directory and apply current patches of buildroot make <pkg>-dirclean # Remove <pkg> build directory make <pkg>-extract # Extract <pkg> sources make <pkg>-patch # Apply patches to <pkg> (Optional) cp -r output/build/<package> /tmp/ 2. Generate the Patch Use the diff command to create a unified diff between the original and modified sources: ...

May 20, 2025 · 2 min

External Toolchain in Buildroot

Using External Toolchain Option 1: Give tarball URL Specify URL for the tarball in BR_TOOLCHAIN_EXTERNAL_URL Example: BR_TOOLCHAIN_EXTERNAL_URL=http://artifactory/my-toolchain.tar.xz In this case you will have to deselect BR2_PRIMARY_SITE_ONLY option Option 2: Give tarball relative dl path If BR2_PRIMARY_SITE_ONLY option is selected then you have to keep the toolchain inside dl/toolchain-external-custom/ directory and pass the name of tarball to BR_TOOLCHAIN_EXTERNAL_URL Example: BR2_PRIMARY_SITE="http://artifactory/buildroot-sources" BR2_PRIMARY_SITE_ONLY=y BR_TOOLCHAIN_EXTERNAL_URL=my-toolcahin.tar.xz This will extract the toolchain to buildroot’s build directory output/host/opt/ext-toolchain ...

April 4, 2025 · 1 min

Buildroot Relocatable SDK

Overview A relocatable toolchain/SDK is a self-contained set of cross-compilation tools that can be moved to different locations without breaking dependencies. Buildroot provides an option to generate such a toolchain, allowing developers to use it for cross-compiling applications without depending on a fixed absolute path. Prepare Relocatable SDK Configure Buildroot for SDK Generation Disable BusyBox and set /bin/sh to None under System configuration. This prevents unnecessary shell dependencies within the SDK, ensuring better relocatability. ...

March 10, 2025 · 1 min

Making File System

Overview Get the final files into a directory eg. target and treat it as root(/) directory of target board/system. Generate users eg. root, admin, ssh, etc Generate device lists Clean few files Generate ext image using mkfs Taking reference from buildroot common.mk and ext2.mk scripts/makedevs -d output/build/buildroot-fs/full_devices_table.txt output/build/buildroot-fs/ext2/target mkfs.ext4 -d output/build/buildroot-fs/ext2/target -r 1 -N 0 -m 5 -L rootfs -O ^64bit output/images/rootfs.ext2 2G # Fakeroot execution complete /opt/rk3588_nvrx/host/sbin/resize2fs -M output/images/rootfs.ext2 /opt/rk3588_nvrx/host/sbin/e2fsck -fy /output/images/rootfs.ext2 /opt/rk3588_nvrx/host/sbin/resize2fs -M /output/images/rootfs.ext2 Fakeroot Script #!/bin/sh set -ex chown -h -R 0:0 $(TARGET) $(HOST_DIR)/bin/makedevs -d full_devices_table.txt $(TARGET) $(HOST_DIR)/sbin/mkfs.ext4 -d $(TARGET) -r 1 -N 0 -m 5 -L "rootfs" -O ^64bit rootfs.ext2 "2G" Post EXT4 $(HOST_DIR)/sbin/resize2fs -M rootfs.ext2 $(HOST_DIR)/sbin/e2fsck -fy rootfs.ext2 $(HOST_DIR)/sbin/tune2fs -m 5 rootfs.ext2 $(HOST_DIR)/sbin/resize2fs -M rootfs.ext2 Testing on Host sudo mount -o loop path/to/rootfs.ext4 /tmp/fs_path Makedevs Creates a batch of special files as specified in a device table. ...

November 11, 2024 · 3 min