Skip to contentSkip to conversation

Grub2 and Splash

Buildroot Steve Kenton 2 participants 2 messages Feb 18, 2015

lore
Share & tools
lore
#0 lore raw

Looking into adding a splash screen to my grub2 menu.
Cobbled together the one below using font from my build host and it works. Trying to build unicode.pf2 with buildroot immediately ran into snag with freetype.

Finally RTFM and realized how special the grub2 build is.
Is there a reason that grub2 is not just built as a regular host package?

Steve Kenton

$ more grub.cfg
set default="0"
set timeout="3"

if loadfont /boot/grub/fonts/unicode.pf2 ; then
set gfxmode="640x480"
insmod gfxterm
insmod vbe
terminal_output gfxterm
if terminal_output gfxterm; then true ; else
terminal gfxterm
fi
fi
insmod tga
background_image /boot/grub/splash.tga

menuentry "Buildroot" {
linux /boot/bzImage root=/dev/sda1 rootfstype=ext4 console=tty1 quiet splash=si
lent
}

menuentry "Memtest86+" {
	linux16 /boot/memtest86+.bin
}
#1 lore raw

Dear Steve Kenton,

Quoted 3 lines · Steve Kenton

Looking into adding a splash screen to my grub2 menu.
Cobbled together the one below using font from my build host and it works. Trying to build unicode.pf2 with buildroot immediately ran into snag with freetype.

Could you please be more specific than "ran into snag" ? Which error messages and issues, when trying what exactly ?

Quoted 3 lines

Finally RTFM and realized how special the grub2 build is.
Is there a reason that grub2 is not just built as a regular host package?

Because grub2 is kind of special: it needs to build both some things for the target, and some things for the host. And there are some explanations about it in grub2.mk:

===

# Grub2 is kind of special: it considers CC, LD and so on to be the

# tools to build the native tools (i.e to be executed on the build
# machine), and uses TARGET_CC, TARGET_CFLAGS, TARGET_CPPFLAGS to
# build the bootloader itself.
GRUB2_CONF_ENV = \
        $(HOST_CONFIGURE_OPTS) \
        CPP="$(HOSTCC) -E" \
        TARGET_CC="$(TARGET_CC)" \
        TARGET_CFLAGS="$(TARGET_CFLAGS)" \
        TARGET_CPPFLAGS="$(TARGET_CPPFLAGS)"

===

And it is actually more logical for grub2 to be a target package: the main purpose of grub2 is to have a bootloader on the target, much like U-Boot or Barebox. The fact that in addition Grub2 provides a bunch of host utilities is kind of a "detail".

Again, please be more specific about the issues you encounter. At least please give the detailed steps to reproduce them.

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com