Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Aug 2022 18:29:04 +0000 (UTC)
From:      "Bjoern A. Zeeb" <bzeeb-lists@lists.zabbadoz.net>
To:        Warner Losh <imp@bsdimp.com>
Cc:        Konstantin Belousov <kostikbel@gmail.com>,  FreeBSD Current <current@freebsd.org>
Subject:   Re: init (/rescue/sh) died
Message-ID:  <n77oppp8-n960-po93-np43-q725553soq8q@yvfgf.mnoonqbm.arg>
In-Reply-To: <CANCZdfrwX=60Vi_xo%2B=bkOZhgw2Q6Bui2L-u8jm5Dp0iqRmqhA@mail.gmail.com>
References:  <pp3n1s2s-s5os-pp6-67sp-736soo193n6n@mnoonqbm.arg> <YwOd5CeXTZ9p7jRh@kib.kiev.ua> <CANCZdfrwX=60Vi_xo%2B=bkOZhgw2Q6Bui2L-u8jm5Dp0iqRmqhA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 22 Aug 2022, Warner Losh wrote:

Hi,

> On Mon, Aug 22, 2022 at 9:17 AM Konstantin Belousov <kostikbel@gmail.com>
> wrote:
>
>> On Mon, Aug 22, 2022 at 02:56:47PM +0000, Bjoern A. Zeeb wrote:
>>> Hi,
>>>
>>> I am trying to get some arm64 up and running a bit but cannot use
>>> loader. I have an MD_ROOT embedded in the kernel with /rescue on it.
>>> I set INIT_PATH=/rescue/sh .
>>>
>>> However that doesn't seem to work:
>>>
>>> start_init: trying /rescue/sh
>>> init died (signal 0, exit 0)
>>> panic: Going nowhere without my init!
>>>
>>> Anyone any ideas?
>>
>> Kernel does not set up the standard file descriptors for stdin/out/err
>> for init.  When you try to directly exec /rescue/sh (or /bin/sh), it cannot
>> perform any io.
>>
>
> Agreed. init does lots of magic, in addition to setting up stdin/out/err
> (like
> deal with process groups, etc). /bin/sh doesn't do any of that magic, so it
> can't possibly work as init (PID 1).
>
> Your best bet is to boot -s (RB_SINGLE in the kernel boot_single=yes in the
> boot loader). You'd think you'd be able to symbolically link /etc/rc to
> /rescue/sh,
> but that will result in sh trying to execute /rescue/sh as a shell script
> and no good
> can come from it. I've had luck with "echo sh > $DESTDIR/etc/rc;
> chmod +x $DESTDIR/etc/rc" in the past, but I haven't tried that trick in
> ages...
> The simple equivalent to a tmp file does work.

/rescue/init was simply "hanging" on earlier boots which is why I
had initially switche dto sh.

Here's a few things I did overall:
- disable GDB in kernel config (it gave 2 lines of jitterish on
   initial kernel printf lines before Copyrights.
- Added bootargs = FreeBSD:-vs to the chosen section in FDT
   given I cannot have loader (no EFI); the guard trick is nice if you
   know about it ;)
- Removed my previous env file I had added to the kernel to set
   tunables.
- linked /bin/sh to /rescue/sh
- put a printf "hello world\n"; exit 1 in the top of /etc/rc just in
   case -s wouldn't work
- changed INIT_PATH=/rescue/init

Got a sh and can run sysctl and dmesg and type echo * in /rescue :)
Even reboot works :)

Now that basic netbooting and user space work I can start adding SoC
drivers bit by bit over the next weeks/months :)  That'll be a lot
more unfun.

Thanks you two!  Along with help from Andy earlier this made my day!

Lots of joy!
/bz

-- 
Bjoern A. Zeeb                                                     r15:7



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?n77oppp8-n960-po93-np43-q725553soq8q>