7.4.3.1. BusyBox shell initrc files
Login shells source some default files, notably:
/etc/profile $HOME/.profile
In our case, HOME is set to / presumably by init at: https://git.busybox.net/busybox/tree/init/init.c?id=5059653882dbd86e3bbf48389f9f81b0fac8cd0a#n1114
We provide /.profile from rootfs_overlay/.profile, and use the default BusyBox /etc/profile.
The shell knows that it is a login shell if the first character of argv[0] is -, see also: https://stackoverflow.com/questions/2050961/is-argv0-name-of-executable-an-accepted-standard-or-just-a-common-conventi/42291142#42291142
When we use just init=/bin/sh, the Linux kernel sets argv[0] to /bin/sh, which does not start with -.
However, if you use ::respawn:-/bin/sh on inttab described at TTY, BusyBox' init sets argv[0][0] to -, and so does getty. This can be observed with:
cat /proc/$$/cmdline
where $$ is the PID of the shell itself: https://stackoverflow.com/questions/21063765/get-pid-in-shell-bash