Module 4 · Lesson 151 of 156

Boot and toolchain interview questions

Explain boot handoffs, diagnose cross-compiled binary compatibility, and defend a toolchain choice using product constraints and target evidence.

  • Beginner to advanced
  • 8 min read
  • 15 min lab
What you will need

Ubuntu 24.04 in WSL2 or a VM; AArch64 Linux cross GCC and binutils; no board required

Your place in the module
By the end you can 4 objectives
  • Map common embedded Linux interview questions to the relevant module sessions.
  • Explain what each stage in the reference boot sequence hands to the next.
  • Use GCC and ELF inspection to assess whether a binary matches a target image.
  • Justify a toolchain choice using constraints, a tradeoff, and a verification plan.
Video coming soonBoot and toolchain interview questions
The video for this lesson is being recorded. Read the lesson below in the meantime.
Recall first from Peer review and preparing the demo
  • A source review and an image review answer different questions about the same delivery.
  • A useful review finding identifies the affected artifact, the observed behavior, and a way to verify the fix.
  • A live demo identifies the target and shows fresh evidence for the behavior it claims.
01

Answer boot questions by naming each handoff

4 min read

The demo is done; now you prepare for the interviews the module is aimed at. This lesson answers how the question areas map to the module, and how to answer boot chain and toolchain questions with a decision framework.

A file can exist and have execute permission, yet executing it can return ENOENT. Linux documents this result when the ELF interpreter named in the executable is missing. If that executable is supposed to be init, Linux can reach the point where it tries to start user space and still fail. This gives you a concrete interview example that connects an artifact produced on the build host to a failure late in boot. execve(2)

Which module topics should I use to prepare? For reset, boot media, RAM setup, and firmware handoffs, review the Arm and boot ROM lessons (S02) and the U-Boot lessons (S06). For questions about an executable that builds successfully yet fails on the board, use cross-compilation and ELF inspection (S03 and S04). The kernel and command line are in S07. Device tree is in S08, root filesystem and storage are in S09 and S10, and Buildroot and Yocto are in S11 through S14. Boot timing and debugging are in S15 and S16, while updates and security are in S17. Use the SensorNode work in S18 when asked for an example of a decision you made and how you verified it.

What happens between power-on and the application? Give the module's STM32MP1 TF-A and U-Boot configuration as your example. State a responsibility at each transition.

  • Boot ROM to TF-A. The SoC starts with its built-in ROM code. In this configuration the ROM selects a boot source according to the device's boot configuration and loads the early TF-A image into on-chip SRAM. The SRAM matters because external DRAM has yet to be initialized.
  • TF-A to U-Boot. The early Trusted Firmware-A stage initializes DRAM and loads later firmware images, including U-Boot. The full U-Boot then runs in normal-world context. The configured firmware package determines which secure software also runs.
  • U-Boot to Linux. U-Boot selects and loads the kernel and device tree, and may load an external initramfs. It supplies the boot information required by the architecture and transfers control to the kernel entry point. For an AArch64 follow-up, a concrete example is that register x0 carries the physical address of the device tree blob at kernel entry. Booting AArch64 Linux
  • Linux to init. Linux initializes the subsystems and drivers needed to reach user space. With an initramfs containing /init, the kernel can run that program as PID 1 before the final root filesystem is available. Without an initramfs /init, the normal path is for the kernel to mount the root filesystem and then run init from it. PID 1 can then start services, a login prompt, or the product application. Ramfs, rootfs and initramfs
Reference boot sequenceBoot ROMLoads TF-Ainto SRAMTF-AInitializesDRAM andloadsU-BootU-BootLoads Linuxand bootdataLinuxPreparesuser spaceInitRuns as PID1Boot ROMLoads TF-Ainto SRAMTF-AInitializesDRAM andloadsU-BootU-BootLoads Linuxand bootdataLinuxPreparesuser spaceInitRuns as PID1
The main handoffs in the module's STM32MP1 TF-A and U-Boot configuration

Does every Arm board use that sequence? The STM32MP1 sequence describes a specific configuration. A Raspberry Pi 4 can boot Linux through its Raspberry Pi firmware without U-Boot. A BeagleBone Black can use U-Boot SPL to initialize DRAM and load full U-Boot without the TF-A stage in the reference sequence. If asked where SPL fits, say it is an early loader used by some U-Boot configurations. It can prepare enough hardware for full U-Boot to run. Identify the actual board and image before assigning that responsibility.

U-Boot reports that it is starting Linux, then the serial console goes quiet. Which stage failed? That message establishes that U-Boot reached its boot path. Whether Linux ran remains open. Ask for the exact board, kernel image, and last visible message. Check the architecture's entry requirements and the kernel console selection. Successful serial output from U-Boot confirms its own serial setup. Linux has its own console configuration. If Linux reports failure while trying to run init, move your attention to the root filesystem and the executable. The last confirmed event lets you explain which boundary you would investigate and what evidence would narrow the diagnosis.

02

Explain what makes a cross-built program runnable

3 min read

What does aarch64-linux-gnu tell you? Read it as AArch64, Linux, and the GNU user-space ABI, normally associated with glibc in this Linux toolchain. Target names are commonly called triplets. Some include a vendor field, so count on the meaning of the fields rather than a fixed number of hyphens. Compare arm-linux-gnueabihf, which describes a 32-bit Arm Linux target using the GNU EABI with the hard-float calling convention. That convention determines how eligible floating-point arguments and return values cross function boundaries. A change in calling convention affects compatibility between compiled objects and libraries. Ask which user-space ABI the board image uses, since a CPU capable of AArch64 can also be deployed with a 32-bit Linux user space.

What is the sysroot, and why can a build pick up the wrong files? A supplies development headers, startup objects, and libraries for compiling and linking target programs. An SDK can supply those files for the intended target image. A deployed root filesystem supplies runtime files and may omit development files. Build configuration can still introduce host include paths or library metadata explicitly. For example, an incorrect dependency search can find the host's package metadata and pass its paths to a cross build. Say which dependency the build resolved and inspect the actual compiler and linker arguments when the result looks wrong.

How do glibc, musl, and kernel headers fit together? glibc and musl are Linux C library implementations. The C library supplies user-space interfaces and, for dynamically linked programs, a compatible loader and shared libraries. Linux UAPI headers describe interfaces that the kernel exposes to user space. Using headers that describe an interface gives the compiler the declarations it needs. The running kernel still has to implement any feature the program actually uses. A program built against glibc also needs the glibc interfaces and symbol versions it requires. If a target image uses musl, build against the matching musl SDK or verify that the image deliberately supplies the required GNU runtime.

Cross-built binary compatibilityCompilertargetArchitecture and ABITargetsysrootHeaders andlink inputsELFinspectionMachine, interpreter,library dependenciesTargetimageProvidestherequiredruntimeCompilertargetArchitecture and ABITargetsysrootHeaders andlink inputsELFinspectionMachine, interpreter,library dependenciesTargetimageProvidestherequiredruntime
Checks that connect the selected compiler to the running target image

How would you check an executable that builds successfully? On Ubuntu with AArch64 Linux cross GCC and binutils installed, -dumpmachine reports the compiler target, and -print-sysroot reports its configured sysroot for that invocation if there is one. A reported / can coexist with target-specific search directories. Inspect the binary itself after building. This short shell example builds an executable from a C source file supplied on standard input.

bash
aarch64-linux-gnu-gcc -dumpmachine
aarch64-linux-gnu-gcc -print-sysroot
aarch64-linux-gnu-gcc -Wall -Wextra -std=c17 -x c - -o hello-arm64 <<'EOF'
int main(void)
{
    return 0;
}
EOF
aarch64-linux-gnu-readelf -h hello-arm64
aarch64-linux-gnu-readelf -l hello-arm64
aarch64-linux-gnu-readelf -d hello-arm64

On Ubuntu 24.04 with gcc-aarch64-linux-gnu installed, these commands printed aarch64-linux-gnu for -dumpmachine and / for -print-sysroot. The header showed Class: ELF64 and Machine: AArch64, the interpreter was /lib/ld-linux-aarch64.so.1, and the only NEEDED entry was libc.so.6; your values depend on your toolchain. Read Machine and Class in the ELF header for the architecture and word size. Program headers show the interpreter requested by a dynamically linked executable, and the dynamic section lists direct shared library dependencies in NEEDED entries. On the target, check that the exact interpreter path resolves and that the loader can find compatible libraries. A missing interpreter can account for ENOENT at exec time. A missing shared library can instead produce a diagnostic from the interpreter after it starts. If the architecture and library names match but loading still fails, required symbol versions are another check. readelf -V displays ELF version information when present. elf(5) ld.so(8)

03

Make a conditional recommendation

2 min read
Answering a tradeoff questionNameconstraintsCompareoptionsChoose andjustifyVerify ontargetNameconstraintsCompareoptionsChoose andjustifyVerify ontarget
A decision sequence for a tradeoff question
Going deeperExplore the mechanism

“Would you use a prebuilt cross compiler or the product SDK?” Give a conditional recommendation and explain what evidence could change it. Start with the outcome the interviewer cares about. Bringing up a small test program on a development image and shipping a binary across a product fleet have different compatibility requirements.

  1. Name the constraints. Ask which image the binary must run on, which architecture and C library it uses, and who controls updates to that image. If the interviewer leaves a detail open, state an assumption and proceed.
  2. Compare viable options. A distribution cross compiler is quick to obtain and can suit an early test when its compiler and runtime inputs match the target. A product SDK built for the release supplies build inputs aligned with that image, but requires the team to distribute it and keep it aligned across releases.
  3. Choose under the stated constraints. For a program shipped to a fixed product image, choose the matching release SDK. For an isolated smoke test on a development image with a known matching runtime, the distribution compiler is a reasonable starting point. If the production image changes its libc or supported ABI, revisit the choice.
  4. Say how you will verify it. Record the compiler target and sysroot, inspect the resulting ELF and its runtime requirements, then run it on the intended release image. If several releases are supported, include the oldest supported image in the test. That test can expose a runtime dependency introduced by building against newer libraries.

A spoken answer could be: “For a fixed release image, I'd build with that release's SDK because it provides the target headers and libraries for the image we ship. Keeping the SDK current is a maintenance cost. I'd record its version, inspect the executable's interpreter and library requirements, and run it on the oldest image we support. For a temporary development test with a matching ABI and runtime, I'd consider the distribution compiler.”

For reflection, choose an assumption you made about the SensorNode image and name one observation that would confirm it. The practice questions below give you a chance to say that kind of answer aloud. The next lesson, Build systems, device tree, filesystem and debugging questions, asks how you explain image assembly, hardware description, storage choices, and diagnosis once you can identify the relevant boot stage or binary requirement.

Key takeaways

  • The ROM, firmware, bootloader, kernel, and init have distinct responsibilities, and the firmware sequence varies by board.
  • The compiler target identifies an intended architecture and ABI, while the sysroot supplies target build inputs.
  • A dynamically linked ELF can match the target CPU and still require an interpreter that the target image lacks.
  • A defensible toolchain choice names the constraints, the cost of the choice, and the evidence that would confirm it.
Reflect
  1. Explain to a colleague, in two sentences: map common embedded Linux interview questions to the relevant module sessions.
  2. Which objective are you least sure about? Re-read that section, then do its exercise in the practice pack.
  3. What surprised you when you ran the commands yourself?
On a real board

Repeat the key commands on your Raspberry Pi or lab board over SSH or the serial console. Note anything that behaves differently from your PC, such as missing tools, a BusyBox shell or a read-only filesystem.

References and further reading

Find your next step

↑ ↓ to move · Enter to open · Esc to close