# customize boot loader logo



## fluca1978 (Nov 5, 2019)

I'm having hard times in trying to customize the boot loader logo.
I've started copying a .4th file and customizing it, so I created /boot/logo-postgresql.4th, and the configured the loader as

```
% cat /boot/loader.conf
loader_logo="postgresql"
```

but the logo is not showing up. Then I realized that options could be kind of hard-coded, so I tried to override the /boot/logo-orb.4th with my own and configured the boot loader to load the logo _"orb"_, but again I'm not getting it.
So I must be missing some step in the workflow. Anyone knows how to do it?


----------



## SirDice (Nov 5, 2019)

Newer versions of FreeBSD have switched to LUA instead of Forth. The *.4th files are Forth.


----------



## fluca1978 (Nov 6, 2019)

Thanks for the explaination, but again I'm missing something. I've created the file /boot/lua/logo-postgresql.lua with the content as follows:


```
% cat /boot/lua/logo-postgresql.lua
local drawer = require("drawer")

local postgresql_color = {
"   ____  ______  ___   "
"  /    )/      \/   \  "
" (     / __    _\    ) "
"  \    (/ o)  ( o)   ) "
"   \_  (_  )   \ )  /  "
"     \  /\_/    \)_/   "
"      \/  //|  |\\     "
"          v |  | v     "
"            \__/       "
}

drawer.addLogo("postgresql", {
        requires_color = true,
        graphic = postgresql_color,
})

return true
```

and then in /boot/loader.conf I've got:


```
% cat /boot/loader.conf
loader_logo="postgresql"
```

but again, after a reboot, the _orb_ logo is shown. Am I missing something? Do I have to rehash the booting scripts?

By the way, if now _.4th_ files are no more used, why are they still there?


----------



## fluca1978 (Nov 6, 2019)

I cannot spot the problem, is there a way to preview the boot menu?


----------



## SirDice (Nov 6, 2019)

Good question, I don't know actually. I rarely touch any of those files.


----------



## fluca1978 (Nov 12, 2019)

With a print-reboot cycle I found out that lua was claiming about '\' in the string, that was interpreted as an escape sequence.
Therefore I tried first to use single ticks, but that did not solved the problem, so I doubled all the '\' chars in my logo. Now it works, some adjustements are required (position and colors) but at least I've got something working now.


----------



## fluca1978 (Nov 12, 2019)

So, in the case anybody needs, here are the links to the logos https://github.com/fluca1978/fluca1978-pg-utils/tree/master/logos.
In the case anybody attempts at doing something simiar, I've placed a 
	
	



```
print( 'ret ' .. ret )
```
 into /boot/lua/core.lua in the function `try_include` so that, in the case the logo does not get loaded, I can see the returning value and, therefore, the Lua error that prevented the logo to be loaded into the `logodefs` table. That of course means _stopping _the loader from continuing the load process until a `boot` command is issued.


----------



## teo (Nov 19, 2019)

fluca1978 said:


> So, in the case anybody needs, here are the links to the logos https://github.com/fluca1978/fluca1978-pg-utils/tree/master/logos.
> In the case anybody attempts at doing something simiar, I've placed a
> 
> 
> ...


I would  put the UNIX  logo on the  boot of prompt  and remove that ugly logo from the boot, how do proceed?


----------



## fluca1978 (Nov 21, 2019)

teo said:


> I would  put the UNIX  logo on the  boot of prompt  and remove that ugly logo from the boot, how do proceed?



What do you mean with "unix logo"?
At the time FreeBSD provides you with beastie, orb and a text one. So if you want to simply change the logo selecting one among those, you have to configure your /boot/loader.conf, while if you are going to build a new one (as I did with the PostgreSQL one), you have to follow my steps.


----------



## teo (Nov 24, 2019)

fluca1978 said:


> ....while if you are going to build a new one (as I did with the PostgreSQL one), you have to follow my steps.


I would like to build a logo to my liking, what are the steps in this case for the logo to look UNIX at boot time?


----------



## fluca1978 (Nov 25, 2019)

teo said:


> I would like to build a logo to my liking, what are the steps in this case for the logo to look UNIX at boot time?



You have to place a file into /boot/lua, proposing an escaped stringa based table that has the logo you want to display. Then you name it, provide right permissions to the file and set the loader_logo parameter. If you have a look at my PostgreSQL logo it woule be quite easy to do.


----------



## SirDice (Nov 25, 2019)

teo said:


> I would put the UNIX logo on the boot of prompt


There's no such thing as a "UNIX logo", it doesn't exist.


----------



## fluca1978 (Nov 25, 2019)

SirDice said:


> There's no such thing as a "UNIX logo", it doesn't exist.



I think he means to add a custonmized logo, like the word "Unix".


----------



## teo (Dec 2, 2019)

fluca1978 said:


> You have to place a file into /boot/lua, proposing an escaped stringa based table that has the logo you want to display. Then you name it, provide right permissions to the file and set the loader_logo parameter. If you have a look at my PostgreSQL logo it woule be quite easy to do.



I've already created a logo based on your file, it worked very well, and disappeared the ugly logo of the beast. What I have no idea all that procedure with (symbols, numbers, letters, others) as seen in the image, I would like to create my own logo that says UNIX at boot time.


----------



## fluca1978 (Dec 3, 2019)

The "numbers and letters" are escape sequences used to make the colors.
I suggest you start with a blank and white logo, with only your ascii art, and then when ready switch to a coloured version.


----------



## FloppyKing (Oct 2, 2020)

fluca1978 i'm glad you figured this out for me already.  I had a customized boot logo that i was using in FreeBSD10 and couldn't figure out why whatever i did seemed to have no impact.  Seems dumb to still have all those 4th files in the boot folder if they're not used anymore.  Thank you.


----------



## BostonBSD (Oct 29, 2020)

I found coding the table of strings easier with double brackets, I don't have to think about escape characters.  Although, it might only work for black and white images.  I haven't tried color.


```
-- This ASCII image was created by Blazej Kozlowski
-- The author of this code is not Blazej Kozlowski
-- Name this file logo-bunnybw.lua
-- Make sure it has read permissions
-- Place in /boot/lua
-- In /boot/loader.conf, change or add the loader_logo option to read:
-- loader_logo="bunnybw"

local drawer = require("drawer")

local bunny_bw = {
[[                              __]],
[[                     /\    .-" /]],
[[                    /  ; .'  .' ]],
[[                   :   :/  .'   ]],
[[                    \  ;-.'     ]],
[[       .--""""--..__/     `.    ]],
[[     .'           .'    `o  \   ]],
[[    /                    `   ;  ]],
[[   :                  \      :  ]],
[[ .-;        -.         `.__.-'  ]],
[[:  ;          \     ,   ;       ]],
[['._:           ;   :   (        ]],
[[    \/  .__    ;    \   `-.     ]],
[[     ;     "-,/_..--"`-..__)    ]],
[[     '""--.._:          ]]
}

drawer.addLogo("bunnybw", {
    graphic = bunny_bw,
    shift = {x = 2, y = 4},
})

return true
```


----------



## BostonBSD (Oct 29, 2020)

Here's another one just to show that this works.


```
-- Name this file logo-bunnyfacebw.lua
-- Make sure it has read permissions
-- Place in /boot/lua
-- In /boot/loader.conf, change or add the loader_logo option to read:
-- loader_logo="bunnyfacebw"

local drawer = require("drawer")

local bunnyface_bw = {
[[     / \                ]],
[[    / _ \               ]],
[[   | / \ |              ]],
[[   ||   || _______      ]],
[[   ||   || |\     \     ]],
[[   ||   || ||\     \    ]],
[[   ||   || || \    |    ]],
[[   ||   || ||  \__/     ]],
[[   ||   || ||   ||      ]],
[[    \\_/ \_/ \_//       ]],
[[   /   _     _   \      ]],
[[  /               \     ]],
[[  |    O     O    |     ]],
[[  |   \  ___  /   |     ]],
[[ /     \ \_/ /     \    ]],
[[/  -----  |  -----  \   ]],
[[|     \__/|\__/     |   ]],
[[\       |_|_|       /   ]],
[[ \_____       _____/    ]],
[[       \     /          ]],
[[       |     |          ]]
}

drawer.addLogo("bunnyfacebw", {
        graphic = bunnyface_bw,
        shift = {x = 2, y = -3},
})

return true
```


----------



## BostonBSD (Nov 4, 2020)

Try This [from ascii.co.uk, they let you create your own ascii art also]:


```
_    _ _   _ _______   __
| |  | | \ | |_   _\ \ / /
| |  | |  \| | | |  \ V /
| |  | | . ` | | |   > < 
| |__| | |\  |_| |_ / . \
 \____/|_| \_|_____/_/ \_\
```


----------



## SirDice (Nov 4, 2020)

If you're not that creative like me, I can barely draw a stick figure, misc/figlet can be useful. It also has a bunch of extra fonts (misc/figlet-fonts). 


```
% figlet "Hello World"
 _   _      _ _        __        __         _     _
| | | | ___| | | ___   \ \      / /__  _ __| | __| |
| |_| |/ _ \ | |/ _ \   \ \ /\ / / _ \| '__| |/ _` |
|  _  |  __/ | | (_) |   \ V  V / (_) | |  | | (_| |
|_| |_|\___|_|_|\___/     \_/\_/ \___/|_|  |_|\__,_|
```


----------



## _martin (Nov 4, 2020)

Despite other attempts to change it the only FreeBSD logo that I accept is _beastie_ . It has always been so.


----------



## AngryChris (Nov 5, 2020)

_martin said:


> Despite other attempts to change it the only FreeBSD logo that I accept is _beastie_ . It has always been so.


Adding `loader_logo="beastie"` to /boot/loader.conf is always the capstone of every install I do!


----------



## phalange (Nov 5, 2020)

AngryChris said:


> Adding `loader_logo="beastie"` to /boot/loader.conf is always the capstone of every install I do!


I just added this little snippet and it made my day. Sometimes it's the little things I guess?


----------



## a6h (Nov 5, 2020)

phalange said:


> I just added this little snippet and it made my day. Sometimes it's the little things I guess?


Yes, and "beastie" should be default FreeBSD logo. Current one, I don't know, sometimes it reminds me of a cat's head, sometime I feel I'm looking at the back of a fat chicken. Whatever it's, it's not "beastie"


----------

