You copied the Doc URL to your clipboard.

How do I add a test binary into a BusyBox RAMDisk?

Information in this article applies to:

  • Operating System

Problem/Question

How do I add a test binary into a BusyBox RAMDisk?

Scenario

Arm Reference Platforms Deliverables provide references to Armv8-A software. This software stack targets mobile and infrastructure configurations based on the following publicly available Arm platforms:

  • Juno.

  • Armv8-A Architecture Fixed Virtual Platforms (FVPs).

  • System Guidance FVPs.

The software release is updated quarterly on the Arm Community website.

Software components are integrated from publicly available sources, including the System Control Processor (SCP), Arm Trusted Firmware, U-Boot, Linux Kernel, Busybox, and Android.

I work on the flexible BusyBox RAMDisk file system to test and verify the platform functionality. How do I make my test binary work in the file system?

Answer

The Arm Reference Platforms Deliverables are maintained at the site https://community.arm.com/developer/tools-software/oss-platforms/w/docs/304/arm-reference-platforms-deliverables.

Consider the Armv8-A Architecture FVPs as an example. You can follow the instructions described on the site to set up the workspace. There is a directory and script for each component. For the BusyBox RAMDisk, the directory is at work_dir/ramdisk/ and the script is work_dir/build-scripts/build-busybox.sh.

To add the test binary into a BusyBox RAMDisk, take the following steps:

  1. Choose the BusyBox file system and use the following command to build all the software components.

    work_dir/build-scripts/build-all.sh all

    All the software stack images, including the RAMDisk image, are created in the work_dir/output/fvp/fvp-busybox/uboot/ directory.

  2. Display the contents of the default RAMDisk directory:

       cd work_dir
       ls ramdisk/
       busybox files.txt init.sh ramdisk.img

    For example, the content of files.txt is shown as follows:

       dir /dev 0755 0 0
       nod /dev/console 0600 0 0 c 5 1
       dir /sbin 0755 0 0
       file /sbin/kinit /usr/src/klibc/kinit/kinit 0755 0 0
  3. Build the test binary.

    Assume that the test binary is named as hello_world.app, and that the binary is built as a static link. This is because there might not be necessary shared library in the BusyBox environment.

    For example, you can use the following command to build the binary:

    aarch64-linux-gnu-gcc -static -o hello_world.app hello_world.c

    After you finish building the binary, copy the test binary hello_world.app into the work_dir/ramdisk/ directory.

  4. Add the test binary, hello_world.app, into RAMDISK by adding an entry into the work_dir/ramdisk/files.txt file.

    If you use files.txt in Step 2 as an example, you can add an entry as follows:

       dir /dev 0755 0 0
       nod /dev/console 0600 0 0 c 5 1
       dir /sbin 0755 0 0
       file /sbin/kinit /usr/src/klibc/kinit/kinit 0755 0 0
       file /hello_world ./hello_world.app 777 0 0

  5. Rebuild the RAMDisk and package the RAMDisk image by using the following commands:

        cd work_dir
       ./build-scripts/build-busybox.sh clean
       ./build-scripts/build-busybox.sh build
       ./build-scripts/build-busybox.sh package
       ./build-scripts/build-all.sh package

After this step, you can run the software stack and test binary.

Workaround

N/A

Example

N/A

Was this page helpful? Yes No