[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: busybox init returns fails with error code -1 (0x00007f00)
From:       Steffen Nurpmeso <steffen () sdaoden ! eu>
Date:       2022-10-26 20:43:40
Message-ID: 20221026204340.2KCRK%steffen () sdaoden ! eu
[Download RAW message or body]

Bernhard Reutner-Fischer wrote in
 <E13162A9-D132-410B-A1AB-3FAE9ACE6AF5@gmail.com>:
 |> written. Using an emulator like qemu 
 |> -cdrom ../my.iso -m 512m or the 
 |> qemu-system-i386 variant that you target
 |
 |And yes, that's a bit exaggerated.
 |In former times you could have plenty space left on a box with 2MB \
 |RAM even when running Linux.
 |But, alas, nowadays the kernel alone occupies some 3 or 6 MB on its own.
 |Add a few 100k for BusyBox, libc, and you're at a minimum of about \
 |4 million or even more bytes of RAM to run on top of Linux.

I have scripts which auto-generate an initrd of a static kernel
that can boot two distinct Lenovo Notebooks, with an almost fully
populated busybox and cryptsetup.

      echo '. Creating initrd'

      boot/$BB mount -o remount,exec run

      (
         set -e
         boot/$BB mkdir run/x
         cd run/x

         ( xsetup2 "../../boot/$BB" "../../boot/$CS" )
         e=$?
         [ $e -ne 0 ] && exit $e

         ./$BB mknod dev/console c 5 1 # redundant

         echo "#!/$BB sh" > ./init
         ./$BB cat "$conf" >> ./init
         echo "PART_ROOT='$PART_ROOT'" >> ./init
         echo "ROOT_DECRYPT='$ROOT_DECRYPT'" >> ./init
         echo "ROOT_PASS='$ROOT_PASS'" >> ./init
         echo '. /linux-init-s2.sh' >> ./init
         ./$BB chmod 0755 ./init

         {
            # Microcode update must be uncompressed and first
            [ -f ../../boot/early-ucode.cpio ] &&
               ./$BB cat ../../boot/early-ucode.cpio
            # Followed by (possibly compressed) normal initrd
            ./$BB find . | ./$BB cpio -H newc -o | ./$BB gzip -9 -n

What was a bit hard to realize was that the microcode update .cpio
for the processor must be uncompressed and first in the initrd,
maybe that.

         } > ../.initrd
      ) || x 'Failed to create run/.initrd'

Despire early-ucode.cpio there is

  init
  linux-init-s1.sh
  sys
  run
  proc
  mnt
  dev
  dev/console
  bin
  bin/sh
  etc
  etc/mdev.sh
  etc/mdev.conf
  linux-init-lib.sh
  linux-init-s2.sh
  cryptsetup.static
  busybox.static

      boot/$BB mount -o remount,noexec run

      if [ -n "$INITRD_PATH" ]; then
         echo '. Saving initrd to '"$INITRD_PATH$PART_SUFFIX"
         boot/$BB cp run/.initrd "$INITRD_PATH$PART_SUFFIX"
         boot/$BB chmod 0600 "$INITRD_PATH$PART_SUFFIX"
      fi

  9592411 Oct 24 17:34 .kent.initrd.0

(Static kernel on EFI with EFI_STUB and busybox and cryptsetup on
EFI asks for unencryption key, then reaches out via config file
for /boot/ kernel and one more config file, then creates the
initrd with embedded decryption key, as necessary, then uses kexec
to boot the kernel in that /boot/, which then mounts the EFI to
byte-compare kernel, busybox, cryptsetup (plus X) against their
counterparts in /boot/, and echoes differences to /etc/motd.  My
kind of secure boot.)

 |Sucks? Tell the kernel guys!

(Well it is a bit strange, and surely very unprofessional.  But
works without systemd!!!)

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic