Building Linux kernel with Filesystem Using Buildroot¶
Getting Buildroot¶
Stable Buildroot releases are published every three months. Tarballs are available for each stable release (http://buildroot.org/downloads/). However, you can clone an upstream Git repository:
Upstream Buildroot does not support ARCv3 families. If you are going to build Linux for ARCv3 then consider using a separate Synopsys repository with patches for support of ARC HS5x and ARC HS6x:
git clone -b arc-2024.12 https://github.com/foss-for-synopsys-dwc-arc-processors/buildroot
cd buildroot
Using Predefined Configurations¶
Info
By default, snps_archs38_haps_defconfig
uses haps_hs_smp
kernel configuration file. If you are going to run an image on nSIM with
a single core then change it to haps_hs
through make menuconfig
(Kernel
-> Defconfig name
-> haps_hs
).
Buildroot uses configuration files (defconfig
s) for configuring a root filesystem,
a toolchain, a Linux kernel, etc. Buildroot comes with a number of existing predefined
configurations which may be found in config
directory. Use make list-defconfigs
command
to list all available configurations:
$ make list-defconfigs | grep snps
snps_arc32_defconfig - Build for snps_arc32
snps_arc64_defconfig - Build for snps_arc64
snps_arc700_axs101_defconfig - Build for snps_arc700_axs101
snps_archs38_axs103_defconfig - Build for snps_archs38_axs103
snps_archs38_haps_defconfig - Build for snps_archs38_haps
snps_archs38_hsdk_defconfig - Build for snps_archs38_hsdk
Here is a short description of each configuration:
snps_arc32_defconfig
- A configuration for ARC HS5x on HAPS, nSIM or QEMU (available only in a separate repository).snps_arc64_defconfig
- A configuration for ARC HS6x on HAPS, nSIM or QEMU (available only in a separate repository).snps_arc700_axs101_defconfig
- A configuration for ARC 700 on AXS101 development board.snps_archs38_axs103_defconfig
- A configuration for ARC HS38 on AXS103 development board.snps_archs38_haps_defconfig
- A configuration for ARC HS3x/4x in ZeBU, HAPS, nSIM or QEMU.snps_archs38_hsdk_defconfig
- A configuration for ARC HS3x/4x on HSDK and HSDK 4xD development boards. This configuration builds images for running Linux using U-Boot.
Configuring Root Filesystem¶
You can select a predefined configuration this way:
You can manually tune filesystem's configuration this way:
The final configuration file is saved in .config
file.
Configuring Linux Kernel¶
Also, you can configure kernel's options this way:
Building Linux¶
Buildroot with default configurations, which are mentioned above, builds Linux images in this sequence:
- Download sources for a toolchain and build it.
- Download sources for packages, build them using the toolchain and put them
in a filesystem image (
rootfs
). - Download sources for a Linux kernel and build it using the toolchain.
- Link the Linux kernel against
rootfs
(vmlinux
) or save it separately fromrootfs
(bzImage
oruImage
). Whetherrootfs
is linked against Linux kernel or not depends on a particular configuration. For example,snps_archs38_hsdk_defconfig
configuration doesn't linkrootfs
against Linux kernel.
You can build images using make
:
By default, Buildroot builds everything in output
directory. Images are placed in
output/images
directory. For snps_archs38_haps_defconfig
configuration you will find
a couple of filesystem images (rootfs.cpio
and rootfs.tar
) and vmlinux
- a kernel
with the filesystem included:
For example, for snps_archs38_hsdk_defconfig
configuration you will find much more
images (consider reading a guide about building Linux for HSDK for more details):