GRUB

From ThorxWiki
(Difference between revisions)
Jump to: navigation, search
(+script)
(grubpass identified)
 
(7 intermediate revisions by one user not shown)
Line 1: Line 1:
Some GRUB_INIT_TUNE themes I've found online in various places... this is a fragment from my debian:/etc/default/grub file
+
Here are the GRUB_INIT_TUNE fragments from the grubpass source... (tunes.h). Note that some of these differ to mine above, as I've altered the timing in some
  +
<pre>
  +
Super Mario
  +
GRUB_INIT_TUNE="1000 334 1 334 1 0 1 334 1 0 1 261 1 334 1 0 1 392 2 0 4 196 2"
  +
  +
1. Close Encounters
  +
GRUB_INIT_TUNE="220 900 2 1000 2 800 2 400 2 600 3"
  +
  +
2. Fuer Elise
  +
GRUB_INIT_TUNE="480 420 1 400 1 420 1 400 1 420 1 315 1 370 1 335 1 282 3 180 1 215 1 282 1 315 3 213 1 262 1 315 1 335 3 213 1 420 1 400 1 420 1 400 1 420 1 315 1 370 1 335 1 282 3 180 1 215 1 282 1 315 3 213 1 330 1 315 1 282 3"
  +
  +
3. Star Wars: Imperial March
  +
GRUB_INIT_TUNE="480 440 4 440 4 440 4 349 3 523 1 440 4 349 3 523 1 440 8 659 4 659 4 659 4 698 3 523 1 415 4 349 3 523 1 440 8"
  +
  +
4. Wolfenstein 3D
  +
GRUB_INIT_TUNE="300 131 1 196 1 196 1 196 1 294 1 196 1 294 1 196 1 131 1"
  +
  +
5. Mall (Nothing Special)
  +
GRUB_INIT_TUNE="180 440 1 554 1 659 1"
  +
  +
6. My Little Pony
  +
GRUB_INIT_TUNE="2400 587 18 554 4 587 8 659 12 587 16 0 10 587 4 659 4 740 8 587 4 784 12 740 8 659 8 587 4 740 20 587 40"
  +
</pre>
  +
  +
http://download.polytechnic.edu.na/pub4/download.sourceforge.net/pub/sourceforge/g/project/gr/grubpass/grubpass/1.3.2E/src/tunes.h
  +
  +
  +
These are the ones I have in my grub config... this was created before I found the above file, from tunes I found online. I've altered some for my own taste of tune...
  +
   
 
<pre>
 
<pre>
Line 18: Line 18:
   
 
# Star Wars Imperial Death March:
 
# Star Wars Imperial Death March:
#GRUB_INIT_TUNE="480 440 4 440 4 440 4 349 3 523 1 440 4 349 3 523 1 440 8 659 4
+
#GRUB_INIT_TUNE="480 440 4 440 4 440 4 349 3 523 1 440 4 349 3 523 1 440 8 659 4 659 4 659 4 698 3 523 1 415 4 349 3 523 1 440 8"
659 4 659 4 698 3 523 1 415 4 349 3 523 1 440 8"
 
   
 
# Wolfenstein 3D
 
# Wolfenstein 3D
Line 31: Line 31:
   
 
<pre>
 
<pre>
$ cat bin/grubtune2beep
+
#!/bin/bash
#!/bin/bash
+
  +
if [ $# -lt 3 ]; then
  +
echo "Usage: $0 tempo freq dur [freq dur freq dur...]" >&2
  +
exit 1
  +
fi
   
if [ $# -lt 3 ]; then
+
tempo=$1; shift
echo "Usage: $0 tempo freq dur [freq dur freq dur...]" >&2
 
exit 1
 
fi
 
   
tempo=$1; shift
+
while [ -n "$*" ]; do
  +
freq=$1; shift
  +
[ $freq -eq 0 ] && freq=1 # beep will fail if $freq is 0
  +
dur=$1; shift
  +
dur=$((60000*$dur/$tempo))
  +
# ie, 60 (bpm) * 1000 (for milliseconds) * duration / tempo
  +
# Note: on one of my systems, i had to double it (ie, 12000*). I don't
  +
# know why, but it makes some of the tunes I've collected sound right.
  +
# (note: I have not tested all tunes in GRUB)
  +
#
  +
# You can generate a single beep command here, but I prefer to step it
  +
# out since [a] sounds slightly closer to GRUB implementation
  +
# and [b] easier to debug an off-note
  +
# BEEPOPTS="$BEEPOPTS $NEXT -f
  +
# $freq -l $dur"
  +
# NEXT="-n"
  +
echo "beep -f $freq -l $dur"
  +
beep -f $freq -l $dur
  +
done
   
while [ -n "$*" ]; do
+
#echo "playing beep $BEEPOPTS"
freq=$1; shift
 
dur=$1; shift
 
dur=$((60000*$dur/$tempo))
 
# ie, 60 (bpm) * 1000 (for milliseconds) * duration / tempo
 
BEEPOPTS="$BEEPOPTS $NEXT -f $freq -l $dur"
 
NEXT="-n"
 
done
 
   
beep $BEEPOPTS
+
#beep $BEEPOPTS
 
</pre>
 
</pre>

Latest revision as of 17:06, 19 July 2012

Here are the GRUB_INIT_TUNE fragments from the grubpass source... (tunes.h). Note that some of these differ to mine above, as I've altered the timing in some

Super Mario                
GRUB_INIT_TUNE="1000 334 1 334 1 0 1 334 1 0 1 261 1 334 1 0 1 392 2 0 4 196 2"

1. Close Encounters
GRUB_INIT_TUNE="220 900 2 1000 2 800 2 400 2 600 3"

2. Fuer Elise
GRUB_INIT_TUNE="480 420 1 400 1 420 1 400 1 420 1 315 1 370 1 335 1 282 3 180 1 215 1 282 1 315 3 213 1 262 1 315 1 335 3 213 1 420 1 400 1 420 1 400 1 420 1 315 1 370 1 335 1 282 3 180 1 215 1 282 1 315 3 213 1 330 1 315 1 282 3"

3. Star Wars: Imperial March
GRUB_INIT_TUNE="480 440 4 440 4 440 4 349 3 523 1 440 4 349 3 523 1 440 8 659 4 659 4 659 4 698 3 523 1 415 4 349 3 523 1 440 8"

4. Wolfenstein 3D
GRUB_INIT_TUNE="300 131 1 196 1 196 1 196 1 294 1 196 1 294 1 196 1 131 1"

5. Mall (Nothing Special)
GRUB_INIT_TUNE="180 440 1 554 1 659 1"

6. My Little Pony
GRUB_INIT_TUNE="2400 587 18 554 4 587 8 659 12 587 16 0 10 587 4 659 4 740 8 587 4 784 12 740 8 659 8 587 4 740 20 587 40"

http://download.polytechnic.edu.na/pub4/download.sourceforge.net/pub/sourceforge/g/project/gr/grubpass/grubpass/1.3.2E/src/tunes.h


These are the ones I have in my grub config... this was created before I found the above file, from tunes I found online. I've altered some for my own taste of tune...


# Uncomment to get a beep at grub start
# The format unless a file is named is: "tempo [pitch1 duration1] [pitch2 duration2] ..."
# Warning: The menu will not be displayed until the tone is finished

#GRUB_INIT_TUNE="480 440 1"

# Close Encounters/5 Tone:
#GRUB_INIT_TUNE="480 900 2 1000 2 800 2 400 2 600 3"

# Fur Elise (note long):
#GRUB_INIT_TUNE="480 420 1 400 1 420 1 400 1 420 1 315 1 370 1 335 1 282 3 180 1 215 1 282 1 315 3 213 1 262 1 315 1 335 3 213 1 420 1 400 1 420 1 400 1 420 1 315 1 370 1 335 1 282 3 180 1 215 1 282 1 315 3 213 1 330 1 315 1 282 3"

# Super Mario
#GRUB_INIT_TUNE="1000 334 1 334 1 0 1 334 1 0 1 261 1 334 1 0 1 392 2 0 4 196 2"

# Star Wars Imperial Death March:
#GRUB_INIT_TUNE="480 440 4 440 4 440 4 349 3 523 1 440 4 349 3 523 1 440 8 659 4 659 4 659 4 698 3 523 1 415 4 349 3 523 1 440 8"

# Wolfenstein 3D
GRUB_INIT_TUNE="300 131 1 196 1 196 1 196 1 294 1 196 1 294 1 196 1 131 1"


This tip which converts a GRUB_INIT_TUNE to a audio file which sox will play through the soundcard... http://ubuntuforums.org/showthread.php?t=1739495

Based on this script, I've concoted the following, which converts a GRUB_INIT_TUNE into a beep(1) command, to play it through the PC speaker - as grub intended.

 #!/bin/bash

 if [ $# -lt 3 ]; then
     echo "Usage: $0 tempo freq dur [freq dur freq dur...]" >&2
     exit 1
 fi

 tempo=$1; shift

 while [ -n "$*" ]; do
     freq=$1; shift
     [ $freq -eq 0 ] && freq=1  # beep will fail if $freq is 0
     dur=$1;  shift
     dur=$((60000*$dur/$tempo))
     # ie, 60 (bpm) * 1000 (for milliseconds) * duration / tempo
     # Note: on one of my systems, i had to double it (ie, 12000*). I don't
     # know why, but it makes some of the tunes I've collected sound right.
     # (note: I have not tested all tunes in GRUB)
     #
     # You can generate a single beep command here, but I prefer to step it
     # out since [a] sounds slightly closer to GRUB implementation
     # and [b] easier to debug an off-note
     # BEEPOPTS="$BEEPOPTS $NEXT -f
     # $freq -l $dur"
#     NEXT="-n"
     echo "beep -f $freq -l $dur"
     beep -f $freq -l $dur
 done

#echo "playing beep $BEEPOPTS"

#beep $BEEPOPTS
Personal tools
Namespaces

Variants
Actions
Navigation
meta navigation
More thorx
Tools