Skip to content

Building and flashing images on NXP S32G-RDB3

To build an AutoSD image and flash it onto an NXP S32G-RDB3 board, follow these steps:

  1. Update the board firmware.
  2. Build the AutoSD image.
  3. Build the NXP BSP kernel into the AutoSD image.

Important

The NXP S32G-RDB3 platform is not fully enabled in the upstream Linux or AutoSD kernels. Therefore, an AutoSD image using the AutoSD kernel cannot use all the features of this board. For a more robust platform experience, replace the AutoSD kernel with the NXP BSP vendor kernel by following the instructions in Installing the NXP BSP kernel into the AutoSD image.

  1. Install the secondary boot loader (SBL) binary into the AutoSD image.
  2. Flash the image onto an SD card and boot the system.

Updating your S32G-RDB3 firmware

Before flashing an AutoSD image onto the S32G-RDB3 board, install the updated firmware.

Prerequisites

  • An AArch64 host machine running CentOS Stream, Fedora, or RHEL with Internet access.

Procedure

  1. Enable the @centos-automotive-sig/nxp-board-support repo:

    $ dnf copr enable @centos-automotive-sig/nxp-board-support
    
  2. Install the nxp-arm-trusted-firmware:

    $ dnf install nxp-arm-trusted-firmware-armv8
    

After you install the firmware, note the path for the fip.s32 binary you need later for the Installing the NXP BSP into the AutoSD image procedure: /usr/share/nxp-arm-trusted-firmware/s32g399ardb3/fip.s32.

Next steps

After the fip.s32 binary is installed in your host, you can build the AutoSD image.

Building an AutoSD image for S32G-RDB3

Build the AutoSD image using the s32g_vnp_rdb3 target.

Prerequisites

  • An AArch64 host machine running CentOS Stream, Fedora, or RHEL with Internet access.

Procedure

  1. Install the Automotive Image Builder tool for your OS.

  2. Clone the sample-images repository:

    $ git clone https://gitlab.com/CentOS/automotive/sample-images.git
    
  3. Go to the sample-images repository:

    cd sample-images
    
  4. Build the image, setting --target to s32g_vnp_rdb3:

    $ automotive-image-builder build --distro autosd9 \
      --mode package --target s32g_vnp_rdb3 --export image \
      images/developer.aib.yml <my-image>.img
    

    Note

    Replace <my-image> with the name of your image.

Next steps

After you have built the image, install the NXP BSP kernel into it.

Installing the NXP BSP kernel into the AutoSD image

To create a bootable AutoSD image for the S32G-RDB3 board, build the NXP BSP kernel and manually install the SBL binary into the image.

Important

The NXP S32G-RDB3 platform is not fully enabled in the upstream Linux or AutoSD kernels. Therefore, an AutoSD image using the AutoSD kernel cannot use all the features of this board. For a more robust platform experience, replace the AutoSD kernel with the NXP BSP vendor kernel.

Prerequisites

Procedure

  1. Build the NXP BSP kernel:

    $ git clone https://github.com/nxp-auto-linux/linux.git
    cd linux
    make s32cc_defconfig
    # This command is required to boot from AutoSD default boot manager
    
    scripts/config -e CONFIG_EFI
    make -j$(nproc)
    
  2. Set the following environment variables:

    $ IMAGE=../<my-image>.img
    $ image=$(basename $IMAGE)
    $ loopdev="$(losetup --show -fP $IMAGE)"
    $ kernelversion="$(cat include/config/kernel.release)"
    

    Note

    Replace <my-image> with the name of your image.

  3. Create a temporary directory, and mount the third and fourth partitions of the AutoSD image as block devices:

    $ mkdir tmpdir
    $ sudo mount ${loopdev}p4 ./tmpdir/
    $ sudo mount ${loopdev}p3 ./tmpdir/boot/
    
  4. Build the NXP BSP kernel:

    $ sudo make INSTALL_MOD_PATH=./tmpdir modules_install
    $ sudo make INSTALL_DTBS_PATH=./tmpdir/boot/dtb-${kernelversion} dtbs_install
    
  5. Copy the NXP BSP kernel to the AutoSD image that you mounted in ./tmpdir:

    $ sudo cp arch/arm64/boot/Image ./tmpdir/boot/Image-${kernelversion}
    $ sudo cp System.map ./tmpdir/boot/
    
  6. Modify the boot loader:

    $ rm ./tmpdir/boot/loader/*
    $ cat << EOF | sudo tee -a ./tmpdir/boot/loader/entries/ffffffffffffffffffffffffffffffff-${kernelversion}.aarch64.conf
    title Automotive Stream Distribution (${kernelversion}.aarch64) 9
    version ${kernelversion}.aarch64
    linux /Image-${kernelversion}
    devicetree /dtb-${kernelversion}/freescale/s32g399a-rdb3.dtb
    options root=/dev/mmcblk0p4 rw loglevel=4 efi=noruntime acpi=off console=ttyLF0,115200 module.sig_enforce=1 systemd.show_status=auto
    libahci.ignore_sss=1 slub_debug=FPZ fsck.mode=skip rcupdate.rcu_normal_after_boot=0 rcupdate.rcu_expedited=1
    grub_users $grub_users
    grub_arg --unrestricted
    grub_class autosd
    EOF
    
  7. Unmount the filesystem, and detach the loop device:

    $ sudo umount ./tmpdir/boot
    $ sudo umount ./tmpdir
    $ losetup -D ${loopdev}
    
  8. Install the SBL binary, fip.s32, into the AutoSD image:

    $ sudo dd if=/usr/share/nxp-arm-trusted-firmware/s32g399ardb3/fip.s32 of=<my-image>.img \
        skip=512 seek=512 iflag=skip_bytes oflag=seek_bytes \
        conv=fsync,notrunc
    

    Note

    Replace <my-image> with the name of your image.

Next steps

After you have installed the SBL binary and, optionally, the NXP BSP kernel into the AutoSD image, you can flash the image onto the S32G-RDB3 board. For more information about creating and running custom kernels in virtual and physical environments, see Building an AutoSD image that includes a custom kernel.

Flashing the AutoSD image onto the S32G-RDB3 board

Flash your customized AutoSD image onto an SD card and boot the system.

Prerequisites

Procedure

  1. Flash the image onto an SD card, replacing </dev/sdX> with your block device:

    $ sudo dd if=<my-image>.img of=</dev/sdX> \
            status=progress conv=fsync
    

    Note

    Replace <my-image> with the name of your image.

  2. Plug in the SD card and start the system.

    Note

    Flashed u-boot supports EFI boot, so the system boots without any user interaction.

  3. To see the output, log in to the serial port using default credentials:

    Automotive Stream Distribution 9
    Kernel 5.15.129-rt67 on an aarch64
    
    localhost login: root
    Password: password
    [root@localhost ~]#
    

© Red Hat