个人工具

“UbuntuHelp:USplashCustomizationHowto”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
(新页面: {{From|https://help.ubuntu.com/community/USplashCustomizationHowto}} {{Languages|UbuntuHelp:USplashCustomizationHowto}} == How do I customize USplash? == ---- == Edgy USplash == The impl...)
 
 
(未显示同一用户的8个中间版本)
第1行: 第1行:
 
{{From|https://help.ubuntu.com/community/USplashCustomizationHowto}}
 
{{From|https://help.ubuntu.com/community/USplashCustomizationHowto}}
 
{{Languages|UbuntuHelp:USplashCustomizationHowto}}
 
{{Languages|UbuntuHelp:USplashCustomizationHowto}}
 +
<<Include(Tag/Unsupported)>>
 
== How do I customize USplash? ==
 
== How do I customize USplash? ==
 
----
 
----
 
 
== Edgy USplash ==
 
== Edgy USplash ==
The implementation for usplash changed from Dapper to Edgy (6.06 - 6.10) and therefore the technique also changed for adjusting it.  The following is taken directly from /usr/share/doc/usplash-dev/examples/README.
+
The implementation for usplash changed from Dapper to Edgy (6.06 - 6.10) and therefore the technique also changed for adjusting it.  The following is taken directly from /usr/share/doc/usplash-dev/examples/README. In Gutsy, you can find the same file at /usr/share/doc/libusplash-dev/examples/README.  
 
+
Karmic (9.10) uses an X-based splash screen along with [[UbuntuHelp:USplash|USplash]].
 
=== Edgy USplash README Information from usplash-dev ===
 
=== Edgy USplash README Information from usplash-dev ===
 
 
==== How to create usplash themes ====
 
==== How to create usplash themes ====
 
 
Usplash in its current incarnation allows for simple and advanced themes. I'll
 
Usplash in its current incarnation allows for simple and advanced themes. I'll
 
start with explaining the basics of a theme and will introduce the more advanced
 
start with explaining the basics of a theme and will introduce the more advanced
 
topics later. I do assume that the reader has basic C programming knowledge and
 
topics later. I do assume that the reader has basic C programming knowledge and
 
knows what a Makefile is for.
 
knows what a Makefile is for.
 
 
==== A basic theme ====
 
==== A basic theme ====
 
 
A basic theme consist of a background picture and color/position definitions for
 
A basic theme consist of a background picture and color/position definitions for
 
various elements. The usplash-theme.h file lists all of them (ignore the
 
various elements. The usplash-theme.h file lists all of them (ignore the
第23行: 第19行:
 
color/position variables, usplash will take care of drawing a basic progress bar
 
color/position variables, usplash will take care of drawing a basic progress bar
 
and the text. The included usplash-testcard-theme.c is such a basic theme
 
and the text. The included usplash-testcard-theme.c is such a basic theme
 
 
The image you use should have max. 256 colors. The resolution is up to you, but
 
The image you use should have max. 256 colors. The resolution is up to you, but
 
keep in mind that usplash will use the resolution of the image without checking
 
keep in mind that usplash will use the resolution of the image without checking
第32行: 第27行:
 
Makefile to see how to put the pieces together. If you intend to create a
 
Makefile to see how to put the pieces together. If you intend to create a
 
package, make sure to Build-Depend on usplash-dev, which contains pngtousplash
 
package, make sure to Build-Depend on usplash-dev, which contains pngtousplash
and the necessary header files.
+
and the necessary header files. In Hardy this package has been renamed to libusplash-dev.
 
+
 
You should always allow your theme to display text, the INPUT function of
 
You should always allow your theme to display text, the INPUT function of
 
usplash will display text, even when not running verbose.
 
usplash will display text, even when not running verbose.
 
 
Themes have a ratio field where you can specify either USPLASH_4_3 if the image
 
Themes have a ratio field where you can specify either USPLASH_4_3 if the image
 
is a true 4:3 image or 16:9 if the image is a 16:9 image, scaled to 4:3. The
 
is a true 4:3 image or 16:9 if the image is a 16:9 image, scaled to 4:3. The
 
image MUST be a 4:3 image, because usplash can only handle 4:3 video modes
 
image MUST be a 4:3 image, because usplash can only handle 4:3 video modes
 
currently.
 
currently.
 
 
==== Optional 1: Custom font ====
 
==== Optional 1: Custom font ====
 
 
You can include a custom font. You will need to link it into your theme .so file
 
You can include a custom font. You will need to link it into your theme .so file
 
and set the .font field in the theme structure. The example theme supplies a
 
and set the .font field in the theme structure. The example theme supplies a
 
custom font, so once again: look there. The font should be a bdf font, converted
 
custom font, so once again: look there. The font should be a bdf font, converted
 
with bdftousplash.
 
with bdftousplash.
 
 
==== Optional 2: Custom drawing functions and animation ====
 
==== Optional 2: Custom drawing functions and animation ====
 
 
Themes can override the functions called for displaying the progress bar and/or
 
Themes can override the functions called for displaying the progress bar and/or
 
text. This can be used to create better looking progress bar.  If you supply a
 
text. This can be used to create better looking progress bar.  If you supply a
 
custom progress bar, you're sort of forced to implement custom animations too,
 
custom progress bar, you're sort of forced to implement custom animations too,
 
since the animation code is also used for displaying a pulsating progress bar.
 
since the animation code is also used for displaying a pulsating progress bar.
 
 
25 times per second, the animation function is called. This function has one
 
25 times per second, the animation function is called. This function has one
 
argument: whether the progress bar is currently pulsating or not. This allows
 
argument: whether the progress bar is currently pulsating or not. This allows
 
you to create animated themes as well as simply doing a better looking progress
 
you to create animated themes as well as simply doing a better looking progress
 
bar.
 
bar.
 
 
If you override the custom drawing functions, please make sure that any images
 
If you override the custom drawing functions, please make sure that any images
 
you use, use the exact same palette as the background image. You can do this by
 
you use, use the exact same palette as the background image. You can do this by
第66行: 第53行:
 
respctive images or by following the instructions on
 
respctive images or by following the instructions on
 
http://carol.gimp.org/gimp/resources/palettes/howto.html
 
http://carol.gimp.org/gimp/resources/palettes/howto.html
 
 
For now, you should not override draw_text, because the INPUT function of
 
For now, you should not override draw_text, because the INPUT function of
 
usplash will not use it and thus the txt will look odd in you theme.
 
usplash will not use it and thus the txt will look odd in you theme.
 
 
The included example theme uses custom animation for the progress bar, so once
 
The included example theme uses custom animation for the progress bar, so once
 
again it can be used as an example.
 
again it can be used as an example.
 
 
==== Optional 3: Multiple themes in one file ====
 
==== Optional 3: Multiple themes in one file ====
 
 
Usplash theme librarys can contain multiple themes in a linked list. Each theme
 
Usplash theme librarys can contain multiple themes in a linked list. Each theme
 
has a next pointer, which should either be NULL or point to another theme in the
 
has a next pointer, which should either be NULL or point to another theme in the
 
same file. The example theme includes the same theme at three different
 
same file. The example theme includes the same theme at three different
 
resolutions.
 
resolutions.
 
 
The first theme in the list should still be called usplash_theme and it should
 
The first theme in the list should still be called usplash_theme and it should
 
be the fallback variant of your theme, lowest resolution and 4:3 scale. This
 
be the fallback variant of your theme, lowest resolution and 4:3 scale. This
 
because usplash will use the first theme in case no favorable resolution was
 
because usplash will use the first theme in case no favorable resolution was
 
specified on th command line.
 
specified on th command line.
 
 
The theme selection will also take the ratio of your screen into account, so it
 
The theme selection will also take the ratio of your screen into account, so it
 
will favor a low-res 16:9 variant over a high-res 4:3 variant if you have a 16:9
 
will favor a low-res 16:9 variant over a high-res 4:3 variant if you have a 16:9
 
screen.
 
screen.
 
 
--
 
--
 
Sept. 6 2006
 
Sept. 6 2006
 
Dennis Kaarsemaker <[email protected]>
 
Dennis Kaarsemaker <[email protected]>
 
 
== Dapper USplash ==
 
== Dapper USplash ==
 
Before starting, make sure you understand the following:
 
Before starting, make sure you understand the following:
 
 
* The PNG must be: 640x480 16 colours. If you are using a different console mode, the image will be centered (both horizontally and verically) and the area around it will be filled with the background colour (image's palette colour #0).
 
* The PNG must be: 640x480 16 colours. If you are using a different console mode, the image will be centered (both horizontally and verically) and the area around it will be filled with the background colour (image's palette colour #0).
 
 
* Some palette entries are used for particular purposes:
 
* Some palette entries are used for particular purposes:
 
 
{|border="1" cellspacing="0"
 
{|border="1" cellspacing="0"
 
| ''Palette'' || ''Reason''  
 
| ''Palette'' || ''Reason''  
第117行: 第93行:
 
| 13 || Failure color  
 
| 13 || Failure color  
 
|}
 
|}
 
 
* The development version of GIMP (CVS or version 2.3.10 or later) has a new plug-in which lets you drag entries in the colormap (palette) to rearrange them. This plug-in is helpful in making these splash images. It is called "Rearrange Colormap" and is available in the image menu at Colors->Map->Rearrange Colormap. You _may_ have to save to a different format other than PNG though and convert back to PNG using a different program as the PNG export plug-in may rearrange the colormap.
 
* The development version of GIMP (CVS or version 2.3.10 or later) has a new plug-in which lets you drag entries in the colormap (palette) to rearrange them. This plug-in is helpful in making these splash images. It is called "Rearrange Colormap" and is available in the image menu at Colors->Map->Rearrange Colormap. You _may_ have to save to a different format other than PNG though and convert back to PNG using a different program as the PNG export plug-in may rearrange the colormap.
 
 
----
 
----
 
 
After that, the process is simple, just follow these steps:
 
After that, the process is simple, just follow these steps:
 
 
==== 1. Install BOGL packages needed ====
 
==== 1. Install BOGL packages needed ====
 
<pre><nowiki>  
 
<pre><nowiki>  
 
sudo apt-get install libbogl-dev  
 
sudo apt-get install libbogl-dev  
 
</nowiki></pre>
 
</nowiki></pre>
 
 
==== 2. Run these steps to get your splash built: ====
 
==== 2. Run these steps to get your splash built: ====
 
<pre><nowiki>  
 
<pre><nowiki>  
 +
#convert -colors 16 yourimage.png usplash-artwork.png
 
cp yourimage.png usplash-artwork.png
 
cp yourimage.png usplash-artwork.png
 
pngtobogl usplash-artwork.png > usplash-artwork.c
 
pngtobogl usplash-artwork.png > usplash-artwork.c
第136行: 第108行:
 
gcc -shared -Wl,-soname,usplash-artwork.so usplash-artwork.o -o yourimage-splash.so  
 
gcc -shared -Wl,-soname,usplash-artwork.so usplash-artwork.o -o yourimage-splash.so  
 
</nowiki></pre>
 
</nowiki></pre>
 
 
==== 3. Create a directory for local usplash images (if necessary) and copy your new splash to it: ====
 
==== 3. Create a directory for local usplash images (if necessary) and copy your new splash to it: ====
 
<pre><nowiki>
 
<pre><nowiki>
第142行: 第113行:
 
sudo cp yourimage-splash.so /usr/local/lib/usplash/yourimage-splash.so
 
sudo cp yourimage-splash.so /usr/local/lib/usplash/yourimage-splash.so
 
</nowiki></pre>
 
</nowiki></pre>
 
 
==== 4. Add your splash to the alternatives system: ====
 
==== 4. Add your splash to the alternatives system: ====
 
<pre><nowiki>
 
<pre><nowiki>
第152行: 第122行:
 
</nowiki></pre>
 
</nowiki></pre>
 
and select the /usr/local/lib/usplash/yourimage-splash.so file (the file that you have just added to alternatives).
 
and select the /usr/local/lib/usplash/yourimage-splash.so file (the file that you have just added to alternatives).
 
 
==== 5. Regenerate the initramfs: ====
 
==== 5. Regenerate the initramfs: ====
 
<pre><nowiki>
 
<pre><nowiki>
 
sudo dpkg-reconfigure linux-image-$(uname -r)
 
sudo dpkg-reconfigure linux-image-$(uname -r)
 
</nowiki></pre>
 
</nowiki></pre>
 
 
==== 6. Configure GRUB: A MUST FOR Dapper Drake (6.06)! ====
 
==== 6. Configure GRUB: A MUST FOR Dapper Drake (6.06)! ====
 
Open you GRUB configuration file.
 
Open you GRUB configuration file.
第175行: 第143行:
 
| vga=794 || 1280x1024  
 
| vga=794 || 1280x1024  
 
|}
 
|}
 +
<ol><li>'''Automatic (and update-proof) GRUB Configuration'''</li></ol>
  
A. '''Automatic (and update-proof) GRUB Configuration'''
 
 
Find the line  
 
Find the line  
 
<pre><nowiki>
 
<pre><nowiki>
第186行: 第154行:
 
</nowiki></pre>
 
</nowiki></pre>
 
(Don't "uncomment" the line - it only works when it is "commented".)
 
(Don't "uncomment" the line - it only works when it is "commented".)
 
 
Save the file, then execute
 
Save the file, then execute
 
<pre><nowiki>
 
<pre><nowiki>
 
sudo update-grub
 
sudo update-grub
 
</nowiki></pre>
 
</nowiki></pre>
 
 
This will now keep even after any future kernel update, unlike the method below. You're all done.
 
This will now keep even after any future kernel update, unlike the method below. You're all done.
 
+
<ol><li>'''Manual (kernel-specific) GRUB configuration'''</li></ol>
B. '''Manual (kernel-specific) GRUB configuration'''
+
  
 
'''NOTE:''' This is a less recommended approach. Any future kernel updates will not keep your framebuffer resolution setting. Even worse, the setting on your old kernels will likely be lost. The preferred approach is listed above.
 
'''NOTE:''' This is a less recommended approach. Any future kernel updates will not keep your framebuffer resolution setting. Even worse, the setting on your old kernels will likely be lost. The preferred approach is listed above.
 
 
Look for a line that corresponds to your kernel, e.g.
 
Look for a line that corresponds to your kernel, e.g.
 
<pre><nowiki>
 
<pre><nowiki>
第207行: 第171行:
 
</nowiki></pre>
 
</nowiki></pre>
 
That's all. Reboot, and enjoy.
 
That's all. Reboot, and enjoy.
 
 
If your bootup is now black, try setting vga=788, not vga=785, some video cards may not do 640x480.
 
If your bootup is now black, try setting vga=788, not vga=785, some video cards may not do 640x480.
 
[[category:CategoryDocumentation]] [[category:CategoryCleanup]]
 
 
 
 
----
 
----
Discussion about USplash errors in Dapper moved to [[UbuntuHelp:USplashCustomizationHowtoDiscussion]]. If you experience problems with USplash, please go there.
+
Discussion about [[UbuntuHelp:USplash|USplash]] errors in Dapper moved to [[UbuntuHelp:USplashCustomizationHowtoDiscussion|USplashCustomizationHowtoDiscussion]]. If you experience problems with [[UbuntuHelp:USplash|USplash]], please go there.
  
 
[[category:UbuntuHelp]]
 
[[category:UbuntuHelp]]

2009年11月17日 (二) 21:04的最新版本

<<Include(Tag/Unsupported)>>

How do I customize USplash?


Edgy USplash

The implementation for usplash changed from Dapper to Edgy (6.06 - 6.10) and therefore the technique also changed for adjusting it. The following is taken directly from /usr/share/doc/usplash-dev/examples/README. In Gutsy, you can find the same file at /usr/share/doc/libusplash-dev/examples/README. Karmic (9.10) uses an X-based splash screen along with USplash.

Edgy USplash README Information from usplash-dev

How to create usplash themes

Usplash in its current incarnation allows for simple and advanced themes. I'll start with explaining the basics of a theme and will introduce the more advanced topics later. I do assume that the reader has basic C programming knowledge and knows what a Makefile is for.

A basic theme

A basic theme consist of a background picture and color/position definitions for various elements. The usplash-theme.h file lists all of them (ignore the function pointers for now). If you specify only a background image and color/position variables, usplash will take care of drawing a basic progress bar and the text. The included usplash-testcard-theme.c is such a basic theme The image you use should have max. 256 colors. The resolution is up to you, but keep in mind that usplash will use the resolution of the image without checking whether your display supports it. For themes that are to be default for many people, I recommend choosing no higher than 800x600. The utility 'pngtousplash' can be used to convert an image to usplash-usable C code. The example-theme directory contains a complete them that builds out-of-source. Inspect its Makefile to see how to put the pieces together. If you intend to create a package, make sure to Build-Depend on usplash-dev, which contains pngtousplash and the necessary header files. In Hardy this package has been renamed to libusplash-dev. You should always allow your theme to display text, the INPUT function of usplash will display text, even when not running verbose. Themes have a ratio field where you can specify either USPLASH_4_3 if the image is a true 4:3 image or 16:9 if the image is a 16:9 image, scaled to 4:3. The image MUST be a 4:3 image, because usplash can only handle 4:3 video modes currently.

Optional 1: Custom font

You can include a custom font. You will need to link it into your theme .so file and set the .font field in the theme structure. The example theme supplies a custom font, so once again: look there. The font should be a bdf font, converted with bdftousplash.

Optional 2: Custom drawing functions and animation

Themes can override the functions called for displaying the progress bar and/or text. This can be used to create better looking progress bar. If you supply a custom progress bar, you're sort of forced to implement custom animations too, since the animation code is also used for displaying a pulsating progress bar. 25 times per second, the animation function is called. This function has one argument: whether the progress bar is currently pulsating or not. This allows you to create animated themes as well as simply doing a better looking progress bar. If you override the custom drawing functions, please make sure that any images you use, use the exact same palette as the background image. You can do this by creating one big image containing all components and then cutting out the respctive images or by following the instructions on http://carol.gimp.org/gimp/resources/palettes/howto.html For now, you should not override draw_text, because the INPUT function of usplash will not use it and thus the txt will look odd in you theme. The included example theme uses custom animation for the progress bar, so once again it can be used as an example.

Optional 3: Multiple themes in one file

Usplash theme librarys can contain multiple themes in a linked list. Each theme has a next pointer, which should either be NULL or point to another theme in the same file. The example theme includes the same theme at three different resolutions. The first theme in the list should still be called usplash_theme and it should be the fallback variant of your theme, lowest resolution and 4:3 scale. This because usplash will use the first theme in case no favorable resolution was specified on th command line. The theme selection will also take the ratio of your screen into account, so it will favor a low-res 16:9 variant over a high-res 4:3 variant if you have a 16:9 screen. -- Sept. 6 2006 Dennis Kaarsemaker <[email protected]>

Dapper USplash

Before starting, make sure you understand the following:

  • The PNG must be: 640x480 16 colours. If you are using a different console mode, the image will be centered (both horizontally and verically) and the area around it will be filled with the background colour (image's palette colour #0).
  • Some palette entries are used for particular purposes:
Palette Reason
0 Background color
0 Text background color
1 Progress bar color
2 Text foreground color (right)
4 Progress bar background color
8 Text foreground color (left)
13 Failure color
  • The development version of GIMP (CVS or version 2.3.10 or later) has a new plug-in which lets you drag entries in the colormap (palette) to rearrange them. This plug-in is helpful in making these splash images. It is called "Rearrange Colormap" and is available in the image menu at Colors->Map->Rearrange Colormap. You _may_ have to save to a different format other than PNG though and convert back to PNG using a different program as the PNG export plug-in may rearrange the colormap.

After that, the process is simple, just follow these steps:

1. Install BOGL packages needed

 
sudo apt-get install libbogl-dev 

2. Run these steps to get your splash built:

 
#convert -colors 16 yourimage.png usplash-artwork.png
cp yourimage.png usplash-artwork.png
pngtobogl usplash-artwork.png > usplash-artwork.c
gcc -Os -g -I/usr/include/bogl -fPIC -c usplash-artwork.c -o usplash-artwork.o
gcc -shared -Wl,-soname,usplash-artwork.so usplash-artwork.o -o yourimage-splash.so 

3. Create a directory for local usplash images (if necessary) and copy your new splash to it:

sudo mkdir -p /usr/local/lib/usplash/
sudo cp yourimage-splash.so /usr/local/lib/usplash/yourimage-splash.so

4. Add your splash to the alternatives system:

sudo update-alternatives --install /usr/lib/usplash/usplash-artwork.so usplash-artwork.so /usr/local/lib/usplash/yourimage-splash.so 55

If this is not the first alternative you have added for usplash-artwork.so, you may also need to select this alternative explicitly. Run:

sudo update-alternatives --config usplash-artwork.so

and select the /usr/local/lib/usplash/yourimage-splash.so file (the file that you have just added to alternatives).

5. Regenerate the initramfs:

sudo dpkg-reconfigure linux-image-$(uname -r)

6. Configure GRUB: A MUST FOR Dapper Drake (6.06)!

Open you GRUB configuration file.

gksudo gedit /boot/grub/menu.lst

To proceed, you'll need to know the framebuffer code for your desired resolution:

Code Resolution
vga=785 640x480
vga=788 800x600
vga=791 1024x768
vga=794 1280x1024
  1. Automatic (and update-proof) GRUB Configuration

Find the line

# defoptions=quiet splash

and add your framebuffer resolution code, e.g. (for 1024x768)

# defoptions=quiet splash vga=791

(Don't "uncomment" the line - it only works when it is "commented".) Save the file, then execute

sudo update-grub

This will now keep even after any future kernel update, unlike the method below. You're all done.

  1. Manual (kernel-specific) GRUB configuration

NOTE: This is a less recommended approach. Any future kernel updates will not keep your framebuffer resolution setting. Even worse, the setting on your old kernels will likely be lost. The preferred approach is listed above. Look for a line that corresponds to your kernel, e.g.

kernel		/boot/vmlinuz-2.6.15-23-386 root=/dev/hda1 ro quiet splash

and add the desired framebuffer code at the end of the line, e.g.

kernel		/boot/vmlinuz-2.6.15-23-386 root=/dev/hda1 ro quiet splash vga=791

That's all. Reboot, and enjoy. If your bootup is now black, try setting vga=788, not vga=785, some video cards may not do 640x480.


Discussion about USplash errors in Dapper moved to USplashCustomizationHowtoDiscussion. If you experience problems with USplash, please go there.