Getting started on Linux
Set up your development environment with the prerequisite tools and repositories you need to quickly start building AutoSD images.
Prerequisites
- A physical or virtual Linux host machine
- The
automotive-image-buildertool. For more information, see Installing theautomotive-image-buildertool - git
Quick start: 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.
Procedure
-
Copy or modify one of the sample manifests from the sample-images/images directory.
$ git clone https://gitlab.com/CentOS/automotive/sample-images.git -
Build an image with
automotive-image-builder:$ sudo automotive-image-builder build \
--target qemu \
--export qcow2 \
sample-images/images/simple-developer.aib.yml \
my-image.qcow2In this example, include the
simple-developer.aib.ymlautomotive image builder manifest file to build a developer image. The developer image has a number of utilities installed for development purposes. For more information about the Automotive image builder manifests, see Introducing Automotive image builder. For more information about creating a custom manifest, see Deploying software on AutoSD.The
buildcommand takes a number of inputs:- Use
--targetto set the target environment. The default isqemu. Useqemuto build an image that you can launch in a QEMU virtual machine. Runlist-targetsto view the list of available options. - Use
--distroto define the package repository that you want to use for the image build. The default is CentOS Stream 9 (cs9). Runlist-distto view the list of available options. You can also extend this list with your own custom distribution. For more information, see distributions. - Use
--exportto set the export file format. Runlist-exportsto view the list of available options. - Use
--modeto set the type of OS image. This can bepackage, to build a package-based operating system image, orimageto build an OSTree image. The default isimage.
- Use
Quick start: Booting prebuilt AutoSD images in a QEMU VM
A virtualized AutoSD development environment is useful for building and testing applications intended to run on an AutoSD system, or to build new AutoSD images that you can flash onto automotive hardware or use on other systems.
To obtain an AutoSD image that you can boot in a VM, you can either build your own following Quick-start: building AutoSD images, or download one of the nightly developer images, and then launch a VM from the image. You can then use this VM as your development environment, where you can customize and build your own AutoSD images.
Prerequisites
- A physical or virtual Linux host machine
- The
automotive-image-buildertool. For more information, see Installing Automotive imag builde - QEMU
- A developer AutoSD image. Either your own image that you built from the
simple-developer.aib.ymlmanifest, or the developer nightly image.
Procedure
-
Launch a VM from the image with the
automotive-image-runnertool. This tool comes packaged withautomotive-image-builder.$ sudo automotive-image-runner ````<path>````/````<to>````/````<image>````/image.qcow2 -
Log in as the
rootuser with the default password,password.!!! NOTE To enable ssh access, you must set
PasswordAuthentication yesin/etc/ssh/sshd_config. Then you can access the machine withssh -p 2222 -o "UserKnownHostsFile=/dev/null" guest@localhost.
Quick start: Building customized AutoSD images in a QEMU VM
Repeat the procedure in
Quick start: Booting prebuilt AutoSD images in a QEMU VM,
to download and run the latest nightly developer image. Then, expand the disk size, so you can use the
automotive-image-builder tool to create customized system images using your custom .aib.yml manifest file.
For more information about the preconfigured manifest files the Automotive SIG provides as starter examples you can modify, see the Automotive Image Builder example manifests.
For more in-depth information about how to package your applications and embed them in a customized manifest you can then use to generate your customized OS image, see Packaging applications with RPM and Embedding RPM packages in the AutoSD image sections.
Prerequisites
- A physical or virtual Linux host machine
- The
automotive-image-buildertool. For more information, see Installing Automotive image builder - QEMU
- A developer AutoSD image. Either your own image that you built from the
simple-developer.aib.ymlmanifest, or the developer nightly image.
Procedure
-
Extend the virtual disk of your
.qcow2developer image, so that you have enough space to build your custom AutoSD images and facilitate your development work.-
On the host, resize your developer image. In this example, set the disk size to
30G, which is 30GiB:$ qemu-img resize ````<image>````.qcow2 30G
-
-
Launch your virtual AutoSD developer environment:
$ sudo automotive-image-runner ````<path>````/````<image>````.qcow2 -
Log in with the
guestuser and the default password,password.!!! NOTE To enable ssh access, you must set
PasswordAuthentication yesin/etc/ssh/sshd_config. Then you can access the machine withssh -p 2222 -o "UserKnownHostsFile=/dev/null" guest@localhost. -
Change to the
rootuser. Therootuser password is alsopassword:$ su - -
Install the
partedande2fsprogsfile system management tools to extend the file system:# dnf -y install parted e2fsprogs-
Run
partedto extend the size of/dev/vda:# parted /dev/vda -
Resize the
/dev/vda3partition to fill the space available to that partition:(parted) resizepart 3 100% -
Exit the
partedtool:(parted) quit -
Enlarge the file system:
# resize2fs /dev/vda3
-
-
Install
automotive-image-builderin your development VM.-
Enable the
automotive-image-builderrepository:# dnf copr enable @centos-automotive-sig/automotive-image-builder -
Install the
automotive-image-buildertool:# dnf install automotive-image-builder
-
-
In your development VM, create a custom Automotive image builder manifest file that you can configure 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 Sample OS images. To view an example customized manifest, see Sample automotive image builder manifest. For more details about how to build and customize images, see Deploying software on AutoSD and Embedding RPM packages in the AutoSD image. -
Build the OS image from your custom
my-manifest.aib.yml. In this example, build aqcow2format for theqemutarget so that you can launch your image in a VM:# automotive-image-builder build --target qemu --export qcow2 my-manifest.aib.yml my-image.qcow2!!! NOTE For more information about the export file types
automotive-image-buildersupports, see Export formats in theautomotive-image-builderoptions section.For more information about image naming conventions, see AutoSD sample images.
-
Exit the VM and export the image file to the host:
$ scp -P 2222 -o "UserKnownHostsFile=/dev/null" guest@localhost:/home/guest/my-image.qcow2 . -
On the host, launch a VM from your new image:
$ sudo automotive-image-runner my-image.qcow2
For more information about how to build your own customized AutoSD images, see Building and running your customized OS image.