
Robbie VanVossen Getting U-Boot Karl Apsite Paul Skentzos FIT for Xen Joshua Whitehead Xen Developers Summit 2015 Presentation Outline □ U-Boot □ FIT Image □ FIT Image Source File □ Loadables □ Building & Booting □ Benefits of Using FIT ..... where hardware and software design meet 2 U-Boot The Universal Bootloader where hardware and software design meet 3 U-Boot - History □ Open Source Bootloader for embedded devices □ Originally 8xxROM □ 1999 - PPCBoot □ 2000 - Publicly released v0.4.1 □ Strictly for Power PC architecture □ 2002 □ Forked into a product called ARMBoot □ Renamed to Das U-Boot (Universal Bootloader) to reflect new architecture support □ 2003 - Added MIPS32, MIPS64, Coldfire, Altera NIOS−32 □ 2008 - Added Flattened Image Tree support ..... where hardware and software design meet 4 U-Boot - Features □ Multiple loading methods □ TFTP, mmc devices, various flash devices, PXE, IDE, SATA, USB □ Lots of supported architectures □ 68k, ARM, AVR32, Blackfin, MicroBlaze, MIPS, Nios, PPC, and x86 □ Filesystem handling □ Including Cramfs, ext2, ext3, ext4, FAT, FDOS, JFFS2, ReiserFS, UBIFS, and ZFS □ Network handling □ ping, DHCP, TFTP □ FDT handling □ Direct memory reads and writes ..... where hardware and software design meet 5 FIT Image Flattened Image Tree where hardware and software design meet 6 FIT Image - Introduction □ Uses a tree-like structure □ Flexible, monolithic binary that includes everything for booting □ Benefits □ Image Hashing □ Multiple Configurations □ FIT can not load more than one kernel ..... where hardware and software design meet 7 FIT Image - Build Requirements □ Utilities □ mkimage □ dtc - device tree compiler □ Binaries □ Device Tree Binaries □ Kernels □ Optional ramdisks □ Optional Loadables (DornerWorks Contribution) □ Image Source File (*.its) ..... where hardware and software design meet 8 FIT Image - Generation Image FIT Source mkimage Image (*. File (*.its) itb) Binaries (kernels, fdts, ramdisks) ..... where hardware and software design meet 9 Image Source File FIT Configuration (Before our updates) where hardware and software design meet 10 Image Source File - Example.its /dts-v1/; fdt@1 { / { description = "Flattened Device Tree description = "Single Linux kernel and FDT blob"; blob"; #address-cells = <1>; data = /incbin/("./target.dtb"); type = "flat_dt"; images { arch = "arm"; compression = "none"; kernel@1 { load = <00700000>; description = "Vanilla Linux kernel"; hash@1 { data = /incbin/("./vmlinux.bin.gz"); algo = "crc32"; type = "kernel"; }; arch = "arm"; hash@2 { os = "linux"; algo = "sha1"; compression = "gzip"; }; load = <00000000>; }; entry = <00000000>; }; hash@1 { fdt@2 { algo = "crc32"; description = "Flattened Device Tree }; blob"; hash@2 { data = /incbin/("./target2.dtb"); algo = "sha1"; type = "flat_dt"; }; arch = "arm"; }; compression = "none"; load = <00700000>; }; }; ..... where hardware and software design meet 11 Image Source File - Example.its (cont) ramdisk@1 { configurations { description = "ramdisk"; default = "conf@1"; data = /incbin/("./ramdisk"); type = "ramdisk"; conf@1 { arch = "arm"; description = "Linux kernel with FDT os = "linux"; blob"; compression = "gzip"; kernel = "kernel@1"; load = <00800000>; fdt = "fdt@1"; entry = <00800000>; }; hash@1 { algo = "sha1"; conf@2 { }; description = "Linux kernel, fdt, & }; ramdisk"; }; kernel = "kernel@1"; ramdisk = “ramdisk@1”; fdt = "fdt@2"; }; }; }; ..... where hardware and software design meet 12 Image Source File - Format □ The image source file format is defined here: http://git.denx.de/?p=u-boot.git;a=blob_plain;f=doc/uImage. FIT/source_file_format.txt;hb=HEAD ..... where hardware and software design meet 13 Loadables New Configuration Property where hardware and software design meet 14 Loadables - Problem □ To use a FIT Image to load a Xen system, we need a configuration for □ Xen kernel □ Xen Device Tree Blob (DTB) □ Dom0 kernel □ The existing configuration properties: □ Allowed only one image per configuration □ Perform specific tasks and checks based on the type □ The kernel property is the image that gets executed, so it needs to be the Xen kernel □ The fdt property needs to be set to our DTB □ The ramdisk property can’t be used for our Dom0 kernel □ Therefore, we need a way to load a generic image (loadable) to a specific location ..... where hardware and software design meet 15 Loadables - Solution □ Created a new configuration property □ Loadables - A list of image sub-nodes of any type □ The loadables property doesn’t have any extra tasks or checks □ Multiple images □ Now there is a configuration property for the Dom0 Linux Kernel ..... where hardware and software design meet 16 Updating U-Boot - U-Boot □ Updated U-Boot to look for and handle the new loadables field □ Added bootm_find_loadables()/boot_get_loadable() □ Refactored relevant functions for readability and simplicity □ Added tests for loadables □ U-Boot mainline at the tag v2015.07 ..... where hardware and software design meet 17 Updating U-Boot - mkimage □ We modified mkimage to include the new loadables field. $ ./u-boot/tools/mkimage -f xen.its /tftpboot/xen.itb FIT description: Configuration to load a Xen Kernel . Default Configuration: 'config@1' Configuration 0 (config@1) Description: Xen 4.6.0-one loadable Kernel: xen_kernel@1 FDT: fdt@1 Loadables: linux_kernel@1 Configuration 1 (config@2) Description: Plain Linux Kernel: linux_kernel@1 FDT: fdt@2 ..... where hardware and software design meet 18 Loadables - xen.its /dts-v1/; fdt@1 { / { description = "Cubietruck Xen tree blob"; description = "Configuration to load a Xen Kernel"; data = /incbin/("./xen.dtb"); #address-cells = <1>; type = "flat_dt"; arch = "arm"; images { compression = "none"; xen_kernel@1 { load = <0xaec00000>; description = "xen-4.6.0-unstable"; hash@1 { data = /incbin/("./xen"); algo = "md5"; type = "kernel"; }; arch = "arm"; }; os = "linux"; compression = "none"; fdt@2 { load = <0xaea00000>; description = "Cubietruck tree blob"; entry = <0xaea00000>; data = /incbin/("./sun7i-a20-cubietruck.dtb"); hash@1 { type = "flat_dt"; algo = "md5"; arch = "arm"; }; compression = "none"; }; load = <0xaec00000>; hash@1 { algo = "md5"; }; }; ..... where hardware and software design meet 19 Loadables - xen.its (cont) linux_kernel@1 { configurations { description = "Linux zImage"; default = "config@1"; data = /incbin/("./vmlinuz"); type = "kernel"; config@1 { arch = "arm"; description = "Xen 4.6.0-one loadable"; os = "linux"; kernel = "xen_kernel@1"; compression = "none"; fdt = "fdt@1"; load = <0xaf600000>; loadables = "linux_kernel@1"; entry = <0xaf600000>; }; hash@1 { algo = "md5"; config@2 { }; description = "Plain Linux"; }; kernel = "linux_kernel@1"; }; fdt = "fdt@2"; }; }; }; ..... where hardware and software design meet 20 Building & Booting Example of how to build and boot from a FIT image where hardware and software design meet 21 Building the FIT Image □ Build U-Boot with FIT support (CONFIG_FIT=y) □ Build images (Dom0 Kernel, Xen Kernel, and DTB) as usual □ Place images as specified in the image source file □ Build the output FIT image $ mkimage -f xen.its xen.itb □ Copy U-Boot to where it needs to be for your board □ Move the FIT image to where you will be booting from □ We will use an SD card, with a boot partition, as an example ..... where hardware and software design meet 22 Booting the FIT Image □ Place the SD Card in your board □ Boot the board (Our example uses the cubietruck) □ Stop the U-Boot autoboot □ Load the FIT Image into Memory sunxi# fatload mmc 0 0x80000000 /xen.itb □ Boot configuration 1 sunxi# bootm 0x80000000#config@1 □ U-Boot will then check the specified hashes for those images, move them to their proper load addresses, and boot into the specified kernel, Xen □ Before booting a configuration, you can get information about your FIT image with the following command sunxi# iminfo 0x80000000 ..... where hardware and software design meet 23 Booting - Example Output sunxi# bootm 0x80000000#config@1 Trying 'fdt@1' fdt subimage ## Loading kernel from FIT Image at 80000000 ... Description: Cubietruck Xen tree blob Using 'config@1' configuration Type: Flat Device Tree Trying 'xen_kernel@1' kernel subimage Compression: uncompressed Description: xen-4.6.0-unstable Data Start: 0x800a84d8 Type: Kernel Image Data Size: 21940 Bytes = 21.4 KiB Compression: uncompressed Architecture: ARM Data Start: 0x800000dc Hash algo: md5 Data Size: 688912 Bytes = 672.8 KiB Hash value: Architecture: ARM 3c27715e5c19226064186193e3f30bc4 OS: Linux Verifying Hash Integrity ... md5+ OK Load Address: 0xaea00000 Loading fdt from 0x800a84d8 to 0xaec00000 Entry Point: 0xaea00000 Booting using the fdt blob at 0xaec00000 Hash algo: md5 ## Loading loadables from FIT Image at Hash value: 80000000 ... 51424697da4d1523a8c87150c7cbad00 Trying 'linux_kernel@1' loadables subimage Verifying Hash Integrity ... md5+ OK Description: Linux zImage ## Loading fdt from FIT Image at 80000000 ... Type: Kernel Image Using 'config@1' configuration Compression: uncompressed Data Start: 0x800b3108 Data Size: 5247832 Bytes = 5 MiB ..... where hardware and software design meet 24 Booting - Example Output (cont) Architecture: ARM - Setting up control registers - OS: Linux - Turning on paging - Load Address: 0xaf600000 - Ready - Entry Point: 0xaf600000 Checking for initrd in /chosen Hash algo: md5 [...] Hash value: 84c9630522c9737f6ded803177c967e8 Placing Xen at 0x00000000bfe00000- Verifying Hash Integrity ... md5+ OK 0x00000000c0000000 Loading loadables from 0x800b3108 to Xen heap: 000000009e000000- 0xaf600000
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages30 Page
-
File Size-