This series will create my first runnable embedded Linux system based on the Buildroot repository provided by Microchip.
Change Buildroot configuration based on target hardware
This series of articles will demonstrate using the Microchip SAMA5D2-XULT development board. This chapter explains based on the buildroot-external-microchip-linux4microchip-2024.10/configs/sama5d2_xplained_headless_defconfig configuration file:
Preparation – SAMA5D2 MPU Linux Boot Process
-
Power on the internal ROM CODE integrated into the MPU
After powering on, the SAMA5D2 MPU first runs the internal ROM CODE
ROM CODE will complete the following initialization operations:
-
Configure the system stack for Arm supervisor mode.
-
Initialization of PLLA
-
Selection of Master Clock: Once PLLA stabilizes, the Master Clock switches from the internal 12 MHz RC to PLLA, and then polls the PMC status register until MCK stabilizes, at which point the system’s main clock switches to PCK and MCK.
-
Initialization of the C runtime environment: copying variables (from ROM to internal SRAM) and initialization operations.
2. The ROM CODE looks for at91bootstrap in external storage and loads it into the chip’s internal SRAM to run
3. at91bootstrap completes the initialization of system clocks, DDR controllers, etc.
4. at91bootstrap loads U-Boot into external DDR and runs it
Modify the at91bootstrap configuration under Buildroot
View the at91bootstrap configuration under Buildroot

The configuration files for at91bootstrap are located in buildroot-mchp-linux4microchip-2024.10/output/build/at91bootstrap3-v4.0.10/configs directory

at91bootstrap selects the sama5d2_xplained-bsrsd_uboot_defconfig configuration
Configuration file name resolution:
1. sama5d2_xplained_ indicates the evaluation board corresponding to the configuration file
2. bsrsd_- bsr indicates enabling back mode (which allows low-power sleep and wake-up), sd indicates booting from SD card
3. uboot_ indicates that it will load and run the uboot code (at91bootstrap can also choose to load the Linux kernel directly)
Additional Notes:
1. To boot from QSPI flash, refer to sama5d2_xplaineddf_qspi_uboot_defconfig configuration
2. To boot from SPI flash, refer to sama5d2_xplaineddf_uboot_defconfig
3. To boot from eMMC, refer to sama5d2_xplainedemmc_uboot_defconfig
4. To boot from Nand flash, refer to sama5d2_ptc_eknf_uboot_defconfig
Change the at91bootstrap configuration under Buildroot
Under the default configuration of sama5d2_xplained_headless_defconfig, at91bootstrap will choose to boot from the onboard SD card slot. If we want to change it to boot from the onboard eMMC, we can modify the at91bootstrap configuration to sama5d2_xplainedemmc_uboot_defconfig:
Before modification:


After modification:


Just save after modification
Compare the at91bootstrap configurations under Buildroot
Using comparison tools, we can see that the differences between the two configuration files are very small. In the sama5d2_xplained-bsrsd_uboot_defconfig configuration file, SDHC1 is selected. On the SAMA5D2-XULT development board, this SD/eMMC controller 1 is connected to the SD card slot. By enabling this interface in the configuration, at91bootstrap can boot from the SD card; otherwise, it defaults to booting from the onboard eMMC.

Modify the U-Boot configuration under Buildroot
View the U-Boot configuration under Buildroot

The U-Boot configuration files are located in buildroot-mchp-linux4microchip-2024.10/output/build/uboot-linux4microchip-2024.10/configs directory:

U-Boot selects the sama5d2_xplained_mmc_defconfig configuration
Additional Notes:
-
To boot from QSPI flash, refer to sama5d2_xplained_qspiflash_defconfig configuration
-
To boot from SPI flash, refer to sama5d2_xplained_spiflash_defconfig
-
To boot from eMMC, refer to sama5d2_xplained_emmc_defconfig
-
To boot from Nand flash, refer to sama5d2_ptc_ek_nandflash_defconfig
Change the U-Boot configuration under Buildroot
Under the sama5d2_xplained_headless_defconfig default configuration, U-Boot will also choose to boot from the onboard SD card slot. Now we need to modify it to boot from the onboard eMMC, changing U-Boot’s configuration to sama5d2_xplained_emmc_defconfig.
Before modification:


After modification:


Save after modification and recompile
Compare U-Boot configurations under Buildroot
Using comparison tools, we can see that the differences between U-Boot configuration files are very small. Since the SAMA5D27 MPU has two SD/eMMC controllers, choosing to boot from onboard eMMC or the SD card slot affects the changes in U-Boot startup parameters. For example, the onboard eMMC is on SD/eMMC controller 0, so root=/dev/mmcblk0p2. If booting from the SD card (connected to SD/eMMC controller 1), the root filesystem storage partition needs to be modified to root=/dev/mmcblk1p2. Other modifications to BOOT COMMAND follow this logic.
