If you’ve ever tried to build Mendel Linux for the Google Coral Dev Board on a system like Ubuntu 20.04, you probably know the feeling: you follow the instructions exactly, run the build, wait patiently… and then nothing. No u-boot.imx
. No rootfs_arm64.img
. Just a bunch of logs, some warnings, and no clear output.
I’ve been there and I want to share how I troubleshooted the problem, fixed it, and improved the whole process. If you’re stuck at the same point, this guide is for you.
Initial Build Setup
I followed the official Coral Getting Started instructions. Here’s a breakdown of the commands I ran:
# Step 1: Clone the Mendel build environment
repo init -u https://coral.googlesource.com/manifest -b mendel-linux
# Step 2: Sync all repositories
repo sync
# Step 3: Source the build environment
source build/envsetup.sh
# Step 4: Choose your target device
lunch mendel-imx8m_phanbell-userdebug
# Step 5: Start the build
m
At first, everything seemed fine no crashing, no red flags. But at the end? No boot images. No u-boot.imx
, no rootfs_arm64.img
.
The Error That Tripped Me Up
When I dug into the logs, this message jumped out:
ERROR: ld.so: object 'libfakeroot-sysv.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
That doesn’t seem fatal at first glance and maybe it wasn’t the fatal error but it did point to a broken toolchain, and ultimately a broken build.
Define Error
Here’s what I learned:
- fakeroot is a tool that helps simulate file ownership and permissions, especially when building as a non-root user.
- It works by preloading a shared library like
libfakeroot-sysv.so
to fake root capabilities. - This error means the dynamic linker couldn’t find or load that library even though it was supposed to.
And that’s a problem when you’re building in a chrooted or isolated environment, such as pbuilder
.
I even tried creating a symbolic link like this:
ln -s /usr/lib/x86_64-linux-gnu/libfakeroot/libfakeroot-sysv.so /usr/lib/libfakeroot-sysv.so
But that didn’t help because the build environment couldn’t see it anyway.
How I Fix It
Install fakeroot Inside the Chroot
If you’re using something like pbuilder
, the host fakeroot doesn’t matter you need it inside the isolated environment.
Here’s what I did:
sudo pbuilder login --save-after-login
# Now you're inside the pbuilder shell:
apt-get update
apt-get install fakeroot
exit
Then I rebuilt:
m
Boom much smoother build process.
Ensure LD_PRELOAD Path is Correct
On my host system (Ubuntu 20.04), the correct library path was:
export LD_PRELOAD=/usr/lib/libfakeroot/libfakeroot-sysv.so
Double-check it with:
ls -l /usr/lib/libfakeroot/libfakeroot-sysv.so
If it’s missing or corrupted, reinstall:
sudo apt-get install --reinstall fakeroot
Extra Improvement I Made to My Build Process
Once everything started working, I didn’t stop there. I wanted to make my setup reliable, repeatable, and fast.
Automated Setup with a Shell Script
I wrote a simple script to bootstrap my builds:
#!/bin/bash
set -e # Stop if anything fails
echo "[INFO] Setting up build environment..."
source build/envsetup.sh
lunch mendel-imx8m_phanbell-userdebug
echo "[INFO] Starting build..."
m -j$(nproc)
echo "[INFO] Build complete."
I saved it as build_mendel.sh
and made it executable:
chmod +x build_mendel.sh
./build_mendel.sh
Manual Output Check
Sometimes, the build finishes, but you’re still not sure what was produced. I added a post-check step to look for expected files:
cd out/target/product/imx8m_phanbell/
if [ ! -f "u-boot.imx" ]; then
echo "[ERROR] u-boot.imx not found!"
exit 1
fi
if [ ! -f "rootfs_arm64.img" ]; then
echo "[ERROR] rootfs_arm64.img not found!"
exit 1
fi
echo "[SUCCESS] All required images are built."
Speeding Thing Up with ccache
Rebuilding from scratch was taking forever. I installed ccache
and enabled it:
sudo apt install ccache
export USE_CCACHE=1
export CCACHE_DIR=~/.ccache
Now repeated builds are noticeably faster.
Final Thought
This whole process taught me something important even if a build doesn’t crash, it doesn’t mean it succeeded.
It seemed harmless at first. But it was a symptom of a deeper issue and once I addressed it by making sure fakeroot
was installed inside the build environment, everything started clicking into place.