From b01ce4ef53323a391e73c5ce4b221207ff94028f Mon Sep 17 00:00:00 2001 From: Christian Date: Fri, 28 May 2021 10:04:57 -0400 Subject: [PATCH] get started on plymouth thing --- ...21-05-28-pretty-boot-screen-no-plymouth.md | 97 +++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 _drafts/2021-05-28-pretty-boot-screen-no-plymouth.md diff --git a/_drafts/2021-05-28-pretty-boot-screen-no-plymouth.md b/_drafts/2021-05-28-pretty-boot-screen-no-plymouth.md new file mode 100644 index 0000000..b0511f5 --- /dev/null +++ b/_drafts/2021-05-28-pretty-boot-screen-no-plymouth.md @@ -0,0 +1,97 @@ +--- +layout: post +title: "Nice Looking Boot Screen Without Plymouth" +--- + +I was poking around with my Arch Linux installation and I learned that the +initcpio was done using shell scripts that I could write myself, and I ended +up trying to make my system boot process look decent without using Plymouth. + +## Custom initcpio hooks + +You can place custom shell scripts in `/etc/initcpio/hooks`, and have a script +to install it to the initramfs in `/etc/initcpio/install`. This is more detailed +in the [Arch Linux wiki page](https://wiki.archlinux.org/title/mkinitcpio). + +You'll want to create a file named "welcome" or any other name you want in +`/etc/initcpio/hooks`. It will contain a single function `run_hook`, and within +it you can put `echo` or any other commands, as long as it's in the busybox +environment that the initramfs uses. Here's what your welcome hook could look +like: + +``` +REPLACE THIS TEXT WITH THE WELCOME HOOK WHEN YOU GET ON YOUR LAPTOP +``` + +You'll also want to create a file with the same name in `/etc/initcpio/install`, +and it will have two functions: `build` and `help`. The help function just +outputs a message when you do `mkinitcpio -H welcome`, so it can contain any +text you want. The build function will just contain `add_runscript`, to add the +file we put in the hooks folder. Here's what yours could look like: + +``` +REPLACE THIS TEXT TOO +``` + +When that's done, you can add the `welcome` hook somewhere early on in the hooks +part of `/etc/mkinitcpio.conf`, and run `mkinitcpio -P` as root to regenerate +the initramfs to contain your new script. Now when your computer boots, it +should run our script. + +If your cool new message is quickly pushed up and off the screen by boot +messages, you can add `quiet` to your +[kernel parameters](https://wiki.archlinux.org/title/Kernel_parameters) to +silence the extra messages that the kernel usually spits out while booting up. + +## Console font + +The default font for the console may not be your favorite. Thankfully, there are +plenty of fonts you can try out, kept in `/usr/share/kbd/consolefonts/`, and can +be [previewed using `setfont`](https://wiki.archlinux.org/title/Linux_console#Preview_and_temporary_changes). +I use the **WHAT FONT DO I USE?** font, and I have it +[set persistently](https://wiki.archlinux.org/title/Linux_console#Persistent_configuration) +in `/etc/vconsole.conf`. To have the console load your font early on in the boot +process, you can just add `consolefont` somewhere in your mkinitcpio hooks +array. + +## Custom colors + +Your console supports custom colors, and can be easily set using +[linux-vt-setcolors](https://github.com/EvanPurkhiser/linux-vt-setcolors), +available from the AUR as `setcolors-git`. Also install the +[mkinitcpio-colors](https://github.com/EvanPurkhiser/mkinitcpio-colors) program +from the AUR as `mkinitcpio-colors-git`. You can add your color scheme to +`/etc/vconsole.conf` using the format specified on the project's +[README](https://github.com/EvanPurkhiser/mkinitcpio-colors#configuration): + +``` +COLOR_0=000000 # black +COLOR_1=550000 # darkred +... +COLOR_15=ffffff # white +``` + +You can use something like [terminal.sexy](https://terminal.sexy/) to get colors +that you like, and then add the colors to the vconsole config matching the +numbers 0-15 to the same colors. Once you're done with that, add the `colors` +hook to that same hooks array we've been adding stuff to, run `mkinitcpio -P`, +and reboot. You should be greeted with your welcome message, in your own font, +with your own colors. + +![image](/assets/examplebootscreen.png) + +## Extra + +I have an encrypted hard drive, so I'm able to put a message that appears only +after I unlock my drive. I created a second, very similar hook in +`/etc/initcpio/hooks` and created its `/etc/initcpio/install` counterpart, and +put a funny warning in it, and in the `/etc/mkinitcpio.conf` hooks array, I put +my new hook BEFORE the `encrypt` hook, and I put my `welcome` hook AFTER the +`encrypt` hook. Since the hooks run in order, the warning is displayed, and if I +type the correct password, I'm greeted by my laptop, and it loads everything up. + +![image](/assets/mybootscreen.png) + +I hope this has been helpful not only for making a cool boot screen without +Plymouth, but I hope I also helped you learn more about how Arch Linux boots its +system using an initramfs.