Skip to content

Getting started on Linux

Set up your development environment with the prerequisite tools and repositories you need to quickly start building AutoSD images.

Building AutoSD images

To build an AutoSD image, you need the automotive-image-builder tool and a compatible Automotive Image Builder manifest. You can find several sample manifests in the images directory in the sample-images repository.

Prerequisites

Procedure

  1. Copy or modify one of the sample manifests from the sample-images/images directory:

    $ git clone https://gitlab.com/CentOS/automotive/sample-images.git
    
  2. Build an image with automotive-image-builder:

    Important

    This documentation is in the process of being adjusted for the changes implemented in Automotive Image Builder 1.1.4. In the meantime, to keep the sample commands in this documentation valid, you must use the deprecated CLI, as shown in this example.

    $ sudo aib-dev build-deprecated \
        --target qemu \
        --export qcow2 \
        --mode package \
        sample-images/images/simple-developer.aib.yml \
        my-image.qcow2
    

    This example build command uses simple-developer.aib.yml, which is an Automotive Image Builder manifest file that contains several RPM packages for development purposes. The build command options are described in detail in Automotive Image Builder tool.

Booting prebuilt AutoSD images in a QEMU VM

A virtualized AutoSD development environment, or virtual machine (VM), is a convenient place to build and test applications. The image built from simple-developer.aib.yml, for example, includes many tools useful for developing AutoSD images. After you create an AutoSD image file, use the automotive-image-runner tool, included with the automotive-image-builder, to start a VM.

Prerequisites

Procedure

  1. Start a VM using automotive-image-runner:

    $ sudo automotive-image-runner <path>/image.qcow2
    
  2. Log in as the root user with the default password password.

    Note

    Setting the PasswordAuthentication option to yes in sshd_config in the auth: section of your Automotive Image Builder manifest enables ssh access. With ssh enabled, you can access the VM by running ssh -p 2222 -o "UserKnownHostsFile=/dev/null" guest@localhost.

Building customized AutoSD images in a QEMU VM

Whether you download a sample image or build your own, a pre-configured AutoSD platform is the ideal VM environment for creating customized AutoSD images. The AutoSD image disk size is small, however, so you must enlarge the disk size before using the VM to build customized images. After you resize the disk, launch a VM, install the required build tools, and build a customized AutoSD image.

Prerequisites

Procedure

  1. Resize the virtual disk of your .qcow2 image so you have enough space to build and develop custom AutoSD images:

    $ sudo qemu-img resize <image>.qcow2 30G
    
  2. Start a VM:

    $ sudo automotive-image-runner <path>/<image>.qcow2
    

    Alternatively, pass the --nographics argument when you run the automotive-image-runner command. Using the --nographics argument makes it easier to copy and paste code in the VM. It is also an essential argument in systems that run without a display.

    $ sudo automotive-image-runner --nographics <path>/<image>.qcow2
    
  3. Log in with the guest user and the default password password.

    Note

    Setting the PasswordAuthentication option to yes in sshd_config in the auth: section of your Automotive Image Builder manifest enables ssh access. With ssh enabled, you can access the VM by running ssh -p 2222 -o "UserKnownHostsFile=/dev/null" guest@localhost.

  4. Change to the root user. The root user password is also password:

    $ su -
    
  5. Install the tools needed to resize the disk image:

    # dnf -y install parted e2fsprogs
    
  6. Run parted to extend the size of /dev/vda:

    # parted /dev/vda
    
  7. Resize the /dev/vda3 partition to fill the space available to that partition:

    (parted) resizepart 3 100%
    
  8. Exit the parted tool:

    (parted) quit
    
  9. Enlarge the file system:

    # resize2fs /dev/vda3
    
  10. Install copr:

    # dnf install 'dnf-command(copr)'
    
  11. Install automotive-image-builder in the VM.

    1. Enable the automotive-image-builder repository:

      # dnf copr enable @centos-automotive-sig/automotive-image-builder
      
    2. Install the automotive-image-builder tool:

      # dnf install automotive-image-builder
      
  12. From the VM, create a custom Automotive Image Builder manifest file and configure it according to your requirements:

    # vim my-manifest.aib.yml
    

    Note

    The Automotive SIG provides several sample manifest files in sample-images/images/ you can reference. For more information about available sample images, see AutoSD sample images. To view an example customized manifest, see Sample Automotive Image Builder manifest. For more details about how to build and customize images, see Building an image from a custom manifest and Embedding RPM packages from local storage into the AutoSD image.

  13. Build the OS image using your custom my-manifest.aib.yml. In this example, build a qcow2 format for the qemu target so that you can launch your image in a VM:

    Important

    This documentation is in the process of being adjusted for the changes implemented in Automotive Image Builder 1.1.4. In the meantime, to keep the sample commands in this documentation valid, you must use the deprecated CLI, as shown in this example.

    # aib-dev build-deprecated \
        --target qemu \
        --export qcow2 \
        my-manifest.aib.yml \
        my-image.qcow2
    

    Note

    For more information about the export file types automotive-image-builder supports, see Export formats in the Automotive Image Builder tool section.

    For more information about image naming conventions, see AutoSD sample images.

  14. Exit the VM and export the image file to the host:

    $ scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -P 2222 root@localhost:/root/my-image.qcow2 .
    
  15. From the host, launch a VM using your new image:

    $ sudo automotive-image-runner my-image.qcow2
    
  16. Log in to the VM as the root user with the default password password.

Additional resources


© Red Hat