If your embedded product is a touchscreen device such as a Kiosk/Smart TV/infotainment System that relies upon a custom Linux OS then you may have faced challenges in hardware driver support and maintenance of regular software/security updates. Maintaining a custom-built Embedded Linux is a costly task and requires expertise in building the OS and reliably providing OTA updates.
Over the years Embedded Android has evolved into a much better Alternative. Here in this post, I want to share the basic steps to start building an AOSP project from scratch. This will later help if someone wants to build/port a custom Embedded Android stack for a particular hardware
Here I will be sharing how I downloaded Android AOSP sources and built an AOSP image for a Nexus 7 [2012] device. You can follow this approach to build AOSP images for your devices, for example, Nexus 5. So Let’s Start.
Device Information
The Tablet device used here is the Nexus 7 (2012)
Product Name : grouper
Variant: grouper
HW version: ER3
Bootloader Version: 4.23
Environment Setup
>install some required packages
> install adb tool
> Fix Udev permission error
ayx@ayx-HP:~$ lsusb
check the vendor id left of the colon, e.g nexus 5
Open this file
ayx@ayx-HP:~$ sudo gedit /etc/udev/rules.d/51-android.rules
Put the following at the bottom of the file and save
> install Java 7
select java 7 for the followings
> Check versions of the following
In my cases, these were the versions
> install repo tool
Download AOSP sources & Build Image
> Download The Source
> Configure Git account
Replace “ ” marked text with yours
> checkout Lollipop
Wait for the sources to be downloaded
> Find your Device variant
Now in the FASTBOOT bootloader Mode, you will see the VARIANT and other device-related info printed, take note of those. THIS IS THE MOST IMPORTANT THING TO NOTICE
> Download The Device binaries
then go to https://developers.google.com/android/drivers And download the latest binaries for your variant, e.g. for GROUPER variant considering the OS version you want to build. Take note of the branch
extract the binaries to the root of the source tree. For our case into the “aosp_work” folder. Then extract them
> extract the binaries [press ENTER then Space then type I ACCEPT to accept license]
> setup cache for faster build
> clean up
>Apply Patches
There will be a build error related to “uniqueptr” , and you have to rebuild again, so it is better to first apply the patch, follow this Stackoverflow post to patch this issue
ref: https://stackoverflow.com/questions/36048358/building-android-from-sources-unsupported-reloc-43
ref: https://groups.google.com/forum/#!topic/android-building/b66T0PzDIiM
> build
Choose “userdebug” option
This build will use a prebuilt kernel from the vendor.
If everything is okay then the build will be successful
Thank you for sharing your experience in building an AOSP image in your blog post. As a provider of Embedded Software Development Services, I found your insights to be informative and helpful.
ReplyDeleteIt's great to see that you included details on the various steps involved in building an AOSP image, from downloading the source code to configuring the build environment. This is a valuable resource for anyone new to embedded software development.
I also appreciated your tips on troubleshooting and resolving issues that may arise during the build process. As you mentioned, debugging can be a time-consuming and challenging task, but having a systematic approach and keeping a log of errors can help to streamline the process.
Overall, your post provides a great overview of the AOSP image-building process, and I believe it will be useful for anyone interested in embedded software development. Thank you for sharing your knowledge and insights with the community!