Changes between Version 12 and Version 13 of newport/boot


Ignore:
Timestamp:
04/25/2019 06:49:50 PM (5 years ago)
Author:
Tim Harvey
Comment:

updated for kernel.itb and newport.scr bootscript being moved to root partition /boot directory

Legend:

Unmodified
Added
Removed
Modified
  • newport/boot

    v12 v13  
    2727 * {{{diagnostics.bin}}} - an application that can be used for very low level board diagnostics typically used during board validation
    2828
    29 The BDK uses an embedded FAT12 filesystem for its various components (various .bin and .dtb files). We also typically place a Flattened Image Table (FIT) image containing the kernel {{{kernel.itb}}} as well as a legacy U-Boot uImage bootscript {{{newport.scr}}} in this filesystem as well where the Newport Bootloader scripts will find and execute them. The reason for putting the kernel and bootscript here is that the Bootloader can access FAT filesystems but can not access some of the newer filesystems that you may be using as a root filesystem such as F2FS or BTRFS.
     29The BDK uses an embedded FAT12 filesystem for its various components (various .bin and .dtb files).
     30Additionally, if you wanted to use a root filesystem type that is not supported by the bootloader you could also place a Flattened Image Table (FIT) image containing the kernel {{{kernel.itb}}} as well as a U-Boot uImage bootscript {{{newport.scr}}} in this filesystem as well and the Newport Bootloader scripts will find and execute them.
    3031
    3132The FAT12 filesystem is created and managed using a host tool built by the BDK called {{{fatfs-tool}}}.
     
    102103|| 0x0080000 - 0x0100000 || 1024KB || unused || ||
    103104|| ||
    104 || 0x0100000 - 0x0E00000 || 13312KB || FAT12 filesystem || contains various portions of the BDK as well as the device-tree, kernel.itb and bootscript ||
     105|| 0x0100000 - 0x0E00000 || 13312KB || FAT12 filesystem || contains various portions of the BDK as well as the device-tree ||
    105106|| 0x0E00000 - 0x0F00000 || 1024KB || ATF_BL1 || atf/bl1.bin ||
    106107|| 0x0F00000 - 0x0FF0000 || 960KB || ATF_BL2 fip.img || U-Boot ||
     
    149150# define some variables
    150151OUT=myimage.img
     152ROOTFS=bionic-newport
    151153
    152154# 1. start with firmware-newport.img
     
    160162sfdisk -l -uS $OUT # show partition table
    161163
    162 # 3. create a uImage bootscript and kernel.itb and place them on FAT12 partition:
    163 # - you can use the newport/ubuntu.scr as a sample bootscript which shows how to
    164 #   load and execute a compressed kernel in a FIT image: kernel.itb
    165 # - create kernel.itb with compressed kernel image
    166 # - use newport/mkits.sh to create a kernel.its template
    167 # - use mkimage to create a fit image from the template
    168 # - use fatfs-tool to copy the files into the FATFS filesystem within the image
    169 cp linux/arch/arm64/boot/Image vmlinux
    170 gzip -f vmlinux
    171 ./newport/mkits.sh -o kernel.its -k vmlinux.gz -C gzip -v "Newport Kernel"
    172 mkimage -f kernel.its kernel.itb
    173 # inject the kernel.itb into the FAT12 filesystem
    174 fatfs-tool -i $OUT cp kernel.itb /
    175 # create bootscript and inect it into the FAT12 filesystem
    176 mkimage -A arm64 -T script -C none -d newport/ubuntu.scr newport.scr
    177 fatfs-tool -i $OUT cp newport.scr /
    178 # you can use fatfs-tool to list the contents of the FAT12 and see your files
    179 fatfs-tool -i $OUT ls
    180 
    181 # 4. create your root filesystem
     164# 3. create your root filesystem
    182165# - you can use the newport/mkfs script to create an f2fs|ext4 fs from a set of dirs/tarballs
    183166# - specify a minimum filesystem size to keep your image small in order to
     
    186169#   c) write less data and thus more quickly
    187170# - once booted you can resize2fs for ext4 or
    188 sudo ./newport/mkfs ext4 xenial-newport.ext4 1536M linux-newport.tar.xz xenial-newport.tar.xz
     171sudo ./newport/mkfs ext4 $ROOTFS.ext4 1536M linux-newport.tar.xz $ROOTFS.tar.xz
     172
     173# 4. create a uImage bootscript and kernel.itb and place them the root filesystem:
     174# - you can use the newport/ubuntu.scr as a sample bootscript which shows how to
     175#   load and execute a compressed kernel in a FIT image: kernel.itb
     176# - create kernel.itb with compressed kernel image
     177# - use newport/mkits.sh to create a kernel.its template
     178# - use mkimage to create a fit image from the template
     179# - mount your root filesystem and copy them to the boot directory
     180#   (or use fatfs-tool to copy the files into the FATFS filesystem within the image
     181#    if your root filesystem is not supported by the bootloader)
     182# create compressed kernel FIT image
     183cp linux/arch/arm64/boot/Image vmlinux
     184gzip -f vmlinux
     185./newport/mkits.sh -o kernel.its -k vmlinux.gz -C gzip -v "Newport Kernel"
     186mkimage -f kernel.its kernel.itb
     187# create bootscript
     188mkimage -A arm64 -T script -C none -d newport/ubuntu.scr newport.scr
     189# mount your root filesystem and copy them
     190mount $ROOTFS.ext4 /mnt
     191cp kernel.itb newport.scr /mnt/boot/
     192umount $ROOTFS.ext4
    189193
    190194# 5. copy your filesystem to the correct partition offset
    191195# (16MB unless you've had reason to change it)
    192 dd if=xenial-newport.ext4 of=$OUT bs=16M seek=1
     196dd if=$ROOTFS.ext4 of=$OUT bs=16M seek=1
    193197
    194198# 6. compress it
     
    200204To further simplify this process, the Newport BSP Makefile has a 'ubuntu-image' make target that will do all of the above for you if you provide env variables:
    201205 * UBUNTU_KERNEL (uncompressed kernel Image, defaults to linux/arch/arm64/boot/Image)
    202  * UBUNTU_FS (uncompressed filesystem image defaults to xenial-newport.ext4)
    203  * UBUNTU_IMG (output file without the .gz extension, defaults to xenial-newport.img):
     206 * UBUNTU_FS (uncompressed filesystem image defaults to bionic-newport.ext4)
     207 * UBUNTU_IMG (output file without the .gz extension, defaults to bionic-newport.img):
    204208{{{#!bash
    205209# create uncompressed root filesystem image
    206 sudo ./newport/mkfs ext4 xenial-newport.ext4 1536M linux-newport.tar.xz xenial-newport.tar.xz
    207 UBUNTU_KERNEL=linux/arch/arm64/boot/Image UBUNTU_FS=xenial-newport.ext4 UBUNTU_IMG=xenial-newport.img make ubuntu-image
    208 }}}
    209  * This creates ${UBUNTU_IMG}.gz or from the example above xenail-newport.img.gz
     210sudo ./newport/mkfs ext4 bionic-newport.ext4 1536M linux-newport.tar.xz bionic-newport.tar.xz
     211UBUNTU_KERNEL=linux/arch/arm64/boot/Image UBUNTU_FS=bionic-newport.ext4 UBUNTU_IMG=bionic-newport.img make ubuntu-image
     212}}}
     213 * This creates ${UBUNTU_IMG}.gz or from the example above xenial-newport.img.gz
    210214
    211215You can now install this using the methods described in [wiki:newport#firmware-update newport/firware-update]. For example in the bootloader: