46

I wanted to build a custom ROM for Android TV.

I have followed the steps given on the Android Source Code - AOSP website and downloaded the source using the commands below:

repo init -u https://android.googlesource.com/platform/manifest -b master
repo sync -j16 -c

source build/envsetup.sh
lunch aosp_x86-eng

To build the system image, I am using the following command:

make -j16

It is using the latest Q release to build:

PLATFORM_VERSION_CODENAME=Q
PLATFORM_VERSION=Q
TARGET_PRODUCT=aosp_x86
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=LiveTv
TARGET_ARCH=x86
TARGET_ARCH_VARIANT=x86
HOST_ARCH=x86_64
HOST_2ND_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-4.4.0-130-generic-x86_64-Ubuntu-16.04.4-LTS
HOST_CROSS_OS=windows
HOST_CROSS_ARCH=x86
HOST_CROSS_2ND_ARCH=x86_64
HOST_BUILD_TYPE=release
BUILD_ID=OC-MR1
OUT_DIR=out

The build is always successful. system.img and ramdisk.img are also generated.

I wanted to test the system image on an emulator. I used the command below:

./emulator -avd tvrom -sysdir out/target/product/generic_x86/ -system out/target/product/generic_x86/system.img -ramdisk out/target/product/generic_x86/ramdisk.img -data out/target/product/generic_x86/userdata.img -kernel prebuilts/qemu-kernel/x86/kernel-qemu

The avd name is tvrom and the other parameters are paths to the system images I have built.

But, after doing this, system.img is not booting in the emulator and it remains a black screen there.

Also, there is an error printing in the terminal:

Segmentation fault (core dumped)

I searched for it but didn't find any solution. Can anyone please help?

EDIT

If someone provides a list of steps to flash and boot the latest AOSP_X86 or AOSP_X86_64 customized ROM on Android Emulator, then it will be useful.

12
  • Are you using repo sync to download sources? If you are, you need to mention the version as a parameter. Jul 16, 2018 at 9:59
  • @SusmitAgrawal yes I am using repo sync -j8 -c Jul 16, 2018 at 13:35
  • Sorry, I mean repo init. You need to specify the android version here. Check this link for more info: source.android.com/setup/build/downloading Jul 16, 2018 at 13:54
  • @SusmitAgrawal Please see updated question. I have also put bounty on the question. Jul 19, 2018 at 9:34
  • Does the emulator run with other images? Like ones that are provided in Android Studio? Jul 19, 2018 at 11:13

2 Answers 2

0
  1. master branch is not a stable branch. Always sync an officially tagged branch.

  2. The correct lunch target for an emulator is sdk_phone_x86 for 32 bit or sdk_phone_x86_64 for 64 bit.

-2

Verify Build Configuration: Double-check your build configuration, especially the lunch command. Make sure you have selected the correct target for Android TV x86. You can use lunch to select the correct target:

lunch aosp_x86-eng

Use Prebuilt Kernel: Instead of using the kernel from the prebuilts directory, you can try using the kernel provided by the emulator itself. Use the -kernel-qemu option without specifying the path:

./emulator -avd tvrom -sysdir out/target/product/generic_x86/ -system out/target/product/generic_x86/system.img -ramdisk out/target/product/generic_x86/ramdisk.img -data out/target/product/generic_x86/userdata.img -kernel prebuilts/qemu-kernel/x86/kernel-qemu

Use Android TV AVD: Create an AVD specifically for Android TV. You can do this using the AVD Manager:

avdmanager create avd -n tvrom -k "system-images;android-29;google_apis_playstore;x86"

Then, start the emulator using the AVD name:

emulator -avd tvrom

Rebuild and Retry: If none of the above steps resolves the issue, you might want to clean the build and try rebuilding the ROM. Sometimes, issues can be caused by incomplete or corrupted builds.

make clean make -j16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.