Customizing agl-image-weston with AGL¶
This guide provides step-by-step instructions for customizing the AGL agl-image-weston image using Yocto. We cover two common customization tasks: adding packages like glmark2 and resizing the image.
Prerequisites¶
- AGL build environment set up and initialized following 01_Getting_Started/02_Building_AGL_Image
- Your build directory is 'build-agl' that setups by aglsetup.sh
- Yocto knowledge and familiarity with bitbake and layer concepts
1. Adding glmark2 to core-image-weston¶
glmark2 is a benchmarking tool available in meta-openembedded/meta-oe/recipes-benchmark/glmark2. There are multiple ways to add it to your image.
Method 1: Using local.conf (Quickest)¶
The simplest approach is to add glmark2 directly to your local.conf file.
-
Navigate to your build directory:
cd build-agl -
Open the
conf/local.conffile in your preferred editor:vim conf/local.conf -
Add the following line at the end of the file:
IMAGE_INSTALL:append = " glmark2" -
Save and close the file.
-
Build the image:
bitbake agl-image-weston
The glmark2 package will now be included in your image.
Method 2: Creating a Custom Image Recipe¶
For more control and reusability, create a custom image recipe.
-
Create a custom layer in your AGL workspace (if not already present):
bitbake-layers create-layer meta-custom-agl -
Create a new image recipe in the custom layer:
mkdir -p meta-custom-agl/recipes-core/images touch meta-custom-agl/recipes-core/images/agl-image-weston.bbappend -
Edit the new recipe file and add the following content:
IMAGE_INSTALL:append = " glmark2" -
Add your custom layer to the build configuration:
bitbake-layers add-layer meta-custom-agl -
Build your custom image:
bitbake agl-image-weston
2. Resizing the Image by 2 GB¶
By default, agl-image-weston has a predefined size. To increase the image size by 2 GB, you need to adjust the IMAGE_ROOTFS_SIZE variable.
Calculating the Size Increase¶
- 1 GB = 1024 MB = 1,048,576 KB
- 2 GB = 2048 MB = 2,097,152 KB
Method 1: Via local.conf¶
-
Open your
conf/local.conffile:vim conf/local.conf -
Find or add the
IMAGE_ROOTFS_SIZEvariable. If it doesn't exist, add it:IMAGE_ROOTFS_SIZE = "409600"
This example sets the base size to 400 MB. Adjust the value as needed for your use case.
-
To increase by 2 GB, modify the value:
# Original: 400 MB (409600 KB) # Increase by 2 GB (2097152 KB) # New value: 2400 MB (2457600 KB) or 2.4 GB IMAGE_ROOTFS_SIZE = "2457600" -
Save the file and rebuild:
bitbake -c cleansstate agl-image-weston bitbake agl-image-weston
Method 2: Via Custom Image Recipe¶
Prerequire: You already created agl-image-weston.bbappend followed as 'Method 2: Creating a Custom Image Recipe' steps.
-
Add to your agl-image-weston.bbappend recipe:
IMAGE_ROOTFS_SIZE = "2457600" -
Rebuild the image:
bitbake agl-image-weston