Building Automotive Grade Linux (AGL) can be a frustrating experience, especially when you keep running into the same cryptic errors. I recently went through this myself, and I want to share not just the fix, but also the thought process that helped me untangle what was happening.
A Simple Example Code With Error
When I first started debugging AGL, I reminded myself that every big error is just a series of smaller errors stacked together. To illustrate, here’s a tiny Python program that goes wrong:
# Example code
def divide_numbers(a, b):
return a / b
# Intentional error: division by zero
print(divide_numbers(10, 0))
Error Output
ZeroDivisionError: division by zero
Explanation
I’m trying to divide by zero (10 / 0
), which is mathematically undefined. Python does the right thing here and raises a ZeroDivisionError
.
Fix It
I can handle the problem with a try-except
block:
def divide_numbers(a, b):
try:
return a / b
except ZeroDivisionError:
return "Error: Division by zero is not allowed"
print(divide_numbers(10, 0))
Extra Practice Functionality
When I build out error handling in my projects, I usually add a few more features for practice:
- Logging errors for later review
- Allowing user input dynamically
- Handling different exception types (e.g.,
TypeError
,ValueError
)
This same mindset of catching, analyzing, and handling applies perfectly when working with Automotive Grade Linux.
The AGL Build Error
Now, let’s look at the AGL build error that stopped me in my tracks:
ERROR: qemu-native-2.7.0-r1 do_populate_sysroot:
strip: Unable to recognise the format of the input file palcode-clipper
This happened when I tried building AGL 4.0.2 for a Raspberry Pi 2.
At first glance, it doesn’t look like much but the key phrase is:
“Unable to recognise the format of the input file”
That tells me that the strip
tool is being applied to a file it doesn’t understand.
Why This Happens
Here’s what’s going on:
- The Yocto/AGL build system automatically tries to
strip
debug symbols from all files going into the sysroot. - That works fine for ELF binaries (compiled programs).
- But some QEMU data files, like
palcode-clipper
, are firmware blobs not ELF binaries. strip
doesn’t know how to process them, so it fails and brings the build down.
This isn’t just about my machine I tried it on multiple distros. The issue is that newer or stricter versions of binutils
enforce file format rules more aggressively.
How I Fix It
After digging, I found several ways to fix or work around this.
Upgrade to a Newer AGL / Yocto
AGL 4.0.2 is built on Yocto 2.2 Morty which is old. Later versions patched this issue, so the cleanest fix is to update to a newer AGL branch (e.g., master or latest stable).
Patch the Recipe
Inside the qemu-native
recipe, I could tell Yocto to skip stripping already-processed files:
INSANE_SKIP_${PN} += "already-stripped"
Or adjust do_install_append()
to skip non-ELF files.
Disable Stripping Altogether
In conf/local.conf
, I added:
INHIBIT_PACKAGE_STRIP = "1"
This prevents Yocto from stripping anything. The downside? Bigger binaries — but it gets past the error.
Ignore Specific Paths
I also discovered I could make Yocto ignore that directory entirely:
PSEUDO_IGNORE_PATHS .= ":/usr/share/qemu/"
This skips stripping in that path.
My Recommendation
Since I was targeting an older board (Raspberry Pi 2) with an older AGL release (4.0.2), here’s what worked best for me:
- If you can, upgrade AGL/Yocto. Most of these bugs are fixed upstream.
- If you must stay on 4.0.2, add this to your
local.conf
:INHIBIT_PACKAGE_STRIP = "1"
- Clean and rebuild
qemu-native
before retrying:bitbake -c cleansstate qemu-native bitbake agl-demo-platform
This got me past the blocker and allowed the build to continue.
Final Thought
Building Automotive Grade Linux taught me a valuable lesson: errors aren’t roadblocks, they’re breadcrumbs. Just like debugging a small Python program, the key is to understand what’s failing, why it’s failing, and how to either handle or bypass it. If you’re working with an older AGL version, you might need to apply a workaround. If you’re able to upgrade, the issue will likely vanish. Either way, once you understand the role of strip
and how Yocto processes files, the error makes a lot more sense.