Home > Software design >  busybox build does not generate the complete rootfs
busybox build does not generate the complete rootfs

Time:04-04

I am trying to create a rootfs that I can use for the Beaglebone Black.

I have been following the instructions here: https://krinkinmu.github.io/2020/07/05/beaglebone-software-update.html for "Root file system".

I have tried following the instructions which are (missing out the step to change the install directory for simplicity):

git clone git://git.busybox.net/busybox.git
cd busybox/
export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabi-
make defconfig
make -j 8
make install

The issue is that the output folder ./_install only contains:

~/bbb/rfs_busybox$ ls -l _install/
total 12
drwxr-xr-x 2 user user 4096 Apr  1 18:28 bin
lrwxrwxrwx 1 user user   11 Apr  1 18:28 linuxrc -> bin/busybox
drwxr-xr-x 2 user user 4096 Apr  1 18:28 sbin
drwxr-xr-x 4 user user 4096 Apr  1 18:28 usr

There is no /etc/ folder or all the other folder that I would normally expect.

The branch I am using is origin/1_32_stable but I first tried the master branch - no luck so far.

So I don't understand what I am doing wrong here... the method is quite simple, so I am confused...

CodePudding user response:

So I don't understand what I am doing wrong here

Your assumption that Busybox can generate a complete rootfs is simply incorrect. The purpose of Busybox is only to "combine tiny versions of many common UNIX utilities into a single small executable ... with size-optimization and limited resources in mind".
In fact the Busybox 'About' page explicitly mentions that "to create a working system, just add some device nodes in /dev, a few configuration files in /etc, and a Linux kernel". This comment seems to assume a static build that would not require any (dynamic/shared) libraries in a /lib directory.

You could use a build tool such as Buildroot (note the verb object construct of this name) or Yocto, that could build a toolchain, boot program(s), the Linux kernel, and a variety of userspace programs and libraries to populate a complete (or minimal) rootfs.

I have been following the instructions here: https://krinkinmu.github.io/2020/07/05/beaglebone-software-update.html for "Root file system".

Obviously those instructions are incomplete for building a rootfs as you have since found out from another guide.

Note that those instruction are for a "network boot", i.e. the boot programs (MLO and U-Boot) are retrieved from local storage (eMMC), but the Linux kernel and root filesystem are network-based (the kernel is retrieved using TFTP and the rootfs uses NFS).
You neglect to clarify or specify where you expect this rootfs to reside. Note that Buildroot can be easily configured to produce a rootfs image (or archive) specifically for the intended medium.
If your board has sufficient memory and the rootfs is not too large, then a convenient form of rootfs is memory-resident, that is, an initramfs (which should not be confused with ramdisk). Buildroot is capable of easily building an initramfs; see how to rebuild rootfs in buildroot

  • Related