~alpine/devel

2 2

WIP: trying to add consolefont in mkinitfs

David Demelier <markand@malikania.fr>
Details
Message ID
<b2a9ae88-ed2c-b77a-3987-e3a3f52e3da0@malikania.fr>
DKIM signature
missing
Download raw message
Hello all,

I'm trying to create an additional features for mkinitfs, including 
setfont + console fonts.

Why? Because on some laptops with high dpi screens, the initramfs may 
ask passphrase for cryptsetup or show an emergency shell. On my laptop 
this is barely usable by default.

Thus, I've created a /etc/mkinitfs/features.d/consolefont with

/etc/conf.d/consolefont
/usr/sbin/setfont
/usr/share/consolefonts/*.psf.gz

Then, updated initramfs-init just before the first message [0]

--- initramfs-init.orig
+++ initramfs-init
@@ -353,6 +353,7 @@
         done
  done

+# Just for testing yet.
+setfont /usr/share/consolefonts/ter-224n.psf.gz
  [ "$KOPT_quiet" = yes ] || echo "Alpine Init $VERSION"

  # enable debugging if requested

I've enabled consolefont in my mkinitfs.conf and rebooted.

At boot setfont complained that /dev/tty does not exist even though 
printing on the screen does not work and cryptsetup asks the passphrase 
so... I'm unable to understand how can I achieve this. Is it possible to 
create a /dev/tty node? Should mdev be enabled earlier?

[0]: https://git.alpinelinux.org/mkinitfs/tree/initramfs-init.in#n355

Any help is welcomed.

-- 
David
Details
Message ID
<20200128100521.GA12136@lucy.icvn.de>
In-Reply-To
<b2a9ae88-ed2c-b77a-3987-e3a3f52e3da0@malikania.fr> (view parent)
DKIM signature
missing
Download raw message
Hi,

On Tue, Jan 28, 2020 at 10:23:48AM +0100, David Demelier wrote:
> Hello all,
> 
> I'm trying to create an additional features for mkinitfs, including setfont
> + console fonts.
> 
> Why? Because on some laptops with high dpi screens, the initramfs may ask
> passphrase for cryptsetup or show an emergency shell. On my laptop this is
> barely usable by default.
> 
> Thus, I've created a /etc/mkinitfs/features.d/consolefont with
> 
> /etc/conf.d/consolefont
> /usr/sbin/setfont
> /usr/share/consolefonts/*.psf.gz
> 
> Then, updated initramfs-init just before the first message [0]
> 
> --- initramfs-init.orig
> +++ initramfs-init
> @@ -353,6 +353,7 @@
>         done
>  done
> 
> +# Just for testing yet.
> +setfont /usr/share/consolefonts/ter-224n.psf.gz
>  [ "$KOPT_quiet" = yes ] || echo "Alpine Init $VERSION"
> 
>  # enable debugging if requested
> 
> I've enabled consolefont in my mkinitfs.conf and rebooted.
> 
> At boot setfont complained that /dev/tty does not exist even though printing
> on the screen does not work and cryptsetup asks the passphrase so... I'm
> unable to understand how can I achieve this. Is it possible to create a
> /dev/tty node? Should mdev be enabled earlier?
> 
> [0]: https://git.alpinelinux.org/mkinitfs/tree/initramfs-init.in#n355
> 
> Any help is welcomed.

The stdio of the /init script in the initramfs is connected to /dev/console,
which does not have all of the functionality a usual tty is expected to have.

Internally, /dev/console is wired to output on all tty devices that are
specified via the console= kernel boot parameter.

Despite this, the /dev/tty should be available from the devtmpfs. Maybe it
might help to insert /bin/sh into the initramfs script to start an
interactive shell and poke around manually with `setfont`. Having `strace`
in the initramfs might be handy there.

Also, maybe its worth trying with /dev/tty0 (current virtual console). Setting
the font is an operation that only applies to the linux virtual consoles.
/dev/tty (current console) might end up pointing to some serial line.

--
Nero
David Demelier <markand@malikania.fr>
Details
Message ID
<7be3390352304af87c06477095702fce783f7309.camel@malikania.fr>
In-Reply-To
<20200128100521.GA12136@lucy.icvn.de> (view parent)
DKIM signature
missing
Download raw message
On Tue, 2020-01-28 at 10:05 +0000, Nero wrote:
> The stdio of the /init script in the initramfs is connected to
> /dev/console,
> which does not have all of the functionality a usual tty is expected
> to have.
> 
> Internally, /dev/console is wired to output on all tty devices that
> are
> specified via the console= kernel boot parameter.
> 
> Despite this, the /dev/tty should be available from the devtmpfs.
> Maybe it
> might help to insert /bin/sh into the initramfs script to start an
> interactive shell and poke around manually with `setfont`. Having
> `strace`
> in the initramfs might be handy there.

Thank you for your answer.

I've listed the devices inside the init script, there is a lot of
/dev/tty* devices including /dev/tty.

Note the error is “No such device or address”.

So I'm out of ideas yet. Maybe I should do a for loop or try to another
tty.

-- 
Davi
Reply to thread Export thread (mbox)