Skip to content

How to run specific Morello kernel image on FVP

engMennaMahmoud edited this page Aug 8, 2023 · 7 revisions

To be able to work on Morello Kernel development and run it on FVP:

  1. Set up the prerequisites.

  2. Follow these steps to run kernel using Morello-SDK container.

  3. After building the kernel, the SDK environment looks like this (with the kernel built under workspace/linux-out):

  |-> workspace/
      |-> linux/
      |-> linux-out/
  |-> docker-compose.yml
  1. Combine the SDK environment with the morello-Linux environment "Docker image for Morello Linux" by adding it to docker-compose.yml
# Docker composer file for Morello Linux
version: '3.8'
services:
  linux-morello-sdk:
    image:"git.morello-project.org:5050/morello/morello-sdk/morello-sdk:latest"
    container_name: "linux-morello-sdk"
    volumes:
      - ./workspace:/home/morello/workspace
    tty: true
    restart: unless-stopped
  morello-linux:
    image:"git.morello-project.org:5050/morello/morello-linux/morello-linux:latest"
    container_name: "morello-linux"
    environment:
      - UID=1000
      - GID=1000
    volumes:
      - ./workspace:/morello
    tty: true
    restart: unless-stopped
  1. Setup FVP.
cd workspace
wget -O FVP_Morello_0.11_34.tgz https://developer.arm.com/-/media/Arm%20Developer%20Community/Downloads/OSS/FVP/Morello%20Platform/FVP_Morello_0.11_34.tgz?rev=5f34837ae6c14ede8493dfc24c9af397&hash=862883120C5638E0B3C5ACA6FDDC5558021E1886
tar -xzvf FVP_Morello_0.11_34.tgz
./FVP_Morello.sh --force --destination ./FVP_Morello

You should then be able to use the following instructions:

  1. Start the containers:

    docker-compose up -d

  2. Still, on the host, download this package for later use:

   cd workspace
   curl --output kexec-tools_2.0.20-2.1_arm64.deb http://deb.debian.org/debian/pool/main/k/kexec-tools/kexec-tools_2.0.20-2.1_arm64.deb
  1. Enter the morello-linux container:

    docker exec -it -u 1000 morello-linux /bin/bash

  2. Using an editor like Vim, open /usr/bin/morello and append on the last line -v /morello, it should now look like this:

    morello-run.sh -f distro -i /usr/share/morello/images/morello-fvp/morello-fvp.img -v /morello

    (This specifies that /morello should be made available to be mounted as a 9P filesystem in FVP.)

  3. Start FVP:

    # morello

  4. Once FVP has booted, mount the 9P filesystem to access the /morello directory in the container:

 # mkdir /mnt/9p
 # mount -t 9p -o trans=virtio,version=9p2000.L FM /mnt/9p
  1. Install the previously downloaded kexec-tools package:

    # dpkg -i /mnt/9p/kexec-tools_2.0.20-2.1_arm64.deb

  2. You should now be able to boot your own kernel image using Kexec:

    # kexec -l /mnt/9p/linux-out/arch/arm64/boot/Image --reuse-cmdline
    # systemctl kexec
    

The configurations that are not compiled with error:

CONFIG_SECURITY_LOCKDOWN_LSM=y

/home/morello/workspace/linux/scripts/sign-file.c:25:10: fatal error: 'openssl/opensslv.h' file not found
#include <openssl/opensslv.h>
         ^~~~~~~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [/home/morello/workspace/linux/scripts/Makefile.host:111: scripts/sign-file] Error 1
make[1]: *** [/home/morello/workspace/linux/Makefile:1261: scripts] Error 2
make[1]: Leaving directory '/home/morello/workspace/linux-out'
make: *** [Makefile:231: __sub-make] Error 2

CONFIG_IMA_APPRAISE_MODSIG=y

/home/morello/workspace/linux/scripts/sign-file.c:25:10: fatal error: 'openssl/opensslv.h' file not found
#include <openssl/opensslv.h>
         ^~~~~~~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [/home/morello/workspace/linux/scripts/Makefile.host:111: scripts/sign-file] Error 1
make[1]: *** [/home/morello/workspace/linux/Makefile:1261: scripts] Error 2
make[1]: Leaving directory '/home/morello/workspace/linux-out'
make: *** [Makefile:231: __sub-make] Error 2

CONFIG_INTEGRITY_TRUSTED_KEYRING=y

/home/morello/workspace/linux/certs/extract-cert.c:21:10: fatal error: 'openssl/bio.h' file not found
#include <openssl/bio.h>
         ^~~~~~~~~~~~~~~
1 error generated.
make[3]: *** [/home/morello/workspace/linux/scripts/Makefile.host:111: certs/extract-cert] Error 1
make[2]: *** [/home/morello/workspace/linux/scripts/Makefile.build:500: certs] Error 2
make[1]: *** [/home/morello/workspace/linux/Makefile:1999: .] Error 2
make[1]: Leaving directory '/home/morello/workspace/linux-out'
make: *** [Makefile:231: __sub-make] Error 2

Fixed By installing libssl-dev apt-get install libssl-dev in linux-morello-sdk container