Skip to content

Documentation explaining how the Android BSP works, its components, how device drivers are implemented, and how the build procedure takes place.

Notifications You must be signed in to change notification settings

Technical-Writer-SSR/Android-BSP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 

Repository files navigation

Android Board Support Package (BSP)

Android Security Memory Management ION Memory DMA Buffer Interrupt Handling GPIO Control I2C Bus SPI Interface UART Debug
Clock Management Reset Controller PMIC Drivers Regulator Framework Android Boot Image DTB DTO Kernel Configuration Defconfig Management Android Build System Makefile Android.mk
Blueprint Soong AOSP Integration Vendor Interface OEM Adaptation Board Configuration Platform Development Embedded Android System Services Native Daemons Init Scripts
RC Files Firmware Loading Proprietary Blobs Board Fingerprint OTA Updates Recovery Mode Fastboot Protocol Android Debug Bridge Logcat Analysis Kernel Panic
Ramdisk Initramfs Boot Animation Splash Screen Performance Tuning Benchmark Testing Power Optimization Battery Life Thermal Throttling CPU Frequency GPU Rendering
Video Decoding Hardware Encoding OpenGL ES Vulkan API DRM Framework Media Codecs OpenMAX IL Camera2 API Multi Display HDMI Output
Touchscreen Driver Input Subsystem Key Layout Vibration HAL LED Control RTC Drivers Watchdog Timer PWM Controllers ADC Drivers DAC Interface
MIPI DSI MIPI CSI DisplayPort eMMC Storage UFS Support SD Card File System F2FS Support EXT4 FileSystem Android Verified Boot
dm-verity Security fscrypt Encryption Keymaster HAL Gatekeeper Auth Weaver HAL OEM Lock Flashing Tools Partition Layout GPT Partition Boot Partition
System Partition Vendor Partition ODM Partition Product Partition System-as-root A/B A/B Seamless Updates Virtual A/B Super Partition Dynamic Partitions LPM Support
Android Things Automotive Android Android TV Wear OS Android IoT Embedded Linux Yocto Project Buildroot Embedded Open Source License Mixed

Overview

This Android Board Support Package (BSP) provides the necessary software components to support Android OS on the target hardware platform. It includes kernel modifications, device drivers, hardware abstraction layers (HAL), and platform-specific configurations.

Repository Structure

bsp/ ├── kernel/ # Modified Linux kernel source ├── device/ # Device-specific configurations ├── vendor/ # Vendor-specific implementations ├── hardware/ # Hardware abstraction layers ├── bootloader/ # Bootloader sources ├── tools/ # Build and flash utilities └── docs/ # Documentation 

Prerequisites

Development Environment

  • Ubuntu 20.04 LTS or later (recommended)
  • 16GB RAM minimum (32GB recommended)
  • 200GB free disk space
  • Java Development Kit (JDK) 8 or 11

Required Packages

sudo apt-get update sudo apt-get install -y git-core gnupg flex bison build-essential \ zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \ lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev \ libgl1-mesa-dev libxml2-utils xsltproc unzip fontconfig

Build Instructions

1. Initialize the Build Environment

source build/envsetup.sh lunch [target_product]-[build_variant] # Example: lunch mydevice-userdebug

2. Build the BSP Components

# Build the kernel cd kernel make ARCH=arm64 [defconfig_name] make -j$(nproc) # Build the full Android image cd [android_root] make -j$(nproc)

3. Generate Output Images

After successful build, images will be available in:

out/target/product/[device_name]/ ├── boot.img ├── system.img ├── vendor.img ├── dtbo.img └── recovery.img 

Flashing Instructions

Enter Flash Mode

  1. Power off the device
  2. Boot into bootloader mode:
    • Hardware method: [Specific button combination]
    • ADB method: adb reboot bootloader

Flash Images

fastboot flash boot boot.img fastboot flash system system.img fastboot flash vendor vendor.img fastboot flash dtbo dtbo.img fastboot reboot

Device Tree Configuration

Device Tree Source (DTS)

Location: kernel/arch/arm64/boot/dts/vendor/

Key files:

  • [soc].dtsi - SoC common definitions
  • [board].dts - Board-specific configuration
  • [board]-[variant].dts - Device variant configurations

Modifying Device Tree

# Compile DTS to DTB dtc -O dtb -o output.dtb input.dts # Decompile DTB to DTS dtc -I dtb -O dts -o output.dts input.dtb

Hardware Abstraction Layers (HAL)

Available HAL Modules

  • android.hardware.graphics.composer@2.4 - Display HAL
  • android.hardware.audio@7.0 - Audio HAL
  • android.hardware.camera.provider@2.4 - Camera HAL
  • android.hardware.sensors@2.0 - Sensors HAL
  • android.hardware.bluetooth@1.0 - Bluetooth HAL

Adding New HAL Implementation

  1. Create HAL service in hardware/interfaces/
  2. Implement the HIDL/AIDL interface
  3. Update device makefile to include the module

Kernel Modifications

Custom Drivers

Location: kernel/drivers/misc/[vendor]/

To add a new driver:

  1. Create driver source in appropriate subsystem
  2. Update Kconfig and Makefile
  3. Add device tree bindings
  4. Register driver in platform initialization

Kernel Configuration

# Configure kernel make menuconfig # Save configuration cp .config arch/arm64/configs/[defconfig_name]

Debugging

Kernel Logs

adb shell dmesg cat /proc/kmsg

Android Logs

adb logcat adb logcat -b all

Serial Debug Console

  • UART Port: [UART configuration]
  • Baud Rate: 115200
  • Pinout: [TX/RX/GND pins]

Testing

Unit Tests

# Run VTS (Vendor Test Suite) vts-tradefed run commandAndExit vts # Run CTS (Compatibility Test Suite) cts-tradefed run commandAndExit cts

Hardware Validation

# Test specific components adb shell am instrument -w [test_package]

Power Management

Sleep States

  • Suspend-to-RAM: Supported
  • Suspend-to-IDLE: Supported
  • Runtime PM: Enabled for peripherals

Power Configuration

Edit: device/[vendor]/[device]/power/

Thermal Management

  • Thermal zones defined in device tree
  • Cooling devices: [List cooling mechanisms]
  • Trip points configured for CPU/GPU

Performance Tuning

CPU Governor Settings

Default governor: schedutil

GPU Settings

  • GPU frequency scaling enabled
  • Default frequency: [Frequency in MHz]

Memory Configuration

  • ION heap sizes configured in device tree
  • CMA pool size: [Size] MB

Security Features

Verified Boot

  • AVB 2.0 enabled
  • Rollback protection implemented
  • Chain of trust from bootloader to system

SELinux Policies

Location: device/[vendor]/[device]/sepolicy/

Power Measurement Points

  • VDD_CPU: [Measurement point]
  • VDD_GPU: [Measurement point]
  • VDD_MEM: [Measurement point]

Factory Tools

Provisioning

# Enter factory mode adb shell am start com.android.factory/.FactoryActivity

Calibration Utilities

Location: vendor/[vendor]/factory/

Known Issues

  1. [Issue description and workaround]
  2. [Issue description and workaround]

Support

Documentation

  • Hardware Reference Manual: [Link/Reference]
  • Schematics: [Location/Restrictions]
  • Datasheets: [Location/Restrictions]

Contact

  • BSP Support: [Email/Contact]
  • Hardware Support: [Email/Contact]
  • Bug Reports: [Issue Tracker Link]

License

[License Information, e.g., GPL v2 for kernel, Apache 2.0 for Android modifications]

Changelog

See CHANGELOG.md for version history and changes.


Note: This BSP is specific to the hardware platform mentioned above. Porting to other hardware requires significant modifications.

About

Documentation explaining how the Android BSP works, its components, how device drivers are implemented, and how the build procedure takes place.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published