• No results found

U-Boot Advanced Features 1 Boot Count Limit

5.9.9.5 ? alias for 'help'

5.14. U-Boot Advanced Features 1 Boot Count Limit

The Open Source Development Labs Carrier Grade Linux Requirements Definition version 2.0

(http://www.osdl.org/docs/carrier_grade_linux_requirements_definition___version_20_final_public_draft.pdf) contains the following requirement definition (ID PLT.4.0, p. 44):

CGL shall provide support for detecting a repeating reboot cycle due to recurring failures and will go to an offline state if this occurs.

This feature is available in U-Boot if you enable the CONFIG_BOOTCOUNT_LIMIT configuration option. The implementation uses the following environment variables:

bootcount:

This variable will be automatically created if it does not exist, and it will be updated at each reset of the processor. After a power-on reset, it will be initialized with 1, and each reboot will increment the value by 1.

bootlimit:

If this variable exists, its contents are taken as the maximum number of reboot cycles allowed.

altbootcmd:

If, after a reboot, the new value of bootcount exceeds the value of bootlimit, then instead of the standard boot action (executing the contents of bootcmd) an alternate boot action will be performed, and the contents of altbootcmd will be executed.

If the variable bootlimit is not defined in the environment, the Boot Count Limit feature is disabled. If it is enabled, but altbootcmd is not defined, then U-Boot will drop into interactive mode and remain there. It is the responsibility of some application code (typically a Linux application) to reset the variable

bootcount, thus allowing for more boot cycles.

At the moment, the Boot Count Limit feature is available only for MPC8xx, MPC82xx and MPC5200 Power Architecture® processors.

ubootBootcountAccess.c: C-source: bootcount access through /proc file system •

5.14.2. Bitmap Support

By adding the CONFIG_CMD_BMP option to your CONFIG_COMMANDS command selections you can enable support for bitmap images in U-Boot. This will add bmp to the list of commands in your configuration of U-Boot:

=> help bmp

bmp info <imageAddr> - display image info bmp display <imageAddr> [x y] - display image at x,y

This command can be used to show information about bitmap images or to display the images on your screen.

Example:

=> tftp 100000 /tftpboot/LWMON/denk_startup.bmp

TFTP from server 192.168.3.1; our IP address is 192.168.3.74 Filename '/tftpboot/LWMON/denk_startup.bmp'.

Load address: 0x100000

Loading: ############################################################# done

Bytes transferred = 308278 (4b436 hex) => bmp info 100000

Image size : 640 x 480 Bits per pixel: 8

Compression : 0 => bmp display 100000

To keep the code in U-Boot simple and as fast as possible, the bitmap images must match the color depth of your framebuffer device. For example, if your display is configured for a color depth of 8 bpp (bit per pixel) then the bmp command will complain if you try to load images with a different color depth:

=> tftp 100000 /tftpboot/LWMON/Bergkirchen.bmp

TFTP from server 192.168.3.1; our IP address is 192.168.3.74 Filename '/tftpboot/LWMON/Bergkirchen.bmp'. Load address: 0x100000 Loading: ################################################################# ################################################################# ################################################### done

Bytes transferred = 921654 (e1036 hex) => bmp i 100000

Image size : 640 x 480 Bits per pixel: 24

Compression : 0 => bmp d 100000

Error: 8 bit/pixel mode, but BMP has 24 bit/pixel

(As you can see above, the sub-commands "info" and "display" can be abbreviated as "i" resp. "d" .) Images that are bigger than your framebuffer device will be clipped on the top and right hand side.

Images that are smaller than the display will be loaded into the top left corner.

Since loading an image will define a new color map, the remainder of the display will appear with incorrect colors. It is therefore recommended that all images match exactly the size of the current display device. We accepted these restrictions since speed was top priority, and all attempts to implement scaling or optimizing the color maps would slow down the display too much. It is much easier to perform the necessary transformations on the development host, where a plethora of tools is available.

For example, to convert existing images to bitmap files with the required color depth (here: 8 bpp), the

"PBM" -Tools can be used (PBM = portable pix map - see "man 5 ppm" ): bash$ jpegtopnm Bergkirchen.jpg | \

> ppmquant 256 | \

> ppmtobmp -bpp 8 >Bergkirchen-8bit.bmp jpegtopnm: WRITING PPM FILE

ppmquant: making histogram... ppmquant: too many colors!

ppmquant: scaling colors from maxval=255 to maxval=127 to improve clustering... ppmquant: making histogram...

ppmquant: too many colors!

ppmquant: scaling colors from maxval=127 to maxval=63 to improve clustering... ppmquant: making histogram...

ppmquant: 9760 colors found ppmquant: choosing 256 colors...

ppmquant: mapping image to new colors...

ppmtobmp: analyzing colors... ppmtobmp: 231 colors found

ppmtobmp: Writing 8 bits per pixel with a color pallette

This gives the following results on the target:

=> tftp 100000 /tftpboot/LWMON/Bergkirchen-8bit.bmp

TFTP from server 192.168.3.1; our IP address is 192.168.3.74 Filename '/tftpboot/LWMON/Bergkirchen-8bit.bmp'.

Load address: 0x100000

Loading: ############################################################# done

Bytes transferred = 308278 (4b436 hex) => bmp i 100000

Image size : 640 x 480 Bits per pixel: 8

Compression : 0 => bmp d 100000

5.14.3. Splash Screen Support

Even if you manage to boot U-Boot and Linux into a graphical user application within 5 or 6 seconds of power-on (which is not difficult), many customers expect to see "something" immediately. U-Boot supports the concept of a splash screen for such purposes.

To enable splash screen support, you have to add a "#define CONFIG_SPLASH_SCREEN" to your board configuration file. This will also implicitly enable U-Boot Bitmap Support.

After power-on, U-Boot will test if the environment variable "splashimage" is defined, and if it contains the address of a valid bitmap image. If this is the case, the normal startup messages will be suppressed and the defined splash screen will be displayed instead. Also, all output (devices stdout and stderr ) will be suppressed (redirected to the "nulldev" device).

For example, to install this feature on a system, proceed as follows: => tftp 100000 /tftpboot/denx_startup.bmp

TFTP from server 192.168.3.1; our IP address is 192.168.3.74 Filename '/tftpboot/denx_startup.bmp'.

Load address: 0x100000

Loading: ############################################################# done

Bytes transferred = 308278 (4b436 hex) => cp.b 100000 41F80000 $filesize Copy to Flash... done

=> setenv splashimage 41F80000 => saveenv

Saving Environment to Flash... Un-Protected 1 sectors

Erasing Flash... . done

Erased 1 sectors

Writing to Flash... done Protected 1 sectors => bmp info $splashimage Image size : 640 x 480 Bits per pixel: 8

Compression : 0

Note that, for perfect operation, this option has to be complemented by matching Splash Screen Support in

Linux.