Changes between Version 12 and Version 13 of newport/boot
- Timestamp:
- 04/25/2019 06:49:50 PM (6 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
newport/boot
v12 v13 27 27 * {{{diagnostics.bin}}} - an application that can be used for very low level board diagnostics typically used during board validation 28 28 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. 29 The BDK uses an embedded FAT12 filesystem for its various components (various .bin and .dtb files). 30 Additionally, 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. 30 31 31 32 The FAT12 filesystem is created and managed using a host tool built by the BDK called {{{fatfs-tool}}}. … … 102 103 || 0x0080000 - 0x0100000 || 1024KB || unused || || 103 104 || || 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 || 105 106 || 0x0E00000 - 0x0F00000 || 1024KB || ATF_BL1 || atf/bl1.bin || 106 107 || 0x0F00000 - 0x0FF0000 || 960KB || ATF_BL2 fip.img || U-Boot || … … 149 150 # define some variables 150 151 OUT=myimage.img 152 ROOTFS=bionic-newport 151 153 152 154 # 1. start with firmware-newport.img … … 160 162 sfdisk -l -uS $OUT # show partition table 161 163 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 182 165 # - you can use the newport/mkfs script to create an f2fs|ext4 fs from a set of dirs/tarballs 183 166 # - specify a minimum filesystem size to keep your image small in order to … … 186 169 # c) write less data and thus more quickly 187 170 # - 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 171 sudo ./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 183 cp linux/arch/arm64/boot/Image vmlinux 184 gzip -f vmlinux 185 ./newport/mkits.sh -o kernel.its -k vmlinux.gz -C gzip -v "Newport Kernel" 186 mkimage -f kernel.its kernel.itb 187 # create bootscript 188 mkimage -A arm64 -T script -C none -d newport/ubuntu.scr newport.scr 189 # mount your root filesystem and copy them 190 mount $ROOTFS.ext4 /mnt 191 cp kernel.itb newport.scr /mnt/boot/ 192 umount $ROOTFS.ext4 189 193 190 194 # 5. copy your filesystem to the correct partition offset 191 195 # (16MB unless you've had reason to change it) 192 dd if= xenial-newport.ext4 of=$OUT bs=16M seek=1196 dd if=$ROOTFS.ext4 of=$OUT bs=16M seek=1 193 197 194 198 # 6. compress it … … 200 204 To 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: 201 205 * 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): 204 208 {{{#!bash 205 209 # create uncompressed root filesystem image 206 sudo ./newport/mkfs ext4 xenial-newport.ext4 1536M linux-newport.tar.xz xenial-newport.tar.xz207 UBUNTU_KERNEL=linux/arch/arm64/boot/Image UBUNTU_FS= xenial-newport.ext4 UBUNTU_IMG=xenial-newport.img make ubuntu-image208 }}} 209 * This creates ${UBUNTU_IMG}.gz or from the example above xen ail-newport.img.gz210 sudo ./newport/mkfs ext4 bionic-newport.ext4 1536M linux-newport.tar.xz bionic-newport.tar.xz 211 UBUNTU_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 210 214 211 215 You can now install this using the methods described in [wiki:newport#firmware-update newport/firware-update]. For example in the bootloader: