Skip to content

Commit

Permalink
bin/fai-cd create_grub2_image(): Add grub background image + DejaVuSa…
Browse files Browse the repository at this point in the history
…nsMono font to FAI-CD.

Background image: /usr/share/images/desktop-base/desktop-grub.png
  - Can be changed via: `update-alternatives --config desktop-grub`
Font file: /usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf

Needs 'grub2-common', 'fonts-dejavu-core' and 'desktop-base' packages.
  • Loading branch information
dzatoah committed Jul 9, 2024
1 parent 3c34fc1 commit 4d7c5af
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion bin/fai-cd
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,32 @@ copy_kernel_initrd() {
echo "$isoversion" > $tmp/FAI-CD
}
# - - - - - - - - - - - - - - - - - - - - - - - - - -
copy_background_and_font() {
# copy background image and fonts.

local _font="/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf"
local _bgimg="/usr/share/images/desktop-base/desktop-grub.png"

if ! [ -s "${_font}" ]; then
return
fi

if ! [ -s "${_bgimg}" ]; then
return
fi

# Needs 'desktop-base' package.
cp -p "${_bgimg}" $tmp/boot/grub/

# Needs 'grub2-common' and 'fonts-dejavu-core' packages.
grub-mkfont -s 16 -o "$tmp/boot/grub/$(basename ${_font%.ttf}.pf2)" "${_font}"
}
# - - - - - - - - - - - - - - - - - - - - - - - - - -
create_grub2_image_arm64() {

mkdir -p $tmp/boot/grub
copy_background_and_font

if [ -d $NFSROOT/usr/lib/grub/arm64-efi ]; then

prepare_grub_cfg
Expand All @@ -235,6 +258,7 @@ create_grub2_image_arm64() {
create_grub2_image_x86() {

mkdir -p $tmp/boot/grub
copy_background_and_font

if [ -d $NFSROOT/usr/lib/grub/x86_64-efi ]; then

Expand Down Expand Up @@ -262,7 +286,7 @@ create_grub2_image_x86() {
--format=i386-pc \
--output=/tmp/core.img \
--locales="" --fonts="" \
--install-modules="linux normal iso9660 biosdisk memdisk search ls echo test chain msdospart part_msdos part_gpt minicmd ext2 keystatus all_video font sleep gfxterm regexp" \
--install-modules="linux normal iso9660 biosdisk memdisk search ls echo test chain msdospart part_msdos part_gpt minicmd ext2 keystatus all_video font sleep gfxterm regexp gfxterm_background png" \
--modules="linux normal iso9660 biosdisk search" \
"boot/grub/grub.cfg=/tmp/grub.cfg"
cat $NFSROOT/usr/lib/grub/i386-pc/cdboot.img $NFSROOT/tmp/core.img > $scratch/bios.img
Expand Down

0 comments on commit 4d7c5af

Please sign in to comment.