initramfs init script doesn't print anything

160 Views Asked by At

I'm making my own Linux distribution.

I wrote a custom initramfs init script, however, it doesn't print anything. Below is the init script:

#!/usr/bin/busybox sh

mount -t proc none /proc
mount -t sysfs none /sys
mount -t devtmpfs none /dev

echo "Welcome to GLOS"

sleep 10

umount /proc
umount /sys
umount /dev

I'm using EFI Stub, so there's no specific configuration file.

Also, I'm using efibootmgr to make Linux boot, so there's no specific configuration file. The command I used is: efibootmgr -c -d /dev/nvme0n1 -p 1 -L "GLOS" -l '\EFI\GLOS\bootx64.efi' -u initrd=\initramfs.cpio.

There's only one kernel parameter: initrd=\initramfs.cpio. And the initramfs.cpio is generated by kernel sources' usr/gen_initramfs.sh.

Busybox is compiled statically and I checked its path. Also, it is compiled with mount, umount, ash, echo and sleep.

Permissions of /dev/console, /dev/null, /dev/tty0 are 622. I also tried initramfs without embedding /dev/*.

I added x permission to /init.

I also tried redirecting the echo to /dev/console directly.

I also tried compiling the code below statically and use it as /init.

#include <stdio.h>

int main() {
  printf("Welcome to GLOS\n");

  return 0;
}

There wasn't kernel panic.

Why isn't initramfs init script print anything?

0

There are 0 best solutions below