Kernel Shell

One of the first tasks for BitThunder was to replace U-Boot on the Xilinx Zynq platform. We have a requirement to provide the fastest possible boot experience which we just couldn’t achieve with U-Boot.

To satisfy this requirement we have added the BT Kernel Shell, which allows commands to be built into the operating system kernel.

Kernel shell commands are very simple, and you can add them to your application with ease:

static int bt_hello_world_command(int argc, char **argv) {
    bt_printf("Hello World\n");
    return 0;
}

BT_SHELL_COMMAND_DEF oCommand = {
    .szpName = "hello",
    .eType = BT_SHELL_NORMAL_COMMAND,
    .pfnCommand = bt_hello_world_command,
}

Current features

Currently its possible for an application to evaluate a shell command:

BT_ShellCommand("load 0x010008000 /sd0/zImage");

And for an entire script containing ‘#’ comments to be evaluated:

BT_ShellScript("/sd0/boot.cfg");

Currently Implemented Commands

So far we have implemented the following commands:

  • load - Load data from the file system to a fixed memory location (binary).
  • load_fpga - Load an fpga bit-stream to an fpga device.
  • boot - Start the specified core executing at the specified address.

This set of commands allows us to provide our simple U-Boot replacement.

Interestingly we have spawned a new project called BootThunder which will work on providing a fully-featured and light-weight boot-loader based on BitThunder.

See http://bootthunder.bitthunder.org/ for more information.

Coming soon

We shall be adding the following “must-have” commands:

  • ps - Process list.
  • top - Process information with CPU time.
  • ls - file-system listings.
  • cd - Change working directory for current process.
  • cp/mv/rm/mkdir - Basic file-system commands.
  • cat - Echo a file to stdout.
  • echo - Echo a string.

We will also add support for environment variables. Every command / shell feature will be completely configurable, if you don’t need the ls command… configure it out of the build. Same goes for environment variables and script processing.

Back
Next

Posted by: James Walmsley.

Published on: 2013-06-08 00:00:00 +0000

comments powered by Disqus