aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChmouel Boudjnah <chmouel@mandriva.org>2002-01-30 13:16:47 +0000
committerChmouel Boudjnah <chmouel@mandriva.org>2002-01-30 13:16:47 +0000
commit9f1dd44ca147dfb63671bd1967125479b8531c9f (patch)
tree724d15570634cd69dfd6914691fd6de4667d0487
parent6c65f35cc84cd80125622e87c74d0c16a21c146b (diff)
downloadbootsplash-9f1dd44ca147dfb63671bd1967125479b8531c9f.tar
bootsplash-9f1dd44ca147dfb63671bd1967125479b8531c9f.tar.gz
bootsplash-9f1dd44ca147dfb63671bd1967125479b8531c9f.tar.bz2
bootsplash-9f1dd44ca147dfb63671bd1967125479b8531c9f.tar.xz
bootsplash-9f1dd44ca147dfb63671bd1967125479b8531c9f.zip
Initial revisionfirst_import
-rw-r--r--cfg/bootsplash-1024x768.cfg19
-rw-r--r--cfg/bootsplash-1280x1024.cfg19
-rw-r--r--cfg/bootsplash-800x600.cfg19
-rwxr-xr-xscripts/detect-resolution117
-rwxr-xr-xscripts/make-boot-splash87
-rwxr-xr-xscripts/rewritejpeg29
-rw-r--r--tmp/cmdline1
-rw-r--r--tmp/lilo.conf42
-rw-r--r--tmp/menu.lst26
9 files changed, 359 insertions, 0 deletions
diff --git a/cfg/bootsplash-1024x768.cfg b/cfg/bootsplash-1024x768.cfg
new file mode 100644
index 0000000..cd251d1
--- /dev/null
+++ b/cfg/bootsplash-1024x768.cfg
@@ -0,0 +1,19 @@
+# This is the configuration file for the 1024x768 bootsplash picture.
+# This file is necessary to specify the coordinates of the text box on the
+# splash screen.
+
+# tx is the x coordinate of the text window in characters. default is 19
+# multiply width font width for coordinate in pixels.
+tx=0
+
+# ty is the y coordinate of the text window in characters. default is 10
+ty=0
+
+# tw is the width of the text window in characters. default is 104
+# NOTE: this should at least be 80 as on the standard linux text console
+tw=104
+
+# th is the height of the text window in characters. default is 34
+# NOTE: this should at least be 25 as on the standard linux text console
+th=34
+
diff --git a/cfg/bootsplash-1280x1024.cfg b/cfg/bootsplash-1280x1024.cfg
new file mode 100644
index 0000000..c734db9
--- /dev/null
+++ b/cfg/bootsplash-1280x1024.cfg
@@ -0,0 +1,19 @@
+# This is the configuration file for the 1280x1024 bootsplash picture
+# This file is necessary to specify the coordinates of the text box on the
+# splash screen.
+
+# tx is the x coordinate of the text window in characters. default is 24
+# multiply width font width for coordinate in pixels.
+tx=0
+
+# ty is the y coordinate of the text window in characters. default is 14
+ty=0
+
+# tw is the width of the text window in characters. default is 130
+# NOTE: this should at least be 80 as on the standard linux text console
+tw=130
+
+# th is the height of the text window in characters. default is 44
+# NOTE: this should at least be 25 as on the standard linux text console
+th=44
+
diff --git a/cfg/bootsplash-800x600.cfg b/cfg/bootsplash-800x600.cfg
new file mode 100644
index 0000000..de6af8c
--- /dev/null
+++ b/cfg/bootsplash-800x600.cfg
@@ -0,0 +1,19 @@
+# This is the configuration file for the 800x600 bootsplash picture.
+# This file is necessary to specify the coordinates of the text box on the
+# splash screen.
+
+# tx is the x coordinate of the text window in characters. default is 15
+# multiply width font width for coordinate in pixels.
+tx=0
+
+# ty is the y coordinate of the text window in characters. default is 8
+ty=0
+
+# tw is the width of the text window in characters. default is 82
+# NOTE: this should at least be 80 as on the standard linux text console
+tw=82
+
+# th is the height of the text window in characters. default is 26
+# NOTE: this should at least be 25 as on the standard linux text console
+th=26
+
diff --git a/scripts/detect-resolution b/scripts/detect-resolution
new file mode 100755
index 0000000..dad066e
--- /dev/null
+++ b/scripts/detect-resolution
@@ -0,0 +1,117 @@
+#!/usr/bin/perl
+# -*- Mode: cperl -*-
+# Copyright (C) 2002 by Chmouel Boudjnah <chmouel@mandrakesoft.com>
+# Redistribution of this file is permitted under the terms of the GNU
+# Public License (GPL)
+#
+# Detect vga resolution we want.
+#
+
+#use strict;
+my (%main, %entry);
+
+my $vga = detect_from_cmdline(cat_('/proc/cmdline'));
+undef $vga if $vga =~ /x/; #lilo cmdline can't convert
+detect_from_loader() if not $vga;
+if ($vga) {
+ chomp $vga;
+ $vga =~ s/vga=//;
+ $vga = convert_vgamode();
+}
+print $vga, "\n" if $vga;
+
+sub detect_from_cmdline {return (grep /vga=\d+/, split("[ \t]", shift))[0];}
+sub detect_from_loader {
+ my $loader = `detectloader -q`;chomp $loader;
+ if ($loader =~ m/lilo/i ) {
+ parse_lilo_conf();
+ $vga = $entry{$main{default}}{vga};
+ $vga = $main{vga} if not $vga;
+ } elsif ($loader =~ /grub/i ) {
+ parse_grub_conf();
+ $vga = detect_from_cmdline($entry{$main{default}}{options});
+ }
+}
+sub parse_grub_conf {
+ my ($title);
+ my $cnt = 0;
+ my $grub_conf = "/boot/grub/menu.lst";
+ open F, $grub_conf or die "Can't open $grub_conf\n";
+
+ while (<F>) {
+ next if /^\s*#/;
+ $main{default} = $1 if /^default (\d+)/;
+ if (/^title\s+(.*)/) {
+ $title=$1;
+ $entry{$title}{title} = $title;
+ $entry{$title}{cnt} = $cnt;
+ $main{default} = $title if $entry{$title}{cnt} eq $main{default};
+ $cnt++;
+ }
+ if (m/kernel\s+(\(.*\))([^\s]+)\s+(.*)/) {
+ $entry{$title}{partition} = $1;
+ $entry{$title}{kernel} = $2;
+ $entry{$title}{options} = $3;
+ }
+ $entry{$title}{initrd} = $1 if m/\s*initrd.*\)(.*)/;
+ }
+ close F;
+}
+
+sub parse_lilo_conf {
+ my $lilo_conf="/etc/lilo.conf";
+ my ($vga, $label);
+ open F, $lilo_conf or die "Can't open $lilo_conf\n";
+ while (<F>) {
+ next if /^\s*#/;
+ $main{default} = $1 if m/^default=(.*)/;
+ $main{vga} = $1 if m/^vga=(.*)/;
+ $vga = $1 if /vga=(.*)/;
+ $label=$1 if /label=(.*)/;
+ $entry{$label}{vga} = $vga if ($label and $vga);
+ undef $vga if (/image=/ and $vga);
+ }
+ close F;
+}
+
+sub convert_vgamode {
+ my $v;
+ #From drakx Xconfigurator_consts.pm
+ my %vgamodes = (
+ '640xx8' => 769,
+ '640x480x8' => 769,
+ '800xx8' => 771,
+ '800x600x8' => 771,
+ '1024xx8' => 773,
+ '1024x768x8' => 773,
+ '1280xx8' => 775,
+ '1280x1024x8' => 775,
+ '640xx15' => 784,
+ '640x480x15' => 784,
+ '800xx15' => 787,
+ '800x600x15' => 787,
+ '1024xx15' => 790,
+ '1024x768x15' => 790,
+ '1280xx15' => 793,
+ '1280x1024x15' => 793,
+ '640xx16' => 785,
+ '640x480x16' => 785,
+ '800xx16' => 788,
+ '800x600x16' => 788,
+ '1024xx16' => 791,
+ '1024x768x16' => 791,
+ '1280xx16' => 794,
+ '1280x1024x16' => 794,
+ #- '640xx24' => 786, #- there is a problem with these resolutions since the BIOS may take 24 or 32 planes.
+ #- '640x480x24' => 786,
+ #- '800xx24' => 789,
+ #- '800x600x24' => 789,
+ #- '1024xx24' => 792,
+ #- '1024x768x24' => 792,
+ #- '1280xx24' => 795,
+ #- '1280x1024x24' => 795,
+ );
+ foreach my $k (keys %vgamodes) { $v = $k if $vgamodes{$k} == $vga }
+ undef $vga if not $v;return $v;
+}
+sub cat_ { local *F; open F, $_[0] or $_[1] ? die "cat of file $_[0] failed: $!\n" : return; my @l = <F>; wantarray ? @l : join '', @l }
diff --git a/scripts/make-boot-splash b/scripts/make-boot-splash
new file mode 100755
index 0000000..45b8c56
--- /dev/null
+++ b/scripts/make-boot-splash
@@ -0,0 +1,87 @@
+#!/bin/sh
+# -*- Mode: shell-script -*-
+# Copyright (C) 2002 by Chmouel Boudjnah <chmouel@mandrakesoft.com>
+# Redistribution of this file is permitted under the terms of the GNU
+# Public License (GPL)
+# $Id$
+
+: ${splash_dir=/usr/share/bootsplash}
+
+initrd_file=$1
+
+[[ -z $initrd_file ]] && {
+ echo "You need to specify a initrd file as argument"
+ exit 1;
+}
+
+vgamode=$( $splash_dir/scripts/detect-resolution )
+if [[ $vgamode == 800* ]];then
+ resolution=800x600
+elif [[ $vgamode == 1024* ]];then
+ resolution=1024x768
+elif [[ $vgamode == 1280* ]];then
+ resolution=1280x1024
+fi
+
+if [[ -f $splash_dir/images/bootsplash-$resolution.jpg && -f $splash_dir/cfg/bootsplash-$resolution.cfg ]];then
+ image=$splash_dir/images/bootsplash-$resolution.jpg
+ config=$splash_dir/cfg/bootsplash-$resolution.cfg
+fi
+
+if [[ -n $image ]];then
+ if [[ -z $config ]];then
+ echo "Can't find a config files for $resolution";
+ exit 1;
+ fi
+else #no image
+ echo "Can't find images for $resolution";
+fi
+
+# From SuSe mk_initrd script
+function out_byte()
+{
+ let x=$1
+ echo -en "`printf \\\\%o $x`"
+}
+function write_int()
+{
+ let tmp1=($1 & 255)
+ let tmp2=($1>>8)
+ let tmp2=($tmp2&255)
+ let tmp3=($1>>16)
+ let tmp3=($tmp3&255)
+ let tmp4=($1>>24)
+ let tmp4=($tmp4&255)
+ out_byte $tmp1
+ out_byte $tmp2
+ out_byte $tmp3
+ out_byte $tmp4
+}
+function write_short()
+{
+ let tmp1=($1>>8)
+ let tmp2=($1&0xff)
+ out_byte $tmp2
+ out_byte $tmp1
+}
+
+function write_header()
+{
+ # write signature
+ echo -n "BOOTSPL1"
+ # write text x coordinate
+ write_short $1
+ # write text y coordinate
+ write_short $2
+ # write text width
+ write_short $3
+ # write text height
+ write_short $4
+ # write file length
+ write_int $5
+}
+
+source $config
+size=`wc -c<$image`
+write_header $tx $ty $tw $th $size >> $initrd_file
+cat $image >> $initrd_file \ No newline at end of file
diff --git a/scripts/rewritejpeg b/scripts/rewritejpeg
new file mode 100755
index 0000000..b2e36ea
--- /dev/null
+++ b/scripts/rewritejpeg
@@ -0,0 +1,29 @@
+#!/bin/bash
+# -*- Mode: shell-script -*-
+# Copyright (C) 2002 by Chmouel Boudjnah <chmouel@mandrakesoft.com>
+# Redistribution of this file is permitted under the terms of the GNU
+# Public License (GPL)
+#
+# Take a Jpeg and reconvert it via ppm-tools to make sure is
+# compatible for boot logo
+# $Id$
+
+files="$@"
+
+[[ -z $files ]] && {
+ echo "I need jpeg files argument"
+ exit 1
+}
+
+for file in $files;do
+ [[ $file != *.jpg ]] && {
+ echo "$file is not a jpeg"
+ continue;
+ }
+ echo "Converting $file"
+ tmp=${file/.jpg/.ppm}
+ jpegtopnm $file > $tmp
+ ppmtojpeg $tmp > $file
+ rm -f $tmp
+done
+
diff --git a/tmp/cmdline b/tmp/cmdline
new file mode 100644
index 0000000..6eb5a5f
--- /dev/null
+++ b/tmp/cmdline
@@ -0,0 +1 @@
+root=/dev/sda1 devfs=mount vga=0x0317
diff --git a/tmp/lilo.conf b/tmp/lilo.conf
new file mode 100644
index 0000000..6ffbe38
--- /dev/null
+++ b/tmp/lilo.conf
@@ -0,0 +1,42 @@
+boot=/dev/sda
+map=/boot/map
+install=/boot/boot.b
+vga=normal
+default=t
+keytable=/boot/fr-latin1.klt
+lba32
+prompt
+timeout=50
+message=/boot/message
+menu-scheme=wb:bw:wb:bw
+image=/boot/vmlinuz-enterprise
+ label=linux
+ root=/dev/sda1
+ initrd=/boot/initrd-enterprise.img
+ append=" devfs=mount"
+ vga=788
+ read-only
+image=/boot/vmlinuz
+ label=linux-up
+ root=/dev/sda1
+ initrd=/boot/initrd.img
+ append=" devfs=mount"
+ read-only
+image=/boot/vmlinuz
+ label=failsafe
+ root=/dev/sda1
+ initrd=/boot/initrd.img
+ append=" devfs=mount failsafe"
+ read-only
+other=/dev/fd0
+ label=floppy
+ unsafe
+
+image=/boot/vmlinuz-2.4.17-8mdksmp
+ label=t
+ root=/dev/sda1
+ read-only
+ optional
+ vga=790
+ append=" devfs=mount"
+ initrd=/boot/initrd-2.4.17-8mdksmp.img
diff --git a/tmp/menu.lst b/tmp/menu.lst
new file mode 100644
index 0000000..6ad67fc
--- /dev/null
+++ b/tmp/menu.lst
@@ -0,0 +1,26 @@
+timeout 5
+color black/cyan yellow/cyan
+i18n (hd0,0)/boot/grub/messages
+keytable (hd0,0)/boot/fr-latin1.klt
+altconfigfile (hd0,0)/boot/grub/menu.once
+default 0
+
+title linux
+kernel (hd0,0)/boot/vmlinuz-enterprise root=/dev/sda1 devfs=mount vga=787
+initrd (hd0,0)/boot/initrd-enterprise.img
+
+title failsafe
+kernel (hd0,0)/boot/vmlinuz root=/dev/sda1 devfs=mount failsafe
+initrd (hd0,0)/boot/initrd.img
+
+title floppy
+root (fd0)
+chainloader +1
+
+title 2417-5smp
+kernel (hd0,0)/boot/vmlinuz-2.4.17-5mdksmp devfs=mount root=/dev/sda1
+initrd (hd0,0)/boot/initrd-2.4.17-5mdksmp.img
+
+title 2417-5ent
+kernel (hd0,0)/boot/vmlinuz-2.4.17-5mdkenterprise devfs=mount root=/dev/sda1
+initrd (hd0,0)/boot/initrd-2.4.17-5mdkenterprise.img