132 lines · plain
1========================2The PowerPC boot wrapper3========================4 5Copyright (C) Secret Lab Technologies Ltd.6 7PowerPC image targets compresses and wraps the kernel image (vmlinux) with8a boot wrapper to make it usable by the system firmware. There is no9standard PowerPC firmware interface, so the boot wrapper is designed to10be adaptable for each kind of image that needs to be built.11 12The boot wrapper can be found in the arch/powerpc/boot/ directory. The13Makefile in that directory has targets for all the available image types.14The different image types are used to support all of the various firmware15interfaces found on PowerPC platforms. OpenFirmware is the most commonly16used firmware type on general purpose PowerPC systems from Apple, IBM and17others. U-Boot is typically found on embedded PowerPC hardware, but there18are a handful of other firmware implementations which are also popular. Each19firmware interface requires a different image format.20 21The boot wrapper is built from the makefile in arch/powerpc/boot/Makefile and22it uses the wrapper script (arch/powerpc/boot/wrapper) to generate target23image. The details of the build system is discussed in the next section.24Currently, the following image format targets exist:25 26 ==================== ========================================================27 cuImage.%: Backwards compatible uImage for older version of28 U-Boot (for versions that don't understand the device29 tree). This image embeds a device tree blob inside30 the image. The boot wrapper, kernel and device tree31 are all embedded inside the U-Boot uImage file format32 with boot wrapper code that extracts data from the old33 bd_info structure and loads the data into the device34 tree before jumping into the kernel.35 36 Because of the series of #ifdefs found in the37 bd_info structure used in the old U-Boot interfaces,38 cuImages are platform specific. Each specific39 U-Boot platform has a different platform init file40 which populates the embedded device tree with data41 from the platform specific bd_info file. The platform42 specific cuImage platform init code can be found in43 `arch/powerpc/boot/cuboot.*.c`. Selection of the correct44 cuImage init code for a specific board can be found in45 the wrapper structure.46 47 dtbImage.%: Similar to zImage, except device tree blob is embedded48 inside the image instead of provided by firmware. The49 output image file can be either an elf file or a flat50 binary depending on the platform.51 52 dtbImages are used on systems which do not have an53 interface for passing a device tree directly.54 dtbImages are similar to simpleImages except that55 dtbImages have platform specific code for extracting56 data from the board firmware, but simpleImages do not57 talk to the firmware at all.58 59 PlayStation 3 support uses dtbImage. So do Embedded60 Planet boards using the PlanetCore firmware. Board61 specific initialization code is typically found in a62 file named arch/powerpc/boot/<platform>.c; but this63 can be overridden by the wrapper script.64 65 simpleImage.%: Firmware independent compressed image that does not66 depend on any particular firmware interface and embeds67 a device tree blob. This image is a flat binary that68 can be loaded to any location in RAM and jumped to.69 Firmware cannot pass any configuration data to the70 kernel with this image type and it depends entirely on71 the embedded device tree for all information.72 73 treeImage.%; Image format for used with OpenBIOS firmware found74 on some ppc4xx hardware. This image embeds a device75 tree blob inside the image.76 77 uImage: Native image format used by U-Boot. The uImage target78 does not add any boot code. It just wraps a compressed79 vmlinux in the uImage data structure. This image80 requires a version of U-Boot that is able to pass81 a device tree to the kernel at boot. If using an older82 version of U-Boot, then you need to use a cuImage83 instead.84 85 zImage.%: Image format which does not embed a device tree.86 Used by OpenFirmware and other firmware interfaces87 which are able to supply a device tree. This image88 expects firmware to provide the device tree at boot.89 Typically, if you have general purpose PowerPC90 hardware then you want this image format.91 ==================== ========================================================92 93Image types which embed a device tree blob (simpleImage, dtbImage, treeImage,94and cuImage) all generate the device tree blob from a file in the95arch/powerpc/boot/dts/ directory. The Makefile selects the correct device96tree source based on the name of the target. Therefore, if the kernel is97built with 'make treeImage.walnut', then the build system will use98arch/powerpc/boot/dts/walnut.dts to build treeImage.walnut.99 100Two special targets called 'zImage' and 'zImage.initrd' also exist. These101targets build all the default images as selected by the kernel configuration.102Default images are selected by the boot wrapper Makefile103(arch/powerpc/boot/Makefile) by adding targets to the $image-y variable. Look104at the Makefile to see which default image targets are available.105 106How it is built107---------------108arch/powerpc is designed to support multiplatform kernels, which means109that a single vmlinux image can be booted on many different target boards.110It also means that the boot wrapper must be able to wrap for many kinds of111images on a single build. The design decision was made to not use any112conditional compilation code (#ifdef, etc) in the boot wrapper source code.113All of the boot wrapper pieces are buildable at any time regardless of the114kernel configuration. Building all the wrapper bits on every kernel build115also ensures that obscure parts of the wrapper are at the very least compile116tested in a large variety of environments.117 118The wrapper is adapted for different image types at link time by linking in119just the wrapper bits that are appropriate for the image type. The 'wrapper120script' (found in arch/powerpc/boot/wrapper) is called by the Makefile and121is responsible for selecting the correct wrapper bits for the image type.122The arguments are well documented in the script's comment block, so they123are not repeated here. However, it is worth mentioning that the script124uses the -p (platform) argument as the main method of deciding which wrapper125bits to compile in. Look for the large 'case "$platform" in' block in the126middle of the script. This is also the place where platform specific fixups127can be selected by changing the link order.128 129In particular, care should be taken when working with cuImages. cuImage130wrapper bits are very board specific and care should be taken to make sure131the target you are trying to build is supported by the wrapper bits.132