Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagebash
$ export COS_BUILD=$HOME/centos8-dev
$ mkdir -p $COS_BUILD/rpmbuild $COS_BUILD/images/{efi,boot,rootfs} $COS_BUILD/deploy/{efi/dtb/xilinx,boot}

...

This section walks through two builds of the kernel. The first is a bootstrap kernel, which is a straight forward make build. The boostrap bootstrap kernel does not rely on any kernel modules to mount the final root filesystem. The second kernel is built with the CentOS RPM build system. This build system pulls directly from the CentOS kernel repository which also includes patches, kernel configurations and build scripts.

...

Tip

If all of these are options are enabled, then the installed kernel should boot on the ZCU102 and you can skip to “Build the Kernel RPM Packages.”

Warning

If the kernel hangs, i.e. no kernel console messages, then revisit this section and try building a bootstrap kernel. Note you should still see the FSBL banner, PMUFW, ATF and u-boot messages. If you don’t, then something is wrong with your boot.bin on the FAT partition.

First we need to run the “%prep” stage in our SPEC file which will unpack and patch the kernel source.

...

Code Block
Source1000: kernel-aarch64-zynqmp.cfg

Inside the function “BuildKernel()”“BuildKernel”, add line #2 as shown below. This will merge our configuration fragment with the default kernel configuration.

Code Block
languagebash
cp configs/$Config .config
scripts/kconfig/merge_config.sh -m -r .config %{SOURCE1000}

...

The first thing we note is that “Disklabel type” is set to “gpt”. However, Zynq UltraScale+ only support MBR partitioned disks, so we need to convert from GPT to MBR with “sgdisk”.

Code Block
languagebash
$ sgdisk -m 1:2 CentOS-Stream-GenericCloud-8-20200113.0.aarch64.raw 
Warning: The kernel is still using the old partition table.
The new table will be used at the next reboot or after you
run partprobe(8) or kpartx(8)
GPT data structures destroyed! You may now partition the disk using fdisk or
other utilities.

We also need to mark the 1st sector as the boot partition with “sfdisk”.

Code Block
$ sfdisk -A CentOS-Stream-GenericCloud-8-20200113.0.aarch64.raw 1
The bootable flag on partition 1 is enabled now.

The partition table has been altered.
Syncing disks.

...

We need to setup the map devices for the raw disk image we prepared earlier. Mount the first two partitions on “efi” and “rootfs” respectively.

If you are installing on a raw disk image created from an ISO, then there may be three partitions, EFI, boot and rootfs. In this case you will want to mount the second partition on “boot” and copy the kernel RPM packages here.

Code Block
$ cd $COS_BUILD/images
$ sudo kpartx -va CentOS-Stream-GenericCloud-8-20200113.0.aarch64.raw 
add map loop0p1 (253:3): 0 1228800 linear 7:0 2048
add map loop0p2 (253:4): 0 16384000 linear 7:0 1230848
$ sudo mount /dev/mapper/loop0p1 efi
$ sudo mount /dev/mapper/loop0p2 rootfs

...