libbpf / ci

BPF CI
Other
11 stars 24 forks source link

rootfs: Make rootfs init script work with busybox #57

Closed chantra closed 2 years ago

chantra commented 2 years ago

The init scripts are run using busybox's sh which behaves differently than bash.

More specifically:

root@(none) /]# busybox sh
/ # [[ -z $(/bin/mount -t devtmpfs) ]]
sh: on: unknown operand
/ # [[ -a /dev/fd ]]
sh: /dev/fd: unknown operand

This change fixes the first issue by wrapping the command substitution in quotes, and changes -a test to e which seem to do the same thing.

Busybox documentation does not seem to have any reference about that.

With this change and an updated rootfs, the errors do not happen anymore:

  + [ -x /etc/rcS.d/S10-mount ]
  + /etc/rcS.d/S10-mount
  + /bin/mount proc /proc -t proc
  + /bin/mount -t devtmpfs
  + [[ -z devtmpfs on /dev type devtmpfs (rw,relatime,size=3029136k,nr_inodes=757284,mode=755) ]]
  + /bin/mount sysfs /sys -t sysfs
  + /bin/mount bpffs /sys/fs/bpf -t bpf
  + /bin/mount debugfs /sys/kernel/debug -t debugfs
  + [[ -e /dev/fd ]]
  + ln -s /proc/self/fd /dev/fd
  + echo Listing currently mounted file systems
  Listing currently mounted file systems
  + /bin/mount

Example run: https://github.com/kernel-patches/vmtest/actions/runs/3308807044/jobs/5462256604#step:6:425

Fixes #54