Android Automotive OS 13 – Construct And Run On Raspberry Pi 4B – Grape Up


Constructing an Android Automotive OS may not be a tough activity by itself, however the lack of excellent tutorials makes it exceptionally onerous. It solely will get tougher when you don’t have at hand any specialised {hardware} like R-Automobile or Dragonboard. Nevertheless, you’ll be able to simply get a Raspberry Pi – a small ARM-powered, multi-usage pc and an ideal candidate to run AAOS. To make the method simpler for everybody fighting this type of activity, on this article, I’ll clarify step-by-step methods to construct and run the newest model: Android Automotive OS 13. 

Let’s get began! 

Stipulations 

To construct the system, you’ll need a Linux. You should use WSL or MacOS (bear in mind, you want a case-sensitive file system), however pure Linux is the best choice. 

{Hardware} 

As within the earlier article, you want a Raspberry Pi 4B microcomputer, an influence adapter (or you’ll be able to energy it out of your PC with a USB cable), a reminiscence card, and a show. It’s good to have a touchscreen, however you should utilize your mouse and, optionally, a keyboard if extra handy. 

One other nice-to-have component is a USB-TTL bridge for debugging. Discover my earlier article for extra particulars on methods to use it. 

TL;DR; 

Should you’re in search of the easy means, go to https://github.com/grapeup/aaos_local_manifest and comply with the readme. There are only a few instructions to obtain, construct and create a writeable IMG file to your Raspberry. However you want just a few hours to obtain and construct it anyway. Warning! It could not begin when you received’t regulate the show settings (see beneath for particulars). 

Adjusting AOSP to make it AAOS 

This mission is predicated on Raspberry Vanilla by KonstaT – an amazing AOSP port for Raspberry Pi. It covers all the pieces it is advisable run a pure Android in your Raspberry – an adjusted kernel, {hardware} drivers, and so forth. Nevertheless, there isn’t a automotive construct, so it is advisable assemble it. 

There are 4 repositories in github.com/grapeup relating to AAOS – three forks based mostly on Raspberry Vanilla and one new one. 

The repository aaos_local_manifest comprises an inventory of modified and new repositories. All vital adjustments are positioned in machine/brcm/rpi4 and machine/brcm/rpi4-car tasks outlined within the manifest_brcm_rpi4.xml file. Within the readme of this repository, you’ll discover steps to clone and construct the mission.

The subsequent repository, aaos_device_brcm_rpi4, comprises three parts: 

The primary and most vital is to make the most of the brand new rpi4-car mission and take away conflicting objects from the bottom mission.  

Within the aosp_rpi4.mk file, there’s a new line  

$(name inherit-product, machine/brcm/rpi4-car/rpi4_car.mk) 

to incorporate a brand new mission. 

Within the machine.mk file, the product attribute is modified to automotive,nosdcard, and all customized overlays are eliminated, together with the overlay listing subsequent to the file. 

Within the manifest.xml file, the android.{hardware}.automotive.automobile HAL ({Hardware} Abstraction Layer) is added. 

The second component is to configure the construct for the show I exploit. I needed to set the display screen decision in vendor.prop and set the display screen density in BoardConfig.mk. You most likely don’t want such adjustments when you use a typical PC monitor, otherwise you want another one to your customized show. Bear in mind that the system received’t begin in any respect if the decision configured right here just isn’t supported by your show. 

The final component comprises my regional/language settings in aosp_rpi4.mk. I’ve determined to make use of this file, because it’s not automotive-related, and to go away it within the code to indicate methods to regulate it if wanted. 

The primary half 

Probably the most main adjustments are positioned within the aaos_device_brcm_rpi4_car repository. 

The rpi4_car.mk file is predicated on machine/generic/automotive/widespread/automotive.mk with few adjustments. 

Conditional, particular settings for the Generic System Pictures are eliminated together with the emulator configuration (machine/generic/automotive/widespread/config.ini) and the emulator audio package deal (android.{hardware}.audio.service-caremu)

As a substitute, you want a mix of vendor-specific and board-specific parts, not included within the widespread/automotive makefile designed for an emulator. 

Android Automotive OS is strictly coupled with an audio engine, so it is advisable add an automotive audio management package deal (android.{hardware}.automotive.audiocontrol@2.0-service) to make it work, even when you don’t wish to join any audio system to your board. Additionally, AAOS makes use of a particular show controller with the flexibility to make use of two shows on the similar time (android.frameworks.automotive.show@1.0-service), so it is advisable embrace it too. The subsequent half is SELinux coverage for actual boards (not an emulator). 

BOARD_SEPOLICY_DIRS += machine/generic/automotive/widespread/sepolicy 

Then it is advisable add permissions to a couple pre-installed, automotive-oriented packages, to permit them to run within the system or consumer areas. 

PRODUCT_COPY_FILES += machine/google/cuttlefish/shared/auto/preinstalled-packages-product-car-cuttlefish.xml:$(TARGET_COPY_OUT_PRODUCT)/and so forth/sysconfig/preinstalled-packages-product-car-cuttlefish.xml

The subsequent element is EVS  – Exterior View System launched to AAOS 13. Even when you don’t actually wish to join a number of cameras to the system to date, you must embrace the default implementation of the element and configure it to work as a mock. 

DEVICE_PACKAGE_OVERLAYS += machine/google/cuttlefish/shared/auto/overlay
ENABLE_EVS_SERVICE ?= true
ENABLE_MOCK_EVSHAL ?= true
ENABLE_CAREVSSERVICE_SAMPLE ?= true
ENABLE_SAMPLE_EVS_APP ?= true
ENABLE_CARTELEMETRY_SERVICE ?= true
CUSTOMIZE_EVS_SERVICE_PARAMETER := true
PRODUCT_PACKAGES += android.{hardware}.automotive.evs@1.1-service
PRODUCT_COPY_FILES += machine/google/cuttlefish/shared/auto/evs/init.evs.rc:$(TARGET_COPY_OUT_VENDOR)/and so forth/init/init.evs.rc
BOARD_SEPOLICY_DIRS += machine/google/cuttlefish/shared/auto/sepolicy/evs

The final half is to regulate variables for a system when working. You set two system properties immediately within the makefile (to permit a compelled orientation and to allow the AVRCP Bluetooth profile).

PRODUCT_SYSTEM_DEFAULT_PROPERTIES +=
    config.override_forced_orient=true
    persist.bluetooth.enablenewavrcp=false

Ultimately, you override the next system variables, utilizing predefined and customized overlays.

PRODUCT_PACKAGE_OVERLAYS +=
   
machine/brcm/rpi4-car/overlay
   
machine/generic/automotive/widespread/overlay

Typically talking, PRODUCT_PACKAGE_OVERLAYS permits us to overwrite any worth from a property file positioned within the supply code. For instance, in our case the overlay root listing is machine/brcm/rpi4-car/overlay, so the file machine/brcm/rpi4-car/overlay/frameworks/base/core/res/res/values/config.xml overwrites properties from the file frameworks/base/core/res/res/values/config.xml.

Let’s dive into properties modified.

  • frameworks/base/core/res/res/values/config.xml file:
  • config_useVolumeKeySounds disables utilization of {hardware} quantity keys, as they aren’t current in our setup,
  • config_voice_capable allows data-only mode, as there isn’t a chance to make a voice name from our board,
  • config_sms_capable disables SMS capabilities for a similar purpose,
  • networkAttributes and radioAttributes units the system to make use of WiFi, Bluetooth and ethernet connections solely, as there isn’t a GSM modem onboard,
  • config_longPressOnPowerBehavior disables long-press on an influence button, as there isn’t a energy button related,
  • config_disableUsbPermissionDialogs disables USB permission display screen, because it shouldn’t be used within the AAOS,
  • config_defaultUiModeType allows the automotive launcher by default,
  • config_defaultNightMode allows night time mode because the default one.
  • frameworks/base/packages/SettingsProvider/res/values/defaults.xml file:
  • def_wifi_on allows WiFi by default,
  • def_accelerometer_rotation units the default orientation,
  • def_auto_time allows acquiring time from the Web when related,
  • def_screen_brightness units the default display screen brightness,
  • def_bluetooth_on allows Bluetooth by default,
  • def_location_mode permits purposes to make use of location providers by default,
  • def_lockscreen_disabled disables the lockscreen,
  • def_stay_on_while_plugged_in units the machine to remain enabled on a regular basis.
  • packages/apps/Automobile/LatinIME/res/format/input_keyboard.xml file units the default foreground coloration of the default keyboard, because the default one just isn’t very readable. Set keyTextColorPrimary and textColor parameters to regulate it.
  • packages/apps/Automobile/LatinIME/res/values/colours.xml units colours or image characters on the default keyboard and the letter/symbols swap on the underside proper nook.
  • packages/apps/Automobile/SystemUI/res/values/colours.xml units the background coloration of the standing bar fast settings to make the default font coloration readable.
  • packages/apps/Automobile/SystemUI/res/values/config.xml hides brightness settings from the highest bar, because it doesn’t work with no particular drivers for the show.
  • packages/apps/Settings/res/values/config.xml file:
  • config_show_call_volume disables quantity management throughout calls,
  • config_show_charging_sounds disables charging sounds,
  • config_show_top_level_battery disables battery stage icon.
  • packages/modules/Wifi/service/ServiceWifiResources/res/values/config.xml allows 5Ghz assist for the WiFi.
  • packages/providers/Automobile/service/res/values/config.xml disables working a devoted software when the system begins up or a driver is modified.

You’ll be able to learn extra about every of these settings within the feedback within the unique information which these settings got here from.

The final repository is aaos_android_hardware_interfaces . You don’t want it, however there may be one helpful property hardcoded right here. In Android, there’s a idea known as HAL – {Hardware} Abstraction Layer. For AAOS, there may be VHAL – Automobile {Hardware} Abstraction Layer. It’s accountable, amongst others, for HVAC – Heating, Air flow, and Air Conditioning. In our setup, there isn’t a automobile {hardware} and no bodily HVAC, so you utilize android.{hardware}.automotive.automobile@V1-emulator-service whose default implementation is positioned below {hardware}/interfaces/automotive/automobile. To vary the default models utilized by HVAC from imperial to rest-of-the-world, it is advisable regulate the {hardware}/interfaces/automotive/automobile/aidl/impl/default_config/embrace/DefaultConfig.h file.

Constructing

The constructing course of for AAOS 13 for Raspberry Pi is way simpler than the one for AAOS 11. The kernel is already precompiled and there may be a lot much less to do.

Simply name these three instructions:

. construct/envsetup.sh
lunch aosp_rpi4-userdebug
make bootimage systemimage vendorimage

On a Home windows laptop computer (utilizing WSL, after all) with the i7-12850HX processor and 32GB RAM, it takes round 1 hour and 40 minutes to perform the construct.

Making a bootable SD card

There are two choices – with or with out the mkimg.sh script. The script is positioned below machine/brcm/rpi4 listing and linked in the primary listing of the mission as rpi4-mkimg.sh. The script creates a digital picture and places 4 partitions inside – boot, system, vendor, and userdata. It’s helpful as a result of you should utilize Raspberry Pi Imager to put in writing it into an SD card nevertheless, it has just a few limitations. The picture at all times has 7GB (you’ll be able to change it by adjusting the IMGSIZE variable within the script), so that you received’t use the remainder of your card, regardless of how large it’s. Apart from that, you at all times want to put in writing 7GB to your card – even when you must replace solely a single partition, and together with writing zeros to an empty userdata partition.

The choice means is to put in writing it on the cardboard by hand. It’s tough below Home windows as WSL doesn’t comprise card reader drivers, but it surely’s handy in different working methods. All required information are constructed within the out/goal/product/rpi4 listing. Let’s put together and write the cardboard. Warning! In my system, the SD card is seen as /dev/sdb. Please regulate the instructions beneath to not destroy your knowledge.

OK, let’s clear the cardboard. You might want to wipe every partition earlier than wiping the complete machine to take away file methods signatures.

sudo umount /dev/sdb*
sudo wipefs -a /dev/sdb*
sudo wipefs -a /dev/sdb

Now let’s put together the cardboard. This line will use fdisk to create 4 partitions and set flags and filesystems.

echo -e "nnnnn+128Mnantn0cnnnnnn+2Gnnnnnn+256Mnnnpnnnwn" | sudo fdisk /dev/sdb

The final step is to put in writing knowledge and put together the final partition.

sudo dd if=boot.img of=/dev/sdb1 bs=1M
sudo dd if=system.img of=/dev/sdb2 bs=1M
sudo dd if=vendor.img of=/dev/sdb3 bs=1M
sudo mkfs.ext4 -L userdata /dev/sdb4
sudo umount /dev/sdb*

Abstract

Android Automotive OS is a big leap for the automotive trade. As there isn’t a manufacturing automobile with AAOS 13 to date, you’ll be able to expertise the longer term with this handbook. What’s extra, you are able to do it with a low-budget Raspberry Pi pc. This manner, I hope you’ll be able to develop your purposes and play with the system simply with out a further layer of utilizing emulators. Good luck and completely satisfied coding!



Source_link

Leave a Reply

0
    0
    Your Cart
    Your cart is emptyReturn to Shop