Changes between Initial Version and Version 1 of ventana/SplashScreen


Ignore:
Timestamp:
10/22/2017 05:28:45 AM (6 years ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ventana/SplashScreen

    v1 v1  
     1{{{#!html
     2          <div id="wikipage" class="trac-content"><p>
     3</p><div class="wiki-toc">
     4<ol>
     5  <li>
     6    <a href="#VentanaSplashScreen">Ventana Splash Screen</a>
     7    <ol>
     8      <li>
     9        <a href="#U-BootBootloader">U-Boot Bootloader</a>
     10        <ol>
     11          <li>
     12            <a href="#CreateCustomBMPLogoMethod">Create Custom BMP Logo Method</a>
     13          </li>
     14          <li>
     15            <a href="#ModifyDefaultLinuxLogoMethod">Modify Default Linux Logo Method</a>
     16          </li>
     17          <li>
     18            <a href="#BMPFromStorageMethod">BMP From Storage Method</a>
     19          </li>
     20          <li>
     21            <a href="#RelatedSourceFiles">Related Source Files</a>
     22          </li>
     23          <li>
     24            <a href="#SuppressingU-BootVersion">Suppressing U-Boot Version</a>
     25          </li>
     26        </ol>
     27      </li>
     28      <li>
     29        <a href="#LinuxKernel">Linux Kernel</a>
     30        <ol>
     31          <li>
     32            <a href="#FurtherKernelOptions">Further Kernel Options</a>
     33          </li>
     34        </ol>
     35      </li>
     36      <li>
     37        <a href="#PSplash">PSplash</a>
     38        <ol>
     39          <li>
     40            <a href="#YoctoSetUp">Yocto Set Up</a>
     41          </li>
     42          <li>
     43            <a href="#OpenWrtSetUp">OpenWrt Set Up</a>
     44          </li>
     45        </ol>
     46      </li>
     47      <li>
     48        <a href="#Android">Android</a>
     49        <ol>
     50          <li>
     51            <a href="#InitLogo-RequiresBuildingofAndroidSourceCode">Init Logo - Requires Building of Android Source Code</a>
     52          </li>
     53          <li>
     54            <a href="#BootAnimation-DoesnotRequireBuildingAndroidSource">Boot Animation - Does not Require Building Android Source</a>
     55            <ol>
     56              <li>
     57                <a href="#DisablingtheBootAnimation">Disabling the Boot Animation</a>
     58              </li>
     59            </ol>
     60          </li>
     61        </ol>
     62      </li>
     63    </ol>
     64  </li>
     65</ol>
     66</div><p>
     67</p>
     68<h1 id="VentanaSplashScreen">Ventana Splash Screen</h1>
     69<p>
     70<a style="padding:0; border:none" href="/attachment/wiki/ventana/SplashScreen/lcd_gateworks_logo.png"><img width="400px" src="/raw-attachment/wiki/ventana/SplashScreen/lcd_gateworks_logo.png" /></a>
     71<br />
     72For devices that have a display, customers may often want to present a splash-screen as soon as possible. This provides a sense of responsiveness for those expecting a visual effect on power up while at the same time providing an avenue for the prominent display of a vendor logo. All for minimal impact on overall system boot time. This page covers the various splash screen options available to Ventana products as well as instructions for customization.
     73</p>
     74<p>
     75For each step in the typical boot process, a splash screen can usually be configured for the duration of its operation. For example, the IMX6 processor used on Ventana boards starts with a Primary Boot Loader (PBL) (this is firmware inside the IMX6 which can not be modified), a Secondary Program Loader (SPL) which configures DRAM and loads the main bootloader, then the OS kernel itself. The first place a splash screen can be configured is the bootloader where typically a static splash is displayed. This image can be switched out or left in place by the kernel. Finally, depending on the operating system, a dynamic animated splash may be enabled in early userspace init which leads to a GUI if available once init is complete.
     76</p>
     77<p>
     78<a style="padding:0; border:none" href="/attachment/wiki/ventana/SplashScreen/SplashScreensInTheBootProcess.png"><img src="/raw-attachment/wiki/ventana/SplashScreen/SplashScreensInTheBootProcess.png" /></a><br />
     79<sub>Note: Times will vary depending based on hardware, OS, and configuration. Times shown are for the default development configuration without boot speed tuning.</sub>
     80</p>
     81<p>
     82From the above timelines you can see where it may be most useful to implement a splash screen. For example:
     83</p>
     84<ul><li>if your intention is to provide feedback within the first second of power-up then you must do this in the bootloader (but be aware it will not persist for more than 1.5 seconds or so
     85</li><li>if your intention is to provide feedback within the first 2 seconds then you'll get the most bang-for-your buck using a kernel splash
     86</li><li>if your intention is to have a splash up until the moment that you can interact with the Android GUI then you at least have to use a userspace spash (for Android this is best done via the bootanimation.zip)
     87</li><li>if you want visual feedback all along the way you may want to implement a bootloader splash, a kernel splash, and a userspace splash
     88</li></ul><h2 id="U-BootBootloader">U-Boot Bootloader</h2>
     89<p>
     90As previously mentioned, the first opportunity to display a splash screen becomes available at the start of bootloader execution. Being mainly responsible for configuring the DRAM controller and loading/executing the OS kernel, the bootloader's support for displays is rudimentary. However, there currently exists a small number of methods to configure the bootloader's splash screen.
     91</p>
     92<p>
     93The methods available to Ventana's U-boot are as follows:
     94</p>
     95<ol><li>Create a custom BMP logo <strong>(recommended)</strong>
     96</li><li>Modify the default linux "Tux" logo
     97</li><li>Load BMP from storage using environment
     98</li></ol><p>
     99Bootloader Splash Screen Method Comparison:
     100</p>
     101<table class="wiki">
     102<tr><th style="text-align: center">                         </th><th> Create Custom BMP Logo </th><th> Modify Default Linux Logo </th><th> Load From Storage
     103</th></tr><tr><td style="text-align: left">Dynamic Placement          </td><td style="text-align: center">        <strong>X</strong>           </td><td style="text-align: center">                             </td><td style="text-align: center">     <strong>X</strong>         
     104</td></tr><tr><td style="text-align: left">Immediate Display          </td><td style="text-align: center">        <strong>X</strong>           </td><td style="text-align: center">        <strong>X</strong>              </td><td style="text-align: center">                     
     105</td></tr><tr><td style="text-align: left">Minimal Boot Speed Impact  </td><td style="text-align: center">        <strong>X</strong>           </td><td style="text-align: center">        <strong>X</strong>              </td><td style="text-align: center">                     
     106</td></tr><tr><td style="text-align: left">Easy to Implement          </td><td style="text-align: center">        <strong>X</strong>           </td><td style="text-align: center">                             </td><td style="text-align: center">                     
     107</td></tr><tr><td style="text-align: left">Modifiable in Environment  </td><td style="text-align: center">                          </td><td style="text-align: center">                             </td><td style="text-align: center">     <strong>X</strong>         
     108</td></tr><tr><td style="text-align: left">No Color Limitations       </td><td style="text-align: center">                          </td><td style="text-align: center">                             </td><td style="text-align: center">     <strong>X</strong>         
     109</td></tr></table>
     110<p>
     111In order to implement any of the aforementioned you will need access to a U-Boot build system. For more information see the <a class="wiki" href="/wiki/ventana/bootloader#BuildingfromSource">ventana/bootloader</a> wiki.
     112</p>
     113<p>
     114By default, the Ventana bootloader has the following splash screen related configs defined in <tt>u-boot-imx6/include/configs/gw_ventana.h</tt>.
     115</p>
     116<div class="code"><pre><span class="cp">#define CONFIG_CFB_CONSOLE
     117</span>              <span class="o">-</span> Enables console device <span class="k">for</span> a color framebuffer<span class="p">.</span>
     118<span class="cp">#define CONFIG_VIDEO
     119</span>              <span class="o">-</span> Define this to enable video support <span class="p">(</span><span class="k">for</span> output to video<span class="p">).</span>
     120<span class="cp">#define CONFIG_VIDEO_LOGO
     121</span>              <span class="o">-</span> Enable support <span class="k">for</span> display of Linux logo in upper left corner<span class="p">.</span>
     122</pre></div><p>
     123Before continuing, ensure that they are defined otherwise the following methods will not function as intended. For those wishing to suppress any sort of splash screen, removing these configs will disable all U-Boot video support.
     124</p>
     125<h3 id="CreateCustomBMPLogoMethod">Create Custom BMP Logo Method</h3>
     126<p>
     127This method simply involves creating a custom BMP image and placing it within the U-Boot build system where it will automatically be configured to be used as a splash screen image. All things considered, this is the recommended option for most users and is the default behavior for the latest Ventana bootloader.
     128</p>
     129<ul><li>Start by first completing a source compile of the Gateworks bootloader shown <a class="wiki" href="/wiki/ventana/bootloader#BuildingfromSource">here</a>
     130</li></ul><ol><li>Begin by adding the following configs (omitting descriptions) to <tt>u-boot-imx6/include/configs/gw_ventana.h</tt>:
     131<div class="code"><pre><span class="cp">#define CONFIG_VIDEO_LOGO
     132</span>              <span class="o">-</span> Enable support <span class="k">for</span> display of Linux logo in upper left corner<span class="p">.</span>
     133<span class="cp">#define CONFIG_VIDEO_BMP_LOGO
     134</span>              <span class="o">-</span> Use bmp_logo<span class="p">.</span>h instead of linux_logo<span class="p">.</span>h <span class="k">for</span> logo<span class="p">.</span> Requires CONFIG_VIDEO_LOGO<span class="p">.</span>
     135<span class="cp">#define CONFIG_SPLASH_SCREEN_ALIGN
     136</span>              <span class="o">-</span> If this option is set the splash image <span class="p">(</span>or bmp logo<span class="p">)</span> can be freely positioned
     137                on the screen<span class="p">.</span> Environment variable <span class="s">"splashpos"</span> specifies the position as
     138                <span class="s">"x,y"</span><span class="p">.</span> If a positive number is given it is used as number of pixel from
     139                left<span class="o">/</span>top<span class="p">.</span> If a negative number is given it is used as number of pixel from
     140                right<span class="o">/</span>bottom<span class="p">.</span> You can also specify <span class="sc">'m'</span> as x and<span class="o">/</span>or y to center the image<span class="p">.</span>
     141</pre></div><ul><li>Note that this is already done in the <a class="ext-link" href="https://github.com/Gateworks/u-boot-imx6"><span class="icon">​</span>current Gateworks bootloader source</a>
     142</li></ul></li></ol><ol start="2"><li>Download and install the opensource photo editing software <a class="ext-link" href="https://www.gimp.org/downloads/"><span class="icon">​</span>GIMP</a>
     143</li></ol><ol start="3"><li>Launch GIMP and open the logo to be used <tt>File &gt; Open...</tt>
     144</li></ol><ol start="4"><li>Scale your image to the size of your target display <tt>Image &gt; Scale Image...</tt>. The width of your image <strong>*must*</strong> be equal to or less than the resolution of your display or the image will become distorted and may even hang the bootloader. Height values larger than your display will simply crop the image.
     145<ol class="loweralpha"><li>If you plan on supporting multiple displays of different resolutions, a good approach is to scale your image to be compatible with your smallest display and set its background color to black so when centered it will look clean on your larger displays. You can quickly change the background color of your image in GIMP by using color select on your background color <tt>Select &gt; By Color</tt>, then using the bucket tool <tt>Tools &gt; Painting Tools &gt; Bucket Fill</tt> to fill the desired areas with black.
     146</li></ol></li></ol><ol start="5"><li>Convert the image to index mode <tt>Image &gt; Mode &gt; Indexed...</tt>. Select the <tt>Generate optimum palette</tt> option and set your maximum number of colors to 224.
     147</li></ol><ol start="6"><li>Open the export dialogue window <tt>File &gt; Export As...</tt>. Set the save location to <tt>u-boot-imx6/tools/logos/gateworks.bmp</tt>. Open the <tt>Select File Type (By Extension)</tt> menu located in the bottom left of the dialogue and select the Windows BMP Image (.bmp) extension. Select <tt>Export</tt>, and under <tt>Compatability Options</tt> select <tt>Do not write color space information</tt> before finally selecting <tt>Export</tt> again.
     148<ol class="loweralpha"><li>Note that if your <tt>u-boot-imx6/board/gateworks/gw_ventana/Kconfig</tt> has BOARD or VENDOR changed from the defaults, rename the .bmp file to the value of BOARD or VENDOR otherwise the U-Boot Makefile will not generate the necessary files for your image.
     149</li></ol></li></ol><ol start="7"><li>Navigate to your U-Boot build directory and kick off a <tt>make</tt> command. For information on compiling the bootloader, please see <a class="ext-link" href="http://trac.gateworks.com/wiki/ventana/bootloader#BuildingfromSource"><span class="icon">​</span>this page</a>.
     150</li></ol><ol start="8"><li>Update your device's bootloader with the new binaries via <tt>run updateuboot</tt> from the bootloader or JTAG flashing. To see more information, please visit <a class="ext-link" href="http://trac.gateworks.com/wiki/ventana/bootloader#ProgrammingInstallingU-Boot"><span class="icon">​</span>this page</a>.
     151</li></ol><ol start="9"><li>Break into your device's bootloader and set splashpos via <tt>setenv splashpos m,m</tt> then <tt>saveenv</tt>.
     152<ol class="loweralpha"><li>If you wish for this to be a part of your default environment, add it to your <tt>CONFIG_EXTRA_ENV_SETTINGS_COMMON</tt> define statement.
     153</li></ol></li></ol><p>
     154Upon reset and provided a display, the bootloader will now display your custom logo in the middle of your display.
     155</p>
     156<h3 id="ModifyDefaultLinuxLogoMethod">Modify Default Linux Logo Method</h3>
     157<p>
     158A secondary approach is to directly modify the file responsible for displaying the default linux "Tux" logo that comes standard on stock releases of U-Boot. While this is a somewhat straightforward concept, acquiring and using the dated tools to produce a header file in a similar format to <tt>u-boot-imx6/include/linux_logo.h</tt> can be problematic. This also has the same 224 color limitation, and using an image with dimensions other that 80x80 requires further editing of video driver source files. Therefore this method is discouraged.
     159</p>
     160<p>
     161For those seeking further information and steps regardless, see <a class="ext-link" href="https://developer.ridgerun.com/wiki/index.php?title=IMX6_boot_logo#Changing_u-boot_boot_logo_from_source_code"><span class="icon">​</span>this page</a>.
     162</p>
     163<p>
     164Displaying the default "Tux" logo (or your custom image) is enabled by adding the following config (omitting description) to <tt>u-boot-imx6/include/configs/gw_ventana.h</tt>:
     165</p>
     166<div class="code"><pre><span class="cp">#define CONFIG_VIDEO_LOGO
     167</span>              <span class="o">-</span> Enable support <span class="k">for</span> display of Linux logo in upper left corner<span class="p">.</span>
     168</pre></div><h3 id="BMPFromStorageMethod">BMP From Storage Method</h3>
     169<p>
     170The final method for implementing a splash screen in U-Boot is by pulling a image from a storage medium at the beginning of the boot script using environment variables. This has the advantage of being able to change the splash screen image by using the bootloader environment or even within userspace by replacing the designated file. However this method still requires an initial editing of the bootloader source and is only recommended if the client wishes to have the ability to change the splash screen image frequently. It also has the added disadvantage of losing at least a few seconds of display time depending on your configuration. This occurs because of the need to first mount your storage medium which occurs after the boot delay during the bootcmd script.
     171</p>
     172<p>
     173This method can only use RBG (uncompressed) BMP images. As a result, no color limitation exists as is the case in previous methods. The steps are as follows:
     174</p>
     175<ol><li>Begin by adding the following configs (omitting descriptions) to <tt>u-boot-imx6/include/configs/gw_ventana.h</tt>:
     176<div class="code"><pre><span class="cp">#define CONFIG_CMD_BMP
     177</span>              <span class="o">-</span> Adds support <span class="k">for</span> displaying raw bmp images<span class="p">.</span>
     178<span class="cp">#define CONFIG_SPLASH_SCREEN_ALIGN
     179</span>              <span class="o">-</span> If this option is set the splash image <span class="p">(</span>or bmp logo<span class="p">)</span> can be freely positioned
     180                on the screen<span class="p">.</span> Environment variable <span class="s">"splashpos"</span> specifies the position as
     181                <span class="s">"x,y"</span><span class="p">.</span> If a positive number is given it is used as number of pixel from
     182                left<span class="o">/</span>top<span class="p">.</span> If a negative number is given it is used as number of pixel from
     183                right<span class="o">/</span>bottom<span class="p">.</span> You can also specify <span class="sc">'m'</span> as x and<span class="o">/</span>or y to center the image<span class="p">.</span>
     184</pre></div></li></ol><ol start="2"><li>Make the below bootloader environment edits in the bootloader itself or in the CONFIG_EXTRA_ENV_SETTINGS_COMMON definition in <tt>gw_ventana.h</tt>:
     185<div class="code"><pre>setenv splash GWLogo.bmp
     186
     187setenv splashpos m,m
     188
     189setenv show_splash <span class="s1">'${fsload} ${loadaddr} ${bootdir}/${splash}; bmp d ${loadaddr}'</span>
     190
     191setenv flash_boot <span class="s1">'setenv fsload ubifsload; ubi part rootfs; if ubi check boot; \
     192then ubifsmount ubi0:boot; setenv root ubi0:rootfs ubi.mtd=2 rootfstype=squashfs,ubifs; \
     193setenv bootdir; elif ubi check rootfs; then ubifsmount ubi0:rootfs; \
     194setenv root ubi0:rootfs ubi.mtd=2 rootfstype=ubifs; fi; setenv dtype nand; \
     195run show_splash; run loadscript; if ${fsload} ${loadaddr} ${bootdir}/${uimage}; \
     196then setenv bootargs console=${console},${baudrate} root=${root} ${video} ${extra}; \
     197if run loadfdt; then ubifsumount; bootm ${loadaddr} - ${fdt_addr}; \
     198else ubifsumount; bootm; fi; fi'</span>
     199</pre></div><sub>Note that the added <tt>run show_splash</tt> must be after the ubi mounting and before the loadscript execution as shown.
     200</sub></li></ol><ol start="3"><li>Open the <a class="wiki" href="/wiki/linux/ubi#OnatargetboardwithNANDFLASH">linux/ubi</a> wiki and follow the example "Mounting UBI NAND FLASH volume" (replace rootfs with boot)
     201</li></ol><ol start="4"><li>Place your BMP image in your boot volume under the same name as your <tt>splash</tt> environment variable.
     202</li></ol><h3 id="RelatedSourceFiles">Related Source Files</h3>
     203<p>
     204For those interested in seeing the primary source code related to the displaying of splash screens in U-boot the following list has been created for your convenience.
     205</p>
     206<ul><li>Within the <tt>include</tt> folder:
     207<ul><li><tt>bmp_layout.h</tt> - defines a bmp image header
     208</li><li><tt>bmp_logo_data.h</tt> - the data contents of a bmp logo
     209</li><li><tt>bmp_logo.h</tt> - the metadata of a bmp logo (dimensions etc)
     210</li><li><tt>linux_logo.h</tt> - default linux logo (sitting penguin aka tux)
     211</li></ul></li><li>Within the <tt>tools</tt> folder:
     212<ul><li><tt>bmp_logo.c</tt> - c tool that converts a raw bmp image into data headers used for logos in bootloader
     213</li><li><tt>bmp_logo</tt> - executable of bmp_logo.c
     214</li></ul></li><li>Within the <tt>doc</tt> folder:
     215<ul><li><tt>README.displaying-bmps</tt> - discusses memory alignment issues when using BMP from storage
     216</li><li><tt>README.splashprepare</tt> - discusses possibility of custom preprocessing for BMP images
     217</li></ul></li><li>Within the <tt>common</tt> folder:
     218<ul><li><tt>lcd.c</tt> - responsible for displaying BMPs from storage
     219</li></ul></li><li>Within the <tt>drivers/video/</tt> folder:
     220<ul><li><tt>cfb_console.c</tt> - responsible for displaying BMPs injected at compile time (first two methods)
     221</li><li><tt>fbcon.c</tt> - file to change hardcoded dimension values in if modifying default linux logo
     222</li></ul></li><li><tt>board/gateworks/gw_ventana/Kconfig</tt> - contains the config targets to define BOARD and VENDOR
     223</li></ul><h3 id="SuppressingU-BootVersion">Suppressing U-Boot Version</h3>
     224<p>
     225After following one of the above methods to change your bootloader's splash image, you may have noticed that editing the image alone still leaves the U-Boot version string displayed on the right side of the image (or overflowed onto the image itself). While some clients may want this information present, for those that do not we have implemented a small code change in our latest bootloader to add the ability of hiding this U-Boot version information.
     226</p>
     227<p>
     228We added the ability to the Gateworks bootloader to disable this via CONFIG_HIDE_LOGO_VERSION which is defined in <tt>u-boot-imx6/include/configs/gw_ventana.h</tt>:
     229</p>
     230<div class="code"><pre><span class="cp">#define CONFIG_HIDE_LOGO_VERSION
     231</span>              <span class="o">-</span> Custom config to hide U<span class="o">-</span>boot version when CONFIG_VIDEO_LOGO
     232                or CONFIG_VIDEO_BMP_LOGO is defined
     233</pre></div><ul><li>If you want the see the version info, undefine this to bring it back
     234</li></ul><p>
     235For those using a different bootloader version that would like to implement this behavior themselves, see the following git diff and apply it as a patch or make the manual edits yourself:
     236</p>
     237<div class="code"><pre><span class="gh">diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c
     238index a81affa..60a44e6 100644
     239</span><span class="gd">--- a/drivers/video/cfb_console.c
     240</span><span class="gi">+++ b/drivers/video/cfb_console.c
     241</span><span class="gu">@@ -1986,7 +1986,6 @@ static void plot_logo_or_black(void *screen, int width, int x, int y, int black)
     242</span> static void *video_logo(void)
     243 {
     244        char info[128];
     245<span class="gd">-       int space, len;
     246</span>        __maybe_unused int y_off = 0;
     247        __maybe_unused ulong addr;
     248        __maybe_unused char *s;
     249<span class="gu">@@ -2036,6 +2035,8 @@ static void *video_logo(void)
     250</span>
     251        sprintf(info, " %s", version_string);
     252
     253<span class="gi">+#ifndef CONFIG_HIDE_LOGO_VERSION
     254+       int space, len;
     255</span>        space = (VIDEO_LINE_LEN / 2 - VIDEO_INFO_X) / VIDEO_FONT_WIDTH;
     256        len = strlen(info);
     257
     258<span class="gu">@@ -2048,6 +2049,7 @@ static void *video_logo(void)
     259</span>                y_off = 1;
     260        } else
     261                video_drawstring(VIDEO_INFO_X, VIDEO_INFO_Y, (uchar *) info);
     262<span class="gi">+#endif
     263</span>
     264 #ifdef CONFIG_CONSOLE_EXTRA_INFO
     265        {
     266</pre></div><h2 id="LinuxKernel">Linux Kernel</h2>
     267<p>
     268Additionally, the Linux kernel has static splash-screen support. This is also very rudimentary however kernel code changes can be made to specify the graphic that is displayed.
     269</p>
     270<ol><li>Begin by following the steps at the <a class="wiki" href="/wiki/linux/kernel#BuildingtheLinuxkernelout-of-tree">linux/kernel</a> to set up a development environment for the linux kernel.
     271</li></ol><ol start="2"><li>Download and install the opensource photo editing software <a class="ext-link" href="https://www.gimp.org/downloads/"><span class="icon">​</span>GIMP</a> if you have not done so already.
     272</li></ol><ol start="3"><li>Launch GIMP and open the logo or image to be used <tt>File &gt; Open...</tt>
     273</li></ol><ol start="4"><li>Open the export dialogue window <tt>File &gt; Export As...</tt>. Set the save location to your kernel working directory. Open the <tt>Select File Type (By Extension)</tt> menu located in the bottom left of the dialogue and select the PNM Image (.pnm) extension. Select <tt>Export</tt>, ensure that the Data Formatting type is <tt>Raw</tt> then select <tt>Export</tt> again to finish.
     274</li></ol><ol start="5"><li>Convert to 224 color pnm using <tt>ppmquant</tt>:
     275<div class="code"><pre>ppmquant 224 &lt;gimp_export_file&gt;.pnm &gt; logo_linux_clut224.ppm
     276</pre></div></li></ol><ol start="6"><li>Convert to plain ppm and copy to kernel logo directory:
     277<div class="code"><pre>pnmtoplainpnm logo_linux_clut224.ppm &gt; drivers/video/logo/logo_linux_clut224.ppm
     278</pre></div></li></ol><ol start="7"><li>Build and deploy new kernel.
     279</li></ol><h3 id="FurtherKernelOptions">Further Kernel Options</h3>
     280<p>
     281While there is some severe limitations to the capabilities of splash screen support in the linux kernel, there does exist some possible improvements/modifications that require editing the kernel source.
     282</p>
     283<p>
     284Some modifications with accompanying links for those looking to investigate further:
     285</p>
     286<ul><li>Using bootloader framebuffer
     287</li></ul><blockquote>
     288<p>
     289One potential work around for the limitations inherent to the built in splash capabilities of the linux kernel is by using the same framebuffer that the bootloader prepared. This has been implemented by another developer via the CONFIG_FB_PRE_INIT_FB config option and can be seen in <tt>drivers/video/mb862xx/mb862xxfbdrv.c</tt>. Further information about this config can be seen <a class="ext-link" href="http://www.denx.de/wiki/view/DULG/LinuxSplashScreen"><span class="icon">​</span>here</a> and <a class="ext-link" href="http://osdir.com/ml/linux-kernel/2009-04/msg10153.html"><span class="icon">​</span>here</a>.
     290</p>
     291</blockquote>
     292<blockquote>
     293<p>
     294A similar method utilizing the bootloader's prepared framebuffer involves saving the contents of the framebuffer device after the splash has been presented and then directly writing that saved file to the framebuffer within the kernel. More information <a class="ext-link" href="http://free-electrons.com/blog/super-fast-linux-splashscreen/"><span class="icon">​</span>here</a>.
     295</p>
     296</blockquote>
     297<ul><li>Fix backlight flickering
     298</li></ul><blockquote>
     299<p>
     300During the kernel boot process a number of different drivers go through a cycle of registering display hardware which includes a pwm controlled backlight if present. This results in what appears to be a "flickering" display where varying driver defaults cause rapid changes to the backlight intensity. A potential solution would be to edit said pwm driver defaults so they all hold the same value, or remove the assignment alltogether. Further information on linux core PWM drivers can be found <a class="ext-link" href="http://processors.wiki.ti.com/index.php/Linux_Core_PWM_User%27s_Guide#Introduction"><span class="icon">​</span>here</a>.
     301</p>
     302</blockquote>
     303<ul><li>Disable flashing framebuffer cursor
     304</li></ul><blockquote>
     305<p>
     306For some kernel splash implementations a flashing console cursor can appear during boot which may overwrite a portion of the framebuffer that was originally displaying a splash image. If this situation applies, you can disable the cursor by editing the <tt>drivers/video/console/fbcon.c</tt> driver and removing all of the logic in the <tt>static void fbcon_cursor(...)</tt> function.
     307</p>
     308</blockquote>
     309<h2 id="PSplash">PSplash</h2>
     310<p>
     311Both the Yocto and OpenWrt BSPs currently have built in support for kernel splash editing via <a class="ext-link" href="http://git.yoctoproject.org/cgit/cgit.cgi/psplash/about/"><span class="icon">​</span>PSplash</a>.
     312</p>
     313<p>
     314PSplash is a userspace graphical boot splash screen for mainly embedded Linux devices supporting a 16bpp or 32bpp framebuffer. It has few dependencies (just libc), supports basic images and text and handles rotation. An early init script kicks off the <tt>psplash</tt> daemon and further init scripts use the <tt>psplash-write</tt> app to send single argument commands to advance the progress bar and finally exit the daemon.
     315</p>
     316<p>
     317Example usage:
     318</p>
     319<div class="code"><pre>psplash &amp;                      <span class="c"># run daemon in background
     320</span>psplash-write MSG <span class="s2">"my message"</span> <span class="c"># display message
     321</span>psplash-write PROGRESS &lt;n&gt;     <span class="c"># set progress bar (from 0 to 100%)
     322</span>psplash-write QUIT             <span class="c"># remove splash and exit daemon
     323</span></pre></div><p>
     324To modify the image displayed when the daemon is running, begin by following the set up instructions specific to your BSP
     325</p>
     326<ul><li><a class="wiki" href="/wiki/ventana/SplashScreen#YoctoSetUp">Yocto Set Up</a>
     327</li><li><a class="wiki" href="/wiki/ventana/SplashScreen#OpenWrtSetUp">OpenWrt Set Up</a>
     328</li></ul><h3 id="YoctoSetUp">Yocto Set Up</h3>
     329<p>
     330For demonstration purposes we will simply replace the header file in the psplash directory <tt>sources/poky/meta/recipes-core/psplash/files/psplash-poky-img.h</tt> that is acts as the source for the default splash image. However, if you are managing your own layer, the recommended method for customizing a logo is to mimic what meta-yocto does in its layer (i.e. copy the <tt>meta-yocto/recipes-core/psplash</tt> directory into your own layer and overwrite that header file) rather than changing the default psplash-poky-img.h.
     331</p>
     332<ol><li>Begin by following the instructions at <a class="wiki" href="/wiki/Yocto/Building">Yocto/Building</a> to set up a working environment.
     333</li></ol><ol start="2"><li>If you do not have one already, create a JPEG (jpg, jpeg, jpe) logo that will fit the dimensions of your display.
     334<ol class="loweralpha"><li>If planning to support multiple displays, scale your JPEG logo to a size that will fit your smallest display and fill the image with a <span style="background: #EFEFE7">grey</span> background (HTML color is specifically <span style="background: #EFEFE7">#EFEFE7</span>). PSplash will automatically center your image against its own background, making a single image look clean on multiple displays of varying dimensions. For steps on creating a logo, or filling the background color, refer to the <a class="wiki" href="/wiki/ventana/SplashScreen#CreateCustomBMPLogo">above</a> section.
     335</li></ol></li></ol><ol start="3"><li>Use the <tt>make-image-header.sh</tt> shell script to create the header file that will be used during compile time. This script is located within the PSplash package and can be found via a <tt>find &lt;BUILD_DIR&gt; -name "make-image-header.sh"</tt>.
     336<ol class="loweralpha"><li>An example result of this find command would be <tt>&lt;BUILD_DIR&gt;/build/tmp/work/cortexa9hf-vfp-neon-poky-linux-gnueabi/psplash/0.1+gitAUTOINC+14c8f7b705-r15/git/make-image-header.sh</tt>, however your directory may be different depending on architecture/versions etc.
     337</li></ol></li></ol><blockquote>
     338<p>
     339Example usage:
     340</p>
     341<div class="code"><pre>./make-image-header.sh /&lt;PATH&gt;/&lt;IMAGE&gt;.jpg POKY
     342</pre></div></blockquote>
     343<ol start="4"><li>Copy the resulting header to the psplash recipe header under the recipe's "files" directory:
     344<div class="code"><pre>cp &lt;IMAGE&gt;.h &lt;BUILD_DIR&gt;/sources/poky/meta-yocto/recipes-core/psplash/files/psplash-poky-img.h
     345</pre></div>Alternatively, you could also use the fact that 'MACHINE' is inserted into the files search path and just add a new file to the <tt>ventana</tt> directory:
     346<div class="code"><pre>mkdir poky/meta-yocto/recipes-core/psplash/files/ventana
     347cp psplash-poky-img.h poky/meta-yocto/recipes-core/psplash/files/ventana/
     348</pre></div></li><li>Rebuild the PSplash package.
     349<ol class="loweralpha"><li>If unfamiliar with package rebuilding you can use the following <tt>rebuild</tt> shell script and execute via <tt>./rebuild psplash</tt> while within your build directory.
     350<div class="code"><pre><span class="c">#!/bin/bash
     351</span>
     352<span class="c"># $1 is the recipe to install
     353</span>install<span class="o">()</span> <span class="o">{</span>
     354    <span class="nb">local </span><span class="nv">recipe</span><span class="o">=</span><span class="s2">"$@"</span>
     355    bitbake -f -c clean <span class="s2">"${recipe}"</span> <span class="o">&amp;&amp;</span> bitbake --no-setscene <span class="s2">"${recipe}"</span> <span class="o">&amp;&amp;</span> bitbake package-index
     356<span class="o">}</span>
     357
     358runme<span class="o">()</span> <span class="o">{</span>
     359    <span class="k">case</span> <span class="s2">"$1"</span> in
     360        all<span class="o">)</span>
     361            install gateworks-image-minimal
     362            install gateworks-image-test
     363            install gateworks-image-multimedia
     364            install gateworks-image-gui
     365            ;;
     366        *<span class="o">)</span> install <span class="s2">"$@"</span>;;
     367    <span class="k">esac</span>
     368<span class="o">}</span>
     369
     370<span class="o">[</span> <span class="s2">"$1"</span> <span class="o">]</span> <span class="o">||</span> <span class="nb">exit </span>1
     371
     372<span class="nb">echo</span> <span class="s2">"Note, this will hard-rebuild"</span>
     373<span class="nb">time </span>runme <span class="s2">"$@"</span>
     374</pre></div></li><li>You can verify the success of the custom image insertion by comparing your generated image header file against the one located in the work directory that PSplash was built in. To locate said directory, you can use the example find command from step 3. The directory should follow the pattern: <tt>build/tmp/work/&lt;ARCHITECTURE_VERSION&gt;/psplash/&lt;GIT_VERSION&gt;/git/</tt>
     375</li></ol></li></ol><ol start="6"><li>Rebuild the BSP.
     376<div class="code"><pre>. ./setup-environment build        <span class="c"># activate a bitbake shell if not already done
     377</span>bitbake gateworks-image-multimedia <span class="c"># replace argument with desired target
     378</span></pre></div></li></ol><ol start="7"><li>Deploy the resulting .ubi files located under <tt>&lt;BUILD_DIR&gt;/tmp/deploy/images/ventana/</tt> to target machine.
     379</li></ol><h3 id="OpenWrtSetUp">OpenWrt Set Up</h3>
     380<p>
     381Although <a class="wiki" href="/wiki/OpenWrt">OpenWrt</a> has built in support for <a class="ext-link" href="http://git.yoctoproject.org/cgit/cgit.cgi/psplash/about/"><span class="icon">​</span>PSplash</a>, it is not included in our default configuration for the BSP. It can be added by adding the oldpackages feed. Otherwise the <a class="wiki" href="/wiki/OpenWrt">OpenWrt</a> steps are very similar to the Yocto process.
     382</p>
     383<p>
     384Note that due to differences in the boot process of <a class="wiki" href="/wiki/OpenWrt">OpenWrt</a>, the progress bar functionality of PSplash is disabled. For the related patch see <tt>package/feeds/oldpackages/psplash/patches/001-hide-msgfield-and-progressbar.patch</tt> after step <strong>5</strong>.
     385</p>
     386<ol><li>Follow the steps at the <a class="wiki" href="/wiki/OpenWrt/building">OpenWrt/building</a> wiki to set up an OpenWrt development environment.
     387<ol class="loweralpha"><li>The rest of the steps here assume your present working directory is the top level <a class="wiki" href="/wiki/OpenWrt">OpenWrt</a> folder.
     388</li></ol></li></ol><ol start="2"><li>Edit <tt>./feeds.conf.default</tt> and uncomment the "oldpackages" feed.
     389</li></ol><ol start="3"><li>Update all package feeds: <tt>./scripts/feeds update</tt>
     390</li></ol><ol start="4"><li>Install PSplash and default it to yes (enabled): <tt>./scripts/feeds install -dy psplash</tt>
     391</li></ol><ol start="5"><li>Execute a top level build to create the tools necessary for making a custom logo header file: <tt>make -j1 V=s</tt>
     392</li></ol><ol start="6"><li>If you do not have one already, create a JPEG (jpg, jpeg, jpe) logo that will fit the dimensions of your display.
     393<ol class="loweralpha"><li>If planning to support multiple displays, scale your JPEG logo to a size that will fit your smallest display and fill the image with a <span style="background: #192A65; color: #FFFFFF">blue</span> background (HTML color is specifically <span style="background: #192A65; color: #FFFFFF">#192A65</span>). PSplash will automatically center your image against its own background, making a single image look clean on multiple displays of varying dimensions. For steps on creating a logo, or filling the background color, refer to the <a class="wiki" href="/wiki/ventana/SplashScreen#CreateCustomBMPLogo">above</a> section.
     394</li><li>See the patch located at <tt>package/feeds/oldpackages/psplash/patches/000-adjust-for-openwrt.patch</tt> for information on changing the background PSplash color.
     395</li></ol></li></ol><ol start="7"><li>Use the <tt>make-image-header.sh</tt> shell script to create the header file that will be used during compile time. This script is located within the PSplash package and can be found via a <tt>find &lt;BUILD_DIR&gt; -name "make-image-header.sh"</tt>.
     396<ol class="loweralpha"><li>An example result of this find command would be <tt>build_dir/target-arm_cortex-a9+neon_musl-1.1.12_eabi/psplash-0.1/make-image-header.sh</tt>, however your directory may be different depending on architecture/versions etc.
     397</li></ol></li></ol><blockquote>
     398<p>
     399Example usage:
     400</p>
     401<div class="code"><pre>./make-image-header.sh /&lt;PATH&gt;/&lt;IMAGE&gt;.jpg
     402</pre></div></blockquote>
     403<ol start="8"><li>Use the resulting header file to replace the one located at <tt>package/feeds/oldpackages/psplash/files/image_generic.h</tt>
     404</li></ol><ol start="9"><li>Clean the psplash package <tt>make package/feeds/oldpackages/psplash/clean</tt>
     405</li></ol><ol start="10"><li>Install the psplash package <tt>make package/feeds/oldpackages/psplash/install</tt>
     406</li></ol><ol start="11"><li>Perform a top level make once again <tt>make -j1 V=s</tt>. This should only need to rebuild the psplash package.
     407</li></ol><ol start="12"><li>Deploy the images created under <tt>bin/imx6/</tt> to target boards.
     408</li></ol><h2 id="Android">Android</h2>
     409<p>
     410There currently exists two separate processes in Android that display graphics during the boot process. The first uses an image named <tt>initlogo.rle</tt> which lasts between 1-2 seconds and displays immediately after the kernel has finished booting and passed control to the Android userspace. The second uses a zip folder containing an animation that is named <tt>bootanimation.zip</tt> which then lasts until booting has finished (~15 seconds). Both of these image sources can be modified to display custom graphics.
     411</p>
     412<p>
     413Before attempting to modify either of these sources, follow the steps at <a class="wiki" href="/wiki/Android/Building#BuildingAndroidforVentanafromsource">Android/Building</a> if you have not set up a working source directory.
     414</p>
     415<p>
     416The following examples were written for Android KitKat 4.4.
     417</p>
     418<h3 id="InitLogo-RequiresBuildingofAndroidSourceCode">Init Logo - Requires Building of Android Source Code</h3>
     419<p>
     420To modify the <tt>initlogo.rle</tt> source:
     421</p>
     422<ol><li>Make a copy of or create a logo that is smaller than your display and convert it if necessary to a BMP. The BMP should be <strong>16bit</strong> with no run length encoding.
     423</li></ol><ol start="2"><li>Install <tt>imagemagick</tt> <tt>sudo apt-get install imagemagick</tt>
     424</li></ol><ol start="3"><li>Convert the BMP to PNG <tt>convert initlogo.bmp initlogo.png</tt>
     425</li></ol><ol start="4"><li>Convert the resulting PNG to RAW RGB <tt>convert -depth 16 initlogo.png rgb:initlogo.raw</tt>
     426</li></ol><ol start="5"><li>Use the pre-compiled rgb2565 tool to convert the RAW RGB to RLE and place in the <tt>/system</tt> directory
     427</li></ol><blockquote>
     428<p>
     429<tt>&lt;BUILD_DIR&gt;/out/host/linux-x86/bin/rgb2565 &lt; initlogo.raw &gt; &lt;BUILD_DIR&gt;/system/initlogo.rle</tt>
     430</p>
     431</blockquote>
     432<blockquote>
     433<p>
     434If the rgb2565 executable does not exist run the following commands:
     435</p>
     436<div class="code"><pre><span class="nb">export </span><span class="nv">JAVA_HOME</span><span class="o">=</span>/usr/lib/jvm/java-7-openjdk-amd64
     437<span class="nb">source </span>build/envsetup.sh
     438lunch ventana-eng
     439mmm &lt;BUILD_DIR&gt;build/tools/rgb2565/ <span class="c"># replace &lt;BUILD_DIR&gt; with the path to Android source
     440</span></pre></div></blockquote>
     441<ol start="6"><li>Build and deploy the new Android image.
     442</li></ol><h3 id="BootAnimation-DoesnotRequireBuildingAndroidSource">Boot Animation - Does not Require Building Android Source</h3>
     443<p>
     444A boot animation consists of several parts contained in <tt>bootanimation.zip</tt> located in either the <tt>/system/media/</tt> or <tt>/data/local/</tt> directories of an Android system. In the root of a boot animation zip archive, there are usually a number of folders conventionally named <tt>part0</tt>, <tt>part1</tt>, etc, and a file called <tt>desc.txt</tt>.
     445</p>
     446<p>
     447To modify the <tt>bootanimation.zip</tt> source:
     448</p>
     449<ol><li>Construct the <tt>desc.txt</tt> file specific to your animation that follows this format:
     450<pre class="wiki">&lt;width&gt; &lt;height&gt; &lt;frames per second&gt;
     451p &lt;times to repeat&gt; &lt;end of animation pause time&gt; &lt;folder containing .png animations&gt;
     452</pre></li></ol><blockquote>
     453<p>
     454An example <tt>desc.txt</tt> describing an animation with the first part executing once, then the second part looping until boot (a times to repeat value of  0):
     455</p>
     456<pre class="wiki">640 480 30
     457p 1 0 part0
     458p 0 0 part1
     459</pre></blockquote>
     460<blockquote>
     461<p>
     462For a static image, an example would be:
     463</p>
     464<pre class="wiki">640 480 1
     465p 0 0 part0
     466</pre></blockquote>
     467<ol start="2"><li>Name your animation PNGs in such a way that they are in alphabetically ordered in the same order you wish for them to be displayed. Conventionally files are named in the format of <tt>&lt;height&gt;_&lt;width&gt;_&lt;sequence number&gt;.png</tt>.
     468<ul><li>Note, Gateworks has only tested with PNG image file format.
     469</li></ul></li></ol><blockquote>
     470<p>
     471An example list of files in the part folders:
     472</p>
     473<pre class="wiki">+bootanimation.zip
     474| | +part0
     475| | 480_640_00000.png
     476| | 480_640_00001.png
     477| | 480_640_00002.png
     478| | 480_640_00003.png
     479| | 480_640_00004.png
     480| | 480_640_00005.png
     481| +------------------
     482| +part1
     483| | 480_640_00000.png
     484| | 480_640_00001.png
     485| | 480_640_00002.png
     486| | 480_640_00003.png
     487| +------------------
     488| desc.txt
     489+--------------------
     490</pre></blockquote>
     491<ol start="3"><li>Package your zip <tt>zip -r0 bootanimation.zip desc.txt part0 part1</tt>
     492<ol class="loweralpha"><li>Note that this applies a "store only" compression on the files and is required to properly display the boot animation. If you have a different number of part folders make sure they are all listed.
     493</li></ol></li></ol><ol start="4"><li>Copy the zip to either the <tt>/system/media/</tt> or <tt>/data/local/</tt> directories.
     494<ol><li>Already complete SD Card: Copy the zip to either the <tt>/SYSTEM/media/</tt> or <tt>/DATA/local/</tt> directories.
     495</li></ol></li></ol><ol start="5"><li>Build and deploy the new Android image.
     496<ul><li>NOTE: Not required if copying .zip file to an already in use Android SD Card.
     497</li></ul></li></ol><p>
     498For an example boot animation, see download <a class="attachment" href="/attachment/wiki/ventana/SplashScreen/bootanimation.zip" title="Attachment 'bootanimation.zip' in ventana/SplashScreen">bootanimation.zip</a><a class="trac-rawlink" href="/raw-attachment/wiki/ventana/SplashScreen/bootanimation.zip" title="Download">​</a>.
     499</p>
     500<h4 id="DisablingtheBootAnimation">Disabling the Boot Animation</h4>
     501<p>
     502The boot animation can be disabled via <tt>setprop debug.sf.nobootanimation 1</tt> in either the boot section of <tt>init.rc</tt> or adding to the setprop list in <tt>/system/bin/init.sh</tt>.
     503</p>
     504}}}