Getting started on Linux
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
- A physical or virtual Linux host machine
- The
automotive-image-buildertool - Git
Procedure
-
Copy or modify one of the sample manifests from the sample-images/images directory:
console $ git clone https://gitlab.com/CentOS/automotive/sample-images.git -
Build a disk image with
automotive-image-builder:console $ aib-dev build \ --target qemu \ sample-images/images/simple-developer.aib.yml \ my-image.qcow2The
simple-developer.aib.ymlmanifest contains several RPM packages for development purposes. Thebuildcommand 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 air (automotive-image-runner) tool, included with the automotive-image-builder, to start a VM.
Prerequisites
- A physical or virtual Linux host machine
- The
automotive-image-buildertool - QEMU
- A developer AutoSD image, such as the one you created in Building AutoSD images or a nightly developer image
Procedure
-
Start a VM using
air:console $ air --nographics <path>/image.qcow2 -
Log in as the
rootuser with the default passwordpassword.Note
Setting the
PasswordAuthenticationoption toyesinsshd_configin theauth:section of your Automotive Image Builder manifest enablessshaccess. Withsshenabled, you can access the VM by runningssh -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
- A physical or virtual Linux host machine
- The
automotive-image-buildertool - QEMU
- A developer AutoSD image, such as the one you created in Building AutoSD images or a nightly developer image
Procedure
-
Resize the virtual disk of your
.qcow2image so you have enough space to build and develop custom AutoSD images:console $ sudo qemu-img resize <image>.qcow2 30G -
Start a VM:
console $ air --nographics <path>/<image>.qcow2 -
Log in with the
guestuser and the default passwordpassword.Note
Setting the
PasswordAuthenticationoption toyesinsshd_configin theauth:section of your Automotive Image Builder manifest enablessshaccess. Withsshenabled, you can access the VM by runningssh -p 2222 -o "UserKnownHostsFile=/dev/null" guest@localhost. -
Change to the
rootuser. Therootuser password is alsopassword:console $ su - -
Install the tools needed to resize the disk image:
```console
dnf -y install parted e2fsprogs¶
```
-
Run
partedto extend the size of/dev/vda:```console
parted /dev/vda¶
```
-
Resize the
/dev/vda3partition to fill the space available to that partition:console (parted) resizepart 3 100% -
Exit the
partedtool:console (parted) quit -
Enlarge the file system:
```console
resize2fs /dev/vda3¶
```
-
Install
copr:```console
dnf install 'dnf-command(copr)'¶
```
-
Install
automotive-image-builderin the VM.-
Enable the
automotive-image-builderandosbuild-autocopr repository:```console
dnf copr enable @centos-automotive-sig/automotive-image-builder¶
dnf copr enable @centos-automotive-sig/osbuild-auto¶
```
-
Install the
automotive-image-builderandosbuild-autopackages:```console
dnf install automotive-image-builder osbuild-auto¶
```
-
-
From the VM, create a custom Automotive Image Builder manifest file and configure it according to your requirements:
console # vim my-manifest.aib.ymlNote
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. -
Build a disk image from your custom
my-manifest.aib.yml:console $ aib-dev build \ --target qemu \ my-manifest.aib.yml \ my-image.qcow2Note
For more information about the build options that
automotive-image-buildersupports, see Automotive Image Builder tool.For more information about image naming conventions, see AutoSD sample images.
-
Exit the VM and export the image file to the host:
console $ scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -P 2222 root@localhost:/root/my-image.qcow2 . -
From the host, launch a VM using your new image:
console $ air --nographics my-image.qcow2 -
Log in to the VM as the
rootuser with the default passwordpassword.
Additional resources