Android

Gjøre klart OSet

https://source.android.com/setup/build/initializing#setting-up-a-linux-build-environment
Biblotekene som kreves:
git-core
gnupg
flex
bison
build-essential
zip
curl
zlib1g-dev
gcc-multilib
g++-multilib
libc6-dev-i386
libncurses5
lib32ncurses5-dev
x11proto-core-dev
libx11-dev lib32z1-dev
libgl1-mesa-dev
libxml2-utils
xsltproc unzip
fontconfig

Oppsett av repo og sync av kode

Se mer info på disse linkene:
https://source.android.com/setup/develop
https://source.android.com/setup/build/downloading

På openSUSE, husk å sett keyserver i gpg konfigurasjonsfilen:

echo 'keyserver keys.openpgp.org' >> ~/.gnupg/gpg.conf

Last ned/installer repo:

export REPO=$(mktemp /tmp/repo.XXXXXXXXX)
curl -o ${REPO} https://storage.googleapis.com/git-repo-downloads/repo
gpg --recv-key 8BB9AD793E8E6153AF0F9A4416530D5E920F5C65
curl -s https://storage.googleapis.com/git-repo-downloads/repo.asc | gpg --verify - ${REPO} && install -m 755 ${REPO} ~/bin/repo

Sjekk versjon og annen info med repo version
Opprett en mappe som filene skal legges i, og sett opp git med ekte navn/mail (trenger kun å gjøres om man skal bruke git til å bidra med kode)

mkdir WORKING_DIRECTORY
cd WORKING_DIRECTORY

git config --global user.name Your Name
git config --global user.email [email protected]

For å oppdatere selve repo, kjør:

repo init -u https://android.googlesource.com/platform/manifest

Velg hvilken branch med -b. For eksempel master eller android-12.1.0_r10. Se her for liste.

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

Kjør så sync for å laste ned filene fra valgt branch

repo sync -c -j12

Last ned proprietary kode for spesifikke enheter her:
https://developers.google.com/android/drivers
For å bygge master AOSP, bruk previews:
https://developers.google.com/android/blobs-preview

wget https://dl.google.com/dl/android/aosp/google_devices-oriole-8747182-a3d2de82.tgz
tar zxvf google_devices-oriole-8747182-a3d2de82.tgz
rm google_devices-oriole-8747182-a3d2de82.tgz
chmod +x extract-google_devices-oriole.sh
./extract-google_devices-oriole.sh

Kjør m clean hvis ny vendor

Se m help for alle muligheter

Compile kode (m)

https://source.android.com/setup/build/building

Last inn nødvendige shell kommandoer med source og sett target med lunch lunch product_name-build_variant

source build/envsetup.sh
lunch aosp_arm-eng # eng=development,user=production
export WITH_GMS=true # inkluder google services (bare custom protonaosp)
m # compile, m tar også -j

Package: (factory image)

# Build target files package
m target-files-package
# Build packaging tools
m otatools-package
# Convert target files to images zip
python2 out/soong/host/linux-x86/bin/img_from_target_files \
    out/target/product/$DEVICE/obj/PACKAGING/target_files_intermediates/$DEVICE-target_files-eng.$USER.zip \
    out/target/product/$DEVICE/obj/PACKAGING/target_files_intermediates/$DEVICE-img-eng.$USER.zip
# Convert images zip to factory images
cd device/google/$DEVICE/factory-images
./generate-factory-images-package.sh