<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Open Devices Corner</title>
    <link>https://sx.ix5.org/info/</link>
    <description>Recent content on Open Devices Corner</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <lastBuildDate>Fri, 11 Jun 2021 10:46:00 +0200</lastBuildDate><atom:link href="https://sx.ix5.org/info/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Flashing AOSP on Xperia XZ</title>
      <link>https://sx.ix5.org/info/flashing-aosp-on-xperia-xz/</link>
      <pubDate>Fri, 19 Oct 2018 22:26:47 +0200</pubDate>
      
      <guid>https://sx.ix5.org/info/flashing-aosp-on-xperia-xz/</guid>
      <description>&lt;div class=&#34;message warning&#34;&gt;
The builds for the Xperia XZ will no longer be updated. This guide is severely
out of date (as of 2022). The builds should still work, but proceed with caution.
&lt;/div&gt;
&lt;p&gt;Follow these steps closely. Do not leave out a step and do them in the correct order.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;A big thanks to &lt;a href=&#34;https://forum.xda-developers.com/member.php?u=3928215&#34;&gt;StaticGTF&lt;/a&gt;
for writing large parts of this guide!&lt;/em&gt;&lt;/p&gt;
&lt;h2 id=&#34;tldr&#34;&gt;TL;DR&lt;/h2&gt;
&lt;p&gt;For people who know what they are doing:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Flash latest stock image, then unlock bootloader&lt;/li&gt;
&lt;li&gt;Download v9 binaries from &lt;a href=&#34;https://developer.sony.com/file/download/software-binaries-for-aosp-pie-android-9-0-kernel-4-9-tone/&#34;&gt;developer.sony.com&lt;/a&gt;,
Flash binaries image via fastboot to &lt;code&gt;oem&lt;/code&gt; partition&lt;/li&gt;
&lt;li&gt;Flash this &lt;a href=&#34;https://sx.ix5.org/files/builds/kagura/misc/twrp-3.2.1-0-kagura-ab-x.img&#34;&gt;tweaked TWRP recovery&lt;/a&gt;, credits to Artem Labazov(@ab123321)&lt;/li&gt;
&lt;li&gt;Flash latest build from &lt;a href=&#34;https://sx.ix5.org/files/builds/kagura/aosp-10/&#34;&gt;sx.ix5.org&lt;/a&gt; from inside TWRP&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;That&amp;rsquo;s it.&lt;/p&gt;
&lt;h2 id=&#34;detailed-steps&#34;&gt;Detailed Steps&lt;/h2&gt;
&lt;h3 id=&#34;1-computer-setup&#34;&gt;1. Computer Setup&lt;/h3&gt;
&lt;p&gt;In order to install this ROM, you will need a working computer environment to
install the latest FTFs, recoveries and the OEM binaries.&lt;/p&gt;
&lt;p&gt;There are numerous other guides out there on how to set up fastboot, but this
should be enough for most.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;On Windows:&lt;/strong&gt; Download and install the following components to your computer:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Minimal ADB and Fastboot from
&lt;a href=&#34;https://forum.xda-developers.com/showthread.php?t=2317790&#34;&gt;xda: Minimal ADB and Fastboot&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Androxyde&amp;rsquo;s FlashTool from:
&lt;a href=&#34;https://forum.xda-developers.com/showthread.php?t=920746&#34;&gt;xda: FlashTool&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You will also need to install these drivers for your phone:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Regular Xperia XZ driver&lt;/li&gt;
&lt;li&gt;Flashmode Driver&lt;/li&gt;
&lt;li&gt;Fastboot (S1) Driver&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The drivers are located in the FlashTool installation folder. You will probably
need to reboot your computer with disabled driver signature verification in
order to install these drivers.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;On Linux:&lt;/strong&gt;
Download Androxyde&amp;rsquo;s FlashTool from: &lt;a href=&#34;https://forum.xda-developers.com/showthread.php?t=920746&#34;&gt;xda: FlashTool&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Then, install the &lt;code&gt;fastboot&lt;/code&gt; and &lt;code&gt;adb&lt;/code&gt; tools via your distro&amp;rsquo;s package manager.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;On Ubuntu: &lt;code&gt;apt install android-tools-adb android-tools-fastboot&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;On Arch Linux: &lt;code&gt;pacman -Syu android-tools&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;2-download-necessary-files&#34;&gt;2. Download necessary files&lt;/h3&gt;
&lt;p&gt;Make sure you have all the files needed before starting this process. Best
proceedings practice should mean that you&amp;rsquo;ve got all images located in a folder
where you can easily flash them to the phone with least amount of typing (same
folder as fastboot.exe).&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Download the &lt;code&gt;.FTF&lt;/code&gt; file for the latest stock firmware.
It should should be something ending in &lt;code&gt;.184&lt;/code&gt; or &lt;code&gt;.192&lt;/code&gt; for your region.
See this &lt;a href=&#34;https://forum.xda-developers.com/xperia-xz/how-to/xperia-xz-roll-android-7-0-nougat-39-2-t3510600&#34;&gt;list of latest stock firmware files&lt;/a&gt;.
You can also use the tool &lt;code&gt;XperiFirm&lt;/code&gt; for downloading, which is included with
&lt;code&gt;FlashTool&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Download this &lt;a href=&#34;https://sx.ix5.org/files/builds/kagura/misc/twrp-3.2.1-0-kagura-ab-x.img&#34;&gt;tweaked TWRP recovery&lt;/a&gt;, credits to Artem Labazov(@ab123321)&lt;/li&gt;
&lt;li&gt;Download Sony OEM binaries for &lt;code&gt;tone&lt;/code&gt; on Android Pie, Kernel 4.9 from the
&lt;a href=&#34;https://developer.sony.com/file/download/software-binaries-for-aosp-pie-android-9-0-kernel-4-9-tone/&#34;&gt;Sony Software Binaries page&lt;/a&gt;.&lt;br&gt;
The filename will be
&lt;code&gt;SW_binaries_for_Xperia_Android_9.0_2.3.2_v$VERSION_tone.zip&lt;/code&gt;, where
&lt;code&gt;$VERSION&lt;/code&gt; is currently v9.&lt;/li&gt;
&lt;li&gt;Download the latest AOSP 10 build from
&lt;a href=&#34;https://sx.ix5.org/files/builds/kagura/aosp-10/&#34;&gt;sx.ix5.org&lt;/a&gt;
&lt;!-- The latest semi-stable build is 2018-11-16(there are no *stable* builds yet). --&gt;
&lt;!-- It will be marked in [this xda thread](https://forum.xda-developers.com/xperia-xz/development/xz-aosp-pie-builds-t3864985/post78111505) as well. --&gt;
&lt;/li&gt;
&lt;li&gt;Optional: Download the latest stable Magisk from
&lt;a href=&#34;https://forum.xda-developers.com/apps/magisk/official-magisk-v7-universal-systemless-t3473445&#34;&gt;xda: Magisk&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Optional: Download OpenGApps from
&lt;a href=&#34;https://opengapps.org/?arch=arm64&amp;amp;api=10.0&amp;amp;variant=pico&#34;&gt;opengapps.org&lt;/a&gt;.
You need to chose Android 10.0, ARM64. You can choose any size variant, I would
recommend the &lt;code&gt;pico&lt;/code&gt; one because it has the least bloat.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;3-unlock-bootloader&#34;&gt;3. Unlock Bootloader&lt;/h3&gt;
&lt;p&gt;You need an &lt;a href=&#34;https://developer.sony.com/develop/open-devices/get-started/unlock-bootloader&#34;&gt;unlocked bootloader&lt;/a&gt;.
&lt;strong&gt;Read carefully what this means&lt;/strong&gt;.&lt;/p&gt;
&lt;div class=&#34;message&#34;&gt;
If your bootloader is already unlocked, you can skip ahead to the next step.
&lt;/div&gt;
&lt;div class=&#34;message warning&#34;&gt;
  &lt;h5&gt;Warning!&lt;/h5&gt;
  &lt;a href=&#34;https://forum.xda-developers.com/crossdevice-dev/sony/universal-dirtycow-based-ta-backup-t3514236&#34;&gt;
  Back up your Trim Area(&#34;TA&#34;) partition
  &lt;/a&gt; before unlocking the booatloader. You cannot undo an unlock and your
  DRM keys, possibly along with your warranty, will be lost forever!
&lt;/div&gt;
&lt;p&gt;If you are on a locked bootloader you will need to unlock your bootloader using this page:
&lt;a href=&#34;https://developer.sony.com/develop/open-devices/get-started/unlock-bootloader&#34;&gt;Sony Developer - Unlock bootloader&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;4-flash-latest-stock-firmware&#34;&gt;4. Flash latest stock firmware&lt;/h3&gt;
&lt;p&gt;The following steps are done from your computer with your device attached via USB-cable.&lt;/p&gt;
&lt;div class=&#34;message&#34;&gt;
If you have previously upgraded to the latest stock firmware(&lt;code&gt;.192&lt;/code&gt;)
and only tested out e.g. OmniROM, there is no need to re-flash the stock
firmware and you can skip this step.
&lt;/div&gt;
&lt;p&gt;You can access S1 flash mode by powering down the device completely, then holding
&lt;kbd&gt;VOLUME-DOWN&lt;/kbd&gt; while connecting the USB cable. The notification LED
should turn green and you can stop holding the volume button.&lt;/p&gt;
&lt;p&gt;Flash the latest available Oreo .FTF stock firmware using Androxyde&amp;rsquo;s
&lt;a href=&#34;https://forum.xda-developers.com/showthread.php?t=920746&#34;&gt;FlashTool&lt;/a&gt;.&lt;br&gt;
(Guide for flashing FTF with FlashTool: &lt;a href=&#34;https://forum.xda-developers.com/showthread.php?t=2658952&#34;&gt;xda: How to use Flashtool&lt;/a&gt;)&lt;/p&gt;
&lt;h3 id=&#34;5-flash-twrp-recovery&#34;&gt;5. Flash TWRP Recovery&lt;/h3&gt;
&lt;p&gt;You can access fastboot mode by powering down the device completely, then holding
&lt;kbd&gt;VOLUME-UP&lt;/kbd&gt; while connecting the USB cable. The notification LED should
turn blue and you can stop holding the volume button.&lt;/p&gt;
&lt;p&gt;Flash the TWRP recovery from the command line:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;fastboot flash &lt;span style=&#34;color:red&#34;&gt;recovery&lt;/span&gt; twrp-3.2.1-0-kagura-ab-x.img&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;(You need to use this tweaked recovery because the official TWRP builds can not mount /data or handle encryption).&lt;/p&gt;
&lt;h3 id=&#34;6-flash-oem-binaries&#34;&gt;6. Flash OEM binaries&lt;/h3&gt;
&lt;!-- Unzip it and flash the resulting `.img` file with fastboot. --&gt;
&lt;p&gt;Extract the Sony OEM Binaries zip-archive that contains the image-file needed for the next step.
Flash Sony&amp;rsquo;s OEM binaries with this CLI command: (Note that the destination differs between the recovery and oem!)&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;fastboot flash &lt;span style=&#34;color:red&#34;&gt;oem&lt;/span&gt; SW_binaries_for_Xperia_Android_9.0_2.3.2_v3_tone.img&lt;/code&gt;&lt;/pre&gt;
&lt;!--
Download oem version 1 from the
[Sony Software Binaries Archives](https://developer.sony.com/file/download/software-binaries-for-aosp-pie-android-9-0-kernel-4-9-tone/)
--&gt;
&lt;h3 id=&#34;7-twrp-recovery-operations&#34;&gt;7. TWRP Recovery operations&lt;/h3&gt;
&lt;p&gt;Remove the USB cable from phone and check that it is completely powered down.
Then boot up your device to recovery by pressing and holding &lt;kbd&gt;VOLUME-DOWN&lt;/kbd&gt;
and the &lt;kbd&gt;POWER&lt;/kbd&gt; button at the same time.  When the white Sony logo
appears, release all buttons.&lt;/p&gt;
&lt;h5 id=&#34;71-wipe-data-optional-but-highly-recommended&#34;&gt;7.1 Wipe data (optional, but highly recommended)&lt;/h5&gt;
&lt;p&gt;Wipe &lt;code&gt;/data&lt;/code&gt;, &lt;code&gt;/cache&lt;/code&gt; and Dalvik cache in TWRP:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;When booted into TWRP, swipe from left to right to enable system
modifications.  Do not proceed with system partition marked as &amp;ldquo;Read only&amp;rdquo;!&lt;/li&gt;
&lt;li&gt;Click &amp;ldquo;Wipe&amp;rdquo; and choose to perform a factory reset. Swipe to proceed.
(This will keep the files on your internal storage but delete all your app
data).&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;message&#34;&gt;
If you are coming from stock firmware, you absolutely need to do this. You might
be able to skip this step if you are upgrading from a previous Pie or Q build,
but if you run into problems you need to at least wipe the caches, if not
`/data` as well.
&lt;/div&gt;
&lt;h5 id=&#34;72-flash-the-aosp-rom&#34;&gt;7.2 Flash the AOSP ROM&lt;/h5&gt;
&lt;!-- You can access the TWRP recovery by powering down the device, then holding down --&gt;
&lt;!-- Volume-Down and the Power button.  Wait until the first vibration, release the --&gt;
&lt;!-- buttons, the TWRP logo will appear after about 15 seconds. --&gt;
&lt;ul&gt;
&lt;li&gt;When booted into TWRP, swipe from left to right to enable system
modifications.  Do not proceed with system partition marked as &amp;ldquo;Read only&amp;rdquo;!&lt;/li&gt;
&lt;li&gt;Connect your phone to your computer via USB. The Phone should appear in your
devices-list to the left in Windows Explorer.&lt;/li&gt;
&lt;li&gt;Transfer AOSP ROM zip-file to the phone&amp;rsquo;s internal storage.&lt;/li&gt;
&lt;li&gt;Click &amp;ldquo;Install&amp;rdquo;-tile and select the AOSP ROM file&lt;/li&gt;
&lt;li&gt;Swipe from left to right to start the flashing procedure.&lt;/li&gt;
&lt;/ul&gt;
&lt;h5 id=&#34;73-fix-dsp-file-labels&#34;&gt;7.3 Fix /dsp file labels&lt;/h5&gt;
&lt;div class=&#34;message&#34;&gt;
This only for Android Pie builds. Android 10 does not need this fix any more.
&lt;/div&gt;
&lt;p&gt;If you ever installed an Android Oreo-based custom ROM - e.g. OmniROM 8.1 - your
SELinux file labels for the &lt;code&gt;dsp&lt;/code&gt; partition will be wrong. For a more detailed
explanation and Download, see
&lt;a href=&#34;https://sx.ix5.org/info/post/dsp-file-relabling-for-sodp/&#34;&gt;File relabeling for SODP&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Simply flash the DSP label fixer zip file in TWRP.&lt;/p&gt;
&lt;!--
&lt;div class=&#34;message&#34;&gt;
&lt;b&gt;New:&lt;/b&gt; Simply flash the
&lt;a href=&#34;https://sx.ix5.org/files/builds/kagura/misc/dsp-label-fixer.zip&#34;&gt;DSP label fixer&lt;/a&gt;
zip file in TWRP.
&lt;/div&gt;

To check whether your labels are wrong, mount the `dsp` partition inside TWRP
and type `ls -laZ /dsp/`.
If it shows files with the `qdsp_file` label, do this:
```
chcon -R u:object_r:adsprpcd_file:s0 /dsp/
```
Check again with `ls -lZ /dsp/` and confirm that all files are labeled
`adsprpcd_file`.
--&gt;
&lt;!-- 7.4 Fix /persist file labels and permissions --&gt;
&lt;h5 id=&#34;74-flash-dualsim-patcher-optional&#34;&gt;7.4 Flash dualsim patcher (optional)&lt;/h5&gt;
&lt;p&gt;If you have a dualsim device, download the
&lt;a href=&#34;https://sx.ix5.org/info/post/dualsim-patcher/&#34;&gt;DualSim patcher&lt;/a&gt;.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Transfer the DualSim patcher zip file to the phone&amp;rsquo;s internal storage.&lt;/li&gt;
&lt;li&gt;Click &amp;ldquo;Install&amp;rdquo;-tile and select the DualSim patcher&lt;/li&gt;
&lt;li&gt;Swipe from left to right to start the flashing procedure.&lt;/li&gt;
&lt;/ul&gt;
&lt;h5 id=&#34;75-flash-opengapps-optional&#34;&gt;7.5 Flash OpenGapps (optional)&lt;/h5&gt;
&lt;p&gt;If you have problems afer flashing GApps, wipe all data and flash the ROM again,
without GApps.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Transfer the OpenGApps zip file to the phone&amp;rsquo;s internal storage.&lt;/li&gt;
&lt;li&gt;Click &amp;ldquo;Install&amp;rdquo;-tile and select the OpenGApps zip file&lt;/li&gt;
&lt;li&gt;Swipe from left to right to start the flashing procedure.&lt;/li&gt;
&lt;/ul&gt;
&lt;h5 id=&#34;76-flash-magisk-optional&#34;&gt;7.6 Flash Magisk (optional)&lt;/h5&gt;
&lt;p&gt;Flash &lt;a href=&#34;https://forum.xda-developers.com/apps/magisk/official-magisk-v7-universal-systemless-t3473445&#34;&gt;Magisk v18.1 or later&lt;/a&gt;.
Then install the Magisk Manager app. But read carefully which modules are
compatible!&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Transfer the Magisk zip file to the phone&amp;rsquo;s internal storage.&lt;/li&gt;
&lt;li&gt;Click &amp;ldquo;Install&amp;rdquo;-tile and select the Magisk zip file&lt;/li&gt;
&lt;li&gt;Swipe from left to right to start the flashing procedure.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you are using Magisk, your phone will restart once on first boot. This is
fully normal and is to be expected.&lt;/p&gt;
&lt;h3 id=&#34;8-reboot&#34;&gt;8. Reboot&lt;/h3&gt;
&lt;p&gt;Go back to the TWRP home screen and select &amp;ldquo;Reboot&amp;rdquo;. If TWRP prompts
you to install its own app, decline and choose to restart normally.&lt;/p&gt;
&lt;p&gt;Your phone will take a good while to finish booting up (~5 minutes or more).
Leave it alone until done.&lt;/p&gt;
&lt;div class=&#34;message warning&#34;&gt;
  &lt;h5&gt;Attention!&lt;/h5&gt;
Please also read the
&lt;a href=&#34;https://sx.ix5.org/bugs-sx&#34;&gt;full bug list&lt;/a&gt;!
&lt;/div&gt;
&lt;h2 id=&#34;optional-goodies&#34;&gt;Optional Goodies&lt;/h2&gt;
&lt;!-- The included AOSP Camera cannot record video as of now. --&gt;
&lt;p&gt;You can try OpenCamera, Snap Camera(from LineageOS), or one of the numerous
&lt;a href=&#34;https://www.celsoazevedo.com/files/android/google-camera/&#34;&gt;Google Camera ports&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;troubleshooting&#34;&gt;Troubleshooting&lt;/h2&gt;
&lt;p&gt;If your phone can&amp;rsquo;t boot past the white Sony logo or freezes on Android
boot-animation, try to simultaneously press &lt;kbd&gt;POWER&lt;/kbd&gt; + &lt;kbd&gt;VOLUME-UP&lt;/kbd&gt;
until the first vibration. This will reboot your phone.&lt;/p&gt;
&lt;p&gt;If you need to re-enter TWRP, your phone must first be powered off. You can
always force this no matter where and when by long-pressing
&lt;kbd&gt;POWER&lt;/kbd&gt; + &lt;kbd&gt;VOL-UP&lt;/kbd&gt; until you feel three vibrations. Then
release buttons and boot to TWRP with &lt;kbd&gt;POWER&lt;/kbd&gt; + &lt;kbd&gt;VOLUME-DOWN&lt;/kbd&gt;.&lt;/p&gt;
&lt;h5 id=&#34;magisk&#34;&gt;Magisk&lt;/h5&gt;
&lt;p&gt;If you cannot boot and have Magisk modules installed, it might be that they are
incompatible with this ROM. Before reporting a bug, please remove all Magisk
modules(by flashing the Magisk uninstall zip) and try booting again.&lt;/p&gt;
&lt;h5 id=&#34;encryption-does-not-work&#34;&gt;Encryption does not work&lt;/h5&gt;
&lt;p&gt;See &amp;ldquo;Formatting /data&amp;rdquo; below.&lt;/p&gt;
&lt;h5 id=&#34;formatting-data&#34;&gt;Formatting /data&lt;/h5&gt;
&lt;p&gt;If you still cannot boot the AOSP builds, try formatting your &lt;code&gt;/data&lt;/code&gt; partition.&lt;/p&gt;
&lt;p&gt;If you ever had encryption turned on while running the stock firmware, you also
might have to format your internal storage. This is because the stock firmware
seems to be using a different encryption version or algorithm than the AOSP
builds. The stock firmware runs encryption by default since Android Nougat.&lt;/p&gt;
&lt;div class=&#34;message warning&#34;&gt;
Back up all your photos, apps etc. to your computer as this will &lt;b&gt;wipe your
internal storage completely!&lt;/b&gt;
&lt;/div&gt;
&lt;!--
To format your internal storage, download
[userdata.img](https://sx.ix5.org/files/builds/kagura/misc/userdata.img)
and flash it using fastboot:
&lt;pre&gt;&lt;code&gt;fastboot flash &lt;span style=&#34;color:red&#34;&gt;userdata&lt;/span&gt; userdata.img&lt;/code&gt;&lt;/pre&gt;
--&gt;
&lt;p&gt;For 32Gb (single-SIM) devices, use this command:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;fastboot format:ext4:0x58dffc000 userdata
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;For 64Gb (dual-SIM) devices, use:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;fastboot format:ext4:0xcd5bfc000 userdata
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You need to use the fastboot method because wiping in TWRP does not leave enough
space for the crypto footer (needs to be 32Mb), which you need to run Full Disk
Encryption (FDE).&lt;/p&gt;
&lt;p&gt;Method for calculating needed hex values for &lt;code&gt;fastboot format&lt;/code&gt;, including space
for the crypto footer:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-make&#34; data-lang=&#34;make&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;# Single-SIM:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;# Reserve space for data encryption (23857201152-16384)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;BOARD_USERDATAIMAGE_PARTITION_SIZE&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;23857184768&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;# Dual-SIM:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;# Reserve space for data encryption (55125737472-16384)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;BOARD_USERDATAIMAGE_PARTITION_SIZE&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;55125721088&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then use python to calculate the hex values:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;$ python
hex(23857184768)
 &amp;#39;0x58dffc000&amp;#39;
hex(55125721088)
 &amp;#39;0xcd5bfc000&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;hr&gt;
&lt;p&gt;&lt;em&gt;A big thanks to &lt;a href=&#34;https://forum.xda-developers.com/member.php?u=3928215&#34;&gt;StaticGTF&lt;/a&gt;
for writing large parts of this guide!&lt;/em&gt;&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Building Android</title>
      <link>https://sx.ix5.org/info/building-android/</link>
      <pubDate>Fri, 19 Oct 2018 22:14:54 +0200</pubDate>
      
      <guid>https://sx.ix5.org/info/building-android/</guid>
      <description>&lt;div class=&#34;message warning&#34;&gt;
The builds for the Xperia XZ will no longer be updated. This guide is severely
out of date (as of 2022) and will most likely no longer work. Proceed with caution.
&lt;/div&gt;
&lt;p&gt;This guide will asume you follow the
&lt;a href=&#34;https://developer.sony.com/develop/open-devices/guides/aosp-build-instructions/build-aosp-android-android-10-0-0&#34;&gt;official Sony build guide&lt;/a&gt;,
but add some extra tips.&lt;/p&gt;
&lt;h2 id=&#34;initialize-your-build-directory&#34;&gt;Initialize your build directory&lt;/h2&gt;
&lt;p&gt;Create a &lt;code&gt;~/android/build-env&lt;/code&gt; folder, &lt;code&gt;cd&lt;/code&gt; into it.&lt;/p&gt;
&lt;h2 id=&#34;using-the-repo-tool&#34;&gt;Using the repo tool&lt;/h2&gt;
&lt;p&gt;Download and install the &lt;a href=&#34;https://gerrit.googlesource.com/git-repo/&#34;&gt;repo&lt;/a&gt; tool, either via your package manager
or directly from Google.
Instead of copying the file, it&amp;rsquo;s better to symlink:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;mkdir -p ~/.local/bin
# Add ~/.local/bin to PATH
echo &amp;#34;export PATH=$HOME/.local/bin:$PATH&amp;#34; &amp;gt;&amp;gt; ~/.bashrc
# Symlink
ln -sf ~/android/.repo/repo/repo ~/.local/bin/repo
# Check:
readlink $(which repo)
# -&amp;gt; /home/builder/android/.repo/repo/repo
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Then, run the &lt;code&gt;repo init&lt;/code&gt; command:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;repo init -u https://android.googlesource.com/platform/manifest \
  -b android-10.0.0_r39 -g default,-x86,-mips,-darwin,-notdefault
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Use the appropriate branch tag instead of &lt;code&gt;_r39&lt;/code&gt;. For an overview of currently
published tags, see &lt;a href=&#34;https://source.android.com/setup/start/build-numbers#source-code-tags-and-builds&#34;&gt;Codenames, Tags and Numbers&lt;/a&gt;. Most often, you&amp;rsquo;ll
want to pick the latest Pixel tag, e.g. the Pixel 4.&lt;/p&gt;
&lt;h2 id=&#34;ubuntu-chroot&#34;&gt;Ubuntu chroot&lt;/h2&gt;
&lt;div class=&#34;message focus&#34;&gt;
Since Google use Ubuntu as a reference build environment, it is advisable you use it as well to avoid incompatibility problems.
&lt;b&gt;If you&#39;re on Ubuntu already, you can skip this step.&lt;/b&gt;
&lt;/div&gt;
&lt;p&gt;If you&amp;rsquo;re on another system like Fedora or Arch Linux, you can set up a Ubuntu
chroot build environment instead.&lt;/p&gt;
&lt;p&gt;Another alternative to nspawn is to use &lt;code&gt;docker&lt;/code&gt;, see
&lt;a href=&#34;https://github.com/chris42/android_build&#34;&gt;Sony AOSP on docker&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;A build chroot takes about 1-1.5GB of space and will save you from headaches,
e.g. when Android modules aren&amp;rsquo;t compiled against your host glibc.&lt;/p&gt;
&lt;p&gt;Install &lt;code&gt;debootstrap&lt;/code&gt;, then run this (&lt;code&gt;bionic&lt;/code&gt; is the ubuntu version codename for
18.04 LTS):&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;debootstrap --variant=buildd --arch=amd64 bionic ~/android/ubuntu-android
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;chroot into the newly created builder system, either via &lt;code&gt;chroot&lt;/code&gt; or just using
&lt;code&gt;systemd-nspawn&lt;/code&gt; (Assuming you created your android build environment via &lt;code&gt;repo init&lt;/code&gt; in &lt;code&gt;~/android/build-env&lt;/code&gt;):&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;sudo systemd-nspawn \
  -D /home/&amp;lt;your-username&amp;gt;/android/ubuntu-android
useradd -m -s /bin/bash builder
# -&amp;gt; No need to add a password, nspawn will log you in automatically
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;For Android Q, the way &lt;code&gt;.img&lt;/code&gt; files are mounted during build has changed, e.g.
&lt;code&gt;resize2fs&lt;/code&gt; fails with a standard nspawn container.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;ln -s /proc/self/mounts /etc/mtab
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;And add this to the options of systemd-nspawn:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;    --bind=/dev/loop0:/dev/loop0 \
    --bind=/dev/loop1:/dev/loop1 \
    --bind=/dev/loop2:/dev/loop2 \
    --bind=/dev/loop3:/dev/loop3 \
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;(So that enough loop devices are available)&lt;/p&gt;
&lt;h2 id=&#34;install-required-packages&#34;&gt;Install required packages&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;apt install software-properties-common python
add-apt-repository universe
apt update
apt install bison g++-multilib git gperf libxml2-utils make \
  zlib1g-dev zip liblz4-tool libncurses5
apt install openjdk-8-jdk
# Might be needed on Android 10:
apt install flex

# The following dependencies are all optional:
##############################################
# Faster recompilation
apt install ccache
apt install rsync libssl-dev aapt
# Kernel recompilation:
apt install bc autoconf automake autopoint autotools-dev bsdmainutils gawk \
  groff-base libarchive-zip-perl libpipeline1 libtimedate-perl libtool kmod
# For selinux:
apt install setools python-networkx policycoreutils
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Cross-reference the needed packages with the
&lt;a href=&#34;https://developer.sony.com/develop/open-devices/guides/aosp-build-instructions/build-aosp-android-p-9-0-0&#34;&gt;official Sony build guide&lt;/a&gt;
should this document be out of date.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;If you&amp;rsquo;re building in a chroot:&lt;/strong&gt;
Exit out of the build system by typing &lt;code&gt;exit&lt;/code&gt; (and pressing &lt;code&gt;Ctrl-]&lt;/code&gt; three times
for &lt;code&gt;nspawn&lt;/code&gt;), then re-launch your build system and log in as your builder user.
If you want to share your own ccache etc. with your build environment, &lt;code&gt;bind&lt;/code&gt;
the appropriate directories.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;sudo systemd-nspawn \
--bind=/home/&amp;lt;your-username&amp;gt;/android/build-env/:/home/builder/build-env/ \
  --bind=/home/&amp;lt;your-username&amp;gt;/.ccache/:/home/builder/.ccache/ \
  -D /home/&amp;lt;your-username&amp;gt;/android/ubuntu-android \
  --user=builder
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;local-manifests&#34;&gt;Local manifests&lt;/h2&gt;
&lt;p&gt;Clone the Sony &lt;code&gt;local_manifests&lt;/code&gt; git repo as instructed.
For legacy devices, meaning &lt;code&gt;loire&lt;/code&gt; and &lt;code&gt;tone&lt;/code&gt;, you need to checkout the
&lt;code&gt;android-10_legacy&lt;/code&gt; branch of &lt;code&gt;local_manifests&lt;/code&gt;. For recent devices have to
use the &lt;code&gt;master&lt;/code&gt; branch.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;git clone https://github.com/sonyxperiadev/local_manifests .repo/local_manifests
cd .repo/local_manifests
# For recent devices:
git checkout master
# For legacy devices
git checkout android-10_legacy
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;applying-needed-patches&#34;&gt;Applying needed patches&lt;/h2&gt;
&lt;p&gt;Run &lt;code&gt;repo_update.sh&lt;/code&gt;. Your build directory will now be ready for a first build.&lt;/p&gt;
&lt;div class=&#34;message focus&#34;&gt;
&lt;b&gt;Felix:&lt;/b&gt; If you want to recreate my own builds, use
&lt;code&gt;
git clone https://git.ix5.org/felix/local-manifests-ix5 local_manifests -b &#39;ix5-customizations-10&#39;
&lt;/code&gt;
instead. After you run &lt;code&gt;repo_update.sh&lt;/code&gt;, also run
&lt;code&gt;q_repo_update.sh&lt;/code&gt;. This will fetch my newest changes as well.
&lt;br&gt;
&lt;!--
&lt;b&gt;For Android Pie and ealier:&lt;/b&gt; Use the &lt;code&gt;ix5-customizations&lt;/code&gt; branch and
&lt;code&gt;ix5_repo_update.sh&lt;/code&gt; instead.
--&gt;
&lt;/div&gt;
&lt;h2 id=&#34;prepare-build-environment&#34;&gt;Prepare build environment&lt;/h2&gt;
&lt;p&gt;Run &lt;code&gt;source build/envsetup.sh&lt;/code&gt; inside your build environment and then &lt;code&gt;lunch aosp_&amp;lt;product&amp;gt;-userdebug&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;To find out the product name of your device for &lt;code&gt;aosp_&amp;lt;product&amp;gt;-userdebug&lt;/code&gt;, see
the &lt;a href=&#34;https://sx.ix5.org/info/sony-devices/&#34;&gt;Sony Devices overview&lt;/a&gt;. E.g. for a single-SIM
(&amp;ldquo;SS&amp;rdquo;) Xperia XZ, choose &lt;code&gt;aosp_f8331&lt;/code&gt;, for a dual-SIM XZ, choose &lt;code&gt;aosp_f8332&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;You can also run &lt;code&gt;lunch&lt;/code&gt; without any arguments to get a list of all available
build targets. They will look like &lt;code&gt;aosp_f83xx-...&lt;/code&gt; where &lt;code&gt;f83xx&lt;/code&gt; is the model
number of your device. You can choose between &lt;code&gt;eng&lt;/code&gt; and &lt;code&gt;userdebug&lt;/code&gt; builds, see
&lt;a href=&#34;https://source.android.com/setup/build/building#choose-a-target&#34;&gt;Choose a target&lt;/a&gt;.&lt;br&gt;
For your own usage, &lt;code&gt;userdebug&lt;/code&gt; is most likely what you want.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;user&lt;/code&gt; target is meant for public releases and doesn&amp;rsquo;t include root. You&amp;rsquo;ll
need to look into &lt;code&gt;vendorsetup.sh&lt;/code&gt; (&lt;code&gt;AndroidProducts.mk&lt;/code&gt; for Android Q) - and
perhaps add it for your device - if you want to use it.&lt;/p&gt;
&lt;h2 id=&#34;build-kernels&#34;&gt;Build kernels&lt;/h2&gt;
&lt;p&gt;On Android Q, you need to use a script to build the kernel images. Navigate into
&lt;code&gt;kernel/sony/msm-4.9/common-kernel&lt;/code&gt; and run &lt;code&gt;build-kernels-gcc.sh&lt;/code&gt;.&lt;br&gt;
If building for a Kernel 4.14 device, go into
&lt;code&gt;kernel/sony/msm-&lt;b&gt;4.14&lt;/b&gt;/common-kernel&lt;/code&gt; and use
&lt;code&gt;build-kernels-clang.sh&lt;/code&gt; instead.&lt;/p&gt;
&lt;p&gt;Edit &lt;code&gt;build-kernels-{gcc,clang}.sh&lt;/code&gt; and change the list of platforms in the
script so that it looks like this:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;# Override:
TONE=&amp;#34;kagura&amp;#34;
PLATFORMS=&amp;#34;tone&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This will save you from building the kernel for &lt;em&gt;all&lt;/em&gt; Sony devices and only
build for the Xperia XZ (&amp;ldquo;kagura&amp;rdquo;).&lt;/p&gt;
&lt;h2 id=&#34;build--flash&#34;&gt;Build &amp;amp; Flash&lt;/h2&gt;
&lt;p&gt;For legacy non-A/B devices like the Xperia XZ, run this command:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;make bootimage systemimage
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Newer devices require building for more partitions, like &lt;code&gt;vendor&lt;/code&gt;, &lt;code&gt;dtbo&lt;/code&gt;,
&lt;code&gt;product&lt;/code&gt;, &lt;code&gt;vbmeta&lt;/code&gt; and others.&lt;/p&gt;
&lt;p&gt;In case your build stops at about 90% with this error, most of the time you
should be fine by just restarting the
build with &lt;code&gt;-j 1&lt;/code&gt;&lt;sup id=&#34;fnref:1&#34;&gt;&lt;a href=&#34;#fn:1&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;[ 93% 12745/13686] //frameworks/base:hiddenapi-lists-docs Metalava [common]
FAILED: out/soong/[...]hiddenapi-lists-docs-stubs.srcjar
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;However, if this still fails, try cherry-picking
&lt;a href=&#34;https://review.lineageos.org/c/LineageOS/android_build_soong/+/266411&#34;&gt;this patch from LineageOS&lt;/a&gt;. See also &lt;a href=&#34;https://old.reddit.com/r/LineageOS/comments/fgbs5v/how_to_deal_with_outofmemoryerror_when_building/&#34;&gt;this reddit post&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Then, use &lt;code&gt;fastboot&lt;/code&gt; to flash the generated images&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;cd out/target/product/kagura
fastboot flash boot boot.img
fastboot flash system system.img
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;For 4.14 devices, also flash the other partitions like &lt;code&gt;vendor&lt;/code&gt;, &lt;code&gt;dtbo&lt;/code&gt; etc.&lt;/p&gt;
&lt;p&gt;Do not forget to flash the appropriate &lt;a href=&#34;https://developer.sony.com/develop/open-devices/downloads/software-binaries&#34;&gt;Software Binaries&lt;/a&gt; to the &lt;code&gt;oem&lt;/code&gt;
partition as well!&lt;/p&gt;
&lt;h2 id=&#34;optimize-the-build&#34;&gt;Optimize the build&lt;/h2&gt;
&lt;p&gt;A full build will take about two to three hours&lt;sup id=&#34;fnref:2&#34;&gt;&lt;a href=&#34;#fn:2&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;2&lt;/a&gt;&lt;/sup&gt; on a beefed-out recent
system (Core i7 8th gen 4 cores, 16GB RAM, good SSD). That time can however be
cut down for successive builds to around an hour by utilizing &lt;code&gt;ccache&lt;/code&gt; and
parallelizing the build.&lt;/p&gt;
&lt;p&gt;It is recommendable to use a ccache size of around 50-100GB, depending on
whether you plan to build different ROMS or for multiple devices.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;# On Android Pie and before:
_CCACHE_EXEC=prebuilts/misc/linux-x86/ccache/ccache
# On Android Q:
_CCACHE_EXEC=/usr/bin/ccache
# Set ccache size:
$_CCACHE_EXEC -M 50G
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Then set the environment variable with &lt;code&gt;export USE_CCACHE=1&lt;/code&gt;. This variable
needs to be set anew every time you open a new terminal, so it is
advisable to put &lt;code&gt;export USE_CCACHE=1&lt;/code&gt; at the end of your &lt;code&gt;.bashrc&lt;/code&gt; in your home
directory (or &lt;code&gt;/home/builder/.bashrc&lt;/code&gt; if you&amp;rsquo;re in a chroot).&lt;/p&gt;
&lt;p&gt;&lt;code&gt;ccache&lt;/code&gt; compression might also save a lot of disk space for you. Set
&lt;code&gt;export CCACHE_COMPRESS=1&lt;/code&gt; in your &lt;code&gt;.bashrc&lt;/code&gt;. This cuts ccache disk usage down
to about 5GB per device, but may incur some performance penalty.&lt;/p&gt;
&lt;div class=&#34;message warning&#34;&gt;
On Android Q, you need to install the &lt;code&gt;ccache&lt;/code&gt; package and set
&lt;code&gt;CCACHE_EXEC&lt;/code&gt; in your &lt;code&gt;.bashrc&lt;/code&gt; manually to e.g.
&lt;code&gt;/usr/bin/ccache&lt;/code&gt;. The reason for this is that Google no longer ships
a prebuilt &lt;code&gt;ccache&lt;/code&gt; with Android.
&lt;br&gt;
For more info, see
&lt;a href=&#34;https://sx.ix5.org/info/post/android-q-changes/&#34;&gt;Android Q changes&lt;/a&gt; and 
&lt;a href=&#34;https://android.googlesource.com/platform/build/+/refs/tags/android-q-preview-1/core/ccache.mk#17&#34;&gt;
build/core/ccache.mk&lt;/a&gt;.
&lt;/div&gt;
&lt;p&gt;To use parallel compilation, you need to find out how many threads your CPU has
via &lt;code&gt;nproc&lt;/code&gt;. Then use that number for &lt;code&gt;make -j&amp;lt;nr-of-threads&amp;gt;&lt;/code&gt;. For most
computers it will be the number of CPU cores times 2, e.g. &amp;ldquo;8&amp;rdquo; for a 4-core CPU.&lt;/p&gt;
&lt;p&gt;You can also set &lt;code&gt;export WITHOUT_CHECK_API=true&lt;/code&gt; in your &lt;code&gt;~/.bashrc&lt;/code&gt; to skip the
metalava checks which take up a lot of RAM. Obviously, you should run the
metalava checks when you change any Java code yourself, but you can save a bit
of time if you skip them for routine builds.&lt;/p&gt;
&lt;div class=&#34;message warning&#34;&gt;
If you&#39;re on AOSP Android Q, you need to manually cherry-pick
&lt;a href=&#34;https://android-review.googlesource.com/#/c/1112165&#34;&gt;Bring back env flag to skip checkapi&lt;/a&gt;.
On LineageOS and on current (as of 2019-09-07) &lt;code&gt;master&lt;/code&gt;, the CL has
been merged already.
&lt;/div&gt;
&lt;h2 id=&#34;distributing&#34;&gt;Distributing&lt;/h2&gt;
&lt;p&gt;If you want to share the fruits of your labor, you can create compressed
flashable .zip files. Use &lt;code&gt;make otapackage&lt;/code&gt; instead of &lt;code&gt;make systemimage [...]&lt;/code&gt;.
This will create a flashable zip file in &lt;code&gt;out/target/product/&amp;lt;device-codename&amp;gt;&lt;/code&gt;
named something like &lt;code&gt;aosp_f8331-ota-eng.hostname-2018-10-19&lt;/code&gt;. You can flash
this file via &lt;code&gt;adb sideload&lt;/code&gt; or use a custom recovery like TWRP.&lt;/p&gt;
&lt;p&gt;If you intend to share your builds publicly, you should generate and guard your
own set of signing keys. See &lt;a href=&#34;https://source.android.com/devices/tech/ota/sign_builds&#34;&gt;Signing builds for release&lt;/a&gt; for more
information.&lt;/p&gt;
&lt;!--
Create the directory `dist_output` and use `make dist DIST_DIR=dist_output -j
&lt;nr-of-threads&gt;` to produce a `brotli`-compressed zip file named something like
`aosp_f8331-ota-eng.hostname-2018-10-19`. You can flash this file via `adb
sideload` or use a custom recovery like TWRP.
--&gt;
&lt;p&gt;After you have tested your build on your own device, you can share the file
freely, given that it contains free/libre software under the GPL and other free
licenses. Anything GPL-licensed also demands you have to divulge your build
sources. So put your patches into a git repo and share them with the world.&lt;/p&gt;
&lt;h2 id=&#34;speedier-development&#34;&gt;Speedier development&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Use &lt;code&gt;m module.name -j $(nproc)&lt;/code&gt; to only rebuild a single module. You can then
&lt;code&gt;adb push&lt;/code&gt; or even &lt;code&gt;adb sync&lt;/code&gt; the changes directly to your device&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;make bootimage&lt;/code&gt; to re-generate kernel and ramdisk only (&lt;code&gt;boot.img&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;adb push&lt;/code&gt; or &lt;code&gt;adb sync&lt;/code&gt; instead of flashing full images. N.b.: This is
only possible with disabled vbmeta.&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
## Disabling signature verification
- Disable in TWRP
```
make avbtool -j
avbtool make_vbmeta_image -\-flag 2 -\-output vbmeta.img
```
--&gt;
&lt;h2 id=&#34;going-further&#34;&gt;Going further&lt;/h2&gt;
&lt;p&gt;To show all available build targets, use &lt;code&gt;make modules&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Show commands used live: &lt;code&gt;make showcommands&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Good references:&lt;br&gt;
&lt;a href=&#34;https://elinux.org/Android_Build_System&#34;&gt;eLinux: The Android Build System&lt;/a&gt;&lt;/p&gt;
&lt;div class=&#34;footnotes&#34; role=&#34;doc-endnotes&#34;&gt;
&lt;hr&gt;
&lt;ol&gt;
&lt;li id=&#34;fn:1&#34;&gt;
&lt;p&gt;Android&amp;rsquo;s metalava takes up enormous amounts of RAM. It attempts to
verify the whole Android API at once and is badly designed. If it is run in
parallel to other processes, it will frequently go OOM. By restarting the
process, metalava will be the only one running and hopefully succeed.&amp;#160;&lt;a href=&#34;#fnref:1&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id=&#34;fn:2&#34;&gt;
&lt;p&gt;On Android Q, this time goes up to five hours for me.&amp;#160;&lt;a href=&#34;#fnref:2&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
</description>
    </item>
    
    <item>
      <title>Fake Treble for Xperia XZ</title>
      <link>https://sx.ix5.org/info/fake-treble-for-xperia-xz/</link>
      <pubDate>Fri, 20 Dec 2019 16:55:47 +0100</pubDate>
      
      <guid>https://sx.ix5.org/info/fake-treble-for-xperia-xz/</guid>
      <description>&lt;p&gt;This guide should help you create builds that can run Generic System Images
(GSIs) for the Xperia XZ, even though it was never shipped with a &lt;code&gt;/vendor&lt;/code&gt;
partition.&lt;/p&gt;
&lt;p&gt;We will move the &amp;ldquo;Software Binaries&amp;rdquo;, as Sony calls them, from the &lt;code&gt;/odm&lt;/code&gt;
mountpoint to &lt;code&gt;/vendor/odm&lt;/code&gt; and move the &lt;code&gt;vendor&lt;/code&gt; part from the &lt;code&gt;system&lt;/code&gt;
partition (&lt;code&gt;/system/vendor&lt;/code&gt;) to the &lt;code&gt;oem&lt;/code&gt; partition.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Pre:&lt;/strong&gt;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;Partition   Mountpoint
system      /system
             ↳/vendor
oem         /odm
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;strong&gt;Post:&lt;/strong&gt;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;Partition   Mountpoint
system      /system
oem         /vendor
             ↳/odm
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Most steps in the &lt;a href=&#34;../building-android/&#34;&gt;regular Android build guide&lt;/a&gt; and the
&lt;a href=&#34;https://developer.sony.com/develop/open-devices/guides/aosp-build-instructions/build-aosp-android-android-10-0-0&#34;&gt;official Sony build guide&lt;/a&gt;
apply here as well.&lt;/p&gt;
&lt;h2 id=&#34;how-to&#34;&gt;How-To&lt;/h2&gt;
&lt;h3 id=&#34;local_manifests&#34;&gt;local_manifests&lt;/h3&gt;
&lt;p&gt;Clone my own &lt;code&gt;local_manifests&lt;/code&gt; instead of Sony’s:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;git clone https://git.ix5.org/felix/local-manifests-ix5 \
  local_manifests -b &amp;#39;ix5-customizations-10&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;repo_update&#34;&gt;repo_update&lt;/h3&gt;
&lt;p&gt;After you run &lt;code&gt;repo_update.sh&lt;/code&gt;, also run &lt;code&gt;q_repo_update.sh&lt;/code&gt;. Then, run
&lt;code&gt;treble_repo_update.sh&lt;/code&gt;. These scripts will fetch all the relevant patches you
need to create a fake treble build.&lt;/p&gt;
&lt;!--
Because the tone devices are still on Kernel 4.9, you also need to run
`q_4.9_repo_update.sh`.
--&gt;
&lt;p&gt;You will also need to download the Android 9, Kernel 4.9 Software Binaries. Do
not use the Kernel 4.14 binaries!&lt;/p&gt;
&lt;h3 id=&#34;device-sony-customization&#34;&gt;device-sony-customization&lt;/h3&gt;
&lt;p&gt;Then, create the folder &lt;code&gt;device/sony/customization&lt;/code&gt; inside your build
environment.&lt;/p&gt;
&lt;p&gt;It needs to contain two files:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Customization.mk:&lt;/code&gt; (note the uppercase &lt;code&gt;C&lt;/code&gt;!)&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;BUILD_KERNEL := false
# Include buildvar whether to build a fake treble build or not
include device/sony/customization/customization-noproduct.mk
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;code&gt;customization-noproduct.mk:&lt;/code&gt;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;# Fake treble builds for kagura
PRODUCT_FAKE_TREBLE_BUILD := true
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you want to build a vendor-only OTA package, add this to
&lt;code&gt;customization-noproduct.mk&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;# Skip adding system to ota
PRODUCT_BUILD_SYSTEM_IMAGE := false
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;device-sony-odm&#34;&gt;device-sony-odm&lt;/h3&gt;
&lt;p&gt;Clone &lt;code&gt;https://git.ix5.org/felix/device-sony-odm&lt;/code&gt; into &lt;code&gt;device/sony/odm&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Then, you need to extract the &amp;ldquo;Software Binaries&amp;rdquo; - &amp;ldquo;blobs&amp;rdquo; for short - from the
official images.&lt;/p&gt;
&lt;p&gt;When you download an image from the
&lt;a href=&#34;https://developer.sony.com/develop/open-devices/downloads/software-binaries&#34;&gt;Software Binaries page&lt;/a&gt;,
you will receive a &lt;code&gt;.zip&lt;/code&gt; archive, which contains a &lt;code&gt;.img&lt;/code&gt; file.
This &lt;code&gt;.img&lt;/code&gt; file is a sparse android image&lt;sup id=&#34;fnref:1&#34;&gt;&lt;a href=&#34;#fn:1&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;$ file SW_binaries_for_Xperia_Android_10.0.7.1_r1_v2a_tama.img
 ↳ SW_binaries_for_Xperia_Android_10.0.7.1_r1_v2a_tama.img: \
   Android sparse image, version: 1.0, [...]
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;sparse-images--loop-mount&#34;&gt;Sparse Images &amp;amp; Loop Mount&lt;/h3&gt;
&lt;p&gt;You can un-sparse the image using the &lt;a href=&#34;https://github.com/anestisb/android-simg2img&#34;&gt;simg2img&lt;/a&gt;&lt;sup id=&#34;fnref:2&#34;&gt;&lt;a href=&#34;#fn:2&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;2&lt;/a&gt;&lt;/sup&gt; tool. Run
&lt;code&gt;/path/to/simg2img SW_&amp;lt;name&amp;gt;.img swbins-unsparse.img&lt;/code&gt; and you will receive a
regular loop image of an ext4 file system.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;$ file swbins-unsparse.img
 ↳ swbins-unsparse.img: Linux rev 1.0 ext4 filesystem data, \
   [..] volume name &amp;#34;odm&amp;#34; (extents) (large files) (huge files)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You can then mount that image using &lt;code&gt;loop&lt;/code&gt;&lt;sup id=&#34;fnref:3&#34;&gt;&lt;a href=&#34;#fn:3&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;3&lt;/a&gt;&lt;/sup&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;sudo mount -o loop swbins-unsparse.img /mnt/
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Create &lt;code&gt;device/sony/odm/blobs/&lt;/code&gt; and copy the contents of the mounted image
there:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;cd device/sony/odm
mkdir blobs
sudo cp -r /mnt/* blobs/
# Delete ext4 metadata
sudo rm -rf blobs/lost+found/
# Don&amp;#39;t forget the colon
sudo chown -R $(whoami): blobs/
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;build-it&#34;&gt;Build it!&lt;/h3&gt;
&lt;p&gt;First, because building the kernel on Android Q from inside the Android tree is
quite complicated, we use a script to build them instead.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;cd kernel/sony/msm-4.9/common-kernel
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Edit &lt;code&gt;build-kernels-gcc.sh&lt;/code&gt; and uncomment/edit the &lt;code&gt;Override&lt;/code&gt; lines so the section
looks like this&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;# Override:
TONE=&amp;#34;kagura&amp;#34;
PLATFORMS=&amp;#34;tone&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This will save you from building the kernel for &lt;em&gt;all&lt;/em&gt; Sony devices and only
build for the Xperia XZ (&amp;ldquo;kagura&amp;rdquo;).&lt;/p&gt;
&lt;p&gt;Then, build the kernel with patched &lt;code&gt;dtb&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;bash build-kernels-gcc.sh
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;After this has finished, you should have a file named &lt;code&gt;kernel-dtb-kagura&lt;/code&gt; in
your &lt;code&gt;kernel/sony/msm-4.9/common-kernel&lt;/code&gt; folder.&lt;/p&gt;
&lt;p&gt;Now, go back to your Android root dir and run the build commands:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;source build/envsetup.sh &amp;amp;&amp;amp; lunch aosp_f8331-userdebug
make bootimage systemimage vendorimage
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;In case your build stops at about 90% with this error, just re-start the
build&lt;sup id=&#34;fnref:4&#34;&gt;&lt;a href=&#34;#fn:4&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;4&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;[ 93% 12745/13686] //frameworks/base:hiddenapi-lists-docs Metalava [common]
FAILED: out/soong/[...]hiddenapi-lists-docs-stubs.srcjar
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Flash the resulting files in
&lt;code&gt;out/target/product/kagura/&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;fastboot flash boot boot.img
fastboot flash oem vendor.img
&lt;/code&gt;&lt;/pre&gt;&lt;!-- fastboot flash system system.img --&gt;
&lt;div class=&#34;message warning&#34;&gt;
Do not flash Sony’s software binary image again now, all the needed blobs are
already included in &lt;code&gt;vendor.img&lt;/code&gt; for you!
&lt;/div&gt;
&lt;h3 id=&#34;ota&#34;&gt;OTA&lt;/h3&gt;
&lt;p&gt;To create a flashable zip file, use &lt;code&gt;make otapackage&lt;/code&gt;. You can install the
resulting zip file in &lt;code&gt;out/target/product/kagura&lt;/code&gt; via TWRP or any other
recovery.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;adb push out/target/product/kagura/aosp_f8331-ota-eng*.zip /sdcard/
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;compatible-gsis&#34;&gt;Compatible GSIs&lt;/h3&gt;
&lt;p&gt;You need to use system-as-root, &lt;code&gt;arm64_ab&lt;/code&gt; GSIs since this is now the default
for Android 10.&lt;/p&gt;
&lt;p&gt;Use &lt;code&gt;fastboot flash system &amp;lt;my-gsi.img&amp;gt;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Since SELinux is in enforcing mode, badly-built GSIs will fail to run. You can
set it to permissive by changing the commandline:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;BOARD_KERNEL_CMDLINE += androidboot.selinux=permissive
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;or set &lt;code&gt;BOARD_USE_ENFORCING_SELINUX := false&lt;/code&gt; in &lt;code&gt;Customization.mk&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;going-back-to-regular-builds&#34;&gt;Going back to regular builds&lt;/h3&gt;
&lt;p&gt;You need to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Unset &lt;code&gt;PRODUCT_FAKE_TREBLE_BUILD&lt;/code&gt; in &lt;code&gt;customization-noproduct.mk&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Unset &lt;code&gt;PRODUCT_BUILD_SYSTEM_IMAGE&lt;/code&gt; in &lt;code&gt;customization-noproduct.mk&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Revert &lt;code&gt;dtsi: tone: conjure oem into /vendor&lt;/code&gt; in &lt;code&gt;kernel/sony/msm-4.9/kernel&lt;/code&gt; in
case you want to build non-treble &lt;code&gt;tone&lt;/code&gt; builds again&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
- Undo the `revert: liblights: Migrate to kernel 4.14 LED class for RGB
  tri-led` commit in `device/sony/common` in case you want to build for 4.14
  devices like the `tama` or `kumano` platform
--&gt;
&lt;div class=&#34;message&#34;&gt;
After you&#39;ve flashed your fake treble build, you need to re-flash the regular
Software Binaries to the &lt;code&gt;oem&lt;/code&gt; partition if you want to return to
regular builds.
&lt;/div&gt;
&lt;h2 id=&#34;explanation&#34;&gt;Explanation&lt;/h2&gt;
&lt;p&gt;The fake treble methodology relies on some patches on top of the SODP repos.&lt;/p&gt;
&lt;h3 id=&#34;git-scripts&#34;&gt;git scripts&lt;/h3&gt;
&lt;p&gt;Here is an example of picking git patches, see
&lt;a href=&#34;https://git.ix5.org/felix/ix5_repo_update/src/commit/2134e86de59f0e4519428d82270715064365f7e6/q_repo_update.sh#L234-L247&#34;&gt;q_repo_update&lt;/a&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;
pushd $ANDROOT/device/sony/tone
LINK=&amp;#34;https://git.ix5.org/felix/device-sony-tone&amp;#34;
(git remote --verbose | grep -q $LINK) || git remote add ix5 $LINK
do_if_online git fetch ix5

# git checkout &amp;#39;disable-verity-no-forceencrypt&amp;#39;
# Change forceencrypt to encryptable for userdata
apply_commit af592265685fddf24100cbc1fdcdcb5bfd2260c1
# Disable dm-verity
apply_commit b611c8d91a374f246be393d89f20bbf3fc2ab9f7

# git checkout &amp;#39;treble-odm-3&amp;#39;
# Use oem as /vendor
apply_commit 796ff85b93d28a301cce7bd6b3e0852a35180e04

popd
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This piece of code could be simplified as:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;cd device/sony/tone

git fetch https://git.ix5.org/felix/device-sony-tone \
  &amp;#39;disable-verity-no-forceencrypt&amp;#39;
# Change forceencrypt to encryptable for userdata
git cherry-pick af592265685fddf24100cbc1fdcdcb5bfd2260c1
# Disable dm-verity
git cherry-pick b611c8d91a374f246be393d89f20bbf3fc2ab9f7

git fetch https://git.ix5.org/felix/device-sony-tone \
   &amp;#39;treble-odm-3&amp;#39;\
# Use oem as /vendor
git cherry-pick 796ff85b93d28a301cce7bd6b3e0852a35180e04
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;So it enters the &lt;code&gt;device/sony/tone&lt;/code&gt; repository, fetches several branches from
the ix5 git repos and applies the needed commits.&lt;/p&gt;
&lt;p&gt;For example, the treble patches for tone devices:
&lt;a href=&#34;https://git.ix5.org/felix/device-sony-tone/commits/branch/treble-odm-3&#34;&gt;branch&lt;/a&gt; -
&lt;a href=&#34;https://git.ix5.org/felix/device-sony-tone/commit/796ff85b93d28a301cce7bd6b3e0852a35180e04&#34;&gt;Use oem as vendor&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This patch modifies the &lt;code&gt;fstab&lt;/code&gt; file used to mount partitions by Android, sets
the size of the fake &lt;code&gt;vendor&lt;/code&gt; partition to the size of the real &lt;code&gt;oem&lt;/code&gt; partition,
sets &lt;code&gt;TARGET_COPY_OUT_VENDOR&lt;/code&gt; and checks whether &lt;code&gt;PRODUCT_FAKE_TREBLE_BUILD&lt;/code&gt; is
set.&lt;/p&gt;
&lt;h3 id=&#34;another-example&#34;&gt;Another example&lt;/h3&gt;
&lt;p&gt;Same for the needed &lt;code&gt;dtsi&lt;/code&gt; changes:
&lt;a href=&#34;https://git.ix5.org/felix/ix5_repo_update/src/commit/2134e86de59f0e4519428d82270715064365f7e6/treble_repo_update.sh#L76&#34;&gt;treble_repo_update&lt;/a&gt; -
&lt;a href=&#34;https://git.ix5.org/felix/ix5_repo_update/src/commit/2134e86de59f0e4519428d82270715064365f7e6/patches/dtsi-tone-conjure-oem-into-vendor.patch&#34;&gt;dtsi: Conjure oem into vendor&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This changes the early-mount arguments so that the kernel treats the &lt;code&gt;oem&lt;/code&gt;
partition correctly on early bootup.&lt;/p&gt;
&lt;h3 id=&#34;more&#34;&gt;More&lt;/h3&gt;
&lt;p&gt;This same methodology applies to the rest of the needed commits. Should they be
out of date, please fetch them, resolve the git conflicts yourself, and maybe
send a pull request so that others might benefit.&lt;/p&gt;
&lt;h2 id=&#34;not-a-lawyer&#34;&gt;Not a Lawyer&lt;/h2&gt;
&lt;p&gt;You should decide for youself whether this approach falls within the purview of
the blobs EULA. In the EU, you might have some more rights than in other areas
so some passages of the following might be void, but I&amp;rsquo;ve highlighted the
relevant parts of the EULA below:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2. END USER RIGHTS AND USE.&lt;/strong&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Sony Mobile grants You non-exclusive, non-transferable end-user copyright
rights to download the Software on the local hard disk(s) or other permanent
storage media of one computer and install the Software, by using the Fastboot
Protocol, on a single Sony Mobile device with an unlocked boot loader at a
time. Except as provided by any Open Source License Terms, You may use the
Software only for the sole purpose of testing and validating Your own
applications and/or content (“Purpose”). [&amp;hellip;]&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;3. LIMITATIONS ON END USER RIGHTS.&lt;/strong&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;a) You may not use (other than as expressly permitted for the Purpose),
modify, translate, reproduce, or transfer the right to use the Software or
copy the Software. You may not use the Software for any reason other than the
Purpose.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div class=&#34;footnotes&#34; role=&#34;doc-endnotes&#34;&gt;
&lt;hr&gt;
&lt;ol&gt;
&lt;li id=&#34;fn:1&#34;&gt;
&lt;p&gt;For more info, see
&lt;a href=&#34;https://source.android.com/devices/bootloader/partitions-images#sparse-image-format&#34;&gt;source.android.com&lt;/a&gt;
or search for &amp;ldquo;Sparse Image&amp;rdquo;.&amp;#160;&lt;a href=&#34;#fnref:1&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id=&#34;fn:2&#34;&gt;
&lt;p&gt;You should already have the tool in
&lt;code&gt;out/host/linux-x86/bin/simg2img&lt;/code&gt; as well.&amp;#160;&lt;a href=&#34;#fnref:2&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id=&#34;fn:3&#34;&gt;
&lt;p&gt;You also use &lt;code&gt;udisksctl&lt;/code&gt; to mount the image:
&lt;code&gt;udisksctl loop-setup -r -f swbins-unsparse.img&lt;/code&gt;&amp;#160;&lt;a href=&#34;#fnref:3&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id=&#34;fn:4&#34;&gt;
&lt;p&gt;Android&amp;rsquo;s metalava takes up enormous amounts of RAM. It attempts to
verify the whole Android API at once and is badly designed.&amp;#160;&lt;a href=&#34;#fnref:4&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
</description>
    </item>
    
    <item>
      <title>SELinux</title>
      <link>https://sx.ix5.org/info/selinux/</link>
      <pubDate>Sat, 08 Dec 2018 22:15:22 +0200</pubDate>
      
      <guid>https://sx.ix5.org/info/selinux/</guid>
      <description>&lt;p&gt;&lt;em&gt;Sorry this is such a mess, this is more of a braindump&amp;hellip;&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;!-- TODO: Rewrite this to just be a dense reference, point to indiviual articles and --&gt;
&lt;!-- https://selinuxproject.org/ --&gt;
&lt;h2 id=&#34;general&#34;&gt;General&lt;/h2&gt;
&lt;p&gt;(from &lt;a href=&#34;https://wiki.aalto.fi/download/attachments/100218155/SEAndroid-Aalto.pdf?version=1&amp;amp;modificationDate=1425973622725&amp;amp;api=v2&#34;&gt;SEAndroid-Aalto presentation&lt;/a&gt;):&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Subjects are primarily processes. Processes that participate in the access
control are assigned a domain&lt;/p&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;Objects are e.g. files, sockets.. Objects that participate in the access
control are assigned a type&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt; X          N        allow   M                 Y
subjects   domains   rules  types          objects
                                 --------------[]
                                /      --------[]
[]---\        /-------------[]---- ---/--------[]
[]    ------[]------/-------[]--- ---/---------[]
[]----------[]\----/--------[]-\----/----------[]
[]      /  -[]-\------------[]--\--------------[]
[]-----/  /   \ \              \/\             []
[]       /     \------------[]--\-\------------[]
[]------/-                       --\-----------[]
                                    -----------[]
&lt;/code&gt;&lt;/pre&gt;&lt;blockquote&gt;
&lt;p&gt;An object is always an OS primitive of some sort. This is not a policy issue,
this is reality. An object therefore belongs to one or more classes which are
predefined by the system proper. A class can be e.g. file, socket, character
device, &amp;hellip;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;Objects   Classes      Permissions
[]--           /-----------[]
[]--\-------[]-------------[]
[]-/          \------------[]
[]-
&lt;/code&gt;&lt;/pre&gt;&lt;blockquote&gt;
&lt;p&gt;A class is associated with a fixed set of permissions (e.g read, write,
open..), often closely mapped to system call functionality. Again, the set of
available permission is predefined, policy does not change that But! An allow
rule includes also the class, and within that the permissions allowed by the
rule. Class and permission names are ”well known” as defined by NSA / SELinux&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;In general: &lt;code&gt;allow [domain] [type] : [class] {[ allowed permissions ]}&lt;/code&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;[domain]&lt;/code&gt;: Subject(a process in a domain)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;[type]&lt;/code&gt;: Object(a file or other resource)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;[class]&lt;/code&gt;: Resource class(from predefined set)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;[allowed_permissions]&lt;/code&gt;: Class-specific permissions that are allowed by this
rule&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;testing&#34;&gt;Testing&lt;/h2&gt;
&lt;!-- TODO: Expand testing tools info, e.g. sesearch, matchpathcon(and its gotchas for --&gt;
&lt;!-- selecting policy path!!!!) --&gt;
&lt;p&gt;Install needed tools for the host machine:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;apt install setools python-networkx policycoreutils
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;strong&gt;Testing it out:&lt;/strong&gt; either &lt;code&gt;mka selinux_policy&lt;/code&gt; or &lt;code&gt;make bootimage&lt;/code&gt;
But to only check if the policy is valid: &lt;code&gt;make -j $(nproc) sepolicy_tests&lt;/code&gt;!&lt;/p&gt;
&lt;h1 id=&#34;misc&#34;&gt;Misc&lt;/h1&gt;
&lt;p&gt;Directories:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;system/sepolicy&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;device/sony/sepolicy&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;device/sony/&amp;lt;platform&amp;gt;/sepolicy_platform&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;system/bt/vendor_libs/linux/sepolicy&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;system/extras/boottime_tools/bootio/sepolicy&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&amp;hellip;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;file_contexts&lt;/code&gt;(&amp;ldquo;real&amp;rdquo; files, but not necessarily limited to that),
&lt;code&gt;genfs_contexts&lt;/code&gt;(&amp;ldquo;generated&amp;rdquo; files) -&amp;gt; contexts need to exist!&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;property_contexts&lt;/code&gt; -&amp;gt; always need a corresponding type in &lt;code&gt;property.te&lt;/code&gt;!&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;!--
TODO:
- Sepolicy macros
- Interaction with closed-source &#34;secure&#34; stuff, `rild`
- Apps, services, files, binaries
- How to read denials
- Where to look for reference (marlin, crosshatch, crosshatch-sepolicy),
  permalinks to indiviual lines of policy
- Things that can be left as-is (via `dontaudit`)
--&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;PRODUCT_FULL_TREBLE_OVERRIDE := false
BOARD_USE_ENFORCING_SELINUX := true
&lt;/code&gt;&lt;/pre&gt;&lt;!-- Ideally, we would like the Qualcomm blobs to function as vndbinder/vndservice --&gt;
&lt;!-- programs so that we can declare `BOARD_FULL_TREBLE_OVERRIDE`(?). --&gt;
&lt;p&gt;Treble and changes from Oreo to Pie
&lt;code&gt;binder_in_vendor_violators&lt;/code&gt; etc&lt;/p&gt;
&lt;p&gt;&lt;code&gt;binder&lt;/code&gt;, &lt;code&gt;hwbinder&lt;/code&gt;, &lt;code&gt;vndbinder&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Cleaning commands:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;rm out/target/product/kagura/obj/ETC/*sepolicy* -r
find out/target/product/kagura/ -iname &amp;#34;*sepolicy*&amp;#34; -exec rm -rv {} \;
find out/target/product/kagura/ -iname &amp;#34;*selin*&amp;#34; -exec rm -rv {} \;
find out/target/product/kagura/ -iname &amp;#34;*file_context*&amp;#34; -exec rm -rv {} \;
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://stackoverflow.com/questions/33779286/selinux-policy-definition-for-android-system-service-how-to-setup&#34;&gt;https://stackoverflow.com/questions/33779286/selinux-policy-definition-for-android-system-service-how-to-setup&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://www.all-things-android.com/content/understanding-se-android-policy-files&#34;&gt;https://www.all-things-android.com/content/understanding-se-android-policy-files&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://android.stackexchange.com/questions/120061/how-selinux-protects-android-from-rooting&#34;&gt;https://android.stackexchange.com/questions/120061/how-selinux-protects-android-from-rooting&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://www.whitewinterwolf.com/posts/2016/08/15/examine-android-selinux-policy/&#34;&gt;https://www.whitewinterwolf.com/posts/2016/08/15/examine-android-selinux-policy/&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://serverfault.com/questions/521078/how-can-i-query-for-all-selinux-rules-default-file-contexts-etc-affecting-a-type&#34;&gt;https://serverfault.com/questions/521078/how-can-i-query-for-all-selinux-rules-default-file-contexts-etc-affecting-a-type&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://selinuxproject.org/page/ObjectClassesPerms&#34;&gt;https://selinuxproject.org/page/ObjectClassesPerms&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://selinuxproject.org/page/PolicyLanguage&#34;&gt;https://selinuxproject.org/page/PolicyLanguage&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://selinuxproject.org/page/AVCRules&#34;&gt;https://selinuxproject.org/page/AVCRules&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://selinuxproject.org/page/XpermRules&#34;&gt;https://selinuxproject.org/page/XpermRules&lt;/a&gt; (allowxperm etc, important for
defining ioctls!)&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Tips:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;restorecon -R /path&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ls -Z /path&lt;/code&gt; or &lt;code&gt;ls -Z /path/file&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ps -AZ&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Always try to find out what the macros mean!
Check &lt;code&gt;system/sepolicy/pulic/{te_macros,global_macros}&lt;/code&gt; and any file you might
find that explains a thing that does not fall within the standard
&lt;code&gt;rule_name source_type target_type : class perm_set;&lt;/code&gt; schema.
Especially &lt;code&gt;binder_use()&lt;/code&gt; and similar macros pull in &lt;code&gt;neverallow&lt;/code&gt;s and things
you might not expect.&lt;/li&gt;
&lt;li&gt;Have a copy of the &lt;code&gt;te_macros&lt;/code&gt; and &lt;code&gt;global_macros&lt;/code&gt; printed out!&lt;/li&gt;
&lt;li&gt;&lt;code&gt;load_policy&lt;/code&gt; to reload policy on device&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sesearch&lt;/code&gt; and &lt;code&gt;seinfo&lt;/code&gt; tools to examine policy(must be installed on host, not
available on standard android device)&lt;/li&gt;
&lt;li&gt;Check paths with &lt;code&gt;matchpathcon -P &amp;lt;policy file dir&amp;gt; -f &amp;lt;file_contexts_file&amp;gt; /my/path&lt;/code&gt; (&lt;strong&gt;Important:&lt;/strong&gt; &lt;code&gt;-P&lt;/code&gt; needs to point to the &lt;em&gt;directory&lt;/em&gt; containing
the &lt;code&gt;policy&lt;/code&gt; file, not the policy file itself!)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Examples:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://android.googlesource.com/device/google/marlin/+/android-9.0.0_r21/sepolicy/&#34;&gt;https://android.googlesource.com/device/google/marlin/+/android-9.0.0_r21/sepolicy/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://android.googlesource.com/device/google/crosshatch-sepolicy/+/android-9.0.0_r21&#34;&gt;https://android.googlesource.com/device/google/crosshatch-sepolicy/+/android-9.0.0_r21&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Different app levels:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;seapp_contexts&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;platform_app.te&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;service_contexts&lt;/code&gt;, &lt;code&gt;hwservice_contexts&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;From domain.te:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Only &lt;code&gt;service_manager_types&lt;/code&gt; can be added to &lt;code&gt;service_manager&lt;/code&gt;&lt;br&gt;
&lt;code&gt;# TODO: rework this:&lt;/code&gt;&lt;br&gt;
&lt;code&gt;neverallow * ~service_manager_type:service_manager { add find };&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;From init.te:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Init never adds or uses services via &lt;code&gt;service_manager&lt;/code&gt;&lt;br&gt;
&lt;code&gt;neverallow init service_manager_type:service_manager { add find };&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;!-- TODO: Make this example more clear --&gt;
&lt;p&gt;Or own domain via own &lt;code&gt;myapp.te&lt;/code&gt;, with:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;type myapp, domain;
type myapp_exec, exec_type, vendor_file_type, file_type;

init_daemon_domain(myapp);
add_service(myapp, qcrilam_service)

typeattribute myapp binder_in_vendor_violators;
binder_use(myapp)

allow myapp_service self:hwservice_manager find;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;(for more, see
&lt;a href=&#34;https://stackoverflow.com/questions/28914215/is-it-possible-to-use-the-package-name-as-the-domain-name-in-android-selinux&#34;&gt;https://stackoverflow.com/questions/28914215/is-it-possible-to-use-the-package-name-as-the-domain-name-in-android-selinux&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;Have a look at &lt;code&gt;system/sepolicy/public/te_macros&lt;/code&gt;,
&lt;code&gt;system/sepolicy/public/global_macros&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Google&amp;rsquo;s guides:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://source.android.com/security/selinux/customize&#34;&gt;https://source.android.com/security/selinux/customize&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://source.android.com/security/selinux/implement&#34;&gt;https://source.android.com/security/selinux/implement&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;gotchas&#34;&gt;Gotchas&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Confusing domains, types vs attributes(?), labels, objects, contexts, &amp;hellip;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;service_manager&lt;/code&gt; (from &lt;code&gt;add_service(domain, service)&lt;/code&gt;) vs &lt;code&gt;servicemanager&lt;/code&gt;
(from &lt;code&gt;binder_use(domain)&lt;/code&gt;). Yes, this is extremely confusing!&lt;/li&gt;
&lt;li&gt;Confusing public/vendor and private policy folders/&amp;ldquo;APIs&amp;rdquo;&lt;/li&gt;
&lt;li&gt;Confusing objects(mostly files) and running subjects like &amp;ldquo;apps&amp;rdquo;(the Java
ones) or &amp;ldquo;services&amp;rdquo;(mostly C binaries that run from /system/bin or
/vendor/bin, but can also be Java apps OR HAL/HIDL implementations)&lt;/li&gt;
&lt;li&gt;Things can be active(searching/finding something) or passive(being labeled
something and then being interacted with). Attributes are mostly passive,
while subjects and their actions are active.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;seapp&#34;&gt;seapp&lt;/h2&gt;
&lt;p&gt;Is &lt;code&gt;seapp_contexts&lt;/code&gt; a labeling mechanism? Or a sanity check through neverallows?
Can you leave out everything apart from &lt;code&gt;name=com.my.app&lt;/code&gt;?&lt;/p&gt;
&lt;p&gt;&lt;code&gt;seinfo&lt;/code&gt; is mainly used to enforce signing requirements, e.g. you have
&lt;code&gt;mac_permissions.xml&lt;/code&gt;(MAC = Mandatory Access Control) that specifies that
anything with &lt;code&gt;seinfo=platform&lt;/code&gt; has to be signed by the platform key:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;lt;?xml version=&amp;#34;1.0&amp;#34; encoding=&amp;#34;utf-8&amp;#34;?&amp;gt;&amp;lt;policy&amp;gt;
[...]
&amp;lt;!-- Platform dev key in AOSP --&amp;gt;
&amp;lt;signer signature=&amp;#34;@PLATFORM&amp;#34; &amp;gt;
  &amp;lt;seinfo value=&amp;#34;platform&amp;#34; /&amp;gt;
&amp;lt;/signer&amp;gt;
&amp;lt;/policy&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;taming-a-service-qcrilam&#34;&gt;Taming a service: QcRilAm&lt;/h2&gt;
&lt;!-- TODO: Changeme to reflect changed seapp_contexts version where we changed
qcrilam to a priv-app! --&gt;
&lt;!-- Or maybe even better, move this into the SELinux article series instead, maybe --&gt;
&lt;!-- part 3 --&gt;
&lt;p&gt;&lt;strong&gt;THIS IS OUT OF DATE!&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;QcRilAm is our own little app/service that proxies requests from rild to
&lt;code&gt;android.hardware.radio.am&lt;/code&gt;. It was written by oshmoun and is needed to get
in-call audio to work.
It consists of two parts: One HIDL implementation and one Java app that acts as
a service. The two talk via binder.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;# Establish vnd_qcril_audio_hwservice
# hwservice_contexts
vendor.qti.hardware.radio.am::IQcRilAudio           u:object_r:vnd_qcril_audio_hwservice:s0
vendor.qti.hardware.radio.am::IQcRilAudioCallback   u:object_r:vnd_qcril_audio_hwservice:s0
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The HIDL service(called &lt;code&gt;vendor.qti.hardware.radio.am&lt;/code&gt;) gets accessed by &lt;code&gt;rild&lt;/code&gt; via
hwbinder calls(since it is a &lt;code&gt;hardware&lt;/code&gt; service).&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;# Allow rild to access vendor.qti.hardware.radio.am HIDL services
# rild.te
hwbinder_use(rild)
add_hwservice(rild, vnd_qcril_audio_hwservice)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The persistent android service part of QcRilAm is a java app that will also
appear in a user&amp;rsquo;s app listing called &lt;code&gt;com.sony.qcrilam&lt;/code&gt;. It only serves to run
its one service called &lt;code&gt;com.sony.qcrilam.QcRilAmService&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Right now, it appears in the process list as a &lt;code&gt;platform_app&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;$ ps -AZ | grep qcrilam
u:r:platform_app:s0:c512,c768  u0_a62        2045   585 3685212  80452 SyS_epoll_wait      0 S com.sony.qcrilam
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To use a more restricted and thus safer domain:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;# Assign com.sony.qcrilam.QcRilAmService a domain
# service_contexts
com.sony.qcrilam.QcRilAmService         u:object_r:qcrilam_service:s0
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;But wait! We need to define what a &lt;code&gt;qcrilam_service&lt;/code&gt; is first!&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;# service.te
type qcrilam_service, service_manager_type;
&lt;/code&gt;&lt;/pre&gt;&lt;!-- TODO: vndservice!!! --&gt;
&lt;p&gt;Same goes for &lt;code&gt;vnd_qcril_audio_hwservice&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;# hwservice.te
type vnd_qcril_audio_hwservice,    hwservice_manager_type;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Alright, now we need to assign &lt;code&gt;qcrilam_service&lt;/code&gt; to a domain. We could borrow from
an already existing one, but AOSP doesn&amp;rsquo;t quite provide one that suits us.
So we create our own:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;# qcrilam.te
type qcrilam, domain;
add_service(qcrilam, qcrilam_service)
# the add_service() macro is equivalent to this:
#allow qcrilam qcrilam_service:service_manager { add find };
# TODO: Not needed with vnd change!
#typeattribute qcrilam binder_in_vendor_violators;
#binder_use(qcrilam_service)
vndbinder_use(qcrilam_service)
binder_call(qcrilam, vnd_qcril_audio_hwservice)
&lt;/code&gt;&lt;/pre&gt;&lt;!-- TODO: This is out of date! --&gt;
&lt;p&gt;&lt;code&gt;com.sony.qcrilam&lt;/code&gt; got assigned the &lt;code&gt;platform_app&lt;/code&gt; label by SELinux
automatically. This is a very high privilege level, as opposed to
&lt;code&gt;untrusted_app&lt;/code&gt; contexts. We want qcrilam to find its HIDL cousin via
hwservicemanager in addition to being able to call them via binder:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;# platform_app.te
allow platform_app vnd_qcril_audio_hwservice:hwservice_manager find;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;A final thing to keep in mind is that &lt;code&gt;rild&lt;/code&gt; is very greedy with permissions.
Modems are a black box we have to contend with. Allow platform apps to talk to
rild via binder and vice versa:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;# rild.te
binder_call(platform_app, rild);
binder_call(rild, platform_app);
&lt;/code&gt;&lt;/pre&gt;&lt;h1 id=&#34;wrapping-up&#34;&gt;Wrapping up&lt;/h1&gt;
&lt;p&gt;Something to keep in mind is: You are only allowing or disallowing things, not
influencing the flow of programs&lt;sup id=&#34;fnref:1&#34;&gt;&lt;a href=&#34;#fn:1&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt;. Even if te macros can look like little
function statements, they only dictate what gets allowed, not how a program
behaves.&lt;/p&gt;
&lt;div class=&#34;footnotes&#34; role=&#34;doc-endnotes&#34;&gt;
&lt;hr&gt;
&lt;ol&gt;
&lt;li id=&#34;fn:1&#34;&gt;
&lt;p&gt;Ok that one is not 100% correct, some programs will try to do things and when they get denied switch to a different strategy. But in general, you will not incluence control flow much with sepolicy.&amp;#160;&lt;a href=&#34;#fnref:1&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
</description>
    </item>
    
    <item>
      <title>DRAFT: Kernel Compilation</title>
      <link>https://sx.ix5.org/info/kernel-compilation/</link>
      <pubDate>Sat, 20 Jun 2020 21:24:31 +0200</pubDate>
      
      <guid>https://sx.ix5.org/info/kernel-compilation/</guid>
      <description>&lt;p&gt;Sony link: &lt;a href=&#34;https://developer.sony.com/develop/open-devices/guides/kernel-compilation-guides/how-to-build-and-flash-a-linux-kernel-for-aosp-supported-devices#AutoLinuxKernel&#34;&gt;How to build and flash a Linux Kernel for AOSP&lt;/a&gt;&lt;/p&gt;
&lt;!--
TODO:
- Remove 4.8 GCC info
- Remove automatic AOSP build kernel section, not supported on Q+
--&gt;
&lt;h3 id=&#34;unlock-bootloader&#34;&gt;Unlock bootloader&lt;/h3&gt;
&lt;p&gt;See &lt;a href=&#34;https://developer.sony.com/develop/open-devices/get-started/unlock-bootloader&#34;&gt;Unlock Bootloader&lt;/a&gt; on sony.com&lt;/p&gt;
&lt;h3 id=&#34;download-cross-compiler&#34;&gt;Download cross compiler&lt;/h3&gt;
&lt;p&gt;Linaro or clang&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Clang:&lt;/strong&gt;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;git clone https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86 -b android-10.0.0_r39 clang-linux-x86
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;strong&gt;Linaro GCC:&lt;/strong&gt;
Download&lt;/p&gt;
&lt;!-- TODO: Use linux releases, not mingw --&gt;
&lt;p&gt;&lt;code&gt;gcc-arm-9.2-2019.12-mingw-w64-i686-arm-none-linux-gnueabihf.tar.xz&lt;/code&gt;
and
&lt;code&gt;gcc-arm-9.2-2019.12-mingw-w64-i686-aarch64-none-linux-gnu.tar.xz&lt;/code&gt;
from the &lt;a href=&#34;https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-a/downloads&#34;&gt;ARM website&lt;/a&gt;, extract the files.&lt;/p&gt;
&lt;!--
Linaro: Download `gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu.tar.xz` from [releases.linaro.org][linaro].
--&gt;
&lt;h3 id=&#34;export-cross-compiler&#34;&gt;Export cross compiler&lt;/h3&gt;
&lt;!-- TODO: Fix linaro link, clang git clone, set clang version per Android level --&gt;
&lt;p&gt;Linaro GCC:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;export CROSS_COMPILE=&amp;lt;android-dir&amp;gt;/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-
export CROSS_COMPILE_ARM32=&amp;lt;android-dir&amp;gt;/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;For clang:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;export CC=clang-linux-x86/clang-r353983c1/bin
export CLANG_TRIPLE=aarch64-linux-gnu
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;download-kernel-source&#34;&gt;Download kernel source&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;git clone https://github.com/sonyxperiadev/kernel
cd kernel
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Also techpack/audio, data-kernel, wifi modules&lt;/p&gt;
&lt;h3 id=&#34;identify-defconfig&#34;&gt;Identify defconfig&lt;/h3&gt;
&lt;p&gt;The defconfig &lt;code&gt;name&lt;/code&gt; is constructed using this schema:
&lt;code&gt;aosp_&amp;lt;platform&amp;gt;_&amp;lt;codename&amp;gt;_defconfig&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;As for the &lt;code&gt;codename&lt;/code&gt;, search the
&lt;a href=&#34;https://sx.ix5.org/info/sony-devices/&#34;&gt;Sony Devices overview&lt;/a&gt; for the device &lt;code&gt;Code name&lt;/code&gt;, e.g. &lt;code&gt;kagura&lt;/code&gt; for the Xperia XZ.&lt;/p&gt;
&lt;p&gt;For &lt;code&gt;platform&lt;/code&gt;, use the &amp;ldquo;board&amp;rdquo; name, e.g. &lt;code&gt;tone&lt;/code&gt; for Xperia XZ.&lt;/p&gt;
&lt;p&gt;So, Xperia XZ becomes &lt;code&gt;aosp_tone_kagura_defconfig&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;For easier reference, here&amp;rsquo;s an overview:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Device name&lt;/th&gt;
&lt;th&gt;defconfig&lt;/th&gt;
&lt;th&gt;DTBO&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Xperia X&lt;/td&gt;
&lt;td&gt;&lt;code&gt;aosp_loire_suzu_defconfig&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;false&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Xperia X Compact&lt;/td&gt;
&lt;td&gt;&lt;code&gt;aosp_loire_kugo_defconfig&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;false&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Xperia Touch&lt;/td&gt;
&lt;td&gt;&lt;code&gt;aosp_loire_blanc_defconfig&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;false&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Xperia X Performance&lt;/td&gt;
&lt;td&gt;&lt;code&gt;aosp_tone_dora_defconfig&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;false&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Xperia XZ&lt;/td&gt;
&lt;td&gt;&lt;code&gt;aosp_tone_kagura_defconfig&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;false&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Xperia XZs&lt;/td&gt;
&lt;td&gt;&lt;code&gt;aosp_tone_keyaki_defconfig&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;false&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Xperia XZ Premium&lt;/td&gt;
&lt;td&gt;&lt;code&gt;aosp_yoshino_maple_defconfig&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;false&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Xperia XZ1&lt;/td&gt;
&lt;td&gt;&lt;code&gt;aosp_yoshino_poplar_defconfig&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;false&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Xperia XZ1 Compact&lt;/td&gt;
&lt;td&gt;&lt;code&gt;aosp_yoshino_lilac_defconfig&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;false&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Xperia XA2&lt;/td&gt;
&lt;td&gt;&lt;code&gt;aosp_nile_pioneer_defconfig&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;false&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Xperia XA2 Ultra&lt;/td&gt;
&lt;td&gt;&lt;code&gt;aosp_nile_discovery_defconfig&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;false&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Xperia XA2 Plus&lt;/td&gt;
&lt;td&gt;&lt;code&gt;aosp_nile_voyager_defconfig&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;false&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Xperia XZ2&lt;/td&gt;
&lt;td&gt;&lt;code&gt;aosp_tama_akari_defconfig&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;true&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Xperia XZ2 Compact&lt;/td&gt;
&lt;td&gt;&lt;code&gt;aosp_tama_apollo_defconfig&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;true&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Xperia XZ3&lt;/td&gt;
&lt;td&gt;&lt;code&gt;aosp_tama_akatsuki_defconfig&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;true&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Xperia 10&lt;/td&gt;
&lt;td&gt;&lt;code&gt;aosp_ganges_kirin_defconfig&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;true&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Xperia 10 Plus&lt;/td&gt;
&lt;td&gt;&lt;code&gt;aosp_ganges_mermaid_defconfig&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;true&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Xperia 1&lt;/td&gt;
&lt;td&gt;&lt;code&gt;aosp_kumano_griffin_defconfig&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;true&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Xperia 5&lt;/td&gt;
&lt;td&gt;&lt;code&gt;aosp_kumano_bahamut_defconfig&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;true&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Xperia 10 II&lt;/td&gt;
&lt;td&gt;&lt;code&gt;aosp_seine_pdx201_defconfig&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;true&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3 id=&#34;configure-kernel&#34;&gt;Configure kernel&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;make ARCH=arm64 CROSS_COMPILE=$CROSS_COMPILE CROSS_COMPILE_ARM32=$CROSS_COMPILE_ARM32 &amp;lt;device_defconfig&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;For clang:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;make ARCH=arm64 CC=$CC CLANG_TRIPLE=$CLANG_TRIPLE CROSS_COMPILE=$CROSS_COMPILE CROSS_COMPILE_ARM32=$CROSS_COMPILE_ARM32 &amp;lt;device_defconfig&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;build-kernel&#34;&gt;Build kernel&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;make \
  ARCH=arm64 \
  CROSS_COMPILE=$CROSS_COMPILE \
  CROSS_COMPILE_ARM32=$CROSS_COMPILE_ARM32 \
  -j $(nproc)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;For clang:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;make \
  ARCH=arm64 \
  CC=$CC \
  CLANG_TRIPLE=$CLANG_TRIPLE \
  CROSS_COMPILE=$CROSS_COMPILE \
  CROSS_COMPILE_ARM32=$CROSS_COMPILE_ARM32 \
  -j $(nproc)
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;copy-kernel-and-dtbo&#34;&gt;Copy kernel and dtbo&lt;/h3&gt;
&lt;h4 id=&#34;devices-with-appended-dtb&#34;&gt;Devices with appended DTB&lt;/h4&gt;
&lt;p&gt;Copy &lt;code&gt;&amp;lt;kernel&amp;gt;/arch/arm64/boot/Image.gz-dtb&lt;/code&gt; to
&lt;code&gt;&amp;lt;android-dir&amp;gt;/kernel/sony/msm-4.14/common-kernel/kernel-dtb-&amp;lt;device&amp;gt;&lt;/code&gt;.&lt;/p&gt;
&lt;h4 id=&#34;dtbo-devices&#34;&gt;DTBO devices&lt;/h4&gt;
&lt;p&gt;Copy &lt;code&gt;&amp;lt;kernel&amp;gt;/arch/arm64/boot/Image.gz&lt;/code&gt; to
&lt;code&gt;&amp;lt;android-dir&amp;gt;/kernel/sony/msm-4.14/common-kernel/kernel-dtb-&amp;lt;device&amp;gt;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Then, build &lt;code&gt;mkdtimg&lt;/code&gt; from inside your Android tree and run it:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;export MKDTIMG=&amp;lt;android-dir&amp;gt;/out/host/linux-x86/bin/mkdtimg
$MKDTIMG create &amp;lt;android-dir&amp;gt;kernel/sony/msm-4.14/common-kernel/dtbo-&amp;lt;device&amp;gt;.img \
  `find &amp;lt;kernel-dir&amp;gt;/arch/arm64/boot/dts -name &amp;#34;*.dtbo&amp;#34;`
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;build-bootimage-and-dtboimage&#34;&gt;Build bootimage and dtboimage&lt;/h3&gt;
&lt;p&gt;Navigate into top-level Android directory.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;source build/envsetup.sh &amp;amp;&amp;amp; lunch
make -j $(nproc) bootimage
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The DTBO image will be generated automatically when building boot image.&lt;/p&gt;
&lt;p&gt;See also: Marijn&amp;rsquo;s &lt;a href=&#34;https://github.com/MarijnS95/oot&#34;&gt;oot script&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;See also: &lt;a href=&#34;https://sx.ix5.org/info/handling-android-images/&#34;&gt;Handling Android Images&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;download-fastboot&#34;&gt;Download fastboot&lt;/h3&gt;
&lt;p&gt;On Linux: Install fastboot package&lt;/p&gt;
&lt;p&gt;On Windows: Link to drivers&lt;/p&gt;
&lt;h3 id=&#34;flash-via-fastboot&#34;&gt;Flash via fastboot&lt;/h3&gt;
&lt;p&gt;Make sure the current slot is correct:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;$ fastboot getvar current-slot
-&amp;gt; &amp;#34;a&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Else, set it:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;fastboot set_active a
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Then, flash images:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;fastboot flash boot out/target/product/&amp;lt;device&amp;gt;/boot.img
# For DTBO devices:
fastboot flash dtbo out/target/product/&amp;lt;device&amp;gt;/dtbo.img
&lt;/code&gt;&lt;/pre&gt;&lt;!--
TODO: Logical partitions? avoid fastbootd
--&gt;
&lt;p&gt;Finally:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;fastboot reboot
&lt;/code&gt;&lt;/pre&gt;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;# https://t.me/PixelExperienceSony/34425
#!/bin/bash

export ANDROID_ROOT=/home/kgvarunkanth/kgv/arrow
export KERNEL_TOP=$ANDROID_ROOT/kernel/sony/msm-4.14
export KERNEL_TMP=$ANDROID_ROOT/out/kernel-4.14
export CC=$ANDROID_ROOT/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/
export CC32=$ANDROID_ROOT/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/bin/
export CLANG=$ANDROID_ROOT/prebuilts/clang/host/linux-x86/clang-r353983c/bin/
export PATH=$CC:$CC32:$CLANG:$PATH
rm -rf $KERNEL_TMP
make O=$KERNEL_TMP clean
make O=$KERNEL_TMP mrproper
make O=$KERNEL_TMP ARCH=arm64 aosp_yoshino_maple_defconfig
make O=$KERNEL_TMP ARCH=arm64 CC=clang CLANG_TRIPLE=aarch64-linux-gnu- CROSS_COMPILE=aarch64-linux-android- CROSS_COMPILE_ARM32=arm-linux-androideabi- -j1
&lt;/code&gt;&lt;/pre&gt;</description>
    </item>
    
    <item>
      <title>Android Init Stages</title>
      <link>https://sx.ix5.org/info/android-init-stages/</link>
      <pubDate>Mon, 25 Feb 2019 16:49:06 +0100</pubDate>
      
      <guid>https://sx.ix5.org/info/android-init-stages/</guid>
      <description>&lt;h2 id=&#34;stages&#34;&gt;Stages&lt;/h2&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Init stage&lt;/th&gt;
&lt;th&gt;Contents&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;early-init&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Very first stage of initialization. Used for SELinux and OOM settings&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;init&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Creates file systems, mount points, and writes kernel variables&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;early-fs&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Run just before filesystems are ready to be mounted&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;fs&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Specifies which partitions to load&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;post-fs&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Commands to run after filesystems (other than &lt;code&gt;/data&lt;/code&gt;) are mounted&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;post-fs-data&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;/data&lt;/code&gt; decrypted (if necessary) and mounted&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;early-boot&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Run after property service has been initialized, but before booting rest&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;boot&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Normal boot commands&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;charger&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Commands used when device is in charger mode&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;em&gt;Adapted from Jonathan Levin&amp;rsquo;s excellent
&lt;a href=&#34;http://www.newandroidbook.com/&#34;&gt;Android Internals: A Confectioner&amp;rsquo;s Cookbook&lt;/a&gt;&lt;/em&gt;, chapter 4.&lt;/p&gt;
&lt;h2 id=&#34;classes&#34;&gt;Classes&lt;/h2&gt;
&lt;p&gt;Programs can be started based on init stage triggers:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;service my_service /bin/mysvc
    user system
    group system
    disabled

on boot
    start my_service
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;But it is more common to assign a &lt;code&gt;class&lt;/code&gt; to a service, based on which it is
started:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;service my_service /bin/mysvc
    class core
    user system
    group system
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The service will be started based on &lt;code&gt;class_start core&lt;/code&gt; which happens &lt;code&gt;on boot&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;TODO: Overview of classes&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Class&lt;/th&gt;
&lt;th&gt;Comment&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;core&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Never shut down after restarting&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;main&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Shut down and then restart after the disk password is entered&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;late_start&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Does not start until after /data has been decrypted and mounted&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Trigger&lt;/th&gt;
&lt;th&gt;Classes&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;on charger&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;charger&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;on late-fs&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;early-hal&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;on nonencrypted&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;hal&lt;/code&gt;, &lt;code&gt;core&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;on boot&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;hal&lt;/code&gt;, &lt;code&gt;core&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id=&#34;keywords-selection&#34;&gt;Keywords (selection)&lt;/h2&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Keyword&lt;/th&gt;
&lt;th&gt;Action&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;start&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Starts a service, even when it&amp;rsquo;s disabled&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;class core&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Makes a service part of a group.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;class_start&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Starts a group. Once this group is started, the service is started only if it is enabled (services can be disabled by having &lt;code&gt;disabled&lt;/code&gt; in the service spec, or &lt;code&gt;disable &amp;lt;service&amp;gt;&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;enable&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Allows a service to be started as part of a &lt;code&gt;class_start&lt;/code&gt;. If the class is already started, this&amp;rsquo;ll schedule the service to be started&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;disable&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Prevent a service from being started as part of &lt;code&gt;class_start&lt;/code&gt;. This does not stop the service if it&amp;rsquo;s already running&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id=&#34;changes-with-encryption&#34;&gt;Changes with encryption&lt;/h2&gt;
&lt;p&gt;With the introduction of system-wide encryption into Android, the init process
gains a few more tricks:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;vold.decrypt triggers&lt;/li&gt;
&lt;li&gt;&lt;code&gt;class early_hal&lt;/code&gt; for crucial services needed for decryption, e.g. &lt;code&gt;keymaster&lt;/code&gt;
and &lt;code&gt;gatekeeper&lt;/code&gt; (TODO: Add link to AOSP &lt;code&gt;init.rc&lt;/code&gt; for &lt;code&gt;class_start&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;restarting framework, reboot, minimal UI stuff&lt;/li&gt;
&lt;li&gt;&lt;code&gt;nonencrypted&lt;/code&gt; trigger, which, despite its name, always gets triggered and
which pulls in &lt;code&gt;class_start main&lt;/code&gt; and &lt;code&gt;class_start late_start&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;on property:vold.decrypt=trigger_restart_min_framework
    class_start main

on property:vold.decrypt=trigger_restart_framework
    stop surfaceflinger
    start surfaceflinger
    class_start main
    class_start late_start

on property:vold.decrypt=trigger_shutdown_framework
    class_reset late_start
    class_reset main
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Gone in master/Q: &lt;a href=&#34;https://android-review.googlesource.com/c/platform/system/vold/+/952637&#34;&gt;Stop using trigger_reset_main&lt;/a&gt;&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Sony Devices</title>
      <link>https://sx.ix5.org/info/sony-devices/</link>
      <pubDate>Sun, 10 Feb 2019 21:21:51 +0100</pubDate>
      
      <guid>https://sx.ix5.org/info/sony-devices/</guid>
      <description>&lt;h3 id=&#34;snapdragon-865-devices-edo-board-2020&#34;&gt;Snapdragon 865 devices (edo board, 2020)&lt;/h3&gt;
&lt;p&gt;Internal SoC codename: &lt;code&gt;sm8250&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Platform: &lt;code&gt;edo&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Latest Open Devices Kernel: 4.19&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Device name&lt;/th&gt;
&lt;th&gt;Code name&lt;/th&gt;
&lt;th&gt;Product (SS, DS)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Xperia 1 II&lt;/td&gt;
&lt;td&gt;pdx203&lt;/td&gt;
&lt;td&gt;xqat51, xqat52&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Xperia 5 II&lt;/td&gt;
&lt;td&gt;pdx206&lt;/td&gt;
&lt;td&gt;xqas52&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;strong&gt;Peculiarities:&lt;/strong&gt; &lt;a href=&#34;https://source.android.com/devices/tech/ota/dynamic_partitions&#34;&gt;Dynamic Android Partitions&lt;/a&gt;, A/B,
has DTBO partition.&lt;/p&gt;
&lt;h3 id=&#34;snapdragon-665-devices-seine-board-2020&#34;&gt;Snapdragon 665 devices (seine board, 2020)&lt;/h3&gt;
&lt;p&gt;Internal SoC codename: &lt;code&gt;sdm660&lt;/code&gt;/&lt;code&gt;sm6125&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Platform: &lt;code&gt;seine&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Latest Open Devices Kernel: 4.14&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Device name&lt;/th&gt;
&lt;th&gt;Code name&lt;/th&gt;
&lt;th&gt;Product (SS, DS)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Xperia 10 II&lt;/td&gt;
&lt;td&gt;pdx201&lt;/td&gt;
&lt;td&gt;xqau51, xqau52&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;strong&gt;Peculiarities:&lt;/strong&gt; First platform with &lt;a href=&#34;https://source.android.com/devices/tech/ota/dynamic_partitions&#34;&gt;Dynamic Android Partitions&lt;/a&gt;, A/B,
has DTBO partition.&lt;/p&gt;
&lt;h3 id=&#34;snapdragon-855-devices-kumano-board-2019&#34;&gt;Snapdragon 855 devices (kumano board, 2019)&lt;/h3&gt;
&lt;p&gt;Internal SoC codename: &lt;code&gt;sm8150&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Platform: &lt;code&gt;kumano&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Latest Open Devices Kernel: 4.14&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Device name&lt;/th&gt;
&lt;th&gt;Code name&lt;/th&gt;
&lt;th&gt;Product (SS, DS)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Xperia 1&lt;/td&gt;
&lt;td&gt;Griffin&lt;/td&gt;
&lt;td&gt;j8110, j9110&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Xperia 5&lt;/td&gt;
&lt;td&gt;Bahamut&lt;/td&gt;
&lt;td&gt;j8210, j9210&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;strong&gt;Peculiarities:&lt;/strong&gt; A/B, has DTBO partition.&lt;/p&gt;
&lt;h3 id=&#34;snapdragon-660-devices-ganges-board-2019&#34;&gt;Snapdragon 660 devices (ganges board, 2019)&lt;/h3&gt;
&lt;p&gt;Internal SoC codename: &lt;code&gt;sdm660&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Platform: &lt;code&gt;ganges&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Latest Open Devices Kernel: 4.14&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Device name&lt;/th&gt;
&lt;th&gt;Code name&lt;/th&gt;
&lt;th&gt;Product (SS, DS)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Xperia 10&lt;/td&gt;
&lt;td&gt;Kirin&lt;/td&gt;
&lt;td&gt;i3113, i4113&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Xperia 10 Plus&lt;/td&gt;
&lt;td&gt;Mermaid&lt;/td&gt;
&lt;td&gt;i3213, i4213&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;strong&gt;Peculiarities:&lt;/strong&gt; A/B.&lt;/p&gt;
&lt;h3 id=&#34;snapdragon-845-devices-tama-board-2018&#34;&gt;Snapdragon 845 devices (tama board, 2018)&lt;/h3&gt;
&lt;p&gt;Internal SoC codename: &lt;code&gt;sdm845&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Platform: &lt;code&gt;tama&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Latest Open Devices Kernel: 4.14&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Device name&lt;/th&gt;
&lt;th&gt;Code name&lt;/th&gt;
&lt;th&gt;Product (SS, DS)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Xperia XZ2&lt;/td&gt;
&lt;td&gt;Akari&lt;/td&gt;
&lt;td&gt;h8216, h8266&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Xperia XZ2 Compact&lt;/td&gt;
&lt;td&gt;Apollo&lt;/td&gt;
&lt;td&gt;h8314, h8324&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Xperia XZ3&lt;/td&gt;
&lt;td&gt;Akatsuki&lt;/td&gt;
&lt;td&gt;h8416, h9436&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;strong&gt;Peculiarities:&lt;/strong&gt; A/B, has DTBO partition.&lt;/p&gt;
&lt;h3 id=&#34;snapdragon-630-devices-nile-board-2018&#34;&gt;Snapdragon 630 devices (nile board, 2018)&lt;/h3&gt;
&lt;p&gt;Internal SoC codename: &lt;code&gt;sdm660&lt;/code&gt; (yes, not 630)&lt;/p&gt;
&lt;p&gt;Platform: &lt;code&gt;nile&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Latest Open Devices Kernel: 4.14&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Device name&lt;/th&gt;
&lt;th&gt;Code name&lt;/th&gt;
&lt;th&gt;Product (SS, DS)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Xperia XA2&lt;/td&gt;
&lt;td&gt;Pioneer&lt;/td&gt;
&lt;td&gt;h3113, h4113&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Xperia XA2 Ultra&lt;/td&gt;
&lt;td&gt;Discovery&lt;/td&gt;
&lt;td&gt;h3213, h4213&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Xperia XA2 Plus&lt;/td&gt;
&lt;td&gt;Voyager&lt;/td&gt;
&lt;td&gt;h3413, h4413&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;strong&gt;Peculiarities:&lt;/strong&gt; A/B.&lt;/p&gt;
&lt;h3 id=&#34;snapdragon-835-devices-yoshino-board-2017&#34;&gt;Snapdragon 835 devices (yoshino board, 2017)&lt;/h3&gt;
&lt;p&gt;Internal SoC codename: &lt;code&gt;msm8998&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Platform: &lt;code&gt;yoshino&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Latest Open Devices Kernel: 4.14&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Device name&lt;/th&gt;
&lt;th&gt;Code name&lt;/th&gt;
&lt;th&gt;Product (SS, DS)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Xperia XZ Premium&lt;/td&gt;
&lt;td&gt;Maple&lt;/td&gt;
&lt;td&gt;g8141, g8142&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Xperia XZ1&lt;/td&gt;
&lt;td&gt;Poplar&lt;/td&gt;
&lt;td&gt;g8341, g8342&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Xperia XZ1 Compact&lt;/td&gt;
&lt;td&gt;Lilac&lt;/td&gt;
&lt;td&gt;g8441&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;strong&gt;Peculiarities:&lt;/strong&gt; Separate &lt;code&gt;/vendor&lt;/code&gt; partition on poplar and lilac. No A/B.&lt;/p&gt;
&lt;h3 id=&#34;snapdragon-820-devices-tone-board-2016&#34;&gt;Snapdragon 820 devices (tone board, 2016)&lt;/h3&gt;
&lt;p&gt;Internal SoC codename: &lt;code&gt;msm8996&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Platform: &lt;code&gt;tone&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Latest Open Devices Kernel: 4.9&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Device name&lt;/th&gt;
&lt;th&gt;Code name&lt;/th&gt;
&lt;th&gt;Product (SS, DS)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Xperia X Performance&lt;/td&gt;
&lt;td&gt;Dora&lt;/td&gt;
&lt;td&gt;f8131, f8132&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Xperia XZ&lt;/td&gt;
&lt;td&gt;Kagura&lt;/td&gt;
&lt;td&gt;f8331, f8332&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Xperia XZs&lt;/td&gt;
&lt;td&gt;Keyaki&lt;/td&gt;
&lt;td&gt;g8231, g8232&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;strong&gt;Peculiarities:&lt;/strong&gt; Legacy.&lt;/p&gt;
&lt;h3 id=&#34;snapdragon-650-devices-loire-board-2016&#34;&gt;Snapdragon 650 devices (loire board, 2016)&lt;/h3&gt;
&lt;p&gt;Internal SoC codename: &lt;code&gt;msm8956&lt;/code&gt;, sometimes &lt;code&gt;msm8954&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Platform: &lt;code&gt;loire&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Latest Open Devices Kernel: 4.9&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Device name&lt;/th&gt;
&lt;th&gt;Code name&lt;/th&gt;
&lt;th&gt;Product (SS, DS)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Xperia X&lt;/td&gt;
&lt;td&gt;Suzu&lt;/td&gt;
&lt;td&gt;f5121, f5122&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Xperia X Compact&lt;/td&gt;
&lt;td&gt;Kugo&lt;/td&gt;
&lt;td&gt;f5321&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Xperia Touch&lt;/td&gt;
&lt;td&gt;Blanc&lt;/td&gt;
&lt;td&gt;g1109&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;strong&gt;Peculiarities:&lt;/strong&gt; Legacy.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&#34;basebands&#34;&gt;Basebands&lt;/h2&gt;
&lt;p&gt;See &lt;code&gt;ro.baseband&lt;/code&gt; or &lt;code&gt;ro.boot.baseband&lt;/code&gt;.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;mdm&lt;/code&gt;: External Modem&lt;/li&gt;
&lt;li&gt;&lt;code&gt;msm&lt;/code&gt;/&lt;code&gt;sdm&lt;/code&gt;: Internal Modem&lt;/li&gt;
&lt;li&gt;&lt;code&gt;apq&lt;/code&gt;: No Modem&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&#34;internals&#34;&gt;Internals&lt;/h1&gt;
&lt;h2 id=&#34;accessing-special-modes&#34;&gt;Accessing special modes&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Fastboot&lt;/strong&gt;: Turn off device, then hold volume-up and connect cable. LED will
be blue.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Download mode&lt;/strong&gt;: Turn off device, then hold volume-down and connect cable. LED
will be green.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Recovery&lt;/strong&gt;: Turn off device, then hold volume-down and power button&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Forced reboot&lt;/strong&gt;: Hold volume-up and power until the first vibration&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Forced shut off&lt;/strong&gt; Hold volume-up and power until the second, longer
vibration(pulses three times)&lt;/p&gt;
&lt;h2 id=&#34;device-internals&#34;&gt;Device internals&lt;/h2&gt;
&lt;h3 id=&#34;kagura&#34;&gt;kagura&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;kagura:/ # cat /sys/devices/soc0/soc_id
246
kagura:/ # cat /sys/devices/soc0/revision
3.1
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;strong&gt;Mount pstore:&lt;/strong&gt;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;# Don&amp;#39;t forget the - dash!
mount -t pstore - /sys/fs/pstore
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;strong&gt;Get MCC/MNC:&lt;/strong&gt;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;cat /data/vendor/radio/iccid*
&lt;/code&gt;&lt;/pre&gt;&lt;!-- ## Leds, thermals, sensors --&gt;
&lt;!-- ## Camera --&gt;
&lt;!-- ## Proprietary modules --&gt;
&lt;!-- ## SoC/Qualcomm stuff --&gt;
&lt;!-- ## Firmware --&gt;
&lt;!-- TERM=xterm mono UnSIN.exe file.sin --&gt;
&lt;h2 id=&#34;misc&#34;&gt;Misc&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Mapping device - target:&lt;/strong&gt;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;pdx203    | xqat51, xqat52
pdx206    | xqas52
pdx201    | xqau51, xqau52
griffin   | j8110, j9110
bahamut   | j8210, j9210
kirin     | i3113, i4113
mermaid   | i3213, i4213
akari     | h8216, h8266
apollo    | h8314, h8324
akatsuki  | h8416, h9436
pioneer   | h3113, h4113
discovery | h3213, h4213
voyager   | h3413, h4413
maple     | g8141, g8142
poplar    | g8341, g8342
lilac     | g8441
dora      | f8131, f8132
kagura    | f8331, f8332
keyaki    | g8231, g8232
suzu      | f5121, f5122
kugo      | f5321
blanc     | g1109
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;strong&gt;List of all targets - both SS/DS:&lt;/strong&gt;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;find . -iname &amp;#39;aosp_*.mk&amp;#39; | cut -d &amp;#39;/&amp;#39; -f 3 | cut -d &amp;#39;.&amp;#39; -f 1
aosp_h8216
aosp_h8266
aosp_h8416
aosp_h9436
aosp_h8314
aosp_h8324
aosp_g1109
aosp_h3213
aosp_h4213
aosp_f8131
aosp_f8132
aosp_f8331
aosp_f8332
aosp_g8231
aosp_g8232
aosp_i3113
aosp_i4113
aosp_f5321
aosp_g8441
aosp_g8141
aosp_g8142
aosp_i3213
aosp_i4213
aosp_h3113
aosp_h4113
aosp_g8341
aosp_g8342
aosp_f5121
aosp_f5122
aosp_h3413
aosp_h4413
aosp_j8210
aosp_j9210
aosp_j8110
aosp_j9110
aosp_xqau51
aosp_xqau52
aosp_f8331
aosp_f8332
aosp_xqat51
aosp_xqat52
aosp_xqas52
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;strong&gt;List of all targets - only one per device:&lt;/strong&gt;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;xqat51
xqas52
xqau51
j8110
j8210
i3113
i3213
h8216
h8314
h8416
h3113
h3213
h3413
g8141
g8341
g8441
f8131
f8331
g8231
f5121
f5321
g1109
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Single-SIM preferred for this list.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>About</title>
      <link>https://sx.ix5.org/info/about/</link>
      <pubDate>Mon, 05 Nov 2018 23:35:35 +0100</pubDate>
      
      <guid>https://sx.ix5.org/info/about/</guid>
      <description>&lt;p&gt;Initially called &amp;ldquo;Sony Xperia Corner&amp;rdquo;, this site contains documentation and
posts about Android building, internals, debugging and more. It focuses on the
Sony Xperia line of Android devices, for which the official
&lt;a href=&#34;https://developer.sony.com/develop/open-devices/&#34;&gt;Sony Open Devices Project&lt;/a&gt;
provides sources and guidance.&lt;/p&gt;
&lt;p&gt;For more information about the project, please visit the
&lt;strong&gt;&lt;a href=&#34;https://opendevices.ix5.org&#34;&gt;Open Devices Project community page&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;You can subscribe to the &lt;a href=&#34;https://sx.ix5.org/info/info/index.xml&#34;&gt;RSS Feed&lt;/a&gt; using your favourite
&lt;a href=&#34;https://en.wikipedia.org/wiki/News_aggregator&#34;&gt;Feed Reader&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Comments powered by &lt;a href=&#34;https://posativ.org/isso/&#34;&gt;isso&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://ix5.org&#34;&gt;Felix Elsner&lt;/a&gt; maintains the site. Its sources are available on
&lt;a href=&#34;https://github.com/ix5/sx_docs&#34;&gt;GitHub&lt;/a&gt;, including the
&lt;a href=&#34;https://github.com/ix5/hugo_theme_kube&#34;&gt;theme used&lt;/a&gt; - please open Pull Requests
for any improvements you&amp;rsquo;d like to see!&lt;/p&gt;
&lt;h2 id=&#34;disclaimer&#34;&gt;Disclaimer&lt;/h2&gt;
&lt;p&gt;This page is neither affiliated with nor endorsed by Sony or any of its subsidiaries.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Security</title>
      <link>https://sx.ix5.org/info/security/</link>
      <pubDate>Fri, 19 Oct 2018 22:15:22 +0200</pubDate>
      
      <guid>https://sx.ix5.org/info/security/</guid>
      <description>&lt;p&gt;Android has a lot of security features built in. However, when testing and
debugging those are really inconvenient to developers. As an end user, you
should be using a ROM which has all the security features enabled, with the
latest security patches.&lt;/p&gt;
&lt;p&gt;If tweaking and experimenting is important to you, you can disable some of those
security features; but be warned, they&amp;rsquo;re there for good reasons.&lt;/p&gt;
&lt;p&gt;&lt;mark&gt;For developers:&lt;/mark&gt; Please do not jeopardize your users&amp;rsquo; security by lazily turning
off security features. In the early stages of porting it is ok to be lax for
debugging reasons, but you should find the root causes of e.g. sepolicy denials
instead of blankly giving out access to anything.&lt;/p&gt;
&lt;h2 id=&#34;verified-boot-with-dm-verity&#34;&gt;Verified boot with dm-verity&lt;/h2&gt;
&lt;p&gt;For more information see &lt;a href=&#34;https://source.android.com/security/verifiedboot/dm-verity&#34;&gt;Implementing dm-verity&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;mark&gt;For developers:&lt;/mark&gt; Disable dm-verity by ripping out the
&lt;code&gt;PRODUCT_SYSTEM_VERITY_PARTITION&lt;/code&gt; block and disabling the &lt;code&gt;call&lt;/code&gt; to
&lt;code&gt;build/target/product/verity.mk&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;encryption&#34;&gt;Encryption&lt;/h2&gt;
&lt;p&gt;The /data and /userdata(a.k.a. the &amp;ldquo;internal SD card&amp;rdquo;) partitions can be
encrypted(&amp;quot;&lt;code&gt;encryptable&lt;/code&gt;&amp;quot;). On recent Android versions, those partitions are
encrypted by default and can not be turned off(&amp;quot;&lt;code&gt;forceencrypt&lt;/code&gt;&amp;quot;).&lt;/p&gt;
&lt;p&gt;&lt;mark&gt;For developers:&lt;/mark&gt; Since some tools like the TWRP custom recovery do not have
proper support for encrypted partitions, it may be advisable to revert this hard
&amp;ldquo;must&amp;rdquo; back to &amp;ldquo;can&amp;rdquo; to give the choice to the users.
Edit &lt;code&gt;fstab.&amp;lt;devicename&amp;gt;&lt;/code&gt; and find a line which looks like the following:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;/dev/block/bootdevice/by-name/userdata  /data  ext4  [...]  [...],forceencrypt=footer,quota
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Change &lt;code&gt;forceencrypt&lt;/code&gt; to &lt;code&gt;encryptable&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;root-and-magisk&#34;&gt;Root and Magisk&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Root:&lt;/strong&gt; &amp;ldquo;Root&amp;rdquo; means you have full access to the system you are running. Most
of the time, you do not want this, rather you want a specific program to run a
specific privileged action only. If everything on your system has root access,
your system will be taken over by viruses in no time.&lt;/p&gt;
&lt;p&gt;That is why you&amp;rsquo;d want a program to manage root access and only give it out to
programs you trust. &lt;strong&gt;Magisk Manager&lt;/strong&gt; is such a program. You need to enable
root the &amp;ldquo;Magisk way&amp;rdquo; by flashing the Magisk zip, which sets up root access on
your system so that only the Magisk Manager app can manage it.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;SafetyNet:&lt;/strong&gt; Simplified, SafetyNet is a way of telling applications that
&amp;ldquo;everything is on stock, no root&amp;rdquo; on your device. Apps can check if SafetyNet is
&amp;ldquo;triggered&amp;rdquo; and may refuse to start if it is.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Hiding root:&lt;/strong&gt; Some apps, such as banking apps and Netflix, demand that you do
not run a custom ROM or have root access enabled on your system.
They can be tricked into thinking you are running a stock ROM with various
methods, some of which can be found in the Magisk repositories.&lt;/p&gt;
&lt;h2 id=&#34;selinux&#34;&gt;SELinux&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Enforcing vs permissive:&lt;/strong&gt; You can set SELinux to permissive, which means it
will only log policy violations instead of blocking them. Again, ok for
development, not ok to risk your users&amp;rsquo; safety by lazily setting it to
&lt;code&gt;permissive&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;mark&gt;For developers:&lt;/mark&gt; A good way to quickly fix issues is to read &lt;code&gt;adb logcat&lt;/code&gt; and watch out for lines that look like this:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;avc: denied { action } for pid=...
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Then read
&lt;a href=&#34;https://gist.github.com/msfjarvis/ec52b48eb2df1688b7cbe32bcd39ee5f&#34;&gt;How to write sepolicy to fix a denial&lt;/a&gt; or
the &lt;a href=&#34;https://lineageos.org/engineering/HowTo-SELinux&#34;&gt;LineageOS SELinux HowTo&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;priv-app-permissions&#34;&gt;Priv-app permissions&lt;/h2&gt;
&lt;p&gt;Privileged apps residing in &lt;code&gt;/system/priv-app&lt;/code&gt; can
have access to system functions which normal apps(e.g. from the Play Store) can
not access. They need to declare which elevated privileges they want, and the
system developer maker needs to declare which permissions should be granted to
these apps.&lt;/p&gt;
&lt;p&gt;Most of the time issues with privapp-permissions arise with GApps, because
Google&amp;rsquo;s apps demand ever increasing power over the system. You should ask the
developers of your GApps variant to fix these issues instead of asking your ROM
maker to disable privapp-permissions.&lt;/p&gt;
&lt;p&gt;&lt;mark&gt;For developers:&lt;/mark&gt; Disable privapp-permissions-enforcing by changing
the following:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;PRODUCT_PROPERTY_OVERRIDES += ro.control_privapp_permissions=enforce
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;to
&lt;code&gt;ro.control_privapp_permissions=log&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;For more information, see
&lt;a href=&#34;https://source.android.com/devices/tech/config/perms-whitelist&#34;&gt;Privileged Permission Whitelisting&lt;/a&gt;.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Structure</title>
      <link>https://sx.ix5.org/info/structure/</link>
      <pubDate>Fri, 19 Oct 2018 22:15:22 +0200</pubDate>
      
      <guid>https://sx.ix5.org/info/structure/</guid>
      <description>&lt;h2 id=&#34;aosp-layout&#34;&gt;AOSP layout&lt;/h2&gt;
&lt;p&gt;When you set up your Android directory with &lt;code&gt;repo init&lt;/code&gt;, what happens is the
Google &lt;code&gt;repo&lt;/code&gt; tool creates a hidden &lt;code&gt;.repo&lt;/code&gt; folder, which by default has a
&lt;code&gt;manifest.xml&lt;/code&gt; file.&lt;/p&gt;
&lt;h3 id=&#34;manifestxml-and-local_manifests&#34;&gt;manifest.xml and local_manifests&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;manifest.xml&lt;/code&gt; is actually a symbolic link to &lt;code&gt;.repo/manifests/default.xml&lt;/code&gt;. It
contains a description of the directories needed to build android, and where to get
them. Those directories are all just git repositories that get cloned from
&lt;a href=&#34;https://android.googlesource.com&#34;&gt;android.googlesource.com&lt;/a&gt;.
A &lt;code&gt;&amp;lt;remote&amp;gt;&lt;/code&gt; is just a git remote base url with a default branch specified. A
&lt;code&gt;&amp;lt;project&amp;gt;&lt;/code&gt; sets &lt;code&gt;name&lt;/code&gt; and &lt;code&gt;path&lt;/code&gt; as well as &lt;code&gt;remote&lt;/code&gt; and &lt;code&gt;revision&lt;/code&gt;(git
branch).&lt;br&gt;
Let&amp;rsquo;s take this example:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;lt;remote name=&amp;#34;sony&amp;#34; fetch=&amp;#34;https://github.com/sonyxperiadev/&amp;#34; /&amp;gt;
&amp;lt;project path=&amp;#34;hardware/qcom/gps&amp;#34; name=&amp;#34;hardware-qcom-gps-sdm845&amp;#34; groups=&amp;#34;device&amp;#34; remote=&amp;#34;sony&amp;#34; revision=&amp;#34;aosp/android-9.0.0_r11&amp;#34; /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This would just &lt;code&gt;git clone&lt;/code&gt; the git repo from &lt;a href=&#34;https://github.com/sonyxperiadev/hardware-qcom-gps-sdm845&#34;&gt;https://github.com/sonyxperiadev/hardware-qcom-gps-sdm845&lt;/a&gt;
into &lt;code&gt;hardware/qcom/gps&lt;/code&gt;. Every time you run &lt;code&gt;repo sync&lt;/code&gt; it would fetch the
latest version of the branch &lt;code&gt;aosp/android-9.0.0_r11&lt;/code&gt; from GitHub.&lt;/p&gt;
&lt;p&gt;Instead of editing &lt;code&gt;manifest.xml&lt;/code&gt;, you can instead put your modifications
inside &lt;code&gt;.repo/local_manifests/&lt;/code&gt;. This way, if the AOSP default manifest changes,
you do not have to re-apply your changes manually.&lt;/p&gt;
&lt;p&gt;To get started with your own &lt;code&gt;local_manifests&lt;/code&gt;, take a look at
&lt;a href=&#34;https://github.com/sonyxperiadev/local_manifests&#34;&gt;github.com/sonyxperiadev/local_manifests&lt;/a&gt;. If you want to remove a default project, use &lt;code&gt;&amp;lt;remove-project&amp;gt;&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;modules&#34;&gt;Modules&lt;/h3&gt;
&lt;p&gt;Every directory with an &lt;code&gt;Android.mk&lt;/code&gt; or &lt;code&gt;Android.bp&lt;/code&gt; file in it will get considered.&lt;/p&gt;
&lt;p&gt;Most interesting to new developers might be the &lt;code&gt;frameworks&lt;/code&gt;, &lt;code&gt;hardware&lt;/code&gt;,
&lt;code&gt;kernel&lt;/code&gt; and &lt;code&gt;packages&lt;/code&gt; folders.&lt;/p&gt;
&lt;!--
### Overlays
You can change e.g. `frameworks/base` manually and edit xml files there or add a
default wallpaper. But this means you have to fork the whole framework. It is
much easier to just add an `overlay` to your build which will overwrite whatever
is in `frameworks/base`. This way, you don&#39;t have to keep up to date with
changes in the framework code. See
[this example](https://git.ix5.org/felix/vendor-sony-ix5/src/commit/3bbeeb0d66b0951bd1c5ffe33ac642bcff353d71/ix5.mk#L54).

## Getting started

**You&#39;ll need:**

- [`local_manifests`](http://github.com/sonyxperiadev/local_manifests) from Sony
  (or [`local_manifests`](https://git.ix5.org/felix/local-manifests-ix5/) from
  me)
- `device-sony-common` from Sony
- `device-sony-&lt;board&gt;` from Sony where `&lt;board&gt;` is your phone platform, e.g.
  `device-sony-tone` for Xperia XZ
- `device-sony-&lt;model-codename&gt;` from Sony where `&lt;model-codename&gt;` is the
  codename of your device, e.g. `device-sony-kagura` for Xperia XZ
- [`repo`](http://commondatastorage.googleapis.com/git-repo-downloads/repo) from Google
- [`repo_update.sh`](https://github.com/sonyxperiadev/repo_update) script from Sony
- (Optional) my own additional script to apply patches called
  [`ix5_repo_update`](https://git.ix5.org/felix/ix5_repo_update)
- (Optional) Your own script to apply your own patches

You can then start tweaking and adding things. For example, you could add more
prebuilt apps into your build or add some xml files that e.g. [enable swipe-up
gestures by default](https://git.ix5.org/felix/vendor-sony-ix5/src/commit/3bbeeb0d66b0951bd1c5ffe33ac642bcff353d71/overlay/common/frameworks/base/core/res/res/values/config.xml#L28).
I would recommend you put your own changes into a separate `vendor/your-name`
directory instead of directly modifying `device/sony/common`.
You will need to include your own vendor directory,
see [this commit](https://git.ix5.org/felix/device-sony-common/commit/b115cc3f7f98c1d26a6bd8b84422706128e3d0b7)
for an example.
--&gt;
&lt;h3 id=&#34;everything-together&#34;&gt;Everything together&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;/home/user
└── android-build-dir
    ├── .repo
    │   ├── local_manifests
    │   │   ├── qcom.xml
    │   │   └── oss.xml
    │   └── manifest.xml
    ├── bionic
    ├── build
    ├── device
    │   └── sony
    │       ├── common
    │       ├── tone
    │       └── kagura
    ├── hardware
    ├── kernel
    │   └── sony
    │       └── msm-4.9
    │           ├── kernel
    │           └── common-kernel
    ├── [...]
    └── out
        └── target
            └── product
                └── kagura
                    ├── boot.img
                    └── system.img
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;caveats&#34;&gt;Caveats&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Use the appropriate branch for your things at all times!
It is tempting to test out patches from &lt;code&gt;master&lt;/code&gt;, but be consistent.&lt;/li&gt;
&lt;li&gt;Cherry-pick carefully&lt;/li&gt;
&lt;li&gt;If anything goes wrong, use &lt;code&gt;repo forall -vc &amp;quot;git reset --hard&amp;quot;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;If you must fork a repository, never commit your changes to the &lt;code&gt;master&lt;/code&gt;
branch, create a custom branch instead. This way, you can still pull from the
&amp;ldquo;upstream&amp;rdquo; repo(i.e. the repo you forked it from) to &lt;code&gt;master&lt;/code&gt; and then merge
from &lt;code&gt;master&lt;/code&gt; into your own custom branch. Otherwise you will run into merge
conflicts very quickly.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;tips&#34;&gt;Tips&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;It is way easier to write a patch and submit it than forking a
repository and keeping it in sync with the upstream repo. If the maintainers do not accept your patch but you still
need it, keep a branch in your forked repository for all your changes and only
cherry-pick them with your own patch script. Take a look at
&lt;a href=&#34;https://github.com/sonyxperiadev/repo_update&#34;&gt;repo_update.sh&lt;/a&gt;
from sonyxperiadev for inspiration.&lt;/li&gt;
&lt;li&gt;Use overlays instead of modifying android_frameworks_base&lt;/li&gt;
&lt;/ul&gt;
</description>
    </item>
    
    <item>
      <title>De-Googling</title>
      <link>https://sx.ix5.org/info/de-googling/</link>
      <pubDate>Fri, 19 Oct 2018 22:14:54 +0200</pubDate>
      
      <guid>https://sx.ix5.org/info/de-googling/</guid>
      <description>&lt;h2 id=&#34;gapps&#34;&gt;GApps&lt;/h2&gt;
&lt;p&gt;All you need for basic functionality is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Play Store&lt;/li&gt;
&lt;li&gt;Play Services&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Can be disabled:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Packageinstaller&lt;/li&gt;
&lt;li&gt;Market Feedback Agent&lt;/li&gt;
&lt;li&gt;DialerFramework&lt;/li&gt;
&lt;li&gt;YouTube&lt;/li&gt;
&lt;li&gt;Calendar&lt;/li&gt;
&lt;li&gt;Email&lt;/li&gt;
&lt;li&gt;Docs Suite&lt;/li&gt;
&lt;li&gt;Google App&lt;/li&gt;
&lt;li&gt;Chrome&lt;/li&gt;
&lt;li&gt;Maps&lt;/li&gt;
&lt;li&gt;Photos&lt;/li&gt;
&lt;li&gt;Google Enrollment apps&lt;/li&gt;
&lt;li&gt;Lens&lt;/li&gt;
&lt;li&gt;Play Music, Movies&lt;/li&gt;
&lt;li&gt;Google Partner Setup&lt;/li&gt;
&lt;li&gt;Device Health Services&lt;/li&gt;
&lt;li&gt;Carrier Services&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;settings&#34;&gt;Settings&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Security:
&lt;ul&gt;
&lt;li&gt;Turn off Google Play Protect and Find My Device&lt;/li&gt;
&lt;li&gt;Show lockdown option&lt;/li&gt;
&lt;li&gt;Disable Smart Lock and Smart Lock For Passwords&lt;/li&gt;
&lt;li&gt;Deactivate all Device Admin apps (but &amp;ldquo;Find my device&amp;rdquo; and Google Pay will
auto-reactivate themselves all the time, so somehow moot)&lt;/li&gt;
&lt;li&gt;Deactivate all Trust agents&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Wi-Fi Preferences: Turn off &amp;ldquo;Open Network Notification&amp;rdquo;&lt;/li&gt;
&lt;li&gt;NFC: Turn off Android Beam&lt;/li&gt;
&lt;li&gt;Printing: Turn off default printing service&lt;/li&gt;
&lt;li&gt;Google Settings:
&lt;ul&gt;
&lt;li&gt;Opt out of ads personalization&lt;/li&gt;
&lt;li&gt;Disable Google Drive backups and back up to somewhere else&lt;/li&gt;
&lt;li&gt;Disable Google Pay&lt;/li&gt;
&lt;li&gt;Disable Firebase app indexing&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
</description>
    </item>
    
    <item>
      <title>Handling Android Images</title>
      <link>https://sx.ix5.org/info/handling-android-images/</link>
      <pubDate>Fri, 19 Oct 2018 22:14:54 +0200</pubDate>
      
      <guid>https://sx.ix5.org/info/handling-android-images/</guid>
      <description>&lt;h2 id=&#34;unpack-bootimg&#34;&gt;Unpack boot.img&lt;/h2&gt;
&lt;p&gt;Get &lt;code&gt;android_bootimg_tools&lt;/code&gt; and extract to &lt;code&gt;~/.local/bin&lt;/code&gt;:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/android-serialport-api/android_bootimg_tools.tar.gz /tmp/tools.tar.gz&lt;/code&gt;&lt;br&gt;
&lt;code&gt;tar xzvf /tmp/tools.tar.gz -C ~/.local/bin/&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Make sure &lt;code&gt;~/.local/bin&lt;/code&gt; is in your &lt;code&gt;PATH&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;You will now have the &lt;code&gt;mkbootimg&lt;/code&gt; and &lt;code&gt;unpackbootimg&lt;/code&gt; programs available.&lt;/p&gt;
&lt;p&gt;Copy the boot.img you want to disect into your local folder and run
&lt;code&gt;mkdir boot/ &amp;amp;&amp;amp; unpackbootimg -i boot.img -o boot/&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;You will now have the following files inside the &lt;code&gt;boot/&lt;/code&gt; folder:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;boot.img-base&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;boot.img-cmdline&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;boot.img-pagesize&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;boot.img-ramdisk.gz&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;boot.img-zImage&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The &lt;code&gt;boot.img-zImage&lt;/code&gt; file is the kernel.&lt;/p&gt;
&lt;p&gt;Source: &lt;a href=&#34;https://unix.stackexchange.com/questions/64628/how-to-extract-boot-img/459881&#34;&gt;stackoverflow&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;unpack-ramdisk&#34;&gt;Unpack ramdisk&lt;/h2&gt;
&lt;p&gt;&lt;em&gt;This is only necessary if you want to change files inside your boot.img. If you
only want to use a different kernel, you can skip this step.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;cd&lt;/code&gt; into &lt;code&gt;boot/&lt;/code&gt; and unpack the ramdisk:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;gunzip --to-stdout --uncompress boot.img-ramdisk.gz | cpio --extract \
  --make-directories --no-absolute-filenames
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To re-pack the cpio archive, move the rootfs files into a subdirectory and run
the following from there:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;find . | cpio -o -H newc &amp;gt; ../boot.img-ramdisk
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The &lt;code&gt;-H newc&lt;/code&gt; option creates the SV4 archive type.&lt;/p&gt;
&lt;p&gt;Then go up one directory and &lt;code&gt;gzip&lt;/code&gt;-compress the archive:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;gzip boot.img-ramdisk
&lt;/code&gt;&lt;/pre&gt;&lt;hr&gt;
&lt;p&gt;The ramdisk has a special format named &lt;code&gt;cpio&lt;/code&gt;. More information on
&lt;a href=&#34;https://en.wikipedia.org/wiki/Cpio&#34;&gt;Wikipedia&lt;/a&gt; and the &lt;a href=&#34;https://www.gnu.org/software/cpio/manual/cpio.html&#34;&gt;manpage&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The exact format of the &lt;code&gt;cpio&lt;/code&gt; archive is “SV4 with no CRC”. You can verify the
archive type for future Android versions by doing:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;$ gunzip --uncompress boot.img-ramdisk.gz
$ file boot.img-ramdisk
# boot.img-ramdisk: ASCII cpio archive (SVR4 with no CRC)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;re-pack-bootimg&#34;&gt;Re-pack boot.img&lt;/h2&gt;
&lt;p&gt;&lt;em&gt;If you unpacked your ramdisk, first re-create a cpio archive and gzip-compress
it again, see the previous step.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Use &lt;code&gt;mkbootimg&lt;/code&gt; with the appropriate flags. To find out the values for
&lt;code&gt;cmdline&lt;/code&gt;, &lt;code&gt;base&lt;/code&gt; and &lt;code&gt;pagesize&lt;/code&gt;, take a look at the generated &lt;code&gt;boot.img-*&lt;/code&gt;
files, e.g. &lt;code&gt;boot.img-base&lt;/code&gt; should contain a number like &lt;code&gt;80000000&lt;/code&gt;.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;mkbootimg \
  --cmdline &amp;#34;$(cat boot.img-cmdline)&amp;#34; \
  --base &amp;#34;$(cat boot.img-base)&amp;#34; \
  --pagesize &amp;#34;$(cat boot.img-pagesize)&amp;#34; \
  --ramdisk &amp;#34;boot.img-ramdisk.gz&amp;#34; \
  --kernel &amp;#34;boot.img-zImage&amp;#34; \
  -o boot-repacked.img
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;For newer devices, the bootloader expects you to set an OS version and a
security patch level in the bootimage. These values should match the system or
vendor image values. The patch level corresponds to the AOSP
Security bulletins, e.g. &lt;a href=&#34;https://source.android.com/security/bulletin/2020-06-01&#34;&gt;2020-06-05&lt;/a&gt;.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;export OS_VERSION=10
export OS_PATCH_LEVEL=&amp;#39;2020-06-05&amp;#39;
mkbootimg \
  --cmdline
  --id \
  [...] \
  --os_version $OS_VERSION \
  --os_patch_level $OS_PATCH_LEVEL
  -o boot-repacked.img
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you are constructing a boot image from scratch, you also need to set kernel
tags offset and ramdisk offset, which can be taken from the device
&lt;code&gt;BoardConfig.mk&lt;/code&gt; or &lt;code&gt;PlatformConfig.mk&lt;/code&gt;.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;export BOARD_KERNEL_TAGS_OFFSET=0x01E00000
export BOARD_RAMDISK_OFFSET=0x02000000
mkbootimg \
  [...] \
  --ramdisk_offset $BOARD_RAMDISK_OFFSET \
  --tags_offset $BOARD_KERNEL_TAGS_OFFSET \
  -o boot-repacked.img
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Here are some example values:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;CMDLINE=&amp;#34;androidboot.bootdevice=7464900.sdhci msm_rtb.filter=0x3F \
  ehci-hcd.park=3 coherent_pool=8M sched_enable_power_aware=1 \
  user_debug=31 cgroup.memory=nokmem printk.devkmsg=on \
  androidboot.hardware=kagura buildvariant=userdebug \
  androidboot.selinux=permissive&amp;#34;
BASE=&amp;#34;80000000&amp;#34; 
PAGESIZE=&amp;#34;4096&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The newly packged boot image will be named &lt;code&gt;boot-repacked.img&lt;/code&gt; (or whatever name
you chose for &lt;code&gt;-o&lt;/code&gt;).&lt;/p&gt;
&lt;h2 id=&#34;gotchas&#34;&gt;Gotchas&lt;/h2&gt;
&lt;p&gt;In case you compiled your own kernel, don&amp;rsquo;t forget to think about &lt;code&gt;.dtb&lt;/code&gt; files!
Many older devices (e.g. the Xperia XZ) need the
&lt;a href=&#34;https://elinux.org/Device_Tree_Reference&#34;&gt;Device Tree Binaries&lt;/a&gt; (&lt;code&gt;dtb&lt;/code&gt;) appended to the kernel &lt;code&gt;zImage&lt;/code&gt;.&lt;/p&gt;
&lt;!--
TODO: List the flags here

## Handling sparse images
What is a sparse image?
simg2img

## Filesystems
ext4, ext2, exfat, ntfs, fat, fuse, permissions

## Partitions
FOTAKernel, boot, system, vendor, oem/odm, dsp, frp, modem

## Tools
- `adb`, `fastboot`
- `android_bootimg_tools`
- `android-simg2img`
- `smali`/`baksmali`
- `sdat2img`
- `vdexExtractor`
- `apktool`
--&gt;
</description>
    </item>
    
    <item>
      <title>Wiping Factory Reset Protection</title>
      <link>https://sx.ix5.org/info/post/wiping-factory-reset-protection/</link>
      <pubDate>Fri, 11 Jun 2021 10:46:00 +0200</pubDate>
      
      <guid>https://sx.ix5.org/info/post/wiping-factory-reset-protection/</guid>
      <description>&lt;p&gt;Boot into a &lt;strong&gt;custom recovery&lt;/strong&gt;, bootloader must be unlocked.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;I used &lt;a href=&#34;https://download.lineageos.org/xz2c&#34;&gt;LineageOS recovery&lt;/a&gt; for the Xperia XZ2 Compact.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Must be &lt;strong&gt;root&lt;/strong&gt;.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;$ getprop ro.frp.pst
/dev/block/bootdevice/by-name/frp
$ blockdev --getsize64 /dev/block/bootdevice/by-name/frp
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Gives size in bytes, e.g. &lt;code&gt;50000&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Insert that size as &lt;code&gt;count&lt;/code&gt; argument and set block size (&lt;code&gt;bs&lt;/code&gt;) to 1 for 1 byte.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;dd if=/dev/zero of=/dev/block/bootdevice/by-name/frp bs=1 count=50000
&lt;/code&gt;&lt;/pre&gt;&lt;div class=&#34;message warning&#34;&gt;
&lt;b&gt;NOTE:&lt;/b&gt; &lt;code&gt;dd&lt;/code&gt; is called &#34;Disk Destroyer&#34; as a joke, but keep in
mind you might irrecoverably brick your device by doing these steps incorrectly!
&lt;/div&gt;
&lt;p&gt;Further information:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://forum.xda-developers.com/t/info-android-device-partitions-and-filesystems.3586565/&#34;&gt;XDA: Android device partitions and filesystems&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-9.0.0_r47/services/core/java/com/android/server/PersistentDataBlockService.java#308&#34;&gt;AOSP: PersistentDataBlockService.java&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
    </item>
    
    <item>
      <title>Quick: Debugging Power Management</title>
      <link>https://sx.ix5.org/info/post/quick-debugging-power-management/</link>
      <pubDate>Wed, 31 Mar 2021 00:00:00 +0000</pubDate>
      
      <guid>https://sx.ix5.org/info/post/quick-debugging-power-management/</guid>
      <description>&lt;p&gt;Quick reference over battery-related debugging, mainly for myself.&lt;/p&gt;
&lt;h3 id=&#34;adb&#34;&gt;adb&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;adb shell dumpsys battery unplug
adb shell dumpsys deviceidle step
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Link: StackOverflow: &lt;a href=&#34;https://stackoverflow.com/questions/3417308/force-an-android-phone-to-sleep-in-order-to-test&#34;&gt;Force Android to sleep&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;kernel&#34;&gt;Kernel&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000&#34;&gt;echo&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;1&lt;/span&gt; &amp;gt; /sys/power/pm_print_times
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;adb connect xxxx
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;adb wait-for-device
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;adb shell &lt;span style=&#34;color:#ba2121&#34;&gt;&amp;#34;echo mem &amp;gt; /sys/power/state&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
    </item>
    
    <item>
      <title>UnSIN with super images</title>
      <link>https://sx.ix5.org/info/post/unsin-super-img/</link>
      <pubDate>Mon, 22 Feb 2021 00:00:00 +0000</pubDate>
      
      <guid>https://sx.ix5.org/info/post/unsin-super-img/</guid>
      <description>&lt;p&gt;Download &lt;code&gt;.ftf&lt;/code&gt; using e.g. &lt;code&gt;xperifirm&lt;/code&gt; (built into FlashTool)&lt;/p&gt;
&lt;p&gt;Extract &lt;code&gt;.ftf&lt;/code&gt; using e.g. &lt;code&gt;unzip&lt;/code&gt; (ftf format is just a zip file)&lt;/p&gt;
&lt;p&gt;Use &lt;a href=&#34;https://forum.xda-developers.com/t/tool-unsin-sin-v3-v4-v5-unpacker-v1-13.3128106/&#34;&gt;UnSIN&lt;/a&gt; in version 1.13 or higher to convert the &lt;code&gt;.sin&lt;/code&gt; image to a
raw image:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;$ unsin super_X-FLASH-ALL-2389.sin
# Extracting sparse files from SIN... Done!
# Restoring image from sparse files... Done!
# Successfully restored image to /path/to/super_X-FLASH-ALL-2389.img
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You need version 1.13 since versions prior to not support super images.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;v1.13 (May 20, 2020):&lt;br&gt;
Added support for super.sin images. (Note: those have to be further unpacked
using &lt;code&gt;lpunpack&lt;/code&gt; into individual partition images)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The resulting image is a special type of archive.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;$ file super_X-FLASH-ALL-2389.img
super_X-FLASH-ALL-2389.img: data
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Use 7-zip to extract the super image. Note the &lt;code&gt;type #&lt;/code&gt;.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;$ 7z l -t# super_X-FLASH-ALL-2389.img

7-Zip [64] 17.03 : Copyright (c) 1999-2020 Igor Pavlov : 2017-08-28
p7zip Version 17.03 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,64 bits,8 CPUs x64)

Scanning the drive for archives:
1 file, 4776710144 bytes (4556 MiB)

Listing archive: super_X-FLASH-ALL-2389.img

--
Path = super_X-FLASH-ALL-2389.img
Type = #

   Date      Time    Attr         Size   Compressed  Name
------------------- ----- ------------ ------------  ------------------------
                    .....      1048576      1048576  1
2020-12-16 18:33:47 .....   1993469952   1993469952  2.ext
                    .....     32378880     32378880  3
2020-12-16 18:33:47 .....    359301120    359301120  4.ext
                    .....      6651904      6651904  5
2020-12-16 18:33:47 .....   1527484416   1527484416  6.ext
                    .....     25456640     25456640  7
2020-12-16 18:33:47 .....    815681536    815681536  8.ext
                    .....     13742080     13742080  9
2020-12-16 18:33:47 .....      1388544      1388544  10.ext
                    .....       106496       106496  11
------------------- ----- ------------ ------------  ------------------------
2020-12-16 18:33:47         4776710144   4776710144  11 files
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Extract to directory &lt;code&gt;super-ex&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;7z x -t# -osuper-ex super_X-FLASH-ALL-2389.img

7-Zip [64] 17.03 : Copyright (c) 1999-2020 Igor Pavlov : 2017-08-28
p7zip Version 17.03 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,64 bits,8 CPUs x64)

Scanning the drive for archives:
1 file, 4776710144 bytes (4556 MiB)

Extracting archive: super_X-FLASH-ALL-2389.img
--         
Path = super_X-FLASH-ALL-2389.img
Type = #

Everything is Ok

Files: 11
Size:       4776710144
Compressed: 4776710144
&lt;/code&gt;&lt;/pre&gt;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;$ file super-ex/*
1:      data
10.ext: Linux rev 1.0 ext2 filesystem data, UUID=7b049680-6af1-5082-b7f5-6a108526cc22, volume name &amp;#34;odm&amp;#34; (extents) (large files) (huge files)
11:     data
2.ext:  Linux rev 1.0 ext2 filesystem data, UUID=f3e365b4-f1d6-54b8-ab22-40687fce6f50 (extents) (large files) (huge files)
3:      data
4.ext:  Linux rev 1.0 ext2 filesystem data, UUID=590ed6e4-782b-5389-a789-83620e9391a0, volume name &amp;#34;system&amp;#34; (extents) (large files) (huge files)
5:      data
6.ext:  Linux rev 1.0 ext2 filesystem data, UUID=cd6e0645-b846-55f7-9c6b-75edaf2b3709, volume name &amp;#34;product&amp;#34; (extents) (large files) (huge files)
7:      data
8.ext:  Linux rev 1.0 ext2 filesystem data, UUID=093d149d-5e86-5459-90e2-d7df2e357daf, volume name &amp;#34;vendor&amp;#34; (extents) (large files) (huge files)
9:      data
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Mount desired image:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;$ udisksctl loop-setup -r -f 8.ext
&lt;/code&gt;&lt;/pre&gt;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;$ ls -la /run/media/user/vendor/

total 180K
drwxr-xr-x  19 root root 4,0K 16. Dez 18:33 ./
drwxr-x---+  3 root root   60 22. Feb 11:07 ../
drwxr-xr-x  10 root 2000 4,0K 16. Dez 18:33 app/
drwxr-x--x   4 root 2000 8,0K 16. Dez 18:33 bin/
drwxr-xr-x   2 root 2000 4,0K 16. Dez 18:33 bt_firmware/
drwxr-xr-x   7 root 2000 4,0K 16. Dez 18:33 camera/
drwxr-xr-x   3 root 2000 4,0K 16. Dez 18:33 charge/
drwxr-xr-x   2 root 2000 4,0K 16. Dez 18:33 dsp/
drwxr-xr-x  27 root 2000 8,0K 16. Dez 18:33 etc/
drwxr-xr-x   4 root 2000 4,0K 16. Dez 18:33 firmware/
drwxr-xr-x   2 root 2000 4,0K 16. Dez 18:33 firmware_mnt/
drwxr-xr-x   3 root 2000 4,0K 16. Dez 18:33 framework/
drwxr-xr-x  12 root 2000  24K 16. Dez 18:33 lib/
drwxr-xr-x  10 root 2000  24K 16. Dez 18:33 lib64/
drwx------   2 root root  16K 16. Dez 18:33 lost+found/
drwxr-xr-x   5 root 2000 4,0K 16. Dez 18:33 overlay/
drwxr-xr-x   3 root 2000 4,0K 16. Dez 18:33 radio/
drwxr-xr-x   5 root 2000 4,0K 16. Dez 18:33 rfs/
drwxr-xr-x   3 root 2000 4,0K 16. Dez 18:33 usr/
-rw-------   1 root root  11K 16. Dez 18:33 build.prop
-rw-------   1 root root  974 16. Dez 18:33 default.prop
lrw-r--r--   1 root root    4 16. Dez 18:33 odm -&amp;gt; /odm
-rw-r--r--   1 root root  28K 16. Dez 18:33 ueventd.rc
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;alternatives&#34;&gt;Alternatives&lt;/h3&gt;
&lt;p&gt;See &lt;a href=&#34;https://forum.xda-developers.com/t/tool-windows-linux-android-apple-unpack-any-sony-firmware-file.3530077/&#34;&gt;Tool: Unpack any Sony firmware file&lt;/a&gt; (from &lt;a href=&#34;https://github.com/munjeni/super_image_dumper&#34;&gt;GitHub&lt;/a&gt;).&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Developing for the Ubports Installer</title>
      <link>https://sx.ix5.org/info/post/developing-ubports-installer/</link>
      <pubDate>Mon, 08 Feb 2021 18:37:50 +0100</pubDate>
      
      <guid>https://sx.ix5.org/info/post/developing-ubports-installer/</guid>
      <description>&lt;p&gt;This post goes over adding a new device to the &lt;a href=&#34;https://github.com/ubports/ubports-installer&#34;&gt;ubports installer&lt;/a&gt;
for Ubuntu Touch and helps ensure that the configs were valid.&lt;/p&gt;
&lt;p&gt;You need to have &lt;code&gt;python&lt;/code&gt;, &lt;code&gt;nodejs&lt;/code&gt; and &lt;code&gt;npm&lt;/code&gt; installed.&lt;/p&gt;
&lt;h3 id=&#34;set-up-the-installer&#34;&gt;Set up the installer&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;git clone https://github.com/ubports/ubports-installer
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000&#34;&gt;cd&lt;/span&gt; ubports-installer
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The README file tells you to run the &lt;code&gt;setup-dev&lt;/code&gt; script, but it&amp;rsquo;s safer to
validate ourselves what it does.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;# Install required programs and npm packages&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;./setup-dev.sh
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;# Same as:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;apt install nodejs npm libgconf-2-4
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;npm install
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;We can now launch the installer with &lt;code&gt;npm start&lt;/code&gt;. For more verbose output, use
&lt;code&gt;npm start -- -vv&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;There are other &amp;ldquo;scripts&amp;rdquo; available to run via &lt;code&gt;run run&lt;/code&gt;, for example
&lt;code&gt;npm run lint&lt;/code&gt;. You can discover all available commands in &lt;a href=&#34;https://github.com/ubports/ubports-installer/blob/95745e519351adc3189e7e285a553bc6c1e5100a/package.json#L27-L35&#34;&gt;package.json&lt;/a&gt;
under the &lt;code&gt;scripts: {...}&lt;/code&gt; section.&lt;/p&gt;
&lt;h3 id=&#34;set-up-device-configs&#34;&gt;Set up device configs&lt;/h3&gt;
&lt;p&gt;To begin setting up our own device in the installer, we need to update the
separately-kept &lt;a href=&#34;https://github.com/ubports/installer-configs&#34;&gt;installer configs&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;git clone https://github.com/ubports/installer-configs
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000&#34;&gt;cd&lt;/span&gt; installer-configs
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;npm install
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Make your changes to &lt;code&gt;v2/&amp;lt;device&amp;gt;.yml&lt;/code&gt;, then check if the YAML syntax is valid
with &lt;code&gt;npm run validate&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The spec for the YAML schema is documented well, and you can look at existing
devices for inspiration.&lt;/p&gt;
&lt;p&gt;Once we have created or updated our own installer configs, we need to let the
installer know about them. Let the build command convert the configs into JSON
files and serve them via a simple HTTP server:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;npm run buildconfigs
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000&#34;&gt;cd&lt;/span&gt; public
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;python -m http.server
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now, we instruct the installer to fetch our updated configs from our own endpoint.&lt;/p&gt;
&lt;p&gt;By default, the installer fetches available devices and configs from
&lt;a href=&#34;https://ubports.github.io/installer-configs/v2/&#34;&gt;ubports.github.io/installer-configs/v2/&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The URL to fetch from is set in &lt;a href=&#34;https://github.com/ubports/ubports-installer/blob/95745e519351adc3189e7e285a553bc6c1e5100a/src/core/api.js#L25&#34;&gt;src/core/api.js&lt;/a&gt;, and the installer
expects a response in JSON format.&lt;/p&gt;
&lt;p&gt;Change&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-js&#34; data-lang=&#34;js&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;baseURL&lt;span style=&#34;color:#666&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#ba2121&#34;&gt;&amp;#34;https://ubports.github.io/installer-configs/v2/&amp;#34;&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;to:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-js&#34; data-lang=&#34;js&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;baseURL&lt;span style=&#34;color:#666&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#ba2121&#34;&gt;&amp;#34;http://localhost:8000/v2/&amp;#34;&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;We also need to change the &lt;a href=&#34;https://github.com/ubports/ubports-installer/blob/95745e519351adc3189e7e285a553bc6c1e5100a/src/core/api.js#L33&#34;&gt;function fetching the index file&lt;/a&gt; a bit, from:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-js&#34; data-lang=&#34;js&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;const&lt;/span&gt; getIndex &lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt; () =&amp;gt; api.get(&lt;span style=&#34;color:#ba2121&#34;&gt;&amp;#34;/&amp;#34;&lt;/span&gt;).then(({ data }) =&amp;gt; data);
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;to:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-js&#34; data-lang=&#34;js&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;const&lt;/span&gt; getIndex &lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt; () =&amp;gt; api.get(&lt;span style=&#34;color:#ba2121&#34;&gt;&amp;#34;/index.json&amp;#34;&lt;/span&gt;).then(({ data }) =&amp;gt; data);
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now the installer fetches your local configs and you can test whether it
succeeds.&lt;/p&gt;
&lt;h3 id=&#34;further-ideas&#34;&gt;Further ideas&lt;/h3&gt;
&lt;p&gt;This post was inspired by my quest to update the installer configs for the
&lt;a href=&#34;https://github.com/ubports/installer-configs/pull/75&#34;&gt;Xperia XZ and X Performance&lt;/a&gt; and hunting down &lt;a href=&#34;https://github.com/ubports/ubports-installer/issues/1754&#34;&gt;a pernicious bug&lt;/a&gt;.
I validated &lt;a href=&#34;https://github.com/ubports/ubports-installer/pull/1786&#34;&gt;my fix&lt;/a&gt; and went on to also &lt;a href=&#34;https://gitlab.com/ubports/infrastructure/devices.ubuntu-touch.io/-/merge_requests/56&#34;&gt;add the XZ&lt;/a&gt; to the
&lt;a href=&#34;https://devices.ubuntu-touch.io/&#34;&gt;official Ubuntu Touch device list&lt;/a&gt;.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Dynamic Partitions: Take Two</title>
      <link>https://sx.ix5.org/info/post/dynamic-partitions-take-two/</link>
      <pubDate>Mon, 25 May 2020 20:12:48 +0200</pubDate>
      
      <guid>https://sx.ix5.org/info/post/dynamic-partitions-take-two/</guid>
      <description>&lt;p&gt;These are just my thoughts and notes, reading this will bring you no
satisfaction whatsoever.&lt;/p&gt;
&lt;h2 id=&#34;starting&#34;&gt;Starting&lt;/h2&gt;
&lt;p&gt;So, turns out, the whole affair at least seems mildly well-documented now,
at least.
See last time: &lt;a href=&#34;https://sx.ix5.org/info/info/post/android-q-dynamic-partitions/&#34;&gt;Android Q: Dynamic Partitions&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;See:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://source.android.com/devices/tech/ota/dynamic_partitions&#34;&gt;DAP Overview&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://source.android.com/devices/tech/ota/dynamic_partitions/ab_launch&#34;&gt;AB Launch&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://source.android.com/devices/tech/ota/dynamic_partitions/ab_legacy&#34;&gt;AB Legacy&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://source.android.com/devices/tech/ota/dynamic_partitions/nonab&#34;&gt;Non-AB&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;adjustments&#34;&gt;Adjustments&lt;/h3&gt;
&lt;p&gt;Kang all the needed stuff from crosshatch, because it didn&amp;rsquo;t launch with DAP and
is also an SDM845 device.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;All in &lt;code&gt;BoardConfig&lt;/code&gt; and device, platform, device-common&lt;/li&gt;
&lt;li&gt;&lt;code&gt;fstab&lt;/code&gt;, &lt;code&gt;fstab.persist&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Don&amp;rsquo;t forget to copy fstab into &lt;code&gt;first_stage_mount&lt;/code&gt; ramdisk of recovery&lt;/li&gt;
&lt;li&gt;init changes, &lt;code&gt;latemount&lt;/code&gt;/&lt;code&gt;first_stage&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;See:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/ix5/device-sony-common/tree/dynamic-partitions&#34;&gt;Common&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/ix5/device-sony-tama/tree/dynamic-partitions&#34;&gt;Tama&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/ix5/device-sony-apollo/tree/dynamic-partitions&#34;&gt;Apollo&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Now, run &lt;code&gt;make otardppackage&lt;/code&gt; to generate the &lt;strong&gt;R&lt;/strong&gt;etrofit &lt;strong&gt;D&lt;/strong&gt;ynamic
&lt;strong&gt;P&lt;/strong&gt;artitions over-the-air package.&lt;/p&gt;
&lt;p&gt;This will also put &lt;code&gt;super_system.img&lt;/code&gt;, &lt;code&gt;super_vendor.img&lt;/code&gt; into the intermediate
target files.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;$ ls obj/PACKAGING/target_files_intermediates/aosp_h8314-target_files-eng.builder/
BOOT/  IMAGES/  META/  OTA/  PREBUILT_IMAGES/  PRODUCT/  ROOT/  SYSTEM/  VENDOR/

$ ls IMAGES/
boot.img  dtbo.img  product.img  product.map  super_empty.img
system.img  system.map  userdata.img  vbmeta.img  vendor.img  vendor.map

$ ls OTA/
android-info.txt  super_system.img  super_vendor.img
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;But, seems Android doesn&amp;rsquo;t want to boot my stuff unless it&amp;rsquo;s &lt;code&gt;f2fs&lt;/code&gt; instead of
&lt;code&gt;ext4&lt;/code&gt; for userdata? Maybe some of their fancy checkpointing stuff is broken on
ext4? (More on that later)&lt;/p&gt;
&lt;p&gt;So, let&amp;rsquo;s use &lt;code&gt;f2fs&lt;/code&gt; for userdata, set it in &lt;code&gt;fstab&lt;/code&gt; and also in the
BoardConfig:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE := f2fs
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Also add some tooling:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;PRODUCT_PACKAGES += \
    sg_write_buffer \
    f2fs_io \
    check_f2fs
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;f2fs stuff with newer kernels is kinda broken:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;2020-05-25 20:12:33 - build_image.py - ERROR   : Failed to build out/target/product/apollo/userdata.img from out/target/product/apollo/data
# Added this for debugging to see which command fails:
#mkfs_output: Command= [&amp;#39;mkf2fsuserimg.sh&amp;#39;, \
#  &amp;#39;out/target/product/apollo/userdata.img&amp;#39;, \
#  &amp;#39;51448807424&amp;#39;, &amp;#39;-f&amp;#39;, &amp;#39;out/target/product/apollo/data&amp;#39;, \
#  &amp;#39;-D&amp;#39;, &amp;#39;out/target/product/apollo/system&amp;#39;, &amp;#39;-s&amp;#39;, \
#  &amp;#39;out/target/product/apollo/obj/ETC/file_contexts.bin_intermediates/file_contexts.bin&amp;#39;, \
#  &amp;#39;-t&amp;#39;, &amp;#39;data&amp;#39;, &amp;#39;-L&amp;#39;, &amp;#39;data&amp;#39;]
# Continues:
Out of space? Out of inodes? The tree size of out/target/product/apollo/data is 0 bytes (0 MB), with reserved space of 0 bytes (0 MB).
The max image size for filesystem files is 51448807424 bytes (49065 MB), out of a total partition size of 51448807424 bytes (49065 MB).
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The message is entirely wrong and misleading. The underlying issue is that the
f2fs tools shipped with android choke on too new kernel versions (I was on 5.6
as of writing this). Google still recommends using Ubuntu 12.04 for building
Android somewhere - or they might&amp;rsquo;ve updated to the brand new 14.04? - and you
should keep this in mind.&lt;/p&gt;
&lt;p&gt;This fails:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;mkf2fsuserimg.sh \
    out/target/product/apollo/userdata.img 51448807424 \
    -f out/target/product/apollo/data \
    -D out/target/product/apollo/system \
    -s out/target/product/apollo/obj/ETC/file_contexts.bin_intermediates/file_contexts.bin \
    -t data \
    -L data
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;With f2fs tools &lt;code&gt;sload_f2fs&lt;/code&gt; spitting errors:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;
[FSCK] Unreachable nat entries                        [Ok..] [0x0]
[FSCK] SIT valid block bitmap checking                [Ok..]
[FSCK] Hard link checking for regular file            [Ok..] [0x0]
[FSCK] valid_block_count matching with CP             [Ok..] [0x9]
[FSCK] valid_node_count matcing with CP (de lookup)   [Ok..] [0x4]
[FSCK] valid_node_count matcing with CP (nat lookup)  [Ok..] [0x4]
[FSCK] valid_inode_count matched with CP              [Ok..] [0x3]
[FSCK] free segment_count matched with CP             [Ok..] [0x5f2b]
[FSCK] next block offset is free                      [Ok..]
[FSCK] fixing SIT types
[FSCK] other corrupted bugs                           [Fail]
Info: Write valid nat_bits in checkpoint
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This logic is wrong and broken in &lt;code&gt;fsck/fsck.c&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;fsck_chk_quota_files()
  [...]
  if (!ret) {
      c.bug_on = 1;
      DBG(1, &amp;#34;OK\n&amp;#34;);
  } else {
      ASSERT_MSG(&amp;#34;Unable to write quota file&amp;#34;);
  }
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Switch the logic (left as an exercise to the reader) and &lt;code&gt;make sload_f2fs-host&lt;/code&gt;
and &lt;code&gt;make fsck.f2fs-host&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Now we&amp;rsquo;re talkin&amp;rsquo;, baby!&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;[FSCK] other corrupted bugs                           [Ok..]

Done.
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;strong&gt;Eh, wrong again, it was something else entirely.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I should&amp;rsquo;ve read the stacktrace more diligently:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;Traceback (most recent call last):
  [...]
  File &amp;#34;build/make/tools/releasetools/build_image.py&amp;#34;, line 479, in BuildImage
    mkfs_output = BuildImageMkfs(in_dir, prop_dict, out_file, target_out, fs_config)
  File &amp;#34;build/make/tools/releasetools/build_image.py&amp;#34;, line 335, in BuildImageMkfs
    mkfs_output = common.RunAndCheckOutput(build_command)
  [...]
OSError: [Errno 2] No such file or directory
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The build system can&amp;rsquo;t find the &lt;code&gt;mkf2fsuserimg&lt;/code&gt; script unless it&amp;rsquo;s either
referred to by full name or has previously been build and put into
&lt;code&gt;out/host/linux-x86/bin/&lt;/code&gt; by the build system.&lt;/p&gt;
&lt;p&gt;Run &lt;code&gt;make mkf2fsuserimg.sh-host&lt;/code&gt; and you should have it.&lt;/p&gt;
&lt;!--
Use f2fs, but fix f2fs kernel detection, then `make` the `make_f2fs`,
`sload_f2fs` and `fsck.f2fs` modules with `-host` appended.
--&gt;
&lt;h3 id=&#34;disappointment&#34;&gt;Disappointment&lt;/h3&gt;
&lt;p&gt;Alright, after some shenanigans to enable adb in recovery, we&amp;rsquo;re booting, but
only into recovery. Something is broken, or rather, a lot.&lt;/p&gt;
&lt;p&gt;Seems the kernel &lt;code&gt;cmdline&lt;/code&gt; is being overflowed&amp;hellip;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;(Reformatted for better readability)
[0.000000] Kernel command line:
rcupdate.rcu_expedited=1
lpm_levels.sleep_disabled=1
androidboot.bootdevice=soc/1d84000.ufshc
swiotlb=2048
service_locator.enable=1
msm_drm.dsi_display0=dsi_panel_somc_tama_cmd:config0
androidboot.selinux=permissive
androidboot.memcg=1
msm_rtb.filter=0x3F
ehci-hcd.park=3
coherent_pool=8M
sched_enable_power_aware=1
user_debug=31
printk.devkmsg=on
loop.max_part=16
kpti=0
androidboot.hardware=apollo
androidboot.super_partition=system
buildvariant=userdebug
androidboot.verifiedbootstate=orange
androidboot.keymaster=1
root=PARTUUID=f9cdf7ba-b834-a72a-f1c9-d6e0c0983896
androidboot.bootdevice=1d84000.ufshc
androidboot.baseband=msm
lcdid_adc=1145782
androidboot.slot_suffix=_a
skip_initramfs
rootwait
ro
init=/init
androidboot.dtbo_idx=2
androidboot.dtb_idx=2
androidboot.bootloader=xboot
oemandroidboot.xboot=1310-7079_X_Boot_SDM845_LA2.0.1_Q_206
androidboot.serialno=XXXXXXXXXX
!!! Not changed:
oemandroidboot.babe08a4=..empty
startup=0x00008000
warmboot=0x00000000
!!!! Below is cut off:
oemandroidboot.b
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&amp;hellip;and we have a nice kernel panic due to some mess:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;[2.541154] Warning: unable to open an initial console.
[2.541276] md: Waiting for all devices to be available before autodetect
[2.541387] md: If you don&amp;#39;t use raid, use raid=noautodetect
[2.541787] md: Autodetecting RAID arrays.
[2.541898] md: autorun ...
[2.541958] md: ... autorun DONE.
[2.544812] F2FS-fs (sda42): Magic Mismatch, valid(0xf2f52010) - read(0x0)
[2.544926] F2FS-fs (sda42): Can&amp;#39;t find valid F2FS filesystem in 1th superblock
[2.545211] F2FS-fs (sda42): Magic Mismatch, valid(0xf2f52010) - read(0x0)
[2.545323] F2FS-fs (sda42): Can&amp;#39;t find valid F2FS filesystem in 2th superblock
[2.545447] F2FS-fs (sda42): Magic Mismatch, valid(0xf2f52010) - read(0x0)
[2.545506] F2FS-fs (sda42): Can&amp;#39;t find valid F2FS filesystem in 1th superblock
[2.545617] F2FS-fs (sda42): Magic Mismatch, valid(0xf2f52010) - read(0x0)
[2.545726] F2FS-fs (sda42): Can&amp;#39;t find valid F2FS filesystem in 2th superblock
[2.545858] [EXFAT] trying to mount...
[2.546179] VFS: Cannot open root device &amp;#34;PARTUUID=f9cdf7ba-b834-a72a-f1c9-d6e0c0983896&amp;#34; or unknown-block(259,26): error -5
( -5 = -EIO =  &amp;#34;I/O error&amp;#34;)
[2.546243] Please append a correct &amp;#34;root=&amp;#34; boot option; here are the available partitions:
[2.546360] 0100            8192 ram0 
[2.546362]  (driver?)
[...]
[2.548881]   0801            2048 sda1 02841782-0268-44d8-8339-11e9e3e5045c
[2.548883] 
[2.549064]   0802           16384 sda2 9de21554-8b13-4e7d-b1e4-0371eb92073f
[2.549065] 
[...]
(This is sda42 aka userdata:)
[2.555792]   103:0001a    4128768 sda42 f9cdf7ba-b834-a72a-f1c9-d6e0c0983896
[2.555793] 
[...]
[2.562123] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(259,26)
[2.562241] CPU: 0 PID: 1 Comm: swapper/0 Tainted: G        W       4.14.176-104797-g31ee8bf990bd-dirty #2
[2.562351] Hardware name: Sony Mobile Communications. Apollo(SDM845 v2.1) (DT)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Could be an error in the f2fs implementation, though I already tried using ext4
for userdata and it gave me the same error.&lt;/p&gt;
&lt;h3 id=&#34;giving-up-for-now&#34;&gt;Giving up for now&lt;/h3&gt;
&lt;p&gt;Yeah so apparently Google just wants everyone to beg Qcom for bootloader updates
instead, as they have done for crosshatch.&lt;/p&gt;
&lt;p&gt;I haven&amp;rsquo;t seen any successful retrofit DAP in the wild so far, only people
&lt;a href=&#34;https://groups.google.com/forum/#!msg/android-building/cZoXCdFCmi0/__pRVlnnAwAJ&#34;&gt;begging for help and crickets in response&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;There&amp;rsquo;s also the matter of the supposedly removed &lt;code&gt;skip_initramfs&lt;/code&gt; parameter,
and how you&amp;rsquo;re supposed to pass a new parameter named
&lt;code&gt;androidboot.force_normal_boot=1&lt;/code&gt; now&amp;hellip; I don&amp;rsquo;t know, this all has been a
massive waste of time.&lt;/p&gt;
&lt;p&gt;See: &lt;a href=&#34;https://source.android.com/devices/tech/ota/dynamic_partitions/implement#system-as-root-changes&#34;&gt;System-as-Root changes&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;other-ideas&#34;&gt;Other ideas&lt;/h3&gt;
&lt;p&gt;Might have messed up the &lt;code&gt;androidboot.boot_devices&lt;/code&gt; parameter?
See &lt;a href=&#34;https://source.android.com/devices/tech/ota/dynamic_partitions/implement#kernel-command-line-changes&#34;&gt;Kernel command line changes&lt;/a&gt;.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Signed App seapp_contexts</title>
      <link>https://sx.ix5.org/info/post/signed-app-seapp_contexts/</link>
      <pubDate>Fri, 22 May 2020 14:58:03 +0200</pubDate>
      
      <guid>https://sx.ix5.org/info/post/signed-app-seapp_contexts/</guid>
      <description>&lt;p&gt;By default, most platform developers set their apps to be signed with the
platform key by using &lt;code&gt;LOCAL_CERTIFICATE := PLATFORM&lt;/code&gt; in make or &lt;code&gt;certificate: platform&lt;/code&gt; in blueprints. All apps signed by the platform key get assigned the
&lt;code&gt;platform_app&lt;/code&gt; SELinux label by default and have elevated privileges and access
to protected broadcasts and permissions.&lt;/p&gt;
&lt;p&gt;That approach falls flat when using GSIs though, as the &amp;ldquo;platform&amp;rdquo; key is now
recognized to be the key used to sign the GSI, which might differ from the one
used to generated the &lt;code&gt;/vendor&lt;/code&gt; parts.&lt;/p&gt;
&lt;p&gt;A better approach is to generate separate keys for apps in the vendor image and
get SELinux to recognize them.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Side note:&lt;/strong&gt; This still leaves the issue unsolved at the framework level.
Android&amp;rsquo;s frameworks-base defines lots of permissions and broadcasts with the
&lt;code&gt;protectionLevel=signature&lt;/code&gt;, which means only apps signed with the platform key
can utilize them. Very few permissions are set as &lt;code&gt;signature|privileged&lt;/code&gt;, which
means they are not avilable by default, but can be granted through
&lt;code&gt;privapp-permissions.xml&lt;/code&gt;, see &lt;a href=&#34;https://source.android.com/devices/tech/config/perms-whitelist&#34;&gt;Privileged Permissions Whitelisting&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This approach still only works for system applications though. For apps on
&lt;code&gt;/vendor&lt;/code&gt; an additional &lt;code&gt;vendorPrivileged&lt;/code&gt; clause in the &lt;code&gt;protectionLevel&lt;/code&gt; is
needed, see for example the permission &lt;code&gt;BIND_IMS_SERVICE&lt;/code&gt;, which is
vendor-accessible: &lt;a href=&#34;https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-10.0.0_r35/core/res/AndroidManifest.xml#2123&#34;&gt;AndroidManifest.xml&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;certs--inclusion&#34;&gt;Certs &amp;amp; Inclusion&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;./development/tools/make_key \
    app_cert \
    &amp;#34;/C=US/ST=California/L=Mountain View/O=Android/OU=Android/CN=Android/emailAddress=android@android.com&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Generates &lt;code&gt;app_cert.pk8&lt;/code&gt; and &lt;code&gt;app_cert.x509.pem&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Include the cert:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;android_app_certificate {
    name: &amp;#34;ModemConfig_app_cert&amp;#34;,
    certificate: &amp;#34;app_cert&amp;#34;,
}

android_app {
    name: &amp;#34;ModemConfig&amp;#34;,
    // Change this:
    //certificate: &amp;#34;platform&amp;#34;,
    // To this:
    certificate: &amp;#34;:ModemConfig_app_cert&amp;#34;,
    // [...]
}
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;exotic-files&#34;&gt;Exotic files&lt;/h3&gt;
&lt;p&gt;First, let SELinux recognize any signature by the &lt;code&gt;app_cert&lt;/code&gt; key, as defined
by the public key file &lt;code&gt;app_cert.x509.pem&lt;/code&gt;, as the signer value &lt;code&gt;@MODEMCONFIG&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;keys.conf&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;[@MODEMCONFIG]
ALL : SonyOpenTelephony/ModemConfig/app_cert.x509.pem
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The &lt;code&gt;ALL&lt;/code&gt; statement is a shorthand for &lt;code&gt;USER&lt;/code&gt;, &lt;code&gt;USERDEBUG&lt;/code&gt; and &lt;code&gt;ENG&lt;/code&gt;. You could
also define this certificate to only be valid for debugging.&lt;/p&gt;
&lt;p&gt;MAC stands for &lt;em&gt;Mandatory Access Control.&lt;/em&gt; This file translates recognized
signer values into &lt;code&gt;seinfo&lt;/code&gt; values that sepolicy vectors can understand and use.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;mac_permissions.xml&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;lt;policy&amp;gt;
    &amp;lt;signer signature=&amp;#34;@MODEMCONFIG&amp;#34; &amp;gt;
        &amp;lt;seinfo value=&amp;#34;modemconfigapp&amp;#34; /&amp;gt;
    &amp;lt;/signer&amp;gt;
&amp;lt;/policy&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;sepolicy&#34;&gt;sepolicy&lt;/h3&gt;
&lt;p&gt;Now, onto the labeling. App SELinux context recognition has a different syntax
than e.g.  &lt;code&gt;file_contexts&lt;/code&gt; or &lt;code&gt;service_contexts&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;seapp_contexts&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;user=_app seinfo=modemconfigapp name=com.sony.opentelephony.modemconfig isPrivApp=true domain=modemconfig_app type=app_data_file
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Note: For &lt;code&gt;seapp_contexts&lt;/code&gt;, the syntax is a bit confusing. &lt;code&gt;user&lt;/code&gt;, &lt;code&gt;seinfo&lt;/code&gt;,
&lt;code&gt;name&lt;/code&gt; and &lt;code&gt;isPrivApp&lt;/code&gt; are &lt;em&gt;matching selectors.&lt;/em&gt; &lt;code&gt;domain&lt;/code&gt; and &lt;code&gt;type&lt;/code&gt; are
&lt;em&gt;assignments.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Thus, the previous statement reads:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Match any app running under the &lt;code&gt;_app&lt;/code&gt; user (e.g. not system user), with a
signature that translates to the &lt;code&gt;modemconfigapp&lt;/code&gt; &lt;code&gt;seinfo&lt;/code&gt; value, with the
name &lt;code&gt;com.sony.opentelephony.modemconfig&lt;/code&gt;, which is a privileged app.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;Assign that app the &lt;code&gt;modemconfig_app&lt;/code&gt; domain and for its data directory under
&lt;code&gt;/data/&lt;/code&gt;, use the &lt;code&gt;app_data_file&lt;/code&gt; label.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Now we can actually write policy for the application.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;modemconfig_app.te&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;type modemconfig_app, domain;
app_domain(modemconfig_app)
# [...]
&lt;/code&gt;&lt;/pre&gt;&lt;hr&gt;
&lt;p&gt;For more information, see the AOSP sources: &lt;a href=&#34;https://android.googlesource.com/platform/system/sepolicy/+/refs/tags/android-10.0.0_r35/private/keys.conf&#34;&gt;keys.conf&lt;/a&gt;,
&lt;a href=&#34;https://android.googlesource.com/platform/system/sepolicy/+/refs/tags/android-10.0.0_r35/private/mac_permissions.xml&#34;&gt;mac_permissions.xml&lt;/a&gt;, &lt;a href=&#34;https://android.googlesource.com/platform/system/sepolicy/+/refs/tags/android-10.0.0_r35/private/seapp_contexts&#34;&gt;seapp_contexts&lt;/a&gt;,
&lt;a href=&#34;https://android.googlesource.com/platform/system/sepolicy/+/refs/tags/android-10.0.0_r35/tools/post_process_mac_perms&#34;&gt;post_process_mac_perms&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Thanks Luk for the inspiration, see &lt;a href=&#34;https://github.com/luk1337/SonyOpenTelephony/commit/9491a7180eea458ca14b01f06644021932a243f9&#34;&gt;this commit&lt;/a&gt; and &lt;a href=&#34;https://gist.github.com/luk1337/f5611b777d5fb4c8a1f67517a660db8d&#34;&gt;this gist&lt;/a&gt;.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Airplane Mode: Kill Cell only</title>
      <link>https://sx.ix5.org/info/post/airplane-mode-kill-cell-only/</link>
      <pubDate>Sun, 17 May 2020 20:47:24 +0200</pubDate>
      
      <guid>https://sx.ix5.org/info/post/airplane-mode-kill-cell-only/</guid>
      <description>&lt;p&gt;You can change Android&amp;rsquo;s behaviour when you toggle airplane mode via adb
commands.&lt;/p&gt;
&lt;p&gt;Check current status:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;adb shell settings get global airplane_mode_radios
# -&amp;gt; cell,bluetooth,wifi,nfc,wimax
adb shell content query --uri content://settings/global  --projection name:value --where &amp;#34;name=&amp;#39;airplane_mode_radios&amp;#39;&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The list of &lt;code&gt;airplane_mode_radios&lt;/code&gt; defines which &amp;ldquo;radios&amp;rdquo; will get turned off
when airplane mode is turned on.&lt;/p&gt;
&lt;p&gt;By removing from that list, you can keep the omitted radios on.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;# Keep Wi-Fi on when turning on airplane mode:
adb shell settings put global airplane_mode_radios cell,bluetooth,nfc,wimax
# Keep both Wi-Fi and bluetooth on:
adb shell settings put global airplane_mode_radios cell,nfc,wimax

# Revert to default:
adb shell settings delete global airplane_mode_radios
&lt;/code&gt;&lt;/pre&gt;&lt;blockquote&gt;
&lt;p&gt;There’s also a way to stop a device from turning on one of these radios when
Airplane Mode has been enabled.
By default, the options given to this command are WiFi, Bluetooth, and NFC.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;adb shell settings put global airplane_mode_toggleable_radios bluetooth,nfc

# Revert to default:
adb shell settings delete global airplane_mode_toggleable_radios
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;strong&gt;Sources:&lt;/strong&gt; See &lt;a href=&#34;https://android.stackexchange.com/questions/59664/possible-to-turn-on-airplane-mode-with-wifi-on-only&#34;&gt;this answer&lt;/a&gt;, &lt;a href=&#34;https://www.xda-developers.com/customize-radios-airplane-mode-android/&#34;&gt;xda&lt;/a&gt;.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Using AIDEGen for AOSP development</title>
      <link>https://sx.ix5.org/info/post/using-aidegen-for-aosp-development/</link>
      <pubDate>Fri, 15 May 2020 19:16:25 +0200</pubDate>
      
      <guid>https://sx.ix5.org/info/post/using-aidegen-for-aosp-development/</guid>
      <description>&lt;p&gt;AIDEGen, presumably a shorthand for &amp;ldquo;Android IDE (helper) Generator&amp;rdquo;, is a tool
in the AOSP source tree that allows working on system applications from within
an IDE like Android Studio that is normally only configured for non-platform app
development.&lt;/p&gt;
&lt;p&gt;For more official information, see the AIDEGen &lt;code&gt;README&lt;/code&gt;:
&lt;a href=&#34;https://android.googlesource.com/platform/tools/asuite/+/refs/tags/android-10.0.0_r35/aidegen/README.md&#34;&gt;Android 10&lt;/a&gt;, &lt;a href=&#34;https://android.googlesource.com/platform/tools/asuite/+/master/aidegen/README.md&#34;&gt;Android master&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The system-reserved &lt;code&gt;com.android.internal&lt;/code&gt;, &lt;code&gt;SystemUI&lt;/code&gt; etc. classes are not
exposed via the Android SDK for app developers, but rather listed in the
platform application&amp;rsquo;s &lt;code&gt;Android.mk&lt;/code&gt; or &lt;code&gt;Android.bp&lt;/code&gt; makefiles.
The &lt;code&gt;aidegen&lt;/code&gt; tool can bridge the gap from makefiles to IDEs and generate
configuration files with the resolved paths of the system classes and libraries
from a working AOSP tree.&lt;/p&gt;
&lt;div class=&#34;message&#34;&gt;
&lt;code&gt;aidegen&lt;/code&gt; can also create configs for C++ IDEs, but we will not cover
them in this article
&lt;/div&gt;
&lt;p&gt;Build AIDEGen:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;. build/envsetup.sh
lunch aosp_x86-userdebug
m aidegen
&lt;/code&gt;&lt;/pre&gt;&lt;div class=&#34;message warning&#34;&gt;
On Android Q, AIDEGen chokes on non-ASCII Java source files. You can
&lt;a href=&#34;https://android-review.googlesource.com/c/platform/tools/asuite/+/1312714&#34;&gt;patch the fix in&lt;/a&gt;
or use Android R or master. That is why we will not be using the prebuilt
&lt;code&gt;aidegen&lt;/code&gt; shipped in Q and instead build &lt;code&gt;aidegen-dev&lt;/code&gt;.
&lt;/div&gt;
&lt;p&gt;The generated &lt;code&gt;aidegen-dev&lt;/code&gt; binary will be in
&lt;code&gt;out/host/linux-x86/bin/aidegen-dev&lt;/code&gt;.&lt;/p&gt;
&lt;!--
(and also duplicated in `out/soong/host/linux-x86/bin/aidegen-dev`, the files
have the same `sha256sum`) :-/
--&gt;
&lt;p&gt;Run it (you must be &lt;code&gt;cd&lt;/code&gt;&amp;rsquo;d to the root of the Android tree):&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;# Usage:
aidegen-dev [OPTIONS] $package_or_path
# Where $package can be a module name or $path can be, well, a path
# E.g.:
aidegen-dev -i s SystemUI
# Full command documentation:
aidegen-dev --help
&lt;/code&gt;&lt;/pre&gt;&lt;div class=&#34;message&#34;&gt;
You will need to run &lt;code&gt;aidegen&lt;/code&gt; anew every time the
&lt;code&gt;Android.mk&lt;/code&gt;-based source files are changed, e.g. when you switch
branches for a security patch or if you changed the &lt;code&gt;Android.mk&lt;/code&gt; or
&lt;code&gt;Android.bp&lt;/code&gt; file of your platform-level app yourself.
&lt;/div&gt;
&lt;!--
&gt; Do -\-help  
&gt; I can&#39;t remember the proper flag for as  
&gt; It can do intellij, as and vscode

`-n, -\-no_launch       Do not launch IDE.`
--&gt;
&lt;p&gt;A more practical example:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;python3 out/soong/host/linux-x86/bin/aidegen-dev \
    -n \ # Do not launch IDE
    -s \ # Skip building jar/modules that create java files at build
    packages/apps/Camera2
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Full command reference of optional arguments, as of Android Q:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;-h, --help            show help message and exit
-d {0,1,2,3,4,5,6,7,8,9}, --depth {0,1,2,3,4,5,6,7,8,9}
                      The depth of module referenced by source.
-v, --verbose         Display DEBUG level logging.
-i IDE, --ide IDE     Launch IDE type:
                        j: IntelliJ,
                        s: Android Studio,
                        e: Eclipse.
-p IDE_INSTALLED_PATH, --ide-path IDE_INSTALLED_PATH
                      IDE installed path.
-n, --no_launch       Do not launch IDE.
-r, --config-reset    Reset all saved configurations,
                      e.g., preferred IDE version.
-s, --skip-build      Skip building jar or modules that create
                      java files in build time, e.g. R/AIDL/Logtags.
-a, --android-tree    Generate whole Android source tree
                      project file for IDE.
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;A good recommendation is to add the generated files to your &lt;code&gt;.gitignore&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-gitignore&#34; data-lang=&#34;gitignore&#34;&gt;#.gitignore

# Eclipse project
**/.classpath
**/.project

# IntelliJ project
**/.idea
**/*.iml
**/*.ipr
**/lib
**/gen
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;See also:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://wiki.lineageos.org/import-android-studio-howto.html&#34;&gt;LineageOS Wiki: Importing sources&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://codechacha.com/ko/android-aidegen/&#34;&gt;This Korean article&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://youtrack.jetbrains.com/issue/IDEA-226939&#34;&gt;Google engineers struggling to explain the insane AOSP build system to
veteran JetBrains engineers in order to make Android Studio a bit less slow
following the ballooning size of Android source files&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
    </item>
    
    <item>
      <title>Quick: Misc Build system quirks</title>
      <link>https://sx.ix5.org/info/post/quick-misc-build-system-quirks/</link>
      <pubDate>Mon, 11 May 2020 17:47:08 +0200</pubDate>
      
      <guid>https://sx.ix5.org/info/post/quick-misc-build-system-quirks/</guid>
      <description>&lt;h2 id=&#34;module-partition-tags&#34;&gt;Module partition tags&lt;/h2&gt;
&lt;p&gt;Short overview over the &lt;code&gt;Android.bp&lt;/code&gt; buildvars for modules, since they make no
sense and I can never remember them.&lt;/p&gt;
&lt;p&gt;See &lt;a href=&#34;https://android.googlesource.com/platform/build/soong/+/refs/tags/android-10.0.0_r35/android/module.go#229&#34;&gt;soong/android/module.go&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;proprietary:&lt;/strong&gt; Whether this is a proprietary vendor module, and should be
installed into /vendor&lt;br&gt;
Use &lt;code&gt;soc_specific&lt;/code&gt; instead for better meaning.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;vendor:&lt;/strong&gt; Whether this module is specific to an SoC (System-On-a-Chip).&lt;br&gt;
When set to true, it is installed into &lt;code&gt;/vendor&lt;/code&gt; (or &lt;code&gt;/system/vendor&lt;/code&gt; if
vendor partition does not exist).&lt;br&gt;
Use &lt;code&gt;soc_specific&lt;/code&gt; instead for better meaning.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;soc_specific:&lt;/strong&gt; Whether this module is specific to an SoC (System-On-a-Chip).&lt;br&gt;
When set to true, it is installed into &lt;code&gt;/vendor&lt;/code&gt; (or &lt;code&gt;/system/vendor&lt;/code&gt; if vendor
partition does not exist).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;device_specific:&lt;/strong&gt; Whether this module is specific to a device, not only for
SoC, but also for off-chip peripherals.&lt;br&gt;
When set to true, it is installed into &lt;code&gt;/odm&lt;/code&gt; (or &lt;code&gt;/vendor/odm&lt;/code&gt; if odm
partition does not exist, or &lt;code&gt;/system/vendor/odm&lt;/code&gt; if both odm and vendor
partitions do not exist).&lt;br&gt;
This implies &lt;code&gt;soc_specific:true&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;product_specific:&lt;/strong&gt; Whether this module is specific to a software
configuration of a product (e.g. country, network operator, etc).&lt;br&gt;
When set to true, it is installed into &lt;code&gt;/product&lt;/code&gt; (or &lt;code&gt;/system/product&lt;/code&gt; if
product partition does not exist).&lt;/p&gt;
&lt;h2 id=&#34;dependencies-on-other-modules&#34;&gt;Dependencies on other modules&lt;/h2&gt;
&lt;p&gt;Normally, linking to a module automatically adds it to the build. But if you
have a non-library module, you can still require its presence from another
module:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;prebuilt_etc {
    name: &amp;#34;android.software.live_wallpaper.xml&amp;#34;,
    src: &amp;#34;android.software.live_wallpaper.xml&amp;#34;,
}

android_app {
    name: &amp;#34;LiveWallpapersPicker&amp;#34;,
    srcs: [&amp;#34;src/**/*.java&amp;#34;],
    required: [&amp;#34;android.software.live_wallpaper.xml&amp;#34;],
    // [...]
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;For the full example, see &lt;a href=&#34;https://android.googlesource.com/platform/packages/wallpapers/LivePicker/+/refs/tags/android-10.0.0_r36/Android.bp#26&#34;&gt;wallpapers: Android.bp&lt;/a&gt;.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>SODP 2020-04-05 Security state</title>
      <link>https://sx.ix5.org/info/post/sodp-2020-04-05-security-state/</link>
      <pubDate>Sat, 02 May 2020 21:11:11 +0100</pubDate>
      
      <guid>https://sx.ix5.org/info/post/sodp-2020-04-05-security-state/</guid>
      <description>&lt;p&gt;Reference: &lt;a href=&#34;https://source.android.com/security/bulletin/2020-04-01&#34;&gt;2020-04-01 Google Bulletin&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;kernel&#34;&gt;Kernel&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Input: ff-memless - kill timer in destroy()&lt;/strong&gt;&lt;br&gt;
&lt;a href=&#34;https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fa3a5a1880c91bb92594ad42dfe9eedad7996b86&#34;&gt;git.kernel.org?id=fa3a5a&lt;/a&gt;&lt;br&gt;
Already merged in 4.9 via 4f039b4fc7d3a &amp;ldquo;treewide: Linux 4.9.203&amp;rdquo;&lt;br&gt;
Already merged in 4.14 via 07063e00169b5 &amp;ldquo;treewide: Linux 4.14.155&amp;rdquo;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;HID: Fix assumption that devices have inputs&lt;/strong&gt;&lt;br&gt;
&lt;a href=&#34;https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d9d4b1e46d9543a82c23f6df03f4ad697dab361b&#34;&gt;git.kernel.org?id=d9d4b1&lt;/a&gt;&lt;br&gt;
Already merged in 4.9 via d0f1e408899a4 &amp;ldquo;treewide: Linux 4.9.199&amp;rdquo;&lt;br&gt;
Already merged in 4.14 via 0e329f9e62b98 &amp;ldquo;treewide: Linux 4.14.152&amp;rdquo;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;ALSA: timer: Fix incorrectly assigned timer instance&lt;/strong&gt;&lt;br&gt;
&lt;a href=&#34;https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e7af6307a8a54f0b873960b32b6a644f2d0fbd97&#34;&gt;git.kernel.org?id=e7af63&lt;/a&gt;&lt;br&gt;
Already merged in 4.9 via 69c2d155bb0ce &amp;ldquo;treewide: Linux 4.9.201&amp;rdquo;&lt;br&gt;
Already merged in 4.14 via b3cdc9dadb7ae &amp;ldquo;treewide: Linux 4.14.154&amp;rdquo;&lt;/p&gt;
&lt;h2 id=&#34;caf-kernel&#34;&gt;CAF Kernel&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;asoc: msm-pcm: Added lock in controls put() and get()&lt;/strong&gt;&lt;br&gt;
&lt;a href=&#34;https://source.codeaurora.org/quic/la/kernel/msm-4.4/commit?id=1c9afab264e3cafa461d746e9dcfd3c0487754cb&#34;&gt;source.codeaurora.org/quic/la/kernel/msm-4.4/commit?id=1c9afa&lt;/a&gt;&lt;br&gt;
4.9: TODO&lt;br&gt;
4.14: Fixed in 85a97521 &amp;ldquo;asoc: msm-pcm: Added lock in controls put() and get()&amp;rdquo;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;soc: msm-pcm: Add mutex lock to protect prvt data&lt;/strong&gt;&lt;br&gt;
&lt;a href=&#34;https://source.codeaurora.org/quic/la/kernel/msm-4.4/commit/?id=42ffbf03ec54dc14824d078f36c350b24c217f8d&#34;&gt;source.codeaurora.org/quic/la/kernel/msm-4.4/commit/?id=42ffbf&lt;/a&gt;
4.9: TODO&lt;br&gt;
Already fixed in 4.14 in kernel-techpack-audio via f2a2905f &amp;ldquo;asoc: msm-pcm: Add mutex lock to protect prvt data&amp;rdquo;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;msm: camera: context: Add null check on context pointer&lt;/strong&gt;&lt;br&gt;
&lt;a href=&#34;https://source.codeaurora.org/quic/la/kernel/msm-4.9/commit/?id=9910e89b27224fbddbf7d15d307597e13d9b9258&#34;&gt;source.codeaurora.org/quic/la/kernel/msm-4.9/commit/?id=9910e8&lt;/a&gt;&lt;br&gt;
4.9: Fixed in 9910e89b &amp;ldquo;msm: camera: context: Add null check on context pointer&amp;rdquo;
4.14: Fixed. Driver was copied. History was lost.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;net: qrtr: Handle error from skb_put_padto&lt;/strong&gt;&lt;br&gt;
&lt;a href=&#34;https://source.codeaurora.org/quic/la/kernel/msm-4.14/commit/?id=870f0ba0fc05bc6ebac1486b39dc9d94c993eafb&#34;&gt;source.codeaurora.org/quic/la/kernel/msm-4.14/commit/?id=870f0&lt;/a&gt;&lt;br&gt;
4.9: TODO&lt;br&gt;
4.14: Fixed in 4ef3e1d net: qrtr: Handle error from skb_put_padto&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;vdec: Set correct output buffer size: dynamic meta mode&lt;/strong&gt;&lt;br&gt;
&lt;a href=&#34;https://source.codeaurora.org/quic/le/platform/hardware/qcom/media/commit/?id=9e80e1db4b56b42f9150d4d51166560d10839f5f&#34;&gt;source.codeaurora.org/quic/le/platform/hardware/qcom/media/commit/?id=9e80e&lt;/a&gt;&lt;br&gt;
4.9: TODO&lt;br&gt;
4.14: Fixed in 6babf936 &amp;ldquo;vdec: Set correct output buffer size: dynamic meta mode&amp;rdquo; on branch LA.UM.8.2.1.r1&lt;/p&gt;
&lt;h2 id=&#34;framework-and-system&#34;&gt;Framework and System&lt;/h2&gt;
&lt;p&gt;Patched via sync of latest AOSP sources.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>GPS HAL Adaptation</title>
      <link>https://sx.ix5.org/info/post/gps-hal-adaptation/</link>
      <pubDate>Mon, 23 Mar 2020 12:12:40 +0100</pubDate>
      
      <guid>https://sx.ix5.org/info/post/gps-hal-adaptation/</guid>
      <description>&lt;!--

#############################################
# TODO
#############################################

Use header exports instead of dedicated header libs, also keep existing
#include paths instead of requiring modifications
-&gt; Also update now obsolete commit ids to appropriate ones

#############################################


(Mostly done I think)

Methodology: What is needed? Has anyone else done this work (for us) already?
What can we ditch? What is proprietary? What is useless fluff?

Using 8.1 CAF tags, replacing proprietary QMI components, using `libloc_loader`,
changing build guards, conversion to blueprint modules, fixing header copying,
deducing (not reverse-engineering!!!) QMI headers from kernel (Jens)

Reorganizing: No longer using `LOCAL_COPY_HEADERS`, defining separate
`cc_library_headers`

(introduce androidmk again, link article, and state its limits)

soong/blueprint nice things
- filegroup
- defaults

meh
- namespaces: imports, having to add them in device tree mk,
  upcoming: visibility

--&gt;
&lt;h2 id=&#34;intro&#34;&gt;Intro&lt;/h2&gt;
&lt;p&gt;The Qualcomm GPS/GNSS functionality in Android is spread out over lots of files
and repositories. Most important are the &lt;code&gt;hardware/qcom/gps&lt;/code&gt; and
&lt;code&gt;vendor/qcom/opensource/location&lt;/code&gt; directories, plus a lot of proprietary
libraries.&lt;/p&gt;
&lt;p&gt;We wanted to upgrade our &lt;a href=&#34;https://github.com/sonyxperiadev/vendor-qcom-opensource-location/tree/q-mr0&#34;&gt;forked opensource location HAL&lt;/a&gt; to a
more recent CAF tag since we had to resort to retrofitting patches to keep up
with the &lt;code&gt;hardware/qcom/gps&lt;/code&gt; parts, see for instance &lt;a href=&#34;https://github.com/sonyxperiadev/vendor-qcom-opensource-location/pull/22&#34;&gt;this PR&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This turned out into a larger ordeal, since more recent Qualcomm/CAF versions of
the OSS location repo depended on extensive changes to the &lt;code&gt;gps&lt;/code&gt; HAL as well, so
we had to pull in those changes and adapt the repo into our SODP build
environment as well.&lt;/p&gt;
&lt;h2 id=&#34;picking-a-caf-tag&#34;&gt;Picking a CAF tag&lt;/h2&gt;
&lt;p&gt;Let‘s take as given that we need to bump our OSS location and gps HALs.
We want the &lt;code&gt;sm8150&lt;/code&gt; future-oriented version of our HALs, so we head to the
CodeAurora Forum git repos and fetch the latest 8.1 tags:
&lt;a href=&#34;https://source.codeaurora.org/quic/la/platform/hardware/qcom/gps/tree/?h=LA.UM.8.1.r1-14500-sm8150.0&#34;&gt;platform/hardware/qcom/gps&lt;/a&gt; and
&lt;a href=&#34;https://source.codeaurora.org/quic/la/platform/vendor/qcom-opensource/location/tree/?h=LA.UM.8.1.r1-14500-sm8150.0&#34;&gt;platform/vendor/qcom-opensource/location&lt;/a&gt; using tag
&lt;code&gt;LA.UM.8.1.r1-14500-sm8150.0&lt;/code&gt;. You can search for tags at the repo’s
&lt;a href=&#34;https://source.codeaurora.org/quic/la/platform/vendor/qcom-opensource/location/refs/&#34;&gt;/refs&lt;/a&gt; node.&lt;/p&gt;
&lt;h2 id=&#34;requirements&#34;&gt;Requirements&lt;/h2&gt;
&lt;p&gt;Starting out, the package list in &lt;a href=&#34;https://github.com/sonyxperiadev/device-sony-common/blob/456037de1ff6823d4d1c2e243d439ec3e9a8cfe8/common-packages.mk#L54-L66&#34;&gt;common-packages.mk&lt;/a&gt; looked like this:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;# hardware/qcom/gps
PRODUCT_PACKAGES += \
    libloc_core \
    libgps.utils \
    liblocation_api \
    libloc_pla \
    libgnss
# vendor/qcom/opensource/location
PRODUCT_PACKAGES += \
    libloc_api_v02 \
    libloc_ds_api \
    libgnsspps
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The &lt;code&gt;init&lt;/code&gt;-startable location services are included via
&lt;a href=&#34;https://github.com/sonyxperiadev/device-sony-common/blob/456037de1ff6823d4d1c2e243d439ec3e9a8cfe8/common-treble.mk#L70-L73&#34;&gt;common-treble.mk&lt;/a&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;# GNSS
PRODUCT_PACKAGES += \
    android.hardware.gnss@1.1-impl-qti \
    android.hardware.gnss@1.1-service-qti
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This results in the following dependency chain:
&lt;code&gt;android.hardware.gnss@1.1-service-qti&lt;/code&gt; loads
&lt;code&gt;android.hardware.gnss@1.1-impl-qti&lt;/code&gt;, which loads:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;libloc_core&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;libgps.utils&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;liblocation_api&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;libloc_pla&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;libgnss&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;code&gt;libloc_core&lt;/code&gt; loads the following in &lt;a href=&#34;https://git.ix5.org/felix/hardware-qcom-gps/src/commit/17d7115c55f42dbe410ed5e4eada4e5faedf01ac/core/ContextBase.cpp#L43-L44&#34;&gt;ContextBase.cpp&lt;/a&gt;
(shortened):&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;const char* libname = &amp;#34;libloc_api_v02.so&amp;#34;;
// If gps.conf has GNSS_DEPLOYMENT = 1 (QCSR SS5 enabled):
libname = &amp;#34;libsynergy_loc_api.so&amp;#34;
if ((handle = dlopen(libname, RTLD_NOW)) != NULL) {
  getLocApi_t* getter = (getLocApi_t*) dlsym(handle, &amp;#34;getLocApi&amp;#34;);
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;That means that we need to provide &lt;code&gt;libloc_api_v02.so&lt;/code&gt;, and in case we want to
provide the OSS &amp;ldquo;synergy API&amp;rdquo;, &lt;code&gt;libsynergy_loc_api.so&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;I could not find any reference to &lt;code&gt;libgnsspps&lt;/code&gt;, and &lt;code&gt;libloc_ds_api&lt;/code&gt; seems unused
on 8.1 as well.&lt;/p&gt;
&lt;p&gt;One peculiarity for SODP is that we cannot rely on proprietary symbols and libs
at build time since all our non-&lt;code&gt;odm&lt;/code&gt; code is public. For that reason,
&lt;a href=&#34;https://github.com/oshmoun&#34;&gt;Obeida Shamoun&lt;/a&gt; wrote a tool called &lt;a href=&#34;https://github.com/sonyxperiadev/vendor-qcom-opensource-location/pull/8&#34;&gt;libloc_loader&lt;/a&gt; which
&lt;code&gt;dlopen&lt;/code&gt;s the required libraries from the &lt;code&gt;/odm&lt;/code&gt; partition. The required
libraries are defined in &lt;a href=&#34;https://github.com/sonyxperiadev/vendor-qcom-opensource-location/blob/d0e4656d09fddb923df440c9b6025c58b9e52135/loc_api/libloc_loader/libloc_loader.h#L4-L7&#34;&gt;libloc_loader.h&lt;/a&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;libdsi_netctrl.so&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;libqmi_cci.so&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;libqmi_common_so.so&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;libqmiservices.so&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;We can ditch &lt;code&gt;libdsi_netctrl&lt;/code&gt; and &lt;code&gt;libqmiservices&lt;/code&gt; and their respective
&lt;a href=&#34;https://github.com/sonyxperiadev/vendor-qcom-opensource-location/blob/d0e4656d09fddb923df440c9b6025c58b9e52135/loc_api/libloc_loader/libloc_loader.c#L14&#34;&gt;loader functions&lt;/a&gt; since their symbols are no longer required on the
8.1 OSS location repo.&lt;/p&gt;
&lt;p&gt;So, let us review our requirements:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;android.hardware.gnss@1.1-impl-qti&lt;/code&gt; (should be bumped to 2.0)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;android.hardware.gnss@1.1-service-qti&lt;/code&gt; (should be bumped to 2.0)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;libloc_core&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;libgps.utils&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;liblocation_api&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;libloc_pla&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;libgnss&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;libloc_api_v02.so&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;libsynergy_loc_api.so&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;libqmi_cci.so&lt;/code&gt; (&lt;code&gt;odm&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;libqmi_common_so.so&lt;/code&gt; (&lt;code&gt;odm&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;adaptation-phase&#34;&gt;Adaptation phase&lt;/h2&gt;
&lt;p&gt;To adapt the new 8.1 HALs, we need to re-apply some commits that we had applied
to the previous CAF base and cull usage of some proprietary libs.
Just rebase the &lt;a href=&#34;https://github.com/sonyxperiadev/vendor-qcom-opensource-location/commits/cb0f300a11348266eba03f4d6cd3a29a82f5a586&#34;&gt;previous SODP adaptation commits&lt;/a&gt; on top of the
8.1 OSS location repo.&lt;/p&gt;
&lt;p&gt;These bringup tweaks are fairly tame and self-explanatory:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;gps: &lt;a href=&#34;https://git.ix5.org/felix/hardware-qcom-gps/commit/4756243ee494aa647201523c52bf6b3fcd3ae7ba&#34;&gt;Remove liblbs_core&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;gps: &lt;a href=&#34;https://git.ix5.org/felix/hardware-qcom-gps/commit/e9cd68d4b5455b20b80e6eb541afdaecc80297b6&#34;&gt;Remove conflicting /etc configs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;oss location: &lt;a href=&#34;https://git.ix5.org/felix/vendor-qcom-opensource-location/commit/8fa540e9da4e953e0bb9743e58bc84ae8c09eab7&#34;&gt;synergy_loc_api: Remove proprietary symbols&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;oss location: &lt;a href=&#34;https://git.ix5.org/felix/vendor-qcom-opensource-location/commit/7fd1200797adfc3b34082c20ca0e64f13908e894&#34;&gt;loc_api: Move inclusion of gps_extended.h&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;oss location: &lt;a href=&#34;https://git.ix5.org/felix/vendor-qcom-opensource-location/commit/04b2d11df23510c682fc0a72466ca7bf9eb89e28&#34;&gt;loc_api: Include missing loc_cfg header&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;qmi-and-proprietary-headers&#34;&gt;QMI and proprietary headers&lt;/h2&gt;
&lt;p&gt;Since Qualcomm wants to keep their chip and core firmware and software internals
secret, they devise all sorts of idiosyncratic schemes and data formats to
interface with their chips. One of those formats is a sort of messaging
protocol called &lt;code&gt;QMI&lt;/code&gt;, a form of IPC. &lt;code&gt;QMI&lt;/code&gt; stands for &amp;ldquo;Qualcomm MSM Interface&amp;rdquo;.
For more information, see the entry on
&lt;a href=&#34;https://osmocom.org/projects/quectel-modems/wiki/QMI&#34;&gt;QMI on the osmocom Wiki&lt;/a&gt;&lt;sup id=&#34;fnref:1&#34;&gt;&lt;a href=&#34;#fn:1&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
&lt;p&gt;Even though the location repo is filed under &lt;code&gt;opensource&lt;/code&gt;, it relies on symbol
definitions in header files that are only shipped with a Qualcomm
&amp;ldquo;Board Support Package&amp;rdquo; - &lt;code&gt;BSP&lt;/code&gt; for short.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s gloss over &lt;em&gt;how&lt;/em&gt; exactly &lt;a href=&#34;https://github.com/EnJens&#34;&gt;Jens Andersen&lt;/a&gt; managed to extract the
needed headers by &lt;em&gt;&amp;ldquo;studying the code and the functions defined in the kernel
headers&amp;rdquo;&lt;/em&gt; and keep in mind that less is more when interacting with and working
around proprietary interfaces. The needed symbols are part of the PR
&lt;a href=&#34;https://github.com/sonyxperiadev/vendor-qcom-opensource-location/pull/2&#34;&gt;Add headers needed for compiling location provider&lt;/a&gt;. I am sorry that
I cannot be more specific with this topic, it‘s a delicate matter.&lt;/p&gt;
&lt;p&gt;With the 8.1 location repo, we need to adapt a few headers slightly:
&lt;a href=&#34;https://git.ix5.org/felix/vendor-qcom-opensource-location/commit/a795a20ffafe413fff5596a3e8d3274128133385&#34;&gt;loc_api: Update QMI header symbols&lt;/a&gt; and
&lt;a href=&#34;https://git.ix5.org/felix/vendor-qcom-opensource-location/commit/d6142220859e23a7933be2cd3fb6cca0bac90c10&#34;&gt;loc_api: Fix error type enums&lt;/a&gt;. &lt;a href=&#34;https://github.com/MarijnS95&#34;&gt;Marijn&lt;/a&gt; and me were puzzled as
to how the doubly-included &lt;code&gt;common_qmi_idl_type_table_object_v01&lt;/code&gt; was even
compiling with the legacy location repo, but we agreed that the definition
should be moved to &lt;code&gt;libloc_loader.c&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;modern-makefile-practices&#34;&gt;Modern makefile practices&lt;/h2&gt;
&lt;p&gt;The heading of this section is a tad contradictory, since the &lt;code&gt;Android.mk&lt;/code&gt;-based
build system is very slowly being phased out. Still, one has to adapt to the
times, and Google is planning to or already has deprecated a good lot of
functions in Q and will make them errors on the R release.&lt;/p&gt;
&lt;p&gt;We shall we begin by looking at a typical old-style multi-library entanglement
of medium complexity. Usually libraries will have interdependencies and reliance
on shared header files.&lt;/p&gt;
&lt;p&gt;File structure:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;├── module_a
│   │── libfoo.c
│   │── libfoo.h
│   └── Android.mk
└── module_b
    │── libbar.c
    │── libbar.h
    └── Android.mk
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;code&gt;module_a/Android.mk&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-make&#34; data-lang=&#34;make&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;&#34;&gt;include&lt;/span&gt; &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;CLEAR_VARS&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;LOCAL_MODULE&lt;/span&gt;           &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; libmodule_a
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;LOCAL_SHARED_LIBRARIES&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; libutils
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;LOCAL_SRC_FILES&lt;/span&gt;        &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; libfoo.c
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;LOCAL_COPY_HEADERS&lt;/span&gt;     &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; libfoo.h
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;LOCAL_COPY_HEADERS_TO&lt;/span&gt;  &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; module_a/
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;LOCAL_C_INCLUDES&lt;/span&gt;       &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;TARGET_OUT_HEADERS&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;/data/inc
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;&#34;&gt;include&lt;/span&gt; &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;BUILD_SHARED_LIBRARY&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;libmodule_a&lt;/code&gt; will have access to the headers in
&lt;code&gt;$(TARGET_OUT_HEADERS)/data/inc&lt;/code&gt;. The headers var resolves to:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;$ get_build_var TARGET_OUT_HEADERS
# out/target/product/&amp;lt;device&amp;gt;/obj/include
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;So &lt;code&gt;out/target/product/&amp;lt;device&amp;gt;/obj/include/data/inc/my_inc.h&lt;/code&gt; will be
&lt;code&gt;#include&lt;/code&gt;-able as &lt;code&gt;my_inc.h&lt;/code&gt; for &lt;code&gt;module_a/libfoo.c&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bc7a00&#34;&gt;#include&lt;/span&gt; &lt;span style=&#34;color:#bc7a00&#34;&gt;&amp;#34;my_inc.h&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#bc7a00&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bc7a00&#34;&gt;&lt;/span&gt;[...]
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Similarly, &lt;code&gt;libfoo.h&lt;/code&gt; will be accessible to &lt;code&gt;libbar.c&lt;/code&gt; (or any other lib for
that matter) because it was explicitly copied into a subfolder of the &lt;code&gt;out&lt;/code&gt;
dir’s &lt;code&gt;include&lt;/code&gt; directory via &lt;code&gt;LOCAL_COPY_HEADERS_TO&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;module_b/Android.mk&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-make&#34; data-lang=&#34;make&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;&#34;&gt;include&lt;/span&gt; &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;CLEAR_VARS&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;LOCAL_MODULE&lt;/span&gt;           &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; libmodule_b
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;LOCAL_SHARED_LIBRARIES&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; libutils libmodule_a
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;LOCAL_SRC_FILES&lt;/span&gt;        &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; libbar.c
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;&#34;&gt;include&lt;/span&gt; &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;BUILD_SHARED_LIBRARY&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;module_b/libbar.c&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bc7a00&#34;&gt;#include&lt;/span&gt; &lt;span style=&#34;color:#bc7a00&#34;&gt;&amp;lt;module_a/libfoo.h&amp;gt;&lt;/span&gt;&lt;span style=&#34;color:#bc7a00&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#bc7a00&#34;&gt;&lt;/span&gt;[...]
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You will note that the &lt;code&gt;make&lt;/code&gt; system allows specifying absolute paths (i.e. not
relative to the module dir and also outside the module dir).&lt;/p&gt;
&lt;p&gt;Android Q is starting to discourage such Wild West practices and kindly asks you
to use &amp;ldquo;header libraries&amp;rdquo; as modules instead.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;module_a/Android.mk&lt;/code&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-make&#34; data-lang=&#34;make&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;LOCAL_PATH&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;call my-dir&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;&#34;&gt;[...]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;&#34;&gt;include&lt;/span&gt; &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;CLEAR_VARS&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;LOCAL_MODULE&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; libmodule_a_headers
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;LOCAL_EXPORT_C_INCLUDE_DIRS&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;LOCAL_PATH&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;/
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;&#34;&gt;include&lt;/span&gt; &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;BUILD_HEADER_LIBRARY&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;module_b/Android.mk&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-make&#34; data-lang=&#34;make&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;&#34;&gt;[...]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;LOCAL_HEADER_LIBRARIES&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; libmodule_a_headers
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;At the same time, you should revise your makefiles and see whether you can
remove some overzealous logic. Makefiles are slow to parse and can slow down
your iteration speed a lot.&lt;/p&gt;
&lt;p&gt;We do the same for &lt;code&gt;libloc_loader&lt;/code&gt; and move its header into a separate module:
&lt;a href=&#34;https://git.ix5.org/felix/vendor-qcom-opensource-location/commit/22b2815d54f036f90d629320b109aa0f1f976bdc&#34;&gt;loc_api: Clean libloc_loader, headers as module&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;soong-and-blueprints&#34;&gt;Soong and blueprints&lt;/h2&gt;
&lt;p&gt;Now we also need to slightly modify some behaviour because &lt;code&gt;soong&lt;/code&gt; does not
allow that specific mode of operating any more. We can prepare this in &lt;code&gt;make&lt;/code&gt;
already so that the switch to soong will not be as drastic.
&lt;a href=&#34;https://git.ix5.org/felix/hardware-qcom-gps/commit/a5c3dfb98572aaf6a1ce3b2b529f4bc0b8261c09&#34;&gt;utils+gnss: Invert debuggable logic&lt;/a&gt;: Rather than checking whether
the build type is a &lt;code&gt;user&lt;/code&gt; build, soong with its &lt;code&gt;product_variables: debuggable&lt;/code&gt;
only allows checking whether it is not.&lt;/p&gt;
&lt;p&gt;Now we can go ahead and start converting the gps and location modules to the
soong &lt;code&gt;Android.bp&lt;/code&gt; language. Using &lt;a href=&#34;https://android.googlesource.com/platform/build/soong/+/refs/tags/android-10.0.0_r32#android_bp-file-format&#34;&gt;blueprints&lt;/a&gt; is much faster to parse. A
downside is that any dependency of a module defined in a blueprint file must
also be defined in a blueprint file, because all blueprint modules are evaluated
and validated before &lt;code&gt;make&lt;/code&gt; modules are read.&lt;/p&gt;
&lt;p&gt;You can use the &lt;a href=&#34;https://sx.ix5.org/info/post/android-blueprint-files/&#34;&gt;androidmk tool&lt;/a&gt; to bear the brunt of the
conversion work, but complex &lt;code&gt;make&lt;/code&gt; structures will not translate one-to-one
into blueprint format.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;../&lt;/code&gt;-style relative &lt;code&gt;LOCAL_C_INCLUDES&lt;/code&gt; outside the module dir like in
&lt;a href=&#34;https://git.ix5.org/felix/hardware-qcom-gps/src/branch/caf-8.1-sodp-port/android/2.0/Android.mk#L37-L38&#34;&gt;gps/2.0/Android.mk&lt;/a&gt; are no longer allowed. We need to define
those as header library modules. For make, you can refer to the
&lt;code&gt;BUILD_HEADER_LIBRARY&lt;/code&gt; example from above, in soong it looks like this:
&lt;a href=&#34;https://git.ix5.org/felix/hardware-qcom-gps/commit/3ddeba35d73fe0b5f73b990e1c6ac1ea428fff7a&#34;&gt;android: Define viz+measurement@1.0 header libs&lt;/a&gt;
&lt;sup id=&#34;fnref:2&#34;&gt;&lt;a href=&#34;#fn:2&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;2&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://git.ix5.org/felix/hardware-qcom-gps/src/branch/caf-8.1-sodp-port/android/2.0/Android.mk#L20-L21&#34;&gt;Source files from outside the module directory&lt;/a&gt; are similarly no
longer allowed.  Soong has the concept of a &lt;code&gt;filegroup&lt;/code&gt; which we can use
instead.&lt;/p&gt;
&lt;p&gt;File structure:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;├── foo
│   ├── foo.c (shared)
│   └── Android.bp
├── bar
│   ├── bar.c
│   └── Android.bp
└── baz
    ├── baz.c
    └── Android.bp
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;code&gt;foo/Android.bp&lt;/code&gt;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;filegroup {
    name: &amp;#34;foo_src&amp;#34;,
    srcs: [&amp;#34;foo.c&amp;#34;]
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You can reference that group of files via &lt;code&gt;:foo_src&lt;/code&gt; (note the colon) from
anywhere else, e.g. &lt;code&gt;bar/Android.bp&lt;/code&gt;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;cc_library_shared {
    name: &amp;#34;bar&amp;#34;,
    srcs: [
        &amp;#34;bar.c&amp;#34;,
        &amp;#34;:foo_src&amp;#34;,
    ],
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You can no longer rely on traditional conditional statements in soong; this is a
no-go:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;ifeq ($(GNSS_HIDL_LEGACY_MEASURMENTS),true)
LOCAL_CFLAGS += -DGNSS_HIDL_LEGACY_MEASURMENTS
endif
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You will need to write your own go logic in Go for makevar-dependent build
logic. See for example how SODP differentiates between &lt;code&gt;gralloc&lt;/code&gt; versions in the
display HAL: &lt;a href=&#34;https://github.com/sonyxperiadev/vendor-qcom-opensource-commonsys-intf-display/blob/fa5a97670dc1a0939aa287cf4b1e5f25c8f82815/Android.bp#L1-L19&#34;&gt;bootstrap_go_module&lt;/a&gt;,
&lt;a href=&#34;https://github.com/sonyxperiadev/vendor-qcom-opensource-commonsys-intf-display/blob/fa5a97670dc1a0939aa287cf4b1e5f25c8f82815/gralloc_defaults.go&#34;&gt;gralloc_defaults.go&lt;/a&gt;, &lt;a href=&#34;https://github.com/sonyxperiadev/device-sony-common/blob/456037de1ff6823d4d1c2e243d439ec3e9a8cfe8/CommonConfig.mk#L77-L81&#34;&gt;device tree config&lt;/a&gt; via
&lt;code&gt;SOONG_CONFIG_&amp;lt;X&amp;gt;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;For project-wide inherited variables, Qualcomm uses
&lt;a href=&#34;https://git.ix5.org/felix/hardware-qcom-gps/src/commit/da31f93c4fe8e1fb8e8d0fc0b75c57e1e18b816f/build/target_specific_features.mk&#34;&gt;target_specific_features.mk&lt;/a&gt; and sets &lt;code&gt;LOCAL_CFLAGS&lt;/code&gt; to
&lt;code&gt;$(GNSS_CFLAGS)&lt;/code&gt;. We can use the &lt;code&gt;defaults&lt;/code&gt; system of soong to supplant that
behaviour:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;cc_defaults {
    name: &amp;#34;foo_defaults&amp;#34;,
    // Contents of $(GNSS_CFLAGS) from target_specific_features follow:
    cflags: [
        &amp;#34;-Werror&amp;#34;,
        &amp;#34;-Wno-error=unused-parameter&amp;#34;,
        [...]
    ],
}
[...]
cc_library_shared {
    name: &amp;#34;libfoo&amp;#34;,
    defaults: [
        &amp;#34;foo_defaults&amp;#34;,
    ],
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Defaults are usable even from outside the current module. But note that source
files stay relative to the inheriting module, so if you have &lt;code&gt;foo/foo.c&lt;/code&gt;,
define &lt;code&gt;foo_defaults&lt;/code&gt; with &lt;code&gt;srcs: [&amp;quot;foo.c&amp;quot;]&lt;/code&gt; and try to access &lt;code&gt;foo_defaults&lt;/code&gt;
from &lt;code&gt;bar&lt;/code&gt; - which also contains &lt;code&gt;foo.c&lt;/code&gt;, you will have &lt;code&gt;bar/foo.c&lt;/code&gt; selected as
&lt;code&gt;srcs&lt;/code&gt;! Defaults are like header files in that way.&lt;/p&gt;
&lt;!-- TOOD: Verify truthiness of this... --&gt;
&lt;p&gt;Taken together, the conversion of our GPS and location repos to soong looks like
this: &lt;a href=&#34;https://git.ix5.org/felix/vendor-qcom-opensource-location/commit/fdad662beaa29974854fe2515d6fd4bd0f0d3049&#34;&gt;location: Convert to Android.bp&lt;/a&gt; and
&lt;a href=&#34;https://git.ix5.org/felix/hardware-qcom-gps/commit/281b87dee91cc10de5ee81898dd8dcfa3a1b27e6&#34;&gt;gps: Convert to Android.bp&lt;/a&gt;. Note that we need to empty the
&lt;code&gt;Android.mk&lt;/code&gt; file or give it a build guard so that we do not run into duplicate
module definitions.&lt;/p&gt;
&lt;h2 id=&#34;namespaces&#34;&gt;Namespaces&lt;/h2&gt;
&lt;p&gt;Now a particular annoyance: &lt;code&gt;android.hardware.gnss@2.0-service-qti&lt;/code&gt; relies on
&lt;a href=&#34;https://github.com/sonyxperiadev/vendor-qcom-opensource-core-utils/blob/52439ba6f6e540a4d112f44e11e0abd236510c35/fwk-detect/Android.bp#L2&#34;&gt;libqti_vndfwk_detect.so&lt;/a&gt;, which is
&lt;a href=&#34;https://github.com/sonyxperiadev/vendor-qcom-opensource-core-utils/pull/2&#34;&gt;hidden behind a soong namespace&lt;/a&gt;. Even though the namespace is
added to &lt;code&gt;PRODUCT_SOONG_NAMESPACES&lt;/code&gt; in our device trees, &lt;code&gt;libqti_vndfwk_detect&lt;/code&gt;
still is inaccessible from other soong modules which have not explicitly
imported the &lt;code&gt;core-utils&lt;/code&gt; namespace.&lt;/p&gt;
&lt;p&gt;Note: &lt;code&gt;make&lt;/code&gt; modules can access &lt;code&gt;libqti_vndfwk_detect&lt;/code&gt; because they only &amp;ldquo;care&amp;rdquo;
about whether &lt;code&gt;core-utils&lt;/code&gt; is in the board’s &lt;code&gt;PRODUCT_SOONG_NAMESPACES&lt;/code&gt;.&lt;/p&gt;
&lt;!-- TOOD: Verify truthiness of this... --&gt;
&lt;p&gt;We define a namespace for &lt;code&gt;hardware/qcom/gps&lt;/code&gt; and let it &lt;code&gt;import&lt;/code&gt; the
&lt;code&gt;core-utils&lt;/code&gt; namespace: &lt;a href=&#34;https://git.ix5.org/felix/hardware-qcom-gps/commit/da31f93c4fe8e1fb8e8d0fc0b75c57e1e18b816f&#34;&gt;gps: Android.bp: Define soong_namespace&lt;/a&gt;.
That in turn necessitaces namespacing the OSS location repo:
&lt;a href=&#34;https://git.ix5.org/felix/vendor-qcom-opensource-location/commit/6b64acf58bd7385af9813183cc64218ce6282b57&#34;&gt;location: Android.bp: Define soong_namespace&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;All in all, more work than I’d have liked, but that is the &amp;ldquo;correct&amp;rdquo; way to do
it, according to Google.&lt;/p&gt;
&lt;h2 id=&#34;device-trees&#34;&gt;Device trees&lt;/h2&gt;
&lt;p&gt;Those changes in the hardware repos need to be reflected in the device trees as
well. &lt;a href=&#34;https://git.ix5.org/felix/device-sony-common/commit/3a745222647aca381464a50c2465b17290595458&#34;&gt;Add GPS+location soong namespaces&lt;/a&gt; and
&lt;a href=&#34;https://git.ix5.org/felix/device-sony-common/commit/d48a4b1eb926a704f226fc3a4288ac2453e88614&#34;&gt;Update GNSS package list&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;sepolicy&#34;&gt;Sepolicy&lt;/h2&gt;
&lt;p&gt;The uprevisioned service binary needs an SELinux label:
&lt;code&gt;sepolicy/vendor/file_contexts&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;-/(system/vendor|vendor)/bin/hw/android\.hardware\.gnss@1\.1-service-qti   u:object_r:hal_gnss_qti_exec:s0
+/(system/vendor|vendor)/bin/hw/android\.hardware\.gnss@2\.0-service-qti   u:object_r:hal_gnss_qti_exec:s0
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;finishing&#34;&gt;Finishing&lt;/h2&gt;
&lt;p&gt;So, what‘s left? Cleaning up and crafting proper commits, documentation,
testing, trying to send as much as possible upstream.&lt;/p&gt;
&lt;p&gt;Converting your projects to soong can make them &amp;ldquo;cleaner&amp;rdquo; and faster to parse,
but since Google is obsessed with namespacing and versioning things - well,
overengineering and refactoring constantly is what it is - implementing
blueprints often ends up being a bit more complicated than it ought to.&lt;/p&gt;
&lt;div class=&#34;footnotes&#34; role=&#34;doc-endnotes&#34;&gt;
&lt;hr&gt;
&lt;ol&gt;
&lt;li id=&#34;fn:1&#34;&gt;
&lt;p&gt;The osmocom Wiki page on QMI might be outdated at this point. QMI is a proprietary and not publicly documented interface.&amp;#160;&lt;a href=&#34;#fnref:1&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id=&#34;fn:2&#34;&gt;
&lt;p&gt;For later, it might be interesting to look into &lt;code&gt;export_header_lib_headers&lt;/code&gt; and &lt;code&gt;export_shared_lib_headers&lt;/code&gt;/&lt;code&gt;export_static_lib_headers&lt;/code&gt;.&amp;#160;&lt;a href=&#34;#fnref:2&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
</description>
    </item>
    
    <item>
      <title>Android Prebuilts</title>
      <link>https://sx.ix5.org/info/post/android-prebuilts/</link>
      <pubDate>Thu, 20 Feb 2020 20:50:46 +0100</pubDate>
      
      <guid>https://sx.ix5.org/info/post/android-prebuilts/</guid>
      <description>&lt;p&gt;Sometimes, you want to use a library or an APK file that someone else already
built and maybe signed for you. Android calls these &amp;ldquo;prebuilts&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;Current supported prebuilt types:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Shared (C/C++) library&lt;/li&gt;
&lt;li&gt;Static (C/C++) library&lt;/li&gt;
&lt;li&gt;Binary (executable)&lt;/li&gt;
&lt;li&gt;Java library&lt;/li&gt;
&lt;li&gt;&lt;code&gt;/etc/&lt;/code&gt; file&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;See &lt;a href=&#34;https://android.googlesource.com/platform/build/soong/+/refs/tags/android-10.0.0_r29/androidmk/cmd/androidmk/android.go#931&#34;&gt;build/soong/androidmk/cmd/androidmk/android.go&lt;/a&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;var prebuiltTypes = map[string]string{
    &amp;#34;SHARED_LIBRARIES&amp;#34;: &amp;#34;cc_prebuilt_library_shared&amp;#34;,
    &amp;#34;STATIC_LIBRARIES&amp;#34;: &amp;#34;cc_prebuilt_library_static&amp;#34;,
    &amp;#34;EXECUTABLES&amp;#34;:      &amp;#34;cc_prebuilt_binary&amp;#34;,
    &amp;#34;JAVA_LIBRARIES&amp;#34;:   &amp;#34;java_import&amp;#34;,
    &amp;#34;ETC&amp;#34;:              &amp;#34;prebuilt_etc&amp;#34;,
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Supported on current master, as of 2020-02-20:&lt;br&gt;
&lt;a href=&#34;https://android.googlesource.com/platform/build/soong/+/refs/tags/android-10.0.0_r29/androidmk/cmd/androidmk/android.go#931&#34;&gt;build/soong/androidmk/androidmk/android.go&lt;/a&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;var prebuiltTypes = map[string]string{
    &amp;#34;SHARED_LIBRARIES&amp;#34;: &amp;#34;cc_prebuilt_library_shared&amp;#34;,
    &amp;#34;STATIC_LIBRARIES&amp;#34;: &amp;#34;cc_prebuilt_library_static&amp;#34;,
    &amp;#34;EXECUTABLES&amp;#34;:      &amp;#34;cc_prebuilt_binary&amp;#34;,
    &amp;#34;JAVA_LIBRARIES&amp;#34;:   &amp;#34;java_import&amp;#34;,
    &amp;#34;APPS&amp;#34;:             &amp;#34;android_app_import&amp;#34;,
    &amp;#34;ETC&amp;#34;:              &amp;#34;prebuilt_etc&amp;#34;,
}
&lt;/code&gt;&lt;/pre&gt;&lt;div class=&#34;message&#34;&gt;
&lt;code&gt;PREBUILT_SHARED_LIBRARY&lt;/code&gt; is deprecated. Define
&lt;code&gt;LOCAL_MODULE_CLASS&lt;/code&gt; and call &lt;code&gt;BUILD_PREBUILT&lt;/code&gt; instead.
&lt;/div&gt;
&lt;h3 id=&#34;binary&#34;&gt;Binary&lt;/h3&gt;
&lt;p&gt;Using &lt;code&gt;make&lt;/code&gt; syntax:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;include $(CLEAR_VARS)
LOCAL_MODULE := myexec
LOCAL_SRC_FILES := myexec
LOCAL_MODULE_CLASS := EXECUTABLES
LOCAL_MODULE_TAGS := optional
# Optional:
LOCAL_MULTILIB := 64
LOCAL_PROPRIETARY_MODULE := true
LOCAL_SHARED_LIBRARIES := libmyexample
include $(BUILD_PREBUILT)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;and in &lt;code&gt;blueprint&lt;/code&gt; format:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;cc_prebuilt_binary {
    name: &amp;#34;myexec&amp;#34;,
    srcs: [&amp;#34;myexec&amp;#34;],
    // Optional:
    vendor: true,
    relative_install_path: &amp;#34;hw&amp;#34;,
    // Soong supports the same extras as for regular cc_binary:
    shared_libs: [
        &amp;#34;libmyexample&amp;#34;,
    ],
    //vintf_fragments: [&amp;#34;vendor.acme.myexec@1.0-service.xml&amp;#34;],
    //init_rc: [&amp;#34;vendor.acme.myexec@1.0-service.rc&amp;#34;],
}
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;shared-library&#34;&gt;(Shared) library&lt;/h3&gt;
&lt;p&gt;Using &lt;code&gt;make&lt;/code&gt; syntax:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;include $(CLEAR_VARS)
LOCAL_MODULE := libmyexample
LOCAL_SRC_FILES := $(LOCAL_MODULE).so
# For shared:
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
# For static:
#LOCAL_MODULE_CLASS := STATIC_LIBRARIES
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_SUFFIX := .so
# Optional:
LOCAL_MULTILIB := 64
LOCAL_PROPRIETARY_MODULE := true
include $(BUILD_PREBUILT)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;and in &lt;code&gt;blueprint&lt;/code&gt; format:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;cc_prebuilt_library_shared {
    name: &amp;#34;libmyexample&amp;#34;,
    srcs: [&amp;#34;libmyexample.so&amp;#34;],
    // Optional:
    compile_multilib: &amp;#34;64&amp;#34;,
    proprietary: true,
    strip: {
        none: true,
    },
}
// For static:
//cc_prebuilt_library_static {
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;app&#34;&gt;App&lt;/h3&gt;
&lt;p&gt;Using &lt;code&gt;make&lt;/code&gt; syntax:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;include $(CLEAR_VARS)
LOCAL_MODULE := MyApp
LOCAL_SRC_FILES := MyApp.apk
LOCAL_CERTIFICATE := platform
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_SUFFIX := .apk
# Optional:
LOCAL_PRIVILEGED_MODULE := true
LOCAL_PROPRIETARY_MODULE := true
include $(BUILD_PREBUILT)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;code&gt;blueprint&lt;/code&gt; support for &lt;code&gt;android_app_import&lt;/code&gt; is in current master (as of
2020-02-20), will be available in Android R:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;android_app_import {
    name: &amp;#34;MyApp&amp;#34;,
    // Make sure the build system doesn&amp;#39;t try to resign the APK
    dex_preopt: {
        enabled: false,
    },
    apk: &amp;#34;MyApp.apk&amp;#34;,
    presigned: true,
}
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;etc-file&#34;&gt;/etc file&lt;/h3&gt;
&lt;p&gt;Using &lt;code&gt;make&lt;/code&gt; syntax:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;include $(CLEAR_VARS)
LOCAL_MODULE := privapp-permissions-myapp.xml
LOCAL_SRC_FILES := privapp-permissions-myapp.xml
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_TAGS := optional
# Optional, else just goes into /system/etc
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/etc/permissions
LOCAL_PROPRIETARY_MODULE := true
include $(BUILD_PREBUILT)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;and in &lt;code&gt;blueprint&lt;/code&gt; format:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;prebuilt_etc {
    name: &amp;#34;privapp-permissions-myapp.xml&amp;#34;,
    src: &amp;#34;privapp-permissions-myapp.xml&amp;#34;,
    // Optional
    sub_dir: &amp;#34;permissions&amp;#34;,
    vendor: true,
}
&lt;/code&gt;&lt;/pre&gt;&lt;h1 id=&#34;converting&#34;&gt;Converting&lt;/h1&gt;
&lt;p&gt;As always, you can use &lt;a href=&#34;https://sx.ix5.org/info/post/android-blueprint-files/&#34;&gt;the androidmk tool&lt;/a&gt; to convert from
&lt;code&gt;make&lt;/code&gt; to &lt;code&gt;blueprint&lt;/code&gt; syntax - not the other way around, though. Take a look
into the source code of &lt;code&gt;build/make&lt;/code&gt; and &lt;code&gt;build/soong&lt;/code&gt; to find out equivalents
if you must.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Android CPU Variants</title>
      <link>https://sx.ix5.org/info/post/android-cpu-variants/</link>
      <pubDate>Thu, 13 Feb 2020 13:55:27 +0100</pubDate>
      
      <guid>https://sx.ix5.org/info/post/android-cpu-variants/</guid>
      <description>&lt;p&gt;See &lt;a href=&#34;https://android.googlesource.com/platform/bionic/+/refs/tags/android-10.0.0_r29/libc/arch-arm/dynamic_function_dispatch.cpp#51&#34;&gt;CpuVariantNames in bionic&amp;rsquo;s libc&lt;/a&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;static constexpr CpuVariantNames cpu_variant_names[] = {
    {&amp;#34;cortex-a76&amp;#34;, kCortexA55},
    {&amp;#34;kryo385&amp;#34;, kCortexA55},
    {&amp;#34;cortex-a75&amp;#34;, kCortexA55},
    {&amp;#34;kryo&amp;#34;, kKryo},
    {&amp;#34;cortex-a73&amp;#34;, kCortexA55},
    {&amp;#34;cortex-a55&amp;#34;, kCortexA55},
    {&amp;#34;cortex-a53&amp;#34;, kCortexA53},
    {&amp;#34;krait&amp;#34;, kKrait},
    {&amp;#34;cortex-a9&amp;#34;, kCortexA9},
    {&amp;#34;cortex-a7&amp;#34;, kCortexA7},
    // kUnknown indicates the end of this array.
    {&amp;#34;&amp;#34;, kUnknown},
};
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;That means:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;kryo&lt;/code&gt; is treated as &lt;code&gt;Kryo&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;cortex-a53&lt;/code&gt; is treated as &lt;code&gt;Cortex A53&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;kryo385&lt;/code&gt;, &lt;code&gt;cortex-a55&lt;/code&gt;, &lt;code&gt;cortex-a73&lt;/code&gt;, &lt;code&gt;cortex-a75&lt;/code&gt; and &lt;code&gt;cortex-a76&lt;/code&gt; are all
treated as a &lt;code&gt;Cortex A55&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;krait&lt;/code&gt; is treated as &lt;code&gt;Krait&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;cortex-a9&lt;/code&gt; is treated as &lt;code&gt;Cortex A9&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;cortex-a7&lt;/code&gt; is treated as &lt;code&gt;Cortex A7&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;generic-and-runtime-variants&#34;&gt;Generic and runtime variants&lt;/h2&gt;
&lt;p&gt;We adjusted our makefiles as follows for an &lt;code&gt;msm8996&lt;/code&gt; device:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-diff&#34; data-lang=&#34;diff&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; TARGET_ARCH := arm64
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; TARGET_ARCH_VARIANT := armv8-a
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; TARGET_CPU_ABI := arm64-v8a
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; TARGET_CPU_ABI2 :=
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a00000&#34;&gt;-TARGET_CPU_VARIANT := kryo
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a00000&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+TARGET_CPU_VARIANT := generic
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+TARGET_CPU_VARIANT_RUNTIME := kryo
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; TARGET_2ND_ARCH := arm
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; TARGET_2ND_ARCH_VARIANT := armv8-a
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; TARGET_2ND_CPU_ABI := armeabi-v7a
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; TARGET_2ND_CPU_ABI2 := armeabi
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a00000&#34;&gt;-TARGET_2ND_CPU_VARIANT := kryo
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a00000&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+TARGET_2ND_CPU_VARIANT := generic
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+TARGET_2ND_CPU_VARIANT_RUNTIME := kryo
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Similar for an &lt;code&gt;sdm845&lt;/code&gt; device:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-diff&#34; data-lang=&#34;diff&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; TARGET_ARCH := arm64
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a00000&#34;&gt;-TARGET_ARCH_VARIANT := armv8-2a
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a00000&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+TARGET_ARCH_VARIANT := armv8-a
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;&lt;/span&gt; TARGET_CPU_ABI := arm64-v8a
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; TARGET_CPU_ABI2 :=
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a00000&#34;&gt;-TARGET_CPU_VARIANT := kryo385
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a00000&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+TARGET_CPU_VARIANT := generic
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+TARGET_CPU_VARIANT_RUNTIME := kryo385
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; TARGET_2ND_ARCH := arm
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a00000&#34;&gt;-TARGET_2ND_ARCH_VARIANT := armv8-2a
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a00000&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+TARGET_2ND_ARCH_VARIANT := armv8-a
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;&lt;/span&gt; TARGET_2ND_CPU_ABI := armeabi-v7a
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; TARGET_2ND_CPU_ABI2 := armeabi
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a00000&#34;&gt;-TARGET_2ND_CPU_VARIANT := kryo385
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a00000&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+TARGET_2ND_CPU_VARIANT := generic
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+TARGET_2ND_CPU_VARIANT_RUNTIME := kryo385
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;links&#34;&gt;Links&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://android.googlesource.com/device/google/crosshatch/+/302a36e5192d5821e42dc010945a1d2c4fe784c6%5E%21/#F0&#34;&gt;https://android.googlesource.com/device/google/crosshatch/+/302a36e5192d5821e42dc010945a1d2c4fe784c6%5E%21/#F0&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://android.googlesource.com/device/google/coral/+/2c479a98ab3a6158bfb0050d7d1766c90c496def%5E%21/&#34;&gt;https://android.googlesource.com/device/google/coral/+/2c479a98ab3a6158bfb0050d7d1766c90c496def%5E%21/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://android.googlesource.com/device/google/crosshatch/+/ed4abfb7bc3c48039985b09609880192d5981fd8%5E%21/#F0&#34;&gt;https://android.googlesource.com/device/google/crosshatch/+/ed4abfb7bc3c48039985b09609880192d5981fd8%5E%21/#F0&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://android.googlesource.com/device/google/crosshatch/+/37f229e80db6abaff3cf437bbe2037ca01f7e56b%5E!/#F0&#34;&gt;https://android.googlesource.com/device/google/crosshatch/+/37f229e80db6abaff3cf437bbe2037ca01f7e56b%5E!/#F0&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://android.googlesource.com/device/google/crosshatch/+/5e58194bb5b96cbe9f031bda2dbc7488480ba999%5E%21/#F0&#34;&gt;https://android.googlesource.com/device/google/crosshatch/+/5e58194bb5b96cbe9f031bda2dbc7488480ba999%5E%21/#F0&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://android.googlesource.com/device/google/crosshatch/+/64a47c6390b3bfae47b0118568a9c2d51f1a541a%5E!/#F0&#34;&gt;https://android.googlesource.com/device/google/crosshatch/+/64a47c6390b3bfae47b0118568a9c2d51f1a541a%5E!/#F0&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://android.googlesource.com/device/google/crosshatch/+/4c075f2a5426cc6975c6fb8b2cf079150b10e13c%5E!/#F0&#34;&gt;https://android.googlesource.com/device/google/crosshatch/+/4c075f2a5426cc6975c6fb8b2cf079150b10e13c%5E!/#F0&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://android.googlesource.com/platform/build/soong/+/d3072b0c7cef7f5a217a055e66d85890c78620bc&#34;&gt;https://android.googlesource.com/platform/build/soong/+/d3072b0c7cef7f5a217a055e66d85890c78620bc&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://android.googlesource.com/platform/build/soong/+/refs/tags/android-10.0.0_r29/cc/config/arm64_device.go#30&#34;&gt;https://android.googlesource.com/platform/build/soong/+/refs/tags/android-10.0.0_r29/cc/config/arm64_device.go#30&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://android.googlesource.com/platform/build/soong/+/refs/tags/android-10.0.0_r29/cc/config/arm_device.go#53&#34;&gt;https://android.googlesource.com/platform/build/soong/+/refs/tags/android-10.0.0_r29/cc/config/arm_device.go#53&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
    </item>
    
    <item>
      <title>Linux Error Codes</title>
      <link>https://sx.ix5.org/info/post/linux-error-codes/</link>
      <pubDate>Wed, 12 Feb 2020 19:54:33 +0100</pubDate>
      
      <guid>https://sx.ix5.org/info/post/linux-error-codes/</guid>
      <description>&lt;p&gt;Source: &lt;a href=&#34;https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/asm-generic/errno-base.h?h=v5.5&#34;&gt;include/uapi/asm-generic/errno-base.h&lt;/a&gt;&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Code&lt;/th&gt;
&lt;th&gt;Nr&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;EPERM&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;Operation not permitted&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ENOENT&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;No such file or directory&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ESRCH&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;No such process&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;EINTR&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;Interrupted system call&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;EIO&lt;/td&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;I/O error&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ENXIO&lt;/td&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;No such device or address&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;E2BIG&lt;/td&gt;
&lt;td&gt;7&lt;/td&gt;
&lt;td&gt;Argument list too long&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ENOEXEC&lt;/td&gt;
&lt;td&gt;8&lt;/td&gt;
&lt;td&gt;Exec format error&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;EBADF&lt;/td&gt;
&lt;td&gt;9&lt;/td&gt;
&lt;td&gt;Bad file number&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ECHILD&lt;/td&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;td&gt;No child processes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;EAGAIN&lt;/td&gt;
&lt;td&gt;11&lt;/td&gt;
&lt;td&gt;Try again&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ENOMEM&lt;/td&gt;
&lt;td&gt;12&lt;/td&gt;
&lt;td&gt;Out of memory&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;EACCES&lt;/td&gt;
&lt;td&gt;13&lt;/td&gt;
&lt;td&gt;Permission denied&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;EFAULT&lt;/td&gt;
&lt;td&gt;14&lt;/td&gt;
&lt;td&gt;Bad address&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ENOTBLK&lt;/td&gt;
&lt;td&gt;15&lt;/td&gt;
&lt;td&gt;Block device required&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;EBUSY&lt;/td&gt;
&lt;td&gt;16&lt;/td&gt;
&lt;td&gt;Device or resource busy&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;EEXIST&lt;/td&gt;
&lt;td&gt;17&lt;/td&gt;
&lt;td&gt;File exists&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;EXDEV&lt;/td&gt;
&lt;td&gt;18&lt;/td&gt;
&lt;td&gt;Cross-device link&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ENODEV&lt;/td&gt;
&lt;td&gt;19&lt;/td&gt;
&lt;td&gt;No such device&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ENOTDIR&lt;/td&gt;
&lt;td&gt;20&lt;/td&gt;
&lt;td&gt;Not a directory&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;EISDIR&lt;/td&gt;
&lt;td&gt;21&lt;/td&gt;
&lt;td&gt;Is a directory&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;EINVAL&lt;/td&gt;
&lt;td&gt;22&lt;/td&gt;
&lt;td&gt;Invalid argument&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ENFILE&lt;/td&gt;
&lt;td&gt;23&lt;/td&gt;
&lt;td&gt;File table overflow&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;EMFILE&lt;/td&gt;
&lt;td&gt;24&lt;/td&gt;
&lt;td&gt;Too many open files&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ENOTTY&lt;/td&gt;
&lt;td&gt;25&lt;/td&gt;
&lt;td&gt;Not a typewriter&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ETXTBSY&lt;/td&gt;
&lt;td&gt;26&lt;/td&gt;
&lt;td&gt;Text file busy&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;EFBIG&lt;/td&gt;
&lt;td&gt;27&lt;/td&gt;
&lt;td&gt;File too large&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ENOSPC&lt;/td&gt;
&lt;td&gt;28&lt;/td&gt;
&lt;td&gt;No space left on device&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ESPIPE&lt;/td&gt;
&lt;td&gt;29&lt;/td&gt;
&lt;td&gt;Illegal seek&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;EROFS&lt;/td&gt;
&lt;td&gt;30&lt;/td&gt;
&lt;td&gt;Read-only file system&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;EMLINK&lt;/td&gt;
&lt;td&gt;31&lt;/td&gt;
&lt;td&gt;Too many links&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;EPIPE&lt;/td&gt;
&lt;td&gt;32&lt;/td&gt;
&lt;td&gt;Broken pipe&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;EDOM&lt;/td&gt;
&lt;td&gt;33&lt;/td&gt;
&lt;td&gt;Math argument out of domain of func&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ERANGE&lt;/td&gt;
&lt;td&gt;34&lt;/td&gt;
&lt;td&gt;Math result not representable&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
</description>
    </item>
    
    <item>
      <title>SODP 2020-02-05 Security state</title>
      <link>https://sx.ix5.org/info/post/sodp-2020-02-05-security-state/</link>
      <pubDate>Sat, 08 Feb 2020 21:11:11 +0100</pubDate>
      
      <guid>https://sx.ix5.org/info/post/sodp-2020-02-05-security-state/</guid>
      <description>&lt;p&gt;Reference: &lt;a href=&#34;https://source.android.com/security/bulletin/2020-02-01&#34;&gt;2020-02-01 Google Bulletin&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;kernel&#34;&gt;Kernel&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;ANDROID: binder: synchronize_rcu() when using POLLFREE&lt;/strong&gt;&lt;br&gt;
&lt;a href=&#34;https://android.googlesource.com/kernel/common/+/5eeb2ca0&#34;&gt;android.googlesource.com/kernel/common/+/5eeb2ca0&lt;/a&gt;&lt;br&gt;
Already merged in 4.9&lt;br&gt;
Already merged in 4.14&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;coredump: fix race condition between mmget_not_zero()/get_task_mm() and core dumping&lt;/strong&gt;&lt;br&gt;
&lt;a href=&#34;https://android.googlesource.com/kernel/common/+/04f5866e41fb70690e28397487d8bd8eea7d712a&#34;&gt;android.googlesource.com/kernel/common/+/04f586&lt;/a&gt;&lt;br&gt;
Already merged in 4.9&lt;br&gt;
Already merged in 4.14&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;ANDROID: fix binder change in merge of 4.9.188&lt;/strong&gt;&lt;br&gt;
&lt;a href=&#34;https://android.googlesource.com/kernel/common/+/3378ce511d7a792ddf0d69d11ce5e284309893fd&#34;&gt;android.googlesource.com/kernel/common/+/3378ce&lt;/a&gt;&lt;br&gt;
Fixed for 4.9 via 232r1-security-2020-02-05-binder&lt;br&gt;
Does not affect 4.14&lt;/p&gt;
&lt;h2 id=&#34;caf-kernel&#34;&gt;CAF Kernel&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;msm: camera: isp: use correct number of entries&lt;/strong&gt;&lt;br&gt;
&lt;a href=&#34;https://source.codeaurora.org/quic/la/kernel/msm-4.9/commit/?id=a2198a95c0a1a319bb6d7ed9fefa1b5e905e6418&#34;&gt;source.codeaurora.org/quic/la/kernel/msm-4.9/commit/?id=a2198a&lt;/a&gt;&lt;br&gt;
Already merged in 4.9&lt;br&gt;
Already merged in 4.14 (copypasted from 4.9)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;ion: Ensure non-HLOS memory cannot be mapped by CPU&lt;/strong&gt;&lt;br&gt;
&lt;a href=&#34;https://source.codeaurora.org/quic/la/kernel/msm-4.14/commit/?id=31142010ccaf6ddad331a7919a7fbf3da80b8359&#34;&gt;source.codeaurora.org/quic/la/kernel/msm-4.14/commit/?id=311420&lt;/a&gt;&lt;br&gt;
Already merged in 4.9&lt;br&gt;
Already merged in 4.14&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;diag: Mark Buffer as NULL after freeing&lt;/strong&gt;&lt;br&gt;
&lt;a href=&#34;https://source.codeaurora.org/quic/la/kernel/msm-4.9/commit/?id=c0cb074983060d6ff46e312a9db81fde869cd63b&#34;&gt;source.codeaurora.org/quic/la/kernel/msm-4.9/commit/?id=c0cb07&lt;/a&gt;&lt;br&gt;
Already merged in 4.9&lt;br&gt;
Already merged in 4.14&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;ASoC: bolero: check for port validation before configuration&lt;/strong&gt;&lt;br&gt;
&lt;a href=&#34;https://source.codeaurora.org/quic/la/platform/vendor/opensource/audio-kernel/commit/?id=bab05c57cb51aee957a1fe926c7d3c54378acb6a&#34;&gt;source.codeaurora.org/quic/la/platform/vendor/opensource/audio-kernel/commit/?id=bab05c&lt;/a&gt;&lt;br&gt;
Not affected, we don&amp;rsquo;t have or even ship the bolero codec&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;msm: kgsl: Verify the offset of the profiling buffer&lt;/strong&gt;&lt;br&gt;
&lt;a href=&#34;https://source.codeaurora.org/quic/la/kernel/msm-4.14/commit/?id=fb37ff663a3d28e3a07549b074c54feb3e4376b5&#34;&gt;source.codeaurora.org/quic/la/kernel/msm-4.14/commit/?id=fb37ff&lt;/a&gt;&lt;br&gt;
Fixed for 4.9 via 232r1-security-caf&lt;br&gt;
Already merged in 4.14 via &amp;ldquo;Fast forward Adreno driver to LA.UM.8.1.r1-11600-sm8150.0&amp;rdquo;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;msm: kgsl: Use a bitmap allocator for global addressing&lt;/strong&gt;&lt;br&gt;
&lt;a href=&#34;https://source.codeaurora.org/quic/la/kernel/msm-4.14/commit/?id=a8acbcb0&#34;&gt;source.codeaurora.org/quic/la/kernel/msm-4.14/commit/?id=a8acbcb0&lt;/a&gt;&lt;br&gt;
Fixed for 4.9 via 232r1-security-caf&lt;br&gt;
Already merged in 4.14 via &amp;ldquo;Fast forward Adreno driver to LA.UM.8.1.r1-11600-sm8150.0&amp;rdquo;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;msm: kgsl: Execute user profiling commands in an IB&lt;/strong&gt;&lt;br&gt;
&lt;a href=&#34;https://source.codeaurora.org/quic/la/kernel/msm-4.4/commit/?id=1aa9c68484c49a7357c0835b38fa1581bb7d6865&#34;&gt;source.codeaurora.org/quic/la/kernel/msm-4.4/commit/?id=1aa9c6&lt;/a&gt;&lt;br&gt;
Fixed for 4.9 via 232r1-security-caf&lt;br&gt;
Already merged in 4.14 via &amp;ldquo;Fast forward Adreno driver to LA.UM.8.1.r1-11600-sm8150.0&amp;rdquo;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;msm: camera: icp: Fix out of bound access issue in ICP&lt;/strong&gt;&lt;br&gt;
&lt;a href=&#34;https://source.codeaurora.org/quic/la/kernel/msm-4.9/commit/?id=9c3d819d2d9563779fd1daa4eefef8628de22a86&#34;&gt;source.codeaurora.org/quic/la/kernel/msm-4.9/commit/?id=9c3d81&lt;/a&gt;&lt;br&gt;
Already merged in 4.9&lt;br&gt;
Already merged in 4.14&lt;/p&gt;
&lt;h2 id=&#34;framework-and-system&#34;&gt;Framework and System&lt;/h2&gt;
&lt;p&gt;Patched via sync of latest AOSP sources.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Google git-repo: forall</title>
      <link>https://sx.ix5.org/info/post/google-git-repo-forall/</link>
      <pubDate>Wed, 05 Feb 2020 00:10:09 +0100</pubDate>
      
      <guid>https://sx.ix5.org/info/post/google-git-repo-forall/</guid>
      <description>&lt;p&gt;Google&amp;rsquo;s &lt;a href=&#34;https://gerrit.googlesource.com/git-repo&#34;&gt;repo tool&lt;/a&gt; tool can run a command in all of its
tracked repositories.&lt;/p&gt;
&lt;p&gt;Use &lt;code&gt;-p&lt;/code&gt; to also show the current repository when running.&lt;/p&gt;
&lt;p&gt;Example usage: See all the changes a security patch bump introduced:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;repo forall -p -c \
  &amp;#34;/usr/bin/git --no-pager \
    diff android-10.0.0_r18..android-10.0.0_r25 \
    2&amp;gt;/dev/null&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Another variant, suggested by &lt;a href=&#34;https://groups.google.com/forum/#!msg/android-building/0DtsHawjs4k/And8o3Dni_UJ&#34;&gt;Jean-Baptiste Queru&lt;/a&gt; back in the day of 4.x:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;repo forall -c &amp;#39;
if git rev-parse android-4.0.3_r1 &amp;gt;/dev/null 2&amp;gt;&amp;amp;1
then
git log --oneline --no-merges android-4.0.3_r1..android-4.0.4_r1.1
else
git log --oneline --no-merges android-4.0.4_r1.1
fi
&amp;#39; | cat
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Find out all commits that you cherry-picked during bringup:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;repo forall -p -c \
    &amp;#34;/usr/bin/git \
    --no-pager log HEAD...android-r-preview-2 \
    2&amp;gt;/dev/null&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Note: The &lt;code&gt;...&lt;/code&gt; triple dot.&lt;/p&gt;
&lt;p&gt;Explanation, see &lt;a href=&#34;https://stackoverflow.com/questions/18595305/git-log-outputs-in-a-specific-revision-range#18595347&#34;&gt;stackoverflow&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;git log a..b&lt;/code&gt; means give me all commits that were made since a, until and
including b (or, like the man page puts it &amp;ldquo;Include commits that are reachable
from b but exclude those that are reachable from a&amp;rdquo;), the three-dot variant&lt;/p&gt;
&lt;p&gt;&lt;code&gt;git log a...b &lt;/code&gt; means &amp;ldquo;Include commits that are reachable from either a or b
but exclude those that are reachable from both&amp;rdquo;, which is a totally different
thing.&lt;/p&gt;
&lt;/blockquote&gt;
</description>
    </item>
    
    <item>
      <title>Quick: Kernel dts Tools</title>
      <link>https://sx.ix5.org/info/post/quick-kernel-dts-tools/</link>
      <pubDate>Tue, 04 Feb 2020 21:37:35 +0100</pubDate>
      
      <guid>https://sx.ix5.org/info/post/quick-kernel-dts-tools/</guid>
      <description>&lt;p&gt;Get a plain-text file from a generated &lt;code&gt;.dtb&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;dtc \
  arch/arm64/boot/dts/qcom/msm8996-v3.0-pmi8996-tone-kagura_generic.dtb \
  &amp;gt; msm8996-v3.0-pmi8996-tone-kagura_generic-generated.dts
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The generated &lt;code&gt;.dts&lt;/code&gt; file is in plain-text and can be viewed in a text editor.&lt;/p&gt;
&lt;p&gt;More: &lt;a href=&#34;https://elinux.org/Device_Tree_Usage&#34;&gt;eLinux: Device Tree Usage&lt;/a&gt;.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Android Q: Build Logs and showcommands</title>
      <link>https://sx.ix5.org/info/post/android-q-build-logs-and-showcommands/</link>
      <pubDate>Fri, 10 Jan 2020 21:53:35 +0100</pubDate>
      
      <guid>https://sx.ix5.org/info/post/android-q-build-logs-and-showcommands/</guid>
      <description>&lt;p&gt;In previous Android versions, you could use &lt;code&gt;showcommands&lt;/code&gt; as a build target
modifier. Now, you get a warning message:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;! The argument `showcommands` is no longer supported.
! Instead, the verbose log is always written to a compressed file in the output dir:
!
!   gzip -cd out/verbose.log.gz | less -R
!
! Older versions are saved in verbose.log.#.gz files
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You can just &lt;code&gt;zcat out/verbose.log.gz&lt;/code&gt;, older versions will be saved as
&lt;code&gt;out/verbose.log.1.gz&lt;/code&gt;, &lt;code&gt;verbose.log.2.gz&lt;/code&gt; and so forth.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Universal Sony Dual-SIM Patcher</title>
      <link>https://sx.ix5.org/info/post/dualsim-patcher/</link>
      <pubDate>Fri, 10 Jan 2020 17:23:28 +0100</pubDate>
      
      <guid>https://sx.ix5.org/info/post/dualsim-patcher/</guid>
      <description>&lt;p&gt;Because the differences between single- and dual-SIM builds are very small,
almost all developers of Sony devices - including me - distribute only
single-SIM builds.&lt;/p&gt;
&lt;p&gt;We need to patch some props in /system/build.prop (or /system/vendor/build.prop,
/vendor/build.prop, depending on the device), mainly:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;persist.vendor.radio.multisim.config=dsds
ro.telephony.default_network=9,1 # (or 9,0, or 9,9, depending on the device)
ro.product.name=&amp;lt;dualsim device name&amp;gt;
persist.vendor.radio.block_allow_data=0 # for kumano devices
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;and substitute all occurrences of the device variant name, e.g. &lt;code&gt;f8331&lt;/code&gt;, with
the dual-SIM variant name (&lt;code&gt;f8332&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;We also need to patch the vintf manifest at &lt;code&gt;/vendor/etc/vintf/manifest.xml&lt;/code&gt; to
include a second instance of the telephony-related HALs. See the added &lt;code&gt;slot2&lt;/code&gt;
and new instances from the &lt;code&gt;_ss&lt;/code&gt; to the &lt;code&gt;_ds&lt;/code&gt; variants here:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;android.hardware.radio&lt;/code&gt;: &lt;a href=&#34;https://github.com/sonyxperiadev/device-sony-common/blob/dc5aa15bba3c8e7bf6a37eea14dc8157ae9493f4/vintf/android.hw.radio_ss.xml&#34;&gt;single-SIM&lt;/a&gt; vs &lt;a href=&#34;https://github.com/sonyxperiadev/device-sony-common/blob/dc5aa15bba3c8e7bf6a37eea14dc8157ae9493f4/vintf/android.hw.radio_ds.xml&#34;&gt;dual-SIM&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;vendor.qti.hardware.radio&lt;/code&gt;: &lt;a href=&#34;https://github.com/sonyxperiadev/device-sony-common/blob/dc5aa15bba3c8e7bf6a37eea14dc8157ae9493f4/vintf/vendor.hw.radio_ss.xml&#34;&gt;single-SIM&lt;/a&gt; vs &lt;a href=&#34;https://github.com/sonyxperiadev/device-sony-common/blob/dc5aa15bba3c8e7bf6a37eea14dc8157ae9493f4/vintf/vendor.hw.radio_ds.xml&#34;&gt;dual-SIM&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To view the actual inner workings, &lt;a href=&#34;https://git.ix5.org/felix/dualsim-patcher&#34;&gt;take a look at the source&lt;/a&gt;.
Particularly interesting is &lt;a href=&#34;https://git.ix5.org/felix/dualsim-patcher/src/branch/master/tmp/patch_dualsim.sh&#34;&gt;the script that does the heavy lifting&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;download&#34;&gt;Download&lt;/h2&gt;
&lt;p&gt;&lt;a href=&#34;https://sx.ix5.org/files/builds/sony/sony-dualsim-patcher-v4.zip&#34;&gt;sony-dualsim-patcher-v4.zip at sx.ix5.org&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;changelog&#34;&gt;Changelog&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Version 4: Fix issues with A/B devices, Android 10 compat&lt;/li&gt;
&lt;li&gt;Version 3: Internal rework, more devices&lt;/li&gt;
&lt;li&gt;Version 2: Compatibility with Xperia XZ Project Treble builds&lt;/li&gt;
&lt;li&gt;Version 1: Initial release&lt;/li&gt;
&lt;/ul&gt;
</description>
    </item>
    
    <item>
      <title>Android Q: Clang got an Upgrade</title>
      <link>https://sx.ix5.org/info/post/android-q-clang-got-an-upgrade/</link>
      <pubDate>Mon, 23 Dec 2019 00:21:03 +0100</pubDate>
      
      <guid>https://sx.ix5.org/info/post/android-q-clang-got-an-upgrade/</guid>
      <description>&lt;p&gt;In the current Android &lt;code&gt;master&lt;/code&gt; branch, the default clang version got upgraded
from 9.0.3 (Q) to 10.0.1.&lt;/p&gt;
&lt;p&gt;The current version is defined in &lt;a href=&#34;https://android.googlesource.com/platform/build/soong/+/7e143af6ee16efad245922acd7baecbd980d2f98/cc/config/global.go#127&#34;&gt;build/soong/cc/config/global.go&lt;/a&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-go&#34; data-lang=&#34;go&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#666&#34;&gt;...&lt;/span&gt;]
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;// prebuilts/clang default settings.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;&lt;/span&gt;ClangDefaultBase         = &lt;span style=&#34;color:#ba2121&#34;&gt;&amp;#34;prebuilts/clang/host&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ClangDefaultVersion      = &lt;span style=&#34;color:#ba2121&#34;&gt;&amp;#34;clang-r370808&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ClangDefaultShortVersion = &lt;span style=&#34;color:#ba2121&#34;&gt;&amp;#34;10.0.1&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
    </item>
    
    <item>
      <title>Android Q: Compiling Kernels in-tree</title>
      <link>https://sx.ix5.org/info/post/android-q-compiling-kernels-in-tree/</link>
      <pubDate>Sat, 17 Aug 2019 22:52:49 +0200</pubDate>
      
      <guid>https://sx.ix5.org/info/post/android-q-compiling-kernels-in-tree/</guid>
      <description>&lt;h2 id=&#34;tldr---kernel-fixes&#34;&gt;TL;DR - Kernel fixes&lt;/h2&gt;
&lt;p&gt;For an example of how to update your kernel makefile for Q, see
&lt;a href=&#34;https://github.com/ix5/kernel-sony/commit/6302f87e5ce1d9198707c42db9c502e0fe62f74b&#34;&gt;Sony Kernel: Update makefiles for Android Q and clang&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;q-build-system-changes&#34;&gt;Q Build system changes&lt;/h2&gt;
&lt;p&gt;The main changes in Android Q are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;New &lt;code&gt;$PATH&lt;/code&gt; restrictions&lt;/li&gt;
&lt;li&gt;GCC 4.9 deprecation&lt;/li&gt;
&lt;li&gt;Removal of ccache&lt;/li&gt;
&lt;li&gt;&lt;code&gt;PHONY&lt;/code&gt; target enforcement&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For more information, see
&lt;a href=&#34;https://android.googlesource.com/platform/build/+/refs/tags/android-q-preview-6/Changes.md&#34;&gt;AOSP: Build System Changes for Android.mk Writers&lt;/a&gt;.&lt;/p&gt;
&lt;h4 id=&#34;phony-targets&#34;&gt;PHONY targets&lt;/h4&gt;
&lt;p&gt;For more information, see &lt;a href=&#34;https://android.googlesource.com/platform/build/+/refs/tags/android-q-preview-6/Changes.md#phony_targets&#34;&gt;.PHONY rule enforcement&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Real output files cannot be marked &lt;code&gt;PHONY&lt;/code&gt; any more, the build system will
complain if &lt;code&gt;PHONY&lt;/code&gt; targets have slashes in them.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;warning: PHONY target &lt;span style=&#34;color:#ba2121&#34;&gt;&amp;#34;out/.../foo&amp;#34;&lt;/span&gt; looks like a real file &lt;span style=&#34;color:#666&#34;&gt;(&lt;/span&gt;contains a &lt;span style=&#34;color:#ba2121&#34;&gt;&amp;#34;/&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Just remove the attribute if
an output file isn&amp;rsquo;t really &lt;code&gt;PHONY&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-diff&#34; data-lang=&#34;diff&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a00000&#34;&gt;-.PHONY: $(PRODUCT_OUT)/kernel
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a00000&#34;&gt;-$(PRODUCT_OUT)/kernel: $(KERNEL_BIN) | $(ACP)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a00000&#34;&gt;-        cp $(KERNEL_BIN) $(PRODUCT_OUT)/kernel
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a00000&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+$(PRODUCT_OUT)/kernel: $(KERNEL_BIN)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+    $(ACP) $(KERNEL_BIN) $(PRODUCT_OUT)/kernel
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Also, you cannot depend on intermediates being &lt;code&gt;PHONY&lt;/code&gt; any more if your final
target is non-&lt;code&gt;PHONY&lt;/code&gt;, but that&amp;rsquo;s standard &lt;code&gt;make&lt;/code&gt; for you.&lt;/p&gt;
&lt;h4 id=&#34;output-directory-restrictions&#34;&gt;Output directory restrictions&lt;/h4&gt;
&lt;p&gt;These will come to bite you if you rely on build
targets with absolute filenames.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-make&#34; data-lang=&#34;make&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00f&#34;&gt;KERNEL_OUT&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;PWD&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;/&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;OUT&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;/obj/KERNEL_OBJ
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00f&#34;&gt;$(KERNEL_OUT)/drivers&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;	make -C &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;KERNEL_SRC&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt; -O &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;KERNEL_OUT&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt; drivers
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Throws&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;warning: writing to &lt;span style=&#34;color:#008000&#34;&gt;readonly&lt;/span&gt; directory: &lt;span style=&#34;color:#ba2121&#34;&gt;&amp;#34;/home/[...]/out/[...]/KERNEL_OBJ/drivers&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;That is because the make target &lt;code&gt;$(KERNEL_OUT)/drivers&lt;/code&gt; does not begin with
&lt;code&gt;out/target/...&lt;/code&gt; but rather is an absolute path; the build system is not smart
enough to recognize that the path &lt;em&gt;should&lt;/em&gt; still be allowed.&lt;/p&gt;
&lt;p&gt;Use a relative-path &lt;code&gt;KERNEL_OUT&lt;/code&gt; for a make target and an
absolute-path&lt;code&gt;KERNEL_OUT_ABS&lt;/code&gt; for invoking the &amp;ldquo;real&amp;rdquo; &lt;code&gt;make&lt;/code&gt; command:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-make&#34; data-lang=&#34;make&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00f&#34;&gt;KERNEL_OUT&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;OUT&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;/obj/KERNEL_OBJ
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00f&#34;&gt;KERNEL_OUT_ABS&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;PWD&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;/&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;OUT&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;/obj/KERNEL_OBJ
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00f&#34;&gt;$(KERNEL_OUT)/drivers&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;	make -C &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;KERNEL_SRC&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt; -O &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;KERNEL_OUT_ABS&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt; drivers
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h4 id=&#34;gcc-is-broken-for-host-compilation&#34;&gt;GCC is broken for host compilation&lt;/h4&gt;
&lt;p&gt;Even with correct &lt;code&gt;PATH&lt;/code&gt; supplied for &lt;code&gt;cc1&lt;/code&gt;, the prebuilt GCC 4.9 still fails at
compiling the host scripts:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  HOSTCC  scripts/basic/fixdep
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#666&#34;&gt;[&lt;/span&gt;...&lt;span style=&#34;color:#666&#34;&gt;]&lt;/span&gt;/kernel/scripts/basic/fixdep.c:105:23:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    fatal error: sys/types.h: No such file or directory
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;     &lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;#include &amp;lt;sys/types.h&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;It&amp;rsquo;s better to use clang for &lt;code&gt;HOSTCC&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;# Android.mk
CLANG_HOST_TOOLCHAIN := $(PWD)/prebuilts/clang/host/linux-x86/clang-r365631/bin
CLANG_HOSTCC := $(CLANG_HOST_TOOLCHAIN)/clang
[...]
KERNEL_CROSS_COMPILE += HOSTCC=&amp;#34;$(CLANG_HOSTCC)&amp;#34;
[...]
my-target:
	make $(MAKE_FLAGS) -C $(KERNEL_SRC_ABS) O=$(KERNEL_OUT_ABS) \
		ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;code&gt;Makefile&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-diff&#34; data-lang=&#34;diff&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a00000&#34;&gt;-HOSTCC       = gcc
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a00000&#34;&gt;-HOSTCXX      = g++
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a00000&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+HOSTCC       = $(HOSTCC)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+HOSTCXX      = $(HOSTCXX)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h4 id=&#34;absolute-paths-for-invoking-build-tools&#34;&gt;Absolute paths for invoking build tools&lt;/h4&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-make&#34; data-lang=&#34;make&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;CLANG_HOST_TOOLCHAIN&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;PWD&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;/prebuilts/clang/host/linux-x86/clang-r365631/bin
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;KERNEL_HOSTCC&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;CLANG_HOST_TOOLCHAIN&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;/clang
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;KERNEL_TOOLCHAIN&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;PWD&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;KERNEL_TOOLCHAIN_PREFIX&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; aarch64-linux-android-
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;KERNEL_TOOLCHAIN_PATH&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;KERNEL_TOOLCHAIN&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;/&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;KERNEL_TOOLCHAIN_PREFIX&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;KERNEL_CROSS_COMPILE&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;KERNEL_CROSS_COMPILE&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;+=&lt;/span&gt; &lt;span style=&#34;color:#19177c&#34;&gt;CC&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ba2121&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;CLANG_CC&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#ba2121&#34;&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;KERNEL_CROSS_COMPILE&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;+=&lt;/span&gt; &lt;span style=&#34;color:#19177c&#34;&gt;CLANG_TRIPLE&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ba2121&#34;&gt;&amp;#34;aarch64-linux-gnu&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;KERNEL_CROSS_COMPILE&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;+=&lt;/span&gt; &lt;span style=&#34;color:#19177c&#34;&gt;HOSTCC&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ba2121&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;KERNEL_HOSTCC&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#ba2121&#34;&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;KERNEL_CROSS_COMPILE&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;+=&lt;/span&gt; &lt;span style=&#34;color:#19177c&#34;&gt;CROSS_COMPILE&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ba2121&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;KERNEL_TOOLCHAIN_PATH&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#ba2121&#34;&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;KERNEL_CROSS_COMPILE&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;+=&lt;/span&gt; &lt;span style=&#34;color:#19177c&#34;&gt;CROSS_COMPILE_ARM32&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ba2121&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;KERNEL_TOOLCHAIN_32BITS_PATH&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#ba2121&#34;&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h4 id=&#34;no-relying-on-tools-being-in-path&#34;&gt;No relying on tools being in PATH&lt;/h4&gt;
&lt;p&gt;You cannot rely on &lt;code&gt;make&lt;/code&gt;, &lt;code&gt;perl&lt;/code&gt;, &lt;code&gt;gcc&lt;/code&gt; etc. being in &lt;code&gt;$PATH&lt;/code&gt;.&lt;br&gt;
For more information, see &lt;a href=&#34;../android-q-changes/#path-restrictions&#34;&gt;Android Q Changes: PATH restrictions&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Perl is no longer allowed as a &lt;code&gt;PATH&lt;/code&gt; tool:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-make&#34; data-lang=&#34;make&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;# Android.mk
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;KERNEL_PERL&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; /usr/bin/perl
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;&#34;&gt;[...]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;KERNEL_CROSS_COMPILE&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;+=&lt;/span&gt; &lt;span style=&#34;color:#19177c&#34;&gt;PERL&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;KERNEL_PERL&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;Makefile&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-diff&#34; data-lang=&#34;diff&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a00000&#34;&gt;-PERL= perl
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a00000&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+PERL= $(PERL)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;lib/Makefile&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;-      cmd_build_OID_registry = perl $(srctree)/$(src)/build_OID_registry $&amp;lt; $@
+      cmd_build_OID_registry = $(PERL) $(srctree)/$(src)/build_OID_registry $&amp;lt; $@
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;code&gt;make&lt;/code&gt; is no longer an allowed &lt;code&gt;PATH&lt;/code&gt; tool, and you need to supply an extra
&lt;code&gt;PATH&lt;/code&gt; for host binutils:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-make&#34; data-lang=&#34;make&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;GCC_PREBUILTS&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;PWD&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;/prebuilts/gcc/linux-x86/host
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;KERNEL_HOST_TOOLCHAIN&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;GCC_PREBUILTS&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;/x86_64-linux-glibc2.17-4.8/x86_64-linux/bin
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;KERNEL_HOST_TOOLCHAIN_LIBEXEC&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;GCC_PREBUILTS&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;/libexec/gcc/x86_64-linux/4.8.3
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;KERNEL_PREBUILT_MAKE&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;PWD&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;/prebuilts/build-tools/linux-x86/bin/make
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;# clang/GCC (glibc) host toolchain needs to be prepended to $PATH for certain
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;# host bootstrap tools to be built. Also, binutils such as `ld` and `ar` are
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;# needed for now.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;KERNEL_MAKE_EXTRA_PATH&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;KERNEL_HOST_TOOLCHAIN&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;&#34;&gt;ifneq&lt;/span&gt; &lt;span style=&#34;&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;TARGET_KERNEL_USE_CLANG&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;&#34;&gt;,true)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#19177c&#34;&gt;KERNEL_MAKE_EXTRA_PATH&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;      &lt;span style=&#34;color:#ba2121&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;KERNEL_HOST_TOOLCHAIN&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#ba2121&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;KERNEL_HOST_TOOLCHAIN_LIBEXEC&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#ba2121&#34;&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;&#34;&gt;endif&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;KERNEL_MAKE&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;	&lt;span style=&#34;color:#19177c&#34;&gt;PATH&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ba2121&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;KERNEL_MAKE_EXTRA_PATH&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#ba2121&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;$$&lt;/span&gt;&lt;span style=&#34;color:#ba2121&#34;&gt;PATH&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;	&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;KERNEL_PREBUILT_MAKE&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
```
#export PATH=$PATH:/home/builder/omni/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/libexec/gcc/x86_64-linux/4.8.3/

export COLLECT_GCC_OPTIONS=&#34;&#39;-E&#39; &#39;-v&#39; &#39;-mtune=generic&#39; &#39;-march=x86-64&#39; cc1 -E -quiet -v -imultiarch x86_64-linux-gnu -iprefix /home/builder/omni/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/lib/gcc/x86_64-linux/4.8.3 - -mtune=generic -march=x86-64&#34;

export PATH=$(pwd)/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/x86_64-linux/bin:$PATH
export PATH=$(pwd)/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/libexec/gcc/x86_64-linux/4.8.3:$PATH

#export PATH=$PATH:/home/builder/omni/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/libexec/gcc/aarch64-linux-android/4.9.x/

#prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/libexec/gcc/arm-linux-androideabi/4.9.x/cc1
#prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/libexec/gcc/aarch64-linux-android/4.9.x/cc1
#prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/libexec/gcc/x86_64-linux/4.8.3/cc1
```

```
builder@ubuntu-android:~/omni$ get_build_var MAKE
prebuilts/build-tools/linux-x86/bin/ckati --color_warnings --kati_stats MAKECMDGOALS=
```

```
kagura:/ # cat /proc/version
Linux version 4.9.185-667870-g42430b55f92b-dirty (nobody@android-build) (Android (5799447 based on r365631) clang version 9.0.6 (https://android.googlesource.com/toolchain/llvm-project 85305eaf1e90ff529d304abac8a979e1d967f0a2) (based on LLVM 9.0.6svn)) #2 SMP PREEMPT Mon Aug 19 01:38:11 CEST 2019
```

```
echo $PATH
/home/builder/omni/prebuilts/jdk/jdk9/linux-x86/bin:/home/builder/omni/out/soong/host/linux-x86/bin:/home/builder/omni/out/host/linux-x86/bin:/home/builder/omni/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin:/home/builder/omni/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/bin:/home/builder/omni/development/scripts:/home/builder/omni/prebuilts/devtools/tools:/home/builder/omni/external/selinux/prebuilts/bin:/home/builder/omni/prebuilts/misc/linux-x86/dtc:/home/builder/omni/prebuilts/misc/linux-x86/libufdt:/home/builder/omni/prebuilts/clang/host/linux-x86/llvm-binutils-stable:/home/builder/omni/prebuilts/asuite/acloud/linux-x86:/home/builder/omni/prebuilts/asuite/aidegen/linux-x86:/home/builder/omni/prebuilts/asuite/atest/linux-x86:/home/builder/omni/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/libexec/gcc/x86_64-linux/4.8.3:/home/builder/omni/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/x86_64-linux/bin:/home/builder/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
```
--&gt;
</description>
    </item>
    
    <item>
      <title>Tone Battery &amp; Storage Features</title>
      <link>https://sx.ix5.org/info/post/tone-battery-and-storage-features/</link>
      <pubDate>Thu, 04 Jul 2019 07:08:19 +0200</pubDate>
      
      <guid>https://sx.ix5.org/info/post/tone-battery-and-storage-features/</guid>
      <description>&lt;p&gt;While researching a bit about the battery management of MSM8996 for implementing
storage statistics for a &lt;a href=&#34;https://github.com/ix5/vendor-sony-oss-health/&#34;&gt;health HAL&lt;/a&gt;, a few notes:&lt;/p&gt;
&lt;h2 id=&#34;battery-dump&#34;&gt;Battery dump&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;kagura:/ # ls /sys/class/power_supply/battery/
allow_hvdcp3
battery_charging_enabled
battery_type
capacity
charge_control_limit
charge_control_limit_max
charge_full
charge_full_design
charge_type
charging_enabled
chgerr_sts
constant_charge_current_max
current_now
cycle_count
device
dp_dm
enable_shutdown_at_low_battery
flash_active
flash_current_max
flash_trigger
fv_cfg
fv_cmp_cfg
health
input_current_limited
input_current_max
input_current_now
input_current_settled
input_current_state
int_cld
lrc_enable
lrc_not_startup
lrc_socmax
lrc_socmin
max_pulse_allowed
power
present
rerun_aicl
resistance_id
restricted_charging
safety_timer_enabled
smart_charging_activation
smart_charging_interruption
smart_charging_status
status
subsystem
system_temp_level
technology
temp
type
uevent
voltage_max
voltage_max_design
voltage_now
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;bms-dump&#34;&gt;BMS dump&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;kagura:/ # ls /sys/class/power_supply/bms/
batt_aging
battery_type
capacity
capacity_raw
charge_full
charge_full_design
charge_now
charge_now_error
charge_now_raw
current_now
cycle_count
cycle_count_id
device
esr_count
hi_power
power
resistance
resistance_id
subsystem
temp
temp_cool
temp_warm
type
uevent
update_now
voltage_max_design
voltage_min
voltage_now
voltage_ocv
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;storage-devices&#34;&gt;Storage devices&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;kagura:/ # readlink /sys/block/mmcblk0
../devices/platform/soc/7464900.sdhci/mmc_host/mmc0/mmc0:0001/block/mmcblk0
kagura:/ # realpath /sys/block/mmcblk0
/sys/devices/platform/soc/7464900.sdhci/mmc_host/mmc0/mmc0:0001/block/mmcblk0
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;storage-device-features&#34;&gt;Storage device features&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;kagura:/ # ls /sys/devices/platform/soc/7464900.sdhci/mmc_host/mmc0/mmc0\:0001/
block/
cid
csd
date
-&amp;gt; 07/2016
driver
dsr
enhanced_area_offset
enhanced_area_size
enhanced_rpmb_supported
erase_size
ffu_capable
fwrev
hwrev
life_time
-&amp;gt; 0x02 0x02
manfid
name
ocr
oemid
-&amp;gt; 0x0100
power
pre_eol_info
-&amp;gt; 01
preferred_erase_size
prv
raw_rpmb_size_mult
rel_sectors
rev
-&amp;gt; 0x8
serial
-&amp;gt; 0xXXXXXXXX
subsystem
type
uevent
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Pretty neat, gives us all we need: Lifetime-A(&lt;code&gt;0x02&lt;/code&gt;), Lifetime-B(&lt;code&gt;0x02&lt;/code&gt;), and
pre-EOL info(&lt;code&gt;01&lt;/code&gt;).&lt;/p&gt;
&lt;h2 id=&#34;block-devices&#34;&gt;Block devices&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;kagura:/ # ls /sys/devices/platform/soc/7464900.sdhci/mmc_host/mmc0/mmc0\:0001/block/mmcblk0/
alignment_offset
discard_alignment
mmcblk0p10
mmcblk0p16
mmcblk0p21
mmcblk0p27
mmcblk0p32
mmcblk0p38
mmcblk0p43
mmcblk0p49
mmcblk0p54
mmcblk0rpmb
removable
uevent
badblocks
ext_range
mmcblk0p11
mmcblk0p17
mmcblk0p22
mmcblk0p28
mmcblk0p33
mmcblk0p39
mmcblk0p44
mmcblk0p5
mmcblk0p55
no_pack_for_random
ro
bdi
force_ro
mmcblk0p12
mmcblk0p18
mmcblk0p23
mmcblk0p29
mmcblk0p34
mmcblk0p4
mmcblk0p45
mmcblk0p50
mmcblk0p6
num_wr_reqs_to_start_packing
size
capability
holders
mmcblk0p13
mmcblk0p19
mmcblk0p24
mmcblk0p3
mmcblk0p35
mmcblk0p40
mmcblk0p46
mmcblk0p51
mmcblk0p7
power
slaves
dev
inflight
mmcblk0p14
mmcblk0p2
mmcblk0p25
mmcblk0p30
mmcblk0p36
mmcblk0p41
mmcblk0p47
mmcblk0p52
mmcblk0p8
queue
stat
device
mmcblk0p1
mmcblk0p15
mmcblk0p20
mmcblk0p26
mmcblk0p31
mmcblk0p37
mmcblk0p42
mmcblk0p48
mmcblk0p53
mmcblk0p9
range
subsystem
&lt;/code&gt;&lt;/pre&gt;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;kagura:/ # cat /sys/devices/platform/soc/7464900.sdhci/mmc_host/mmc0/mmc0\:0001/block/mmcblk0/stat
    2227      191   154756     3016     4937     6565   221592    32364        0    13429    35336
&lt;/code&gt;&lt;/pre&gt;&lt;hr&gt;
&lt;h2 id=&#34;ufsmmc-specifications&#34;&gt;UFS/MMC specifications&lt;/h2&gt;
&lt;p&gt;According to a &lt;a href=&#34;https://www.datasheets.com/datasheet/EMMC08G-W100-A06U-Kingston%20Technology-62609778&#34;&gt;spec sheet from Kingston&lt;/a&gt; &lt;sup id=&#34;fnref:1&#34;&gt;&lt;a href=&#34;#fn:1&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt;, see chapter 5.17
&amp;ldquo;Device Life time&amp;rdquo; and 5.18 &amp;ldquo;Pre EOL Information&amp;rdquo;.&lt;/p&gt;
&lt;h3 id=&#34;device-life-time-set-type-a&#34;&gt;Device Life Time Set Type A&lt;/h3&gt;
&lt;blockquote&gt;
&lt;p&gt;This field provides an estimated indication of the device life time which is
reflected by the average wear out of memory of Type B relative to its maximum
estimated device life time&lt;/p&gt;
&lt;/blockquote&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Value&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;0x00&lt;/td&gt;
&lt;td&gt;Not Defined&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0x01&lt;/td&gt;
&lt;td&gt;0% - 10% Device Life Time Used&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0x02&lt;/td&gt;
&lt;td&gt;10% - 20% Device Life Time Used&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0x03&lt;/td&gt;
&lt;td&gt;20% - 30% Device Life Time Used&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0x04&lt;/td&gt;
&lt;td&gt;30% - 40% Device Life Time Used&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0x05&lt;/td&gt;
&lt;td&gt;40% - 50% Device Life Time Used&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0x06&lt;/td&gt;
&lt;td&gt;50% - 60% Device Life Time Used&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0x07&lt;/td&gt;
&lt;td&gt;60% - 70% Device Life Time Used&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0x08&lt;/td&gt;
&lt;td&gt;70% - 80% Device Life Time Used&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0x09&lt;/td&gt;
&lt;td&gt;80% - 90% Device Life Time Used&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0x0A&lt;/td&gt;
&lt;td&gt;90% - 100% Device Life Time Used&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0x0B&lt;/td&gt;
&lt;td&gt;Exceeded Maximum Device Life Time&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Others&lt;/td&gt;
&lt;td&gt;Reserved&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3 id=&#34;device-life-time-set-type-b&#34;&gt;Device Life Time Set Type B&lt;/h3&gt;
&lt;blockquote&gt;
&lt;p&gt;This field provides an estimated indication of the device life time which is
reflected by the average wear out of memory of Type A relative to its maximum
estimated device life time&lt;/p&gt;
&lt;/blockquote&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Value&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;0x00&lt;/td&gt;
&lt;td&gt;Not Defined&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0x01&lt;/td&gt;
&lt;td&gt;0% - 10% Device Life Time Used&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0x02&lt;/td&gt;
&lt;td&gt;10% - 20% Device Life Time Used&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0x03&lt;/td&gt;
&lt;td&gt;20% - 30% Device Life Time Used&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0x04&lt;/td&gt;
&lt;td&gt;30% - 40% Device Life Time Used&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0x05&lt;/td&gt;
&lt;td&gt;40% - 50% Device Life Time Used&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0x06&lt;/td&gt;
&lt;td&gt;50% - 60% Device Life Time Used&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0x07&lt;/td&gt;
&lt;td&gt;60% - 70% Device Life Time Used&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0x08&lt;/td&gt;
&lt;td&gt;70% - 80% Device Life Time Used&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0x09&lt;/td&gt;
&lt;td&gt;80% - 90% Device Life Time Used&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0x0A&lt;/td&gt;
&lt;td&gt;90% - 100% Device Life Time Used&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0x0B&lt;/td&gt;
&lt;td&gt;Exceeded Maximum Device Life Time&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Others&lt;/td&gt;
&lt;td&gt;Reserved&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3 id=&#34;pre-eol-information&#34;&gt;Pre EOL Information&lt;/h3&gt;
&lt;blockquote&gt;
&lt;p&gt;This field provides information about device life time reflected by average
reserved blocks.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Value&lt;/th&gt;
&lt;th&gt;Pre-EOL Info.&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;0x00&lt;/td&gt;
&lt;td&gt;Not Defined&lt;/td&gt;
&lt;td&gt;Not Defined&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0x01&lt;/td&gt;
&lt;td&gt;Normal&lt;/td&gt;
&lt;td&gt;Normal&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0x02&lt;/td&gt;
&lt;td&gt;Warning&lt;/td&gt;
&lt;td&gt;Consumed 80% of Reserved Blocks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0x03&lt;/td&gt;
&lt;td&gt;Urgent&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0x04 – 0xFF&lt;/td&gt;
&lt;td&gt;Reserved&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;div class=&#34;footnotes&#34; role=&#34;doc-endnotes&#34;&gt;
&lt;hr&gt;
&lt;ol&gt;
&lt;li id=&#34;fn:1&#34;&gt;
&lt;p&gt;Spec sheet &amp;ldquo;Embedded Multi-Media Card&amp;rdquo; - EMMC08G-W100-A06U, Kingston Technology Company, Inc. - 2015-1-22&amp;#160;&lt;a href=&#34;#fnref:1&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
</description>
    </item>
    
    <item>
      <title>Applying Single CAF Commits</title>
      <link>https://sx.ix5.org/info/post/applying-single-caf-commits/</link>
      <pubDate>Tue, 04 Jun 2019 14:25:45 +0200</pubDate>
      
      <guid>https://sx.ix5.org/info/post/applying-single-caf-commits/</guid>
      <description>&lt;p&gt;Normally, git either fetches all remote branches or only a specific branch with
&lt;code&gt;git fetch &amp;lt;remote&amp;gt; &amp;lt;branch&amp;gt;&lt;/code&gt;, but most git servers cannot send a single commit.&lt;/p&gt;
&lt;p&gt;Say you want to apply only a commit from CodeAurora Forum(“CAF”) but you do not
know the branch it is on.
E.g. &lt;a href=&#34;https://source.codeaurora.org/quic/la/kernel/msm-4.9/commit?id=3186af9f3ece8d5d07a3d62cc1a64b448eab375b&#34;&gt;source.codeaurora.org/quic/la/kernel/msm-4.9/commit?id=3186af9f3ece8d5d07a3d62cc1a64b448eab375b&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;You can get a &lt;code&gt;.patch&lt;/code&gt;-formatted version of any commit by exchanging
&lt;code&gt;/commit?id=&lt;/code&gt; for &lt;code&gt;/patch?id=&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;You can download that patch and apply it via git&amp;rsquo;s apply-mail function:
&lt;code&gt;curl &#39;https://source.codeaurora.org/quic/la/kernel/msm-4.9/patch/?id=3186af9f3ece8d5d07a3d62cc1a64b448eab375b&#39; | git am&lt;/code&gt;.&lt;/p&gt;
&lt;!--
```
CAF=https://source.codeaurora.org/quic/la/kernel/msm-4.9
PATCH=3186af9f3ece8d5d07a3d62cc1a64b448eab375b
curl &#34;https://$CAF/patch/?id=$PATCH&#34; \
  | git am
```
--&gt;
</description>
    </item>
    
    <item>
      <title>SODP Device Trees TODO</title>
      <link>https://sx.ix5.org/info/post/sodp-device-trees-todo/</link>
      <pubDate>Sun, 02 Jun 2019 15:00:00 +0200</pubDate>
      
      <guid>https://sx.ix5.org/info/post/sodp-device-trees-todo/</guid>
      <description>&lt;h2 id=&#34;what-do-we-want-what-can-we-do&#34;&gt;What do we want? What can we do?&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Stability&lt;/li&gt;
&lt;li&gt;Better battery life&lt;/li&gt;
&lt;li&gt;More performance&lt;/li&gt;
&lt;li&gt;Fix bugs&lt;/li&gt;
&lt;li&gt;Better sound&lt;/li&gt;
&lt;li&gt;Better network throughput&lt;/li&gt;
&lt;li&gt;Faster storage access&lt;/li&gt;
&lt;li&gt;More free RAM thanks to fixing memory leaks or better memory management&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;where-can-we-improve-things&#34;&gt;Where can we improve things?&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Kernel&lt;/li&gt;
&lt;li&gt;Firmware (unlikely)&lt;/li&gt;
&lt;li&gt;HALs&lt;/li&gt;
&lt;li&gt;Properties&lt;/li&gt;
&lt;li&gt;Configuration files&lt;/li&gt;
&lt;li&gt;Write replacements for Qualcomm HALs or proprietary binaries&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&#34;device-trees&#34;&gt;Device Trees&lt;/h1&gt;
&lt;p&gt;Things we can set in the device trees&lt;/p&gt;
&lt;p&gt;Some things overlap of course, but not too much.&lt;/p&gt;
&lt;h3 id=&#34;audio&#34;&gt;Audio&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Config files:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;a2dp_audio_policy_configuration.xml&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;audio_effects.conf&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;audio_ext_spkr.conf&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;audio_output_policy.conf&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;audio_platform_info.xml&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;audio_platform_info_extcodec.xml&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;audio_platform_info_i2s.xml&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;audio_policy_configuration&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;audio_policy_volumes_drc.xml&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;audio_tuning_mixer.txt&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;mixer_paths.xml&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;mixer_paths_mtp.xml&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;check TX/RX paths&lt;/li&gt;
&lt;li&gt;Soundtrigger/hotword detection:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;sound_trigger_mixer_paths.xml&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sound_trigger_platform_info.xml&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;ACDB tweaks&lt;/li&gt;
&lt;li&gt;Configure Qualcomm Fluence, voice processing&lt;/li&gt;
&lt;li&gt;Tweak latencies:
&amp;ldquo;nile-common: audio: Disable ULL mode&amp;rdquo;
&lt;a href=&#34;https://github.com/omnirom/android_device_sony_nile-common/commit/d9ff18ec6414595481ed5d4d44648c6c7b61a6b8&#34;&gt;https://github.com/omnirom/android_device_sony_nile-common/commit/d9ff18ec6414595481ed5d4d44648c6c7b61a6b8&lt;/a&gt;
&lt;a href=&#34;https://github.com/LineageOS/android_device_sony_nile-common/commit/4dc8401ba95a682e61585f563d78392d5b35df2c&#34;&gt;https://github.com/LineageOS/android_device_sony_nile-common/commit/4dc8401ba95a682e61585f563d78392d5b35df2c&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;bluetooth&#34;&gt;Bluetooth&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Offloading, offloading HALs&lt;/li&gt;
&lt;li&gt;A2DP implementation&lt;/li&gt;
&lt;li&gt;Enable all possible codecs&lt;/li&gt;
&lt;li&gt;LDAC&lt;/li&gt;
&lt;li&gt;&lt;code&gt;bdroid_buildconfig.h&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Low-Energy&lt;/li&gt;
&lt;li&gt;Channels&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;block-devices&#34;&gt;Block Devices&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Tune fstab&lt;/li&gt;
&lt;li&gt;Maybe use f2fs&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/lazerl0rd/device-sony-yoshino/commit/c6a9a94a88e85ac16c759990ff42eebfb888162b#diff-2a70d4c28762e80752b2d8d1ac74dbfe&#34;&gt;https://github.com/lazerl0rd/device-sony-yoshino/commit/c6a9a94a88e85ac16c759990ff42eebfb888162b#diff-2a70d4c28762e80752b2d8d1ac74dbfe&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;gps&#34;&gt;GPS&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;gps.conf&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Check servers&lt;/li&gt;
&lt;li&gt;Check &lt;code&gt;XTRA&lt;/code&gt; versions&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;nfc&#34;&gt;NFC&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Configs&lt;/li&gt;
&lt;li&gt;Check that models are correct&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;sensors&#34;&gt;Sensors&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/LineageOS/android_device_huawei_angler/blob/lineage-16.0/sensorhal/sensorlist.cpp&#34;&gt;Angler: sensorlist.cpp&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;debugging-features&#34;&gt;Debugging features&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Add our custom RPM etc. paths to the dump output of the &lt;code&gt;dumpstate&lt;/code&gt; HAL&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/LineageOS/android_device_huawei_angler/blob/lineage-16.0/dumpstate/DumpstateDevice.cpp&#34;&gt;Angler: dumpstate&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;treble&#34;&gt;Treble&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Update DM, FCM versions&lt;/li&gt;
&lt;li&gt;Update HAL versions of default ones&lt;/li&gt;
&lt;li&gt;Update &lt;code&gt;radio@1.1&lt;/code&gt; to 1.4&lt;/li&gt;
&lt;li&gt;Check that all devices go on &lt;code&gt;PRODUCT_FULL_TREBLE&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;wi-fi&#34;&gt;Wi-Fi&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Configs
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;p2p_supplicant_overlay.conf&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;wpa_supplicant_overlay.conf&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;wpa_supplicant_wcn.conf&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;wifi_concurrency_cfg.txt&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;WCNSS_qcom_cfg.ini&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Configure usable frequencies(DFS)&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;sec_config&#34;&gt;sec_config&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/LineageOS/android_device_google_bonito/blob/lineage-16.0/sec_config&#34;&gt;https://github.com/LineageOS/android_device_google_bonito/blob/lineage-16.0/sec_config&lt;/a&gt;
&lt;a href=&#34;https://github.com/PixelExperience-Devices/device_xiaomi_tulip/blob/pie/configs/sec_config&#34;&gt;https://github.com/PixelExperience-Devices/device_xiaomi_tulip/blob/pie/configs/sec_config&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;seccomp&#34;&gt;seccomp&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/omnirom/android_device_motorola_potter/tree/android-9.0/seccomp_policy&#34;&gt;https://github.com/omnirom/android_device_motorola_potter/tree/android-9.0/seccomp_policy&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;suspend-hal&#34;&gt;Suspend HAL?&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;config_powerDecoupleAutoSuspendModeFromDisplay&lt;/code&gt;
&lt;code&gt;config_powerDecoupleInteractiveModeFromDisplay&lt;/code&gt;
&lt;code&gt;overlay/frameworks/base/core/res/res/values/config.xml&lt;/code&gt;
&lt;a href=&#34;https://github.com/omnirom/android_device_sony_nile-common/commit/c62a3be7b01f6a4f5da7f497d00c024e30448f96&#34;&gt;https://github.com/omnirom/android_device_sony_nile-common/commit/c62a3be7b01f6a4f5da7f497d00c024e30448f96&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;msm_irqbalance&#34;&gt;msm_irqbalance&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Confirm whether IRQs are actually correct&lt;/li&gt;
&lt;li&gt;Ban/unban if needed&lt;/li&gt;
&lt;li&gt;Implement OSS irqbalance&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/PixelExperience-Devices/device_xiaomi_tulip/blob/pie/configs/msm_irqbalance.conf&#34;&gt;https://github.com/PixelExperience-Devices/device_xiaomi_tulip/blob/pie/configs/msm_irqbalance.conf&lt;/a&gt;&lt;/p&gt;
&lt;h1 id=&#34;halsblobs&#34;&gt;HALs/Blobs&lt;/h1&gt;
&lt;p&gt;Things that we have to tweak HALs for or try to get proprietary binaries changed
or write our own replacements.&lt;/p&gt;
&lt;h3 id=&#34;camera&#34;&gt;Camera&lt;/h3&gt;
&lt;p&gt;vendor-qcom-opensource-camera:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Shutter speed, exposure, whitebalance etc. parameters&lt;/li&gt;
&lt;li&gt;Fix CASH with timeouts instead of shutting off sensors&lt;/li&gt;
&lt;li&gt;Flash and shutter coordination&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&#34;kernel&#34;&gt;Kernel&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;Loire: instabilities&lt;/li&gt;
&lt;li&gt;Tone: 5s bug, crashy mtp, heat on even low loads, bad battery life&lt;/li&gt;
&lt;li&gt;Yoshino: Buggy SDE (why does it only happen on GSIs?)&lt;/li&gt;
&lt;li&gt;Nile: Buggy SDE/sluggish stuttery display&lt;/li&gt;
&lt;li&gt;Tama: (Camera)&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&#34;update-forked-hals&#34;&gt;Update forked HALs&lt;/h1&gt;
&lt;p&gt;TODO: List of forked HALs that we should update from CAF&lt;/p&gt;
&lt;h1 id=&#34;todoinspiration&#34;&gt;TODO/Inspiration&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/LineageOS/android_device_huawei_angler/&#34;&gt;https://github.com/LineageOS/android_device_huawei_angler/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/cryptomilk/android_device_sony_lilac/blob/lineage-16.0/system.prop&#34;&gt;https://github.com/cryptomilk/android_device_sony_lilac/blob/lineage-16.0/system.prop&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/omnirom/android_device_xiaomi_beryllium&#34;&gt;https://github.com/omnirom/android_device_xiaomi_beryllium&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/ResurrectionRemix-Devices/device_lenovo_kuntao/blob/pie/vendor_prop.mk&#34;&gt;https://github.com/ResurrectionRemix-Devices/device_lenovo_kuntao/blob/pie/vendor_prop.mk&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/ResurrectionRemix-Devices/device_lenovo_kuntao/blob/pie/bluetooth/bdroid_buildcfg.h&#34;&gt;https://github.com/ResurrectionRemix-Devices/device_lenovo_kuntao/blob/pie/bluetooth/bdroid_buildcfg.h&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/ResurrectionRemix-Devices/device_lenovo_kuntao/tree/pie/audio&#34;&gt;https://github.com/ResurrectionRemix-Devices/device_lenovo_kuntao/tree/pie/audio&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/omnirom/android_device_motorola_potter/blob/android-9.0/system.prop&#34;&gt;https://github.com/omnirom/android_device_motorola_potter/blob/android-9.0/system.prop&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/omnirom/android_device_motorola_potter/blob/android-9.0/device.mk&#34;&gt;https://github.com/omnirom/android_device_motorola_potter/blob/android-9.0/device.mk&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/omnirom/android_device_motorola_potter/tree/android-9.0/audio&#34;&gt;https://github.com/omnirom/android_device_motorola_potter/tree/android-9.0/audio&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;compress_offload&lt;/code&gt;:&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/omnirom/android_device_sony_nile-common/blob/8edcbb4cebd597e39ccaa844ab25bc01d156ac2e/audio/audio_policy_configuration.xml#L92&#34;&gt;https://github.com/omnirom/android_device_sony_nile-common/blob/8edcbb4cebd597e39ccaa844ab25bc01d156ac2e/audio/audio_policy_configuration.xml#L92&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/LineageOS/android_device_essential_mata&#34;&gt;https://github.com/LineageOS/android_device_essential_mata&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/omnirom/android_device_oneplus_oneplus5&#34;&gt;https://github.com/omnirom/android_device_oneplus_oneplus5&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/LineageOS/android_device_google_crosshatch&#34;&gt;https://github.com/LineageOS/android_device_google_crosshatch&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/LineageOS/android_device_google_wahoo&#34;&gt;https://github.com/LineageOS/android_device_google_wahoo&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/LineageOS/android_device_google_bonito&#34;&gt;https://github.com/LineageOS/android_device_google_bonito&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/LineageOS/android_device_xiaomi_dipper&#34;&gt;https://github.com/LineageOS/android_device_xiaomi_dipper&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/PixelExperience-Devices/device_xiaomi_tulip/tree/pie/configs/gps&#34;&gt;https://github.com/PixelExperience-Devices/device_xiaomi_tulip/tree/pie/configs/gps&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/PixelExperience-Devices/device_xiaomi_tulip/blob/pie/bluetooth/bdroid_buildcfg.h&#34;&gt;https://github.com/PixelExperience-Devices/device_xiaomi_tulip/blob/pie/bluetooth/bdroid_buildcfg.h&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/PixelExperience-Devices/device_xiaomi_tulip/commits/pie/audio&#34;&gt;https://github.com/PixelExperience-Devices/device_xiaomi_tulip/commits/pie/audio&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/enesuzun2002/android_device_samsung_zero-common&#34;&gt;https://github.com/enesuzun2002/android_device_samsung_zero-common&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/MoKee/android_device_xiaomi_cepheus&#34;&gt;https://github.com/MoKee/android_device_xiaomi_cepheus&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/motoz2-force/android_device_motorola_nash&#34;&gt;https://github.com/motoz2-force/android_device_motorola_nash&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/LineageOS/android_device_huawei_kiwi&#34;&gt;https://github.com/LineageOS/android_device_huawei_kiwi&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;misc&#34;&gt;Misc&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Re-enable Android Beam on Q&lt;/li&gt;
&lt;/ul&gt;
</description>
    </item>
    
    <item>
      <title>Android Q: Dynamic Partitions</title>
      <link>https://sx.ix5.org/info/post/android-q-dynamic-partitions/</link>
      <pubDate>Wed, 29 May 2019 16:15:09 +0200</pubDate>
      
      <guid>https://sx.ix5.org/info/post/android-q-dynamic-partitions/</guid>
      <description>&lt;p&gt;Talk by Google&amp;rsquo;s David Anderson at Linux Plumber&amp;rsquo;s Conf, see
&lt;a href=&#34;https://www.linuxplumbersconf.org/event/2/timetable/?view=nicecompact&#34;&gt;LPC Schedule&lt;/a&gt; for more, &lt;a href=&#34;https://www.youtube.com/watch?v=xMtDDEj-02c&amp;amp;feature=youtu.be&amp;amp;list=PLVsQ_xZBEyN2tq96cAph0Dcy6gJVq_Wqw&amp;amp;t=4685s&#34;&gt;video at YouTube&lt;/a&gt;.&lt;br&gt;
PDF: &lt;a href=&#34;https://linuxplumbersconf.org/event/2/contributions/225/attachments/49/56/06._Dynamic_Partitions_-_LPC_Android_MC_v2.pdf&#34;&gt;Dynamic Partitions&lt;/a&gt;.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; See &lt;a href=&#34;https://sx.ix5.org/info/info/post/dynamic-partitions-take-two/&#34;&gt;Dynamic Partitions: Take Two&lt;/a&gt;.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;Buildvars:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;PRODUCT_USE_DYNAMIC_PARTITIONS
PRODUCT_USE_DYNAMIC_PARTITION_SIZE
PRODUCT_RETROFIT_DYNAMIC_PARTITIONS
PRODUCT_BUILD_SUPER_PARTITION
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Need to unset &lt;code&gt;BOARD_BUILD_SYSTEM_ROOT_IMAGE&lt;/code&gt;, &lt;code&gt;TARGET_NO_RECOVERY&lt;/code&gt; is
unaffected.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://android-review.googlesource.com/c/platform/build/+/932362&#34;&gt;AOSP build/make: Unset system-as-root for mainline&lt;/a&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-diff&#34; data-lang=&#34;diff&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a00000&#34;&gt;-BOARD_BUILD_SYSTEM_ROOT_IMAGE := true
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;
&lt;p&gt;This flag is not allowed to be true when dynamic partitions are
enabled, which mainline devices are expected to do.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;hr&gt;
&lt;p&gt;Of course, this stuff is hopelessly broken for legacy devices. An attempt to get
it to work:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;build/make&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-diff&#34; data-lang=&#34;diff&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000080;font-weight:bold&#34;&gt;diff --git a/tools/releasetools/build_super_image.py b/tools/releasetools/build_super_image.py
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000080;font-weight:bold&#34;&gt;index f63453d8e..b13b906d0 100755
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000080;font-weight:bold&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#a00000&#34;&gt;--- a/tools/releasetools/build_super_image.py
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a00000&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+++ b/tools/releasetools/build_super_image.py
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#800080;font-weight:bold&#34;&gt;@@ -182,6 +182,9 @@ def BuildSuperImage(inp, out):
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#800080;font-weight:bold&#34;&gt;&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;   if isinstance(inp, str):
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;     if os.path.isdir(inp):
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+      if os.path.isdir(out):
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+        logger.info(&amp;#34;out is a dir: %s, setting to super_empty&amp;#34; % str(out))
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+        out = &amp;#34;%s/super_empty.img&amp;#34; % out
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;&lt;/span&gt;       logger.info(&amp;#34;Building super image from extracted target files...&amp;#34;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;       return BuildSuperImageFromExtractedTargetFiles(inp, out)
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;system/core&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-diff&#34; data-lang=&#34;diff&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000080;font-weight:bold&#34;&gt;index a0ccc10f7..6b2436e59 100644
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000080;font-weight:bold&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#a00000&#34;&gt;--- a/fs_mgr/libfiemap_writer/split_fiemap_writer.cpp
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a00000&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+++ b/fs_mgr/libfiemap_writer/split_fiemap_writer.cpp
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#800080;font-weight:bold&#34;&gt;@@ -95,7 +95,22 @@ std::unique_ptr&amp;lt;SplitFiemap&amp;gt; SplitFiemap::Create(const std::string&amp;amp; file_path, u
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#800080;font-weight:bold&#34;&gt;&lt;/span&gt;         // To make sure the alignment doesn&amp;#39;t create too much inconsistency, we
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;         // account the *actual* size, not the requested size.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;         total_bytes_written += writer-&amp;gt;size();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a00000&#34;&gt;-        remaining_bytes -= writer-&amp;gt;size();
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a00000&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+        LOG(WARNING) &amp;lt;&amp;lt; &amp;#34;SplitFiemap:Create() remaining_bytes = &amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+                     &amp;lt;&amp;lt; remaining_bytes&amp;lt;&amp;lt; &amp;#34;, writer-&amp;gt;size() = &amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+                     &amp;lt;&amp;lt; writer -&amp;gt; size();
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+        // 09-29 23:54:24.512  2523  2525 W gsid: SplitFiemap:Create()
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+        //      remaining_bytes = 1589934592, writer-&amp;gt;size() = 1589936128
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+        // 1589934592 − 1589936128 = −1536
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+        if (remaining_bytes &amp;lt; writer-&amp;gt;size()) {
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+            LOG(WARNING) &amp;lt;&amp;lt; &amp;#34;SplitFiemap:Create() remaining_bytes&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+                         &amp;lt;&amp;lt; &amp;#34;&amp;lt; writer-&amp;gt;size, setting remaining_bytes to 0&amp;#34;;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+            remaining_bytes = 0;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+        } else {
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+            remaining_bytes -= writer-&amp;gt;size();
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+            LOG(WARNING) &amp;lt;&amp;lt; &amp;#34;SplitFiemap:Create()&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+                         &amp;lt;&amp;lt; &amp;#34; remaining_bytes, minus writer-&amp;gt;size = &amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+                         &amp;lt;&amp;lt; remaining_bytes;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+        }
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;         out-&amp;gt;AddFile(std::move(writer));
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;     }
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
    </item>
    
    <item>
      <title>SODP: Working Locally</title>
      <link>https://sx.ix5.org/info/post/sodp-working-locally/</link>
      <pubDate>Fri, 24 May 2019 11:48:01 +0200</pubDate>
      
      <guid>https://sx.ix5.org/info/post/sodp-working-locally/</guid>
      <description>&lt;p&gt;To reset your Android source tree to the branches specified in your manifests,
use &lt;code&gt;repo sync --current-branch -l -j 8 --force-sync&lt;/code&gt;.&lt;br&gt;
The &lt;code&gt;-l&lt;/code&gt; means to not connect to the network.&lt;/p&gt;
&lt;p&gt;To only fetch the newest references without modifying the checked-out tree, use
&lt;code&gt;-n&lt;/code&gt; instead of &lt;code&gt;-l&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;We also made a change to &lt;code&gt;repo_update.sh&lt;/code&gt; that enables you to work offline after
having fetched the relevant commits once:
&lt;a href=&#34;https://github.com/sonyxperiadev/repo_update/pull/96&#34;&gt;Look for commits locally before fetching&lt;/a&gt;.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Persistent Logs</title>
      <link>https://sx.ix5.org/info/post/persistent-logs/</link>
      <pubDate>Thu, 23 May 2019 14:25:53 +0200</pubDate>
      
      <guid>https://sx.ix5.org/info/post/persistent-logs/</guid>
      <description>&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://android.googlesource.com/platform/system/core/+/refs/tags/android-9.0.0_r39/logd/README.property&#34;&gt;https://android.googlesource.com/platform/system/core/+/refs/tags/android-9.0.0_r39/logd/README.property&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://android.googlesource.com/platform/system/core/+/refs/tags/android-9.0.0_r39/logcat/logpersist&#34;&gt;https://android.googlesource.com/platform/system/core/+/refs/tags/android-9.0.0_r39/logcat/logpersist&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://android.googlesource.com/platform/system/core/+/refs/tags/android-9.0.0_r39/logcat/logcatd.rc&#34;&gt;https://android.googlesource.com/platform/system/core/+/refs/tags/android-9.0.0_r39/logcat/logcatd.rc&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;setprop persist.logd.logpersistd logcatd
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Enables &lt;code&gt;logpersist&lt;/code&gt; service&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Android&#39;s toybox</title>
      <link>https://sx.ix5.org/info/post/androids-toybox/</link>
      <pubDate>Fri, 26 Apr 2019 18:29:10 +0200</pubDate>
      
      <guid>https://sx.ix5.org/info/post/androids-toybox/</guid>
      <description>&lt;p&gt;Android ships a stripped down version of standard Linux commands and tools via
&lt;a href=&#34;https://android.googlesource.com/platform/external/toybox/&#34;&gt;toybox&lt;/a&gt;. &lt;code&gt;toybox&lt;/code&gt; is comparable to &lt;a href=&#34;https://en.wikipedia.org/wiki/BusyBox&#34;&gt;busybox&lt;/a&gt;, it consists
of a single executable in &lt;code&gt;/vendor/bin/toybox&lt;/code&gt; which provides all the
functionality.&lt;/p&gt;
&lt;p&gt;For example, to view extended file attributes - &lt;code&gt;xattrs&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;kagura:/persist # toybox getfattr -d /persist/
# file: .
security.restorecon_last=&amp;#34;�+4����	\�	�X�7tu�&amp;#34;
security.selinux=&amp;#34;u:object_r:persist_file:s0&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To wipe a particular &lt;code&gt;xattr&lt;/code&gt; to force &lt;code&gt;restorecon_recursive&lt;/code&gt; to run on next
boot:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;kagura:/persist # toybox setfattr -x security.restorecon_last /persist/
kagura:/persist # toybox getfattr -d /persist/
# file: .
security.selinux=&amp;#34;u:object_r:persist_file:s0&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;As of Android 9.0 Pie, &lt;code&gt;toybox&lt;/code&gt; includes the following commands:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;acpi&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;base64&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;basename&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;blkid&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;blockdev&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;cal&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;cat&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;chattr&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;chcon&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;chgrp&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;chmod&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;chown&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;chroot&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;chrt&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;cksum&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;clear&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;cmp&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;comm&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;cp&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;cpio&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;cut&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;date&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;dd&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;df&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;diff&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;dirname&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;dmesg&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;dos2unix&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;du&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;echo&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;egrep&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;env&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;expand&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;expr&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;fallocate&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;false&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;fgrep&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;file&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;find&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;flock&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;fmt&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;free&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;freeramdisk&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;fsfreeze&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;getenforce&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;getfattr&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;grep&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;groups&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;gunzip&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;gzip&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;head&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;help&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;hostname&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;hwclock&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;id&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ifconfig&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;inotifyd&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;insmod&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;install&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ionice&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;iorenice&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;iotop&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;kill&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;killall&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ln&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;load_policy&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;log&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;logname&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;losetup&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ls&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;lsattr&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;lsmod&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;lsof&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;lspci&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;lsusb&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;makedevs&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;md5sum&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;microcom&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;mkdir&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;mkfifo&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;mknod&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;mkswap&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;mktemp&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;modinfo&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;modprobe&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;more&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;mount&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;mountpoint&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;mv&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;nbd-client&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;nc&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;netcat&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;netstat&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;nice&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;nl&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;nohup&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;od&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;partprobe&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;paste&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;patch&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pgrep&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pidof&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pivot_root&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pkill&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pmap&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;printenv&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;printf&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ps&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pwd&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pwdx&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;readlink&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;realpath&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;renice&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;restorecon&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;rev&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;rfkill&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;rm&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;rmdir&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;rmmod&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;runcon&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sed&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sendevent&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;seq&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;setenforce&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;setfattr&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;setprop&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;setsid&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sha1sum&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sha224sum&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sha256sum&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sha384sum&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sha512sum&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sleep&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sort&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;split&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;start&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;stat&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;stop&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;strings&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;stty&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;swapoff&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;swapon&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sync&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sysctl&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;tac&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;tail&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;tar&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;taskset&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;tee&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;time&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;timeout&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;top&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;touch&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;tr&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;traceroute&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;traceroute6&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;true&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;truncate&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;tty&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;tunctl&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ulimit&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;umount&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;uname&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;uniq&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;unix2dos&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;uptime&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;usleep&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;uudecode&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;uuencode&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;vconfig&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;vmstat&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
    </item>
    
    <item>
      <title>Android Product Buildvars</title>
      <link>https://sx.ix5.org/info/post/android-product-buildvars/</link>
      <pubDate>Wed, 20 Mar 2019 21:19:16 +0100</pubDate>
      
      <guid>https://sx.ix5.org/info/post/android-product-buildvars/</guid>
      <description>&lt;p&gt;The following build variables can be set in files inherited from
&lt;code&gt;AndroidProducts.mk&lt;/code&gt; or &lt;code&gt;$PRODUCT.mk&lt;/code&gt;, e.g. &lt;code&gt;aosp_f8331.mk&lt;/code&gt;.
Some of them become read-only to kati (part of the build system) and setting
their value at a later stage - e.g. in &lt;code&gt;BoardConfig.mk&lt;/code&gt; or inherited files - is
ignored.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;build/make/core/product.mk&lt;/code&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-make&#34; data-lang=&#34;make&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;_product_var_list&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_NAME &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_MODEL &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_LOCALES &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_AAPT_CONFIG &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_AAPT_PREF_CONFIG &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_AAPT_PREBUILT_DPI &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_PACKAGES &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_PACKAGES_DEBUG &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_PACKAGES_ENG &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_PACKAGES_TESTS &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_DEVICE &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_MANUFACTURER &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_BRAND &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_PROPERTY_OVERRIDES &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_DEFAULT_PROPERTY_OVERRIDES &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_PRODUCT_PROPERTIES &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_CHARACTERISTICS &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_COPY_FILES &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_OTA_PUBLIC_KEYS &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_EXTRA_RECOVERY_KEYS &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_PACKAGE_OVERLAYS &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    DEVICE_PACKAGE_OVERLAYS &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_ENFORCE_RRO_EXCLUDED_OVERLAYS &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_ENFORCE_RRO_TARGETS &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_SDK_ATREE_FILES &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_SDK_ADDON_NAME &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_SDK_ADDON_COPY_FILES &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_SDK_ADDON_COPY_MODULES &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_SDK_ADDON_DOC_MODULES &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_SDK_ADDON_SYS_IMG_SOURCE_PROP &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_SOONG_NAMESPACES &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_DEFAULT_WIFI_CHANNELS &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_DEFAULT_DEV_CERTIFICATE &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_RESTRICT_VENDOR_FILES &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_VENDOR_KERNEL_HEADERS &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_BOOT_JARS &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_SUPPORTS_BOOT_SIGNER &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_SUPPORTS_VBOOT &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_SUPPORTS_VERITY &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_SUPPORTS_VERITY_FEC &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_OEM_PROPERTIES &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_SYSTEM_DEFAULT_PROPERTIES &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_SYSTEM_PROPERTY_BLACKLIST &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_VENDOR_PROPERTY_BLACKLIST &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_SYSTEM_SERVER_APPS &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_SYSTEM_SERVER_JARS &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_ALWAYS_PREOPT_EXTRACTED_APK &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_DEXPREOPT_SPEED_APPS &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_LOADED_BY_PRIVILEGED_MODULES &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_VBOOT_SIGNING_KEY &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_VBOOT_SIGNING_SUBKEY &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_VERITY_SIGNING_KEY &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_SYSTEM_VERITY_PARTITION &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_VENDOR_VERITY_PARTITION &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_PRODUCT_VERITY_PARTITION &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_SYSTEM_SERVER_DEBUG_INFO &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_OTHER_JAVA_DEBUG_INFO &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_DEX_PREOPT_MODULE_CONFIGS &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_DEX_PREOPT_DEFAULT_COMPILER_FILTER &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_DEX_PREOPT_DEFAULT_FLAGS &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_DEX_PREOPT_BOOT_FLAGS &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_DEX_PREOPT_PROFILE_DIR &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_DEX_PREOPT_BOOT_IMAGE_PROFILE_LOCATION &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_DEX_PREOPT_GENERATE_DM_FILES &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_USE_PROFILE_FOR_BOOT_IMAGE &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_SYSTEM_SERVER_COMPILER_FILTER &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_SANITIZER_MODULE_CONFIGS &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_SYSTEM_BASE_FS_PATH &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_VENDOR_BASE_FS_PATH &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_PRODUCT_BASE_FS_PATH &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_SHIPPING_API_LEVEL &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    VENDOR_PRODUCT_RESTRICT_VENDOR_FILES &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    VENDOR_EXCEPTION_MODULES &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    VENDOR_EXCEPTION_PATHS &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_ART_USE_READ_BARRIER &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_IOT &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_SYSTEM_HEADROOM &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_MINIMIZE_JAVA_DEBUG_INFO &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_INTEGER_OVERFLOW_EXCLUDE_PATHS &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_ADB_KEYS &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_CFI_INCLUDE_PATHS &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_CFI_EXCLUDE_PATHS &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;    PRODUCT_ACTIONABLE_COMPATIBLE_PROPERTY_DISABLE &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-make&#34; data-lang=&#34;make&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;# $(1): product to inherit
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;#
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;# Does three things:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;#  1. Inherits all of the variables from $1.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;#  2. Records the inheritance in the .INHERITS_FROM variable
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;#  3. Records that we&amp;#39;ve visited this node, in ALL_PRODUCTS
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;#
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;&lt;/span&gt;&lt;span style=&#34;&#34;&gt;define&lt;/span&gt; &lt;span style=&#34;&#34;&gt;inherit-product&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;findstring&lt;/span&gt; ../,&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;1&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;))&lt;/span&gt;,\
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;eval&lt;/span&gt; &lt;span style=&#34;color:#19177c&#34;&gt;np&lt;/span&gt; := &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;call&lt;/span&gt; &lt;span style=&#34;color:#19177c&#34;&gt;normalize&lt;/span&gt;-&lt;span style=&#34;color:#19177c&#34;&gt;paths&lt;/span&gt;,&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;1&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)))&lt;/span&gt;,\
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;eval&lt;/span&gt; &lt;span style=&#34;color:#19177c&#34;&gt;np&lt;/span&gt; := &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;strip&lt;/span&gt; &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;1&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;))))&lt;/span&gt;&lt;span style=&#34;&#34;&gt;\&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;foreach&lt;/span&gt; &lt;span style=&#34;color:#19177c&#34;&gt;v&lt;/span&gt;,&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;_product_var_list&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;, \
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;eval&lt;/span&gt; &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;v&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt; := &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$($(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;v&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;))&lt;/span&gt; &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;INHERIT_TAG&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;np&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)))&lt;/span&gt; &lt;span style=&#34;&#34;&gt;\&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#00f&#34;&gt;$(eval inherit_var &lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;:&lt;/span&gt;= \
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      PRODUCTS.&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;strip&lt;/span&gt; &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;word&lt;/span&gt; 1,&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;_include_stack&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)))&lt;/span&gt;.INHERITS_FROM) \
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;eval&lt;/span&gt; &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;inherit_var&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt; := &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;sort&lt;/span&gt; &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$($(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;inherit_var&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;))&lt;/span&gt; &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;np&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)))&lt;/span&gt; \
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;eval&lt;/span&gt; &lt;span style=&#34;color:#19177c&#34;&gt;inherit_var&lt;/span&gt;:=&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt; \
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;eval&lt;/span&gt; &lt;span style=&#34;color:#19177c&#34;&gt;ALL_PRODUCTS&lt;/span&gt; := &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;sort&lt;/span&gt; &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;ALL_PRODUCTS&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;word&lt;/span&gt; 1,&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;_include_stack&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;))))&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;&#34;&gt;endef&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;build/core/product_config.mk&lt;/code&gt;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;.KATI_READONLY := \
  TARGET_PRODUCT \
  TARGET_BUILD_VARIANT \
  TARGET_BUILD_APPS
.KATI_READONLY := PRODUCT_PROPERTY_OVERRIDES
.KATI_READONLY := PRODUCT_DEFAULT_PROPERTY_OVERRIDES
.KATI_READONLY := PRODUCT_SYSTEM_DEFAULT_PROPERTIES
.KATI_READONLY := PRODUCT_PRODUCT_PROPERTIES
&lt;/code&gt;&lt;/pre&gt;</description>
    </item>
    
    <item>
      <title>SailfishOS Installation on Xperia XZ</title>
      <link>https://sx.ix5.org/info/post/sailfishos-installation-on-xperia-xz/</link>
      <pubDate>Tue, 19 Mar 2019 20:03:22 +0100</pubDate>
      
      <guid>https://sx.ix5.org/info/post/sailfishos-installation-on-xperia-xz/</guid>
      <description>&lt;h2 id=&#34;preparation&#34;&gt;Preparation&lt;/h2&gt;
&lt;p&gt;Download the following files from &lt;a href=&#34;https://sx.ix5.org/files/sailfish/&#34;&gt;sx.ix5.org&lt;/a&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;2019-03-14-system.img&lt;/code&gt; (save as &lt;code&gt;system.img&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;hybris-boot.img&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sfe-f8331-3.0.1.11-heroic.tar.bz2&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Then download these additional files:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://basketbuild.com/filedl/devs?dev=AdrianDC&amp;amp;dl=AdrianDC/Kagura/TWRP-Recovery/twrp-3.2.1-20171219-boot-kagura.img&#34;&gt;AdrianDC&amp;rsquo;s TWRP recovery&lt;/a&gt; named
&lt;code&gt;twrp-3.2.1-20171219-boot-kagura.img&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://developer.sony.com/file/download/software-binaries-for-aosp-oreo-android-8-1-kernel-4-4-tone-v16/&#34;&gt;Software binaries version 16&lt;/a&gt; from Sony, named
&lt;code&gt;SW_binaries_for_Xperia_Android_8.1.6.4_r1_v16_tone.zip&lt;/code&gt; (you need to use
version 16 because 17 has a problem with the sensors)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Install &lt;code&gt;fastboot&lt;/code&gt; on your computer. Instructions can be found at
&lt;a href=&#34;https://developer.android.com/studio/releases/platform-tools.html#downloads&#34;&gt;developer.android.com&lt;/a&gt;. An alternative installer can be found at
&lt;a href=&#34;https://forum.xda-developers.com/showthread.php?t=2317790&#34;&gt;xda: Minimal ADB and Fastboot&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;For accessing &lt;code&gt;fastboot&lt;/code&gt; mode on the device, see &lt;a href=&#34;https://sx.ix5.org/info/sony-devices//#accessing-special-modes&#34;&gt;Accessing special
Modes&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;install-required-recovery&#34;&gt;Install required Recovery&lt;/h2&gt;
&lt;p&gt;Install AdrianDC&amp;rsquo;s TWRP recovery via:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;fastboot flash recovery twrp-3.2.1-20171219-boot-kagura.img
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;install-software-binaries&#34;&gt;Install Software Binaries&lt;/h2&gt;
&lt;p&gt;Unzip the downloaded file so that you get
&lt;code&gt;SW_binaries_for_Xperia_Android_8.1.6.4_r1_v16_tone.img&lt;/code&gt;.
Flash the image via &lt;code&gt;fastboot&lt;/code&gt; to the &lt;code&gt;oem&lt;/code&gt; partition:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;fastboot flash oem SW_binaries_for_Xperia_Android_8.1.6.4_r1_v16_tone.img
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;flashing-android-parts&#34;&gt;Flashing Android Parts&lt;/h2&gt;
&lt;p&gt;Flash &lt;code&gt;hybris-boot.img&lt;/code&gt; via &lt;code&gt;fastboot&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;fastboot flash boot hybris-boot.img
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Then flash the system image via &lt;code&gt;fastboot&lt;/code&gt; as well:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;fastboot flash system system.img
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;flashing-sailfish-parts&#34;&gt;Flashing Sailfish Parts&lt;/h2&gt;
&lt;p&gt;Push &lt;code&gt;sfe-f8331-3.0.1.11-heroic.tar.bz2&lt;/code&gt; to &lt;code&gt;/sdcard/&lt;/code&gt; on the device.&lt;/p&gt;
&lt;p&gt;Then run these commands manually in the device&amp;rsquo;s recovery, e.g. &lt;code&gt;TWRP&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;rm -rf /data/.stowaways/sailfishos/
mkdir -p /data/.stowaways/sailfishos
tar --numeric-owner \
    -xvjf /sdcard/sfe-f8331-3.0.1.11-heroic.tar.bz2 \
    -C /data/.stowaways/sailfishos
rm /sdcard/sfe-f8331-3.0.1.11-heroic.tar.bz2
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Reboot and you should be done.&lt;/p&gt;
&lt;h2 id=&#34;note-about-going-back-to-pie-roms&#34;&gt;Note about going back to Pie ROMs&lt;/h2&gt;
&lt;p&gt;Since this SailfishOS port is based on Android Oreo, when you want to go back to
a Pie ROM after flashing SailfishOs, you need to either flash the stock firmware
for the &lt;code&gt;dsp&lt;/code&gt; partition via FlashTool/Emma or manually re-label the files in
&lt;code&gt;/dsp&lt;/code&gt; to &lt;code&gt;adsprpcd_file&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The exact reasons and procedure are described in
&lt;a href=&#34;https://sx.ix5.org/info/post/dsp-file-relabling-for-sodp/&#34;&gt;DSP File Relabeling for SODP&lt;/a&gt;.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Android Build Variable Read Order</title>
      <link>https://sx.ix5.org/info/post/android-build-variable-read-order/</link>
      <pubDate>Mon, 18 Mar 2019 09:33:13 +0100</pubDate>
      
      <guid>https://sx.ix5.org/info/post/android-build-variable-read-order/</guid>
      <description>&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;: Just use &lt;code&gt;make product-graph&lt;/code&gt;.
Then convert the generated &lt;code&gt;.dot&lt;/code&gt; file to pdf:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;dot -Tpdf -Nshape=box -o out/products.pdf out/products.dot
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&amp;hellip;or svg:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;dot -Tsvg -Nshape=box -o out/products.svg out/products.dot
&lt;/code&gt;&lt;/pre&gt;&lt;!--
Build output:
Product graph DOT: out/products.dot for device/sony/kagura/aosp_f8331.mk
argv: [&#39;build/make/tools/filter-product-graph.py&#39;, &#39;device/sony/kagura/aosp_f8331.mk&#39;]
[100% 8/8] Product graph .dot file: out/products.dot
Command to convert to pdf: dot -Tpdf -Nshape=box -o out/products.pdf out/products.dot
Command to convert to svg: dot -Tsvg -Nshape=box -o out/products.svg out/products.dot
--&gt;
&lt;h2 id=&#34;sony-open-devices-project-read-order-of-build-variables&#34;&gt;Sony Open Devices Project: Read order of build variables&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;kagura/vendorsetup.sh&lt;/code&gt; (only for &lt;code&gt;build/envsetup.sh&lt;/code&gt;)
Sets up the lunch combo, which then sets the environment variables
&lt;code&gt;TARGET_PRODUCT&lt;/code&gt;, &lt;code&gt;TARGET_BUILD_VARIANT&lt;/code&gt;, &lt;code&gt;TARGET_PLATFORM_VERSION&lt;/code&gt;,
&lt;code&gt;TARGET_BUILD_TYPE=release&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;kagura/AndroidProducts.mk&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;kagura/aosp_f8331.mk&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;kagura/aosp_f8332.mk&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;kagura/device.mk&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;tone/platform.mk&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;common/common.mk&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;(&lt;code&gt;customization/customization.mk&lt;/code&gt;)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;common/common-init.mk&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;common/common-odm.mk&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;common/common-packages.mk&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;common/common-perm.mk&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;common/common-prop.mk&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;common/common-treble.mk&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;kagura/BoardConfig.mk&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;tone/PlatformConfig.mk&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;common/CommonConfig.mk&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;(customization/Customization.mk)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;(&lt;code&gt;common-headers/KernelHeaders.mk&lt;/code&gt;)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;(&lt;code&gt;common-kernel/KernelConfig.mk&lt;/code&gt;)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;sepolicy/sepolicy.mk&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;!-- TODO: Which gets read first by the build system? --&gt;
&lt;h2 id=&#34;internal-order&#34;&gt;Internal Order&lt;/h2&gt;
&lt;p&gt;Short:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;build/core/main.mk&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;build/core/config.mk&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;build/core/envsetup.mk&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;build/core/product_config.mk&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;BoardConfig.mk&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;build/core/product.mk&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;build/core/device.mk&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;code&gt;build/core/main.mk&lt;/code&gt;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;BUILD_SYSTEM := $(TOPDIR)build/make/core
include $(BUILD_SYSTEM)/config.mk
include $(BUILD_SYSTEM)/definitions.mk
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Then, include all subdir makefiles:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;subdir_makefiles := $(SOONG_ANDROID_MK) $(file &amp;lt;$(OUT_DIR)/.module_paths/Android.mk.list)
$(foreach mk,$(subdir_makefiles),$(info [$(call inc_and_print,subdir_makefiles_inc)/$(subdir_makefiles_total)] including $(mk) ...)$(eval include $(mk)))
&lt;/code&gt;&lt;/pre&gt;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;include $(BUILD_SYSTEM)/Makefile
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;code&gt;build/core/config.mk&lt;/code&gt;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;include $(BUILD_SYSTEM)/envsetup.mk
&lt;/code&gt;&lt;/pre&gt;&lt;!-- include $(BUILD_SYSTEM)/combo/select.mk --&gt;
&lt;p&gt;&lt;code&gt;build/core/envsetup.mk&lt;/code&gt;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;include $(BUILD_SYSTEM)/product_config.mk
board_config_mk := \
	$(strip $(sort $(wildcard \
		$(SRC_TARGET_DIR)/board/$(TARGET_DEVICE)/BoardConfig.mk \
		$(shell test -d device &amp;amp;&amp;amp; find -L device -maxdepth 4 -path &amp;#39;*/$(TARGET_DEVICE)/BoardConfig.mk&amp;#39;) \
		$(shell test -d vendor &amp;amp;&amp;amp; find -L vendor -maxdepth 4 -path &amp;#39;*/$(TARGET_DEVICE)/BoardConfig.mk&amp;#39;) \
	)))
include $(board_config_mk)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;That means: &lt;code&gt;$board_config_mk&lt;/code&gt; = &lt;code&gt;device/$VENDOR/$DEVICE/BoardConfig.mk&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;build/core/product_config.mk&lt;/code&gt;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;include $(BUILD_SYSTEM)/product.mk
include $(BUILD_SYSTEM)/device.mk
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;strong&gt;TODO:&lt;/strong&gt; Nice charts with relations&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Android Q Changes</title>
      <link>https://sx.ix5.org/info/post/android-q-changes/</link>
      <pubDate>Sat, 16 Mar 2019 08:18:41 +0100</pubDate>
      
      <guid>https://sx.ix5.org/info/post/android-q-changes/</guid>
      <description>&lt;h2 id=&#34;sepolicy&#34;&gt;sepolicy&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;sepolicy&lt;/code&gt; has new &lt;code&gt;neverallows&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;ccache&#34;&gt;ccache&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;ccache&lt;/code&gt; is no longer supported by default, the prebuilt &lt;code&gt;ccache&lt;/code&gt; exec has been
removed.&lt;/p&gt;
&lt;p&gt;See &lt;a href=&#34;https://android.googlesource.com/platform/build/+/refs/tags/android-q-preview-1/core/ccache.mk#17&#34;&gt;build/core/ccache.mk&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;We no longer provide a &lt;code&gt;ccache&lt;/code&gt; prebuilt.&lt;/p&gt;
&lt;p&gt;Ours was old, and had a number of issues that triggered non-reproducible
results and other failures. Newer ccache versions may fix some of those
issues, but at the large scale of our build servers, we weren&amp;rsquo;t seeing
significant performance gains from using &lt;code&gt;ccache&lt;/code&gt; &amp;ndash; you end up needing very
good locality and/or very large caches if you&amp;rsquo;re building many different
configurations.&lt;/p&gt;
&lt;p&gt;Local no-change full rebuilds were showing better results, but why not just
use incremental builds at that point?&lt;/p&gt;
&lt;p&gt;So if you still want to use &lt;code&gt;ccache&lt;/code&gt;, continue setting &lt;code&gt;USE_CCACHE&lt;/code&gt;, but also
set the &lt;code&gt;CCACHE_EXEC&lt;/code&gt; environment variable to the path to your ccache
executable.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Install &lt;code&gt;ccache&lt;/code&gt; and set &lt;code&gt;export CCACHE_EXEC=/usr/bin/ccache&lt;/code&gt; in your
&lt;code&gt;~/.bashrc&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;recovery-needed-for-packaging-otas&#34;&gt;Recovery needed for packaging OTAs&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;FAILED: ninja: unknown target &lt;span style=&#34;color:#ba2121&#34;&gt;&amp;#39;otapackage&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;To get OTA packaging for legacy devices to work via &lt;code&gt;make otapackage&lt;/code&gt;, the
target device needs to enable building a recovery image explicitly now.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-make&#34; data-lang=&#34;make&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;PRODUCT_BUILD_RECOVERY_IMAGE&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; &lt;span style=&#34;color:#008000&#34;&gt;true&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Since Android Pie/Q, certain OTA parameters are extracted from an
intermediate recovery image.&lt;/p&gt;
&lt;p&gt;Devices are now supposed to use &lt;code&gt;BOARD_USES_RECOVERY_AS_BOOT&lt;/code&gt; and as such the
build process - even for legacy devices that do not use recovery-as-boot - is
now structured such that it creates the boot image by first contructing a
recovery image and patching that.&lt;/p&gt;
&lt;p&gt;On Pie, the recovery image was built if it wasn&amp;rsquo;t disabled &lt;em&gt;explicitly:&lt;/em&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-make&#34; data-lang=&#34;make&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;# build/make/core/Makefile
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;&lt;/span&gt;&lt;span style=&#34;&#34;&gt;ifeq&lt;/span&gt; &lt;span style=&#34;&#34;&gt;(,&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;filter&lt;/span&gt; &lt;span style=&#34;color:#19177c&#34;&gt;true&lt;/span&gt;, &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;TARGET_NO_KERNEL&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;TARGET_NO_RECOVERY&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;))&lt;/span&gt;&lt;span style=&#34;&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;&#34;&gt;[...&lt;/span&gt; &lt;span style=&#34;&#34;&gt;build&lt;/span&gt; &lt;span style=&#34;&#34;&gt;recoveryimage]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;On Q, building a recovery image must now be enabled since the recovery
buildvars, including &lt;code&gt;$(recovery_fstab)&lt;/code&gt;, are guarded by
&lt;code&gt;BUILDING_RECOVERY_IMAGE&lt;/code&gt;.&lt;br&gt;
See &lt;a href=&#34;https://r.android.com/951796&#34;&gt;AOSP Gerrit: Add BUILD_RECOVERY_IMAGE and BUILD_BOOT_IMAGE flags&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-make&#34; data-lang=&#34;make&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;# build/make/core/board_config.mk
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;&lt;/span&gt;&lt;span style=&#34;&#34;&gt;ifeq&lt;/span&gt; &lt;span style=&#34;&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;BOARD_USES_RECOVERY_AS_BOOT&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;&#34;&gt;,true)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#19177c&#34;&gt;BUILDING_RECOVERY_IMAGE&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; &lt;span style=&#34;color:#008000&#34;&gt;true&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;&#34;&gt;else&lt;/span&gt; &lt;span style=&#34;&#34;&gt;ifeq&lt;/span&gt; &lt;span style=&#34;&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;PRODUCT_BUILD_RECOVERY_IMAGE&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;&#34;&gt;,)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;&#34;&gt;ifdef&lt;/span&gt; &lt;span style=&#34;&#34;&gt;BOARD_RECOVERYIMAGE_PARTITION_SIZE&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;&#34;&gt;ifeq&lt;/span&gt; &lt;span style=&#34;&#34;&gt;(,&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;filter&lt;/span&gt; &lt;span style=&#34;color:#19177c&#34;&gt;true&lt;/span&gt;, &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;TARGET_NO_KERNEL&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;TARGET_NO_RECOVERY&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;))&lt;/span&gt;&lt;span style=&#34;&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#19177c&#34;&gt;BUILDING_RECOVERY_IMAGE&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; &lt;span style=&#34;color:#008000&#34;&gt;true&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    endif
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  endif
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;&#34;&gt;else&lt;/span&gt; &lt;span style=&#34;&#34;&gt;ifeq&lt;/span&gt; &lt;span style=&#34;&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;PRODUCT_BUILD_RECOVERY_IMAGE&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;&#34;&gt;,true)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#19177c&#34;&gt;BUILDING_RECOVERY_IMAGE&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; &lt;span style=&#34;color:#008000&#34;&gt;true&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;&#34;&gt;endif&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;# build/make/core/Makefile
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;&lt;/span&gt;&lt;span style=&#34;&#34;&gt;[...]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;&#34;&gt;ifdef&lt;/span&gt; &lt;span style=&#34;&#34;&gt;BUILDING_RECOVERY_IMAGE&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;&#34;&gt;[...]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;&#34;&gt;ifdef&lt;/span&gt; &lt;span style=&#34;&#34;&gt;TARGET_RECOVERY_FSTAB&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#19177c&#34;&gt;recovery_fstab&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;TARGET_RECOVERY_FSTAB&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;else&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    recovery_fstab :&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;strip &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;wildcard &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;TARGET_DEVICE_DIR&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;/recovery.fstab&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;))&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  endif
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#666&#34;&gt;[&lt;/span&gt;...&lt;span style=&#34;color:#666&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;&#34;&gt;endif&lt;/span&gt; &lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;# BUILDING_RECOVERY_IMAGE
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Since &lt;code&gt;$(recovery_fstab)&lt;/code&gt; is needed by &lt;code&gt;build_otatools_package&lt;/code&gt;, failing to enable the
recovery image leads to the loss of the &lt;code&gt;otapackage&lt;/code&gt; target. Simplified code:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-make&#34; data-lang=&#34;make&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;# build/make/core/Makefile
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;&lt;/span&gt;&lt;span style=&#34;&#34;&gt;[...]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;build_ota_package&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; &lt;span style=&#34;color:#008000&#34;&gt;true&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;&#34;&gt;ifeq&lt;/span&gt; &lt;span style=&#34;&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;recovery_fstab&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;&#34;&gt;,)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#19177c&#34;&gt;build_ota_package&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; &lt;span style=&#34;color:#008000&#34;&gt;false&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;&#34;&gt;endif&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;&#34;&gt;[...]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;&#34;&gt;ifeq&lt;/span&gt; &lt;span style=&#34;&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;build_ota_package&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;&#34;&gt;,true)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;&#34;&gt;[...]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#00f&#34;&gt;.PHONY&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;:&lt;/span&gt; otapackage
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  otapackage: &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;INTERNAL_OTA_PACKAGE_TARGET&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;&#34;&gt;[...]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;&#34;&gt;endif&lt;/span&gt; &lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;# build_ota_package
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!-- h3 Removal of otapackage target
&lt;div class=&#34;message&#34;&gt;
  &lt;h5&gt;Note&lt;/h5&gt;
  The following does not apply, setting `PRODUCT_BUILD_RECOVERY_IMAGE`
  re-enables OTA packaging.
&lt;/div&gt;

Seems there is no more `make otapackage` on the master branch, though that seems
like a small mistake.
You can still build a flashable zip file via
```
make out/target/product/kagura/aosp_f8331-img-eng.builder.zip
```
Substitute `kagura`, `f8331`, `eng` and `builder` for your actual image name.
On Pie, the image used to be called `aosp_f8331-ota-eng.builder.zip`.

You will still not receive a flashable `.zip` file, but rather a compressed
archive with `system.img,` `vendor.img` and `boot.img` to flash manually.
--&gt;
&lt;h2 id=&#34;path-restrictions&#34;&gt;PATH restrictions&lt;/h2&gt;
&lt;p&gt;If some of your makefiles call &lt;code&gt;make&lt;/code&gt;, &lt;code&gt;perl&lt;/code&gt;, &lt;code&gt;gcc&lt;/code&gt; or some other
host-installed tool directly, you will run into an error quite like this one:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;Disallowed PATH tool &amp;#34;make&amp;#34; used: \
  []string{&amp;#34;make&amp;#34;, &amp;#34;-j4&amp;#34;, &amp;#34;-j8&amp;#34;, &amp;#34;-C&amp;#34;, &amp;#34;/home/[...]/kernel/&amp;#34;, \
  &amp;#34;O=../../../../out/target/product/mydevice/obj/kernel/msm-4.9&amp;#34;, \
  &amp;#34;ARCH=arm64&amp;#34;, &amp;#34;CROSS_COMPILE=/home/[...]/aarch64-linux-android-&amp;#34;, \
  &amp;#34;KCFLAGS=-mno-android&amp;#34;}
See https://android.googlesource.com/platform/build/+/master/Changes.md#PATH_Tools for more information.
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The stopgap solution is to set &lt;code&gt;export TEMPORARY_DISABLE_PATH_RESTRICTIONS=true&lt;/code&gt;
in your build environment, but it is worth exploring the reasons behind this.&lt;/p&gt;
&lt;p&gt;Beginning to dig further, not even inspecting the PATH works:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;builder@android:~/android$ get_build_var PATH
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;build/make/core/dumpvar.mk:29: error: PATH is obsolete. Do not use PATH directly.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;See https://android.googlesource.com/platform/build/+/master/Changes.md#PATH.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;22:32:12 dumpvars failed with: &lt;span style=&#34;color:#008000&#34;&gt;exit&lt;/span&gt; status &lt;span style=&#34;color:#666&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;One can modify &lt;a href=&#34;https://android.googlesource.com/platform/build/+/refs/tags/android-q-preview-6/core/config.mk#38&#34;&gt;build/make/core/config.mk&lt;/a&gt; to temporarily allow
using &lt;code&gt;PATH&lt;/code&gt; by commenting out this line:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;$(KATI_obsolete_var PATH,Do not use PATH directly. See $(CHANGES_URL)#PATH)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;So, why all this?&lt;/p&gt;
&lt;h3 id=&#34;reasons&#34;&gt;Reasons&lt;/h3&gt;
&lt;p&gt;With Android Q, Google has restricted the usage of tools in &lt;code&gt;$PATH&lt;/code&gt;, ostensibly
to cut down on too much variance in build environments. Now, usage of &amp;ldquo;host
tools&amp;rdquo; &lt;sup id=&#34;fnref:1&#34;&gt;&lt;a href=&#34;#fn:1&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt; which are not shipped as checked-in prebuilts is heavily discouraged.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;$PATH&lt;/code&gt; that is visible to the makefiles inside the Android build system is
now set via &lt;a href=&#34;https://android.googlesource.com/platform/build/soong/+/refs/tags/android-q-preview-6/ui/build/path.go#152&#34;&gt;build/soong/ui/build/path.go&lt;/a&gt; and only consists of:
&lt;code&gt;prebuilts/build-tools/path/linux-x86:out/.path&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;prebuilts/build-tools/path/linux-x86&lt;/code&gt; is made up of symlinks to prebuilt common
coreutils etc. such as &lt;code&gt;awk&lt;/code&gt;, &lt;code&gt;cat&lt;/code&gt;, &lt;code&gt;cp&lt;/code&gt;, &lt;code&gt;python&lt;/code&gt; and &lt;code&gt;tar&lt;/code&gt;, some of which are
provided via a host &lt;code&gt;toybox&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;.out/path/&lt;/code&gt; is a bit more complicated. It only contains symlinks that all point
to a go binary named &lt;code&gt;path_interposer&lt;/code&gt;. This &lt;code&gt;path_interposer&lt;/code&gt; - source
&lt;a href=&#34;https://android.googlesource.com/platform/build/soong/+/refs/tags/android-q-preview-6/cmd/path_interposer/main.go&#34;&gt;here&lt;/a&gt; - checks whether the program the symlink points to is an
allowed &lt;code&gt;PATH&lt;/code&gt; tool. Which host tools are allowed is specified in
&lt;a href=&#34;https://android.googlesource.com/platform/build/soong/+/refs/tags/android-q-preview-6/ui/build/paths/config.go&#34;&gt;soong/build/paths/config.go&lt;/a&gt;: They&amp;rsquo;re either &lt;code&gt;Allowed&lt;/code&gt;,
&lt;code&gt;Forbidden&lt;/code&gt;, or allowed-but-logged(&lt;code&gt;Log&lt;/code&gt;) (or some other obscure options).&lt;/p&gt;
&lt;h3 id=&#34;measures&#34;&gt;Measures&lt;/h3&gt;
&lt;p&gt;As suggested in the &lt;a href=&#34;https://android.googlesource.com/platform/build/+/master/Changes.md#path&#34;&gt;Build System Changes advisory&lt;/a&gt;, one should
stop relying on &lt;code&gt;$PATH&lt;/code&gt; in makefiles directly, but if needed, commands can still
be invoked with one-off environment variables:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-make&#34; data-lang=&#34;make&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00f&#34;&gt;$(OUT)/my-bin&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;MY_INTERMEDIATE&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;	&lt;span style=&#34;color:#19177c&#34;&gt;PATH&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;$$&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#008000&#34;&gt;cd&lt;/span&gt; device/ti/beagle_x15/hostcc; &lt;span style=&#34;color:#008000&#34;&gt;pwd&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;)&lt;/span&gt;:&lt;span style=&#34;color:#19177c&#34;&gt;$$&lt;/span&gt;PATH &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;	create-my-out-bin
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;As for invoking &lt;code&gt;make&lt;/code&gt;, especially for kernels, using the full path to a
prebuilt &lt;code&gt;make&lt;/code&gt; binary instead of relying on the host &lt;code&gt;/usr/bin/make&lt;/code&gt; fixes the
issue. Google ships a prebuilt &lt;code&gt;make&lt;/code&gt; in &lt;a href=&#34;https://android.googlesource.com/platform/prebuilts/build-tools/+/refs/tags/android-q-preview-6/linux-x86/bin/&#34;&gt;prebuilts/build-tools/&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-make&#34; data-lang=&#34;make&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;# my-kernel.mk
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;MY_MAKE&lt;/span&gt; &lt;span style=&#34;color:#666&#34;&gt;:=&lt;/span&gt; &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;	&lt;span style=&#34;color:#19177c&#34;&gt;PATH&lt;/span&gt;&lt;span style=&#34;color:#666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ba2121&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;PWD&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#ba2121&#34;&gt;/prebuilts/my-prebuilts/bin:&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;$$&lt;/span&gt;&lt;span style=&#34;color:#ba2121&#34;&gt;PATH&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#b62;font-weight:bold&#34;&gt;&lt;/span&gt;	&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;PWD&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;/prebuilts/build-tools/linux-x86/bin/make
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;&#34;&gt;[...]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;# Stop using $(MAKE) directly. Instead of:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;#$(MAKE) -C $(OUT)/my-dir ...
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;# Use:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#408080;font-style:italic&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;MY_MAKE&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;&#34;&gt;-C&lt;/span&gt; &lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;$(&lt;/span&gt;&lt;span style=&#34;color:#19177c&#34;&gt;OUT&lt;/span&gt;&lt;span style=&#34;color:#008000;font-weight:bold&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;&#34;&gt;/my-dir&lt;/span&gt; &lt;span style=&#34;&#34;&gt;...&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--
`get_build_var MAKE` evaluates to
`prebuilts/build-tools/linux-x86/bin/ckati --color_warnings --kati_stats MAKECMDGOALS=`.
--&gt;
&lt;p&gt;For more kernel-specific information, including how you can switch to clang,
have a look at &lt;a href=&#34;../android-q-compiling-kernels-in-tree/&#34;&gt;Android Q: Compiling Kernels in-tree&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;more-background-info&#34;&gt;More background info&lt;/h3&gt;
&lt;p&gt;See &lt;a href=&#34;https://groups.google.com/d/topic/android-building/DTXxDydFR64/discussion&#34;&gt;Google&amp;rsquo;s Dan Willemsen in answer to some MediaTek guys&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;It&amp;rsquo;s easy to use prebuilt tools from the source directory (or built tools)
from your own rules that need them, either just refer to them by name, or you
may be able to set up your own directory to be added to PATH inside a rule:&lt;br&gt;
&lt;a href=&#34;https://android.googlesource.com/device/ti/beagle-x15/+/7001c965a5d6792c04fd94838161cd6116c605cf/uboot.mk#151&#34;&gt;beagle-x15 uboot.mk&lt;/a&gt;, &lt;a href=&#34;https://android.googlesource.com/device/ti/beagle-x15/+/7001c965a5d6792c04fd94838161cd6116c605cf/hostcc#&#34;&gt;beagle-x15 hostcc dir&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;We&amp;rsquo;re not going to add an extension that allows modifying the environment of
every build command &amp;ndash; that causes problems with the attempts to build common
system images that aren&amp;rsquo;t influenced by the device. The common build commands
should not need anything except our standard tools &amp;ndash; if you&amp;rsquo;ve modified them,
it should be easy enough to also add the dependency to the new tools as well.&lt;/p&gt;
&lt;p&gt;On tools:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;We&amp;rsquo;ve deprecated GCC during Android builds, we recommend clang for
compilation.&lt;/li&gt;
&lt;li&gt;We do have prebuilts of &lt;code&gt;make&lt;/code&gt; and some other common tools in
prebuilts/build-tools/linux-x86/bin&lt;/li&gt;
&lt;li&gt;ccache is not something that we provide anymore &amp;ndash; we&amp;rsquo;ve found it&amp;rsquo;s
generally better to use incremental builds, as ccache can slow down your
builds with extra I/O, and incremental builds should have relatively few
cache hits (unless you&amp;rsquo;re sharing the ccache dir; which runs into even more
I/O issues).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Perl is not something supported at Google, so we don&amp;rsquo;t provide that either &amp;ndash;
we do have built in support for python and the ability to use python packages
from the source tree (or checked in as a prebuilt, when using
embedded_launcher, it&amp;rsquo;s a self-contained binary):
&lt;a href=&#34;https://ci.android.com/builds/submitted/5527387/linux/latest/python.html#python_binary_host&#34;&gt;python_binary_host&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;!--
TODO: explain `path_interposer` and how kernel building works again.
--&gt;
&lt;!--
Add `cc1` back:
```
export PATH=$PATH:/home/builder/android/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/libexec/gcc/aarch64-linux-android/4.9.x 
```
--&gt;
&lt;h3 id=&#34;addendum-jan-2021&#34;&gt;Addendum Jan 2021&lt;/h3&gt;
&lt;p&gt;A great example which lists this page as reference is
&lt;a href=&#34;https://osdn.net/projects/android-x86/scm/git/external-busybox/commits/61c5706fd1128a054c7075e8a3332a0bbd4304d3&#34;&gt;this adaptation to Q&lt;/a&gt; of &lt;code&gt;busybox&lt;/code&gt; from the &lt;a href=&#34;https://www.android-x86.org/&#34;&gt;android-x86 project&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;gcc-deprecation&#34;&gt;GCC deprecation&lt;/h2&gt;
&lt;p&gt;GCC 4.9 is being ever more aggressively deprecated. A delay is added to every
call to the prebuilt GCC and a warning is shown - Google cheekily calls this a
&amp;ldquo;Sleep Constructor&amp;rdquo; &lt;sup id=&#34;fnref:2&#34;&gt;&lt;a href=&#34;#fn:2&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;2&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
&lt;p&gt;Current plans: See &lt;a href=&#34;https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/+/refs/tags/android-q-preview-6/GCC_4_9_DEPRECATION.md&#34;&gt;GCC_4_9_DEPRECATION.md&lt;/a&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;January 2019
&lt;ul&gt;
&lt;li&gt;Move GCC binary to new file name.&lt;/li&gt;
&lt;li&gt;Create shell wrapper with old GCC binary name that calls new binary name.&lt;/li&gt;
&lt;li&gt;Shell wrapper print deprecation warning to stdout, with a link to more info.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;April 2019
&lt;ul&gt;
&lt;li&gt;Move GCC binary name.&lt;/li&gt;
&lt;li&gt;Add 1s sleep to wrapper.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;July 2019
&lt;ul&gt;
&lt;li&gt;Move GCC binary name.&lt;/li&gt;
&lt;li&gt;Total 3s sleep.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;October 2019
&lt;ul&gt;
&lt;li&gt;Move GCC binary name.&lt;/li&gt;
&lt;li&gt;Total 10s sleep.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;January 2020
&lt;ul&gt;
&lt;li&gt;Remove GCC from Android.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;h2 id=&#34;new-hals&#34;&gt;New HALs&lt;/h2&gt;
&lt;p&gt;See: &lt;code&gt;hardware/interfaces&lt;/code&gt;, &lt;code&gt;system/hardware/interfaces&lt;/code&gt;,
&lt;code&gt;hardware/google/interfaces&lt;/code&gt;, &lt;code&gt;frameworks/hardware/interfaces&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;new-buildprop-location&#34;&gt;New build.prop location&lt;/h2&gt;
&lt;p&gt;See system/core: init:
&lt;a href=&#34;https://android.googlesource.com/platform/system/core/+/3182ea132e&#34;&gt;Moving &lt;code&gt;/odm/build.prop&lt;/code&gt; to &lt;code&gt;/odm/etc/build.prop&lt;/code&gt;&lt;/a&gt;
There is no more fallback reading of &lt;code&gt;/odm/build.prop&lt;/code&gt; anymore.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;author Bowgo Tsai &amp;lt;bowgotsai@google.com&amp;gt; Fri May 17 15:40:18 2019 +0800
committer Bowgo Tsai &amp;lt;bowgotsai@google.com&amp;gt; Wed May 22 16:15:44 2019 +0800

Moving /odm/build.prop to /odm/etc/buid.prop

In device root directory, we have the following symlinks:
  - /odm/app -&amp;gt; /vendor/odm/app
  - /odm/bin -&amp;gt; /vendor/odm/bin
  - /odm/etc -&amp;gt; /vendor/odm/etc
  ...

This allows the Generic System Image (GSI) to be used on both devices:
  1) Has a physical odm partition, where those symlink will be hidden
     when /odm is used as the mount point
  2) Has no physical odm partition and fallback to /vendor/odm/.

We can&amp;#39;t just have the symlink /odm -&amp;gt; /vendor/odm, because the former
devices won&amp;#39;t have /vendor/odm directory, which leads to mount failure
when the mount point /odm is resolved to /vendor/odm.

The existing /vendor/odm/build.prop won&amp;#39;t be loaded in the latter
devices, because there is no symlink
    - /odm/build.prop -&amp;gt; /vendor/odm/build.prop.

Note that init blocks reading through direct symlinks (O_NOFOLLOW) so
the above symlink won&amp;#39;t work either. This CL moves the odm build.prop
to /odm/etc/build.prop for init to load it (symlinks in earlier
components of the path will still be followed by O_NOFOLLOW).

Bug: 132128501
Test: boot a device and checks /odm/etc/build.prop is loaded
Change-Id: I0733c277baa67c549bb45599abb70aba13fbdbcf
Merged-In: I0733c277baa67c549bb45599abb70aba13fbdbcf
(cherry picked from commit c49655b2a48eca2ab751b853a9a4692f322cafa2)
&lt;/code&gt;&lt;/pre&gt;&lt;div class=&#34;footnotes&#34; role=&#34;doc-endnotes&#34;&gt;
&lt;hr&gt;
&lt;ol&gt;
&lt;li id=&#34;fn:1&#34;&gt;
&lt;p&gt;&amp;ldquo;Host tools&amp;rdquo; meaning tools found in &lt;code&gt;/usr/bin/*&lt;/code&gt; and other host &lt;code&gt;$PATH&lt;/code&gt; locations.&amp;#160;&lt;a href=&#34;#fnref:1&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id=&#34;fn:2&#34;&gt;
&lt;p&gt;See &lt;a href=&#34;https://llvm.org/devmtg/2017-10/slides/Hines-CompilingAndroidKeynote.pdf&#34;&gt;Compiling Android userspace and Linux Kernel with LLVM&lt;/a&gt;&amp;#160;&lt;a href=&#34;#fnref:2&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
</description>
    </item>
    
    <item>
      <title>Bluetooth Audio Debugging</title>
      <link>https://sx.ix5.org/info/post/bluetooth-audio-debugging/</link>
      <pubDate>Tue, 12 Mar 2019 08:18:00 +0100</pubDate>
      
      <guid>https://sx.ix5.org/info/post/bluetooth-audio-debugging/</guid>
      <description>&lt;!-- ## Angelo --&gt;
&lt;!-- the modifications are 3 lines --&gt;
&lt;!-- ``` --&gt;
&lt;!-- &lt;device name=&#34;SND_DEVICE_OUT_BT_SCO_WB&#34; backend=&#34;bt-sco-wb&#34; interface=&#34;AUX_PCM_RX&#34;/&gt; --&gt;
&lt;!--        &lt;device name=&#34;SND_DEVICE_OUT_BT_SCO&#34; backend=&#34;bt-sco&#34; interface=&#34;AUX_PCM_RX&#34;/&gt; --&gt;
&lt;!-- &lt;device name=&#34;SND_DEVICE_OUT_VOICE_TX&#34; backend=&#34;afe-proxy&#34; interface=&#34;SLIMBUS_0_RX&#34;/&gt; --&gt;
&lt;!-- ``` --&gt;
&lt;!-- to explain the reasons of that --&gt;
&lt;!-- device-sony-kagura mixer_paths.xml --&gt;
&lt;!-- ``` --&gt;
&lt;!-- &lt;path name=&#34;voicemmode2-call bt-sco&#34;&gt; --&gt;
&lt;!--        &lt;ctl name=&#34;AUX_PCM_RX_Voice Mixer VoiceMMode2&#34; value=&#34;1&#34; /&gt; --&gt;
&lt;!-- &lt;path name=&#34;voicemmode2-call&#34;&gt; --&gt;
&lt;!--        &lt;ctl name=&#34;SLIM_0_RX_Voice Mixer VoiceMMode2&#34; value=&#34;1&#34; /&gt; --&gt;
&lt;!-- ``` --&gt;
&lt;!-- voicemmode2-call mode gets audio on the SLIMBUS_0_RX --&gt;
&lt;!-- and in the bt-sco(-wb) usecase (backend) it routes the audio to AUX_PCM_RX --&gt;
&lt;!-- ``` --&gt;
&lt;!-- ./hal/msm8974/platform.c:    hw_interface_table[SND_DEVICE_OUT_BT_SCO] = strdup(&#34;SEC_AUX_PCM_RX&#34;); --&gt;
&lt;!-- ``` --&gt;
&lt;!-- in the HAL --&gt;
&lt;!-- this is erroneously being routed by default --&gt;
&lt;!-- to SEC_AUX_PCM_RX instead --&gt;
&lt;p&gt;After the switch from Kernel version 4.4(&lt;code&gt;LA.UM.6.4.r1&lt;/code&gt;) to
4.9(&lt;code&gt;LE.UM.2.3.2.r1.4&lt;/code&gt;), the Sony Xperia XZ(&amp;ldquo;kagura&amp;rdquo;) could not output any call
sound at all while a bluetooth headset was connected.&lt;/p&gt;
&lt;p&gt;While digging through the &lt;code&gt;dmesg&lt;/code&gt; logs, some things popped up:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;qdsp_cvp_callback: cmd = 0x13199 returned error = 0x2
voice_send_cvp_device_channels_cmd: DSP returned error[ADSP_EBADPARAM]
voice_send_cvp_media_fmt_info_cmd: Set channel info failed err: -22
voice_setup_vocproc: Set media format info failed err:-22
setup voice failed
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The messages are emitted by &lt;a href=&#34;https://github.com/sonyxperiadev/kernel/blob/aosp/LE.UM.2.3.2.r1.4/techpack/audio/dsp/q6voice.c&#34;&gt;q6voice.c&lt;/a&gt;. (The &lt;code&gt;techpack/&lt;/code&gt;
directory contains backports/imports that are not in the regular kernel.)&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s add some logging to 4.9:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;2019-01-29-1845-4.9-with-logging-dmesg10.txt
voc_set_device_config: path_dir=0 port_id=100a, channels=1, sample_rate=16000, \
  bits_per_sample=2
voice_send_cvp_create_cmd: veeeery_early: v-&amp;gt;dev_rx.no_of_channels = 1
voice_send_cvp_create_cmd: veeeery_early: v-&amp;gt;dev_tx.no_of_channels = 1
voice_set_topology_specific_info: Topology Rx no of channels: 15
voice_set_topology_specific_info: Topology Tx no of channels: 15
voice_send_cvp_create_cmd: early: v-&amp;gt;dev_rx.no_of_channels = 15
voice_send_cvp_create_cmd: early: v-&amp;gt;dev_tx.no_of_channels = 15
tx_topology: 69491 tx_port_id=4107, rx_port_id=4106, mode: 0x10f7c
rx_topology: 69514, profile_id: 0x1135e, pkt_size: 64
voice_send_cvp_create_cmd: late: v-&amp;gt;dev_rx.no_of_channels = 15
voice_send_cvp_create_cmd: late: v-&amp;gt;dev_tx.no_of_channels = 15
voice_send_cvp_device_channels_cmd: cvp_set_dev_channels_cmd struct follows:
voice_send_cvp_device_channels_cmd: hdr: hdr_field=592, pkt_size=24, src_port=6, \
  dest_port=64, token=0, opcode=78233
voice_send_cvp_device_channels_cmd: cvp_set_channels: \
  rx_num_channels=1, tx_num_channels=15
qdsp_cvp_callback: cmd = 0x13199 returned error = 0x2
voice_send_cvp_device_channels_cmd: DSP returned error[ADSP_EBADPARAM]
voice_send_cvp_media_fmt_info_cmd: Set channel info failed err: -22
voice_setup_vocproc: Set media format info failed err:-22
setup voice failed
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&amp;hellip;and compare with 4.4:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;2019-01-29-1845-4.4-with-logging-dmesg.txt
voice_send_cvp_device_channels_cmd: cvp_set_dev_channels_cmd struct follows:
voice_send_cvp_device_channels_cmd: hdr: hdr_field=592, pkt_size=24, src_port=6, \
  dest_port=64, token=0, opcode=78233
voice_send_cvp_device_channels_cmd: cvp_set_channels: \
  rx_num_channels=1, tx_num_channels=1
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;We can immediately see something is odd with &lt;code&gt;rx_num_channels&lt;/code&gt; and
&lt;code&gt;tx_num_channels&lt;/code&gt;.&lt;/p&gt;
&lt;!-- some weirdness with 15 being converted to 1 or 2 --&gt;
&lt;p&gt;Hardcoding &lt;code&gt;tx_num_channels&lt;/code&gt; to &lt;code&gt;1&lt;/code&gt; seems to temporarily solve the issue, we
have call audio again.&lt;/p&gt;
&lt;p&gt;But that&amp;rsquo;s not a good solution, let&amp;rsquo;s dig a bit deeper:&lt;br&gt;
The number of channels is frozen on 4.4, but starting on 4.9
the kernel loads voice topology information via
&lt;a href=&#34;https://github.com/sonyxperiadev/kernel/blob/2637f52c94db33b498c6cc6c01df04fd2dde677c/techpack/audio/dsp/q6voice.c#L2421&#34;&gt;voc_get_tx_rx_topology()&lt;/a&gt; - including the number of channels -
from the ACDB(&amp;ldquo;Audio Calibration Database&amp;rdquo;).
ACDB is a proprietary mechanism, and we cannot modify the binary acdb files
without specialized tools.&lt;/p&gt;
&lt;p&gt;It seems the calibration data, at least in respect to bluetooth voice channels,
is off for legacy &amp;ldquo;tone&amp;rdquo; devices such as the Xperia XZ(&amp;ldquo;kagura&amp;rdquo;), and possibly
&amp;ldquo;loire&amp;rdquo; too.&lt;/p&gt;
&lt;p&gt;So we arrive at the next idea: Only read topology on nile, tama and newer
platforms(where the ACDB is correct) via &lt;code&gt;of_machine_is_compatible&lt;/code&gt;:
&lt;a href=&#34;https://github.com/ix5/kernel-sony/commit/42dd56ac06b115ae228567ab10c94f86010f5061&#34;&gt;Do not load bt audio topology on legacy devices&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;But that&amp;rsquo;s also not a very good idea since we are now nuking all ACDB topology
info in &lt;code&gt;q6voice&lt;/code&gt; for legacy when only bluetooth seems wrongly configured.&lt;/p&gt;
&lt;p&gt;The final decision was to do it more elegantly: Just disable the &lt;code&gt;acdb_id&lt;/code&gt; for
&lt;code&gt;OUT_BT_SCO_WB&lt;/code&gt; in the legacy platforms&amp;rsquo; &lt;code&gt;audio_platform_info.xml&lt;/code&gt; files.&lt;/p&gt;
&lt;p&gt;See:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/sonyxperiadev/device-sony-tone/pull/163&#34;&gt;tone: audio_platform_info: Disable ACDB for OUT_BT_SCO_WB&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/sonyxperiadev/device-sony-yoshino/pull/124&#34;&gt;yoshino: audio_platform_info: Disable ACDB for OUT_BT_SCO_WB&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strike&gt;But there is still some way to go, when switching from bluetooth to
earpiece/speaker the sound is gone irrevocably, one needs to restart call to
restore it.&lt;/strike&gt;
It seems the issue is completely gone with the v6 Software Binaries realease.&lt;/p&gt;
&lt;hr&gt;
&lt;!-- Also: [GCC 8 support, SMP2P RDBG disablement, clock fixes, audio fix][pull-audiofix] --&gt;
&lt;!-- with commit --&gt;
&lt;!-- [tp: audio: Don&#39;t care about reusing calibrations for other usecases][tp-audio-commit] --&gt;
&lt;!-- [pull-audiofix]: https://github.com/sonyxperiadev/kernel/pull/1909 --&gt;
&lt;!-- [tp-audio-commit]: https://github.com/sonyxperiadev/kernel/pull/1909/commits/c4966d1ce6d4127f52619c1d1bbaf0c4b5383cf5 --&gt;
</description>
    </item>
    
    <item>
      <title>Debugging DAC_OVERRIDE</title>
      <link>https://sx.ix5.org/info/post/debugging-dac_override/</link>
      <pubDate>Thu, 07 Mar 2019 12:05:37 +0100</pubDate>
      
      <guid>https://sx.ix5.org/info/post/debugging-dac_override/</guid>
      <description>&lt;!-- ``` --&gt;
&lt;!-- now the only possible idea I can imagine is  that smp_affinity is turning read only in some circumstances? that even possible? --&gt;
&lt;!-- but in any case, if this is the issue, we should dontaudit and forget about it --&gt;
&lt;!-- actually... --&gt;
&lt;!-- let&#39;s set the file read-only and see what happens --&gt;
&lt;!-- [  313.289008] type=1400 audit(1551922324.669:34): avc: denied { dac_override } for pid=1849 comm=&#34;msm_irqbalance&#34; capability=1 scontext=u:r:msm_irqbalance:s0 tcontext=u:r:msm_irqbalance:s0 tclass=capability permissive=1 --&gt;
&lt;!-- so this perfectly reproduces what&#39;s seen in the normal usecase --&gt;
&lt;!-- but of course this is fabricated to be like this --&gt;
&lt;!-- let&#39;s hope that grepping for errors in strace will show some results with the unmodified msm_irqbalance --&gt;
&lt;!-- ``` --&gt;
&lt;p&gt;A very peculiar thing happens with a certain program, let&amp;rsquo;s call it
&lt;code&gt;irq_assigner&lt;/code&gt;: When in operation, it performs &lt;em&gt;some&lt;/em&gt; kind of action that
requires the &lt;code&gt;DAC_OVERRIDE&lt;/code&gt; capability:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;avc: denied { dac_override } for capability=1 \
  scontext=u:r:irq_assigner:s0 tcontext=u:r:irq_assigner:s0 tclass=capability
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This is the program in question, &lt;code&gt;/vendor/etc/init/irq_assigner.rc&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;service irq_assigner /vendor/bin/irq_assigner
    socket irq_assigner seqpacket 660 root system
    class core
    user root
    group root
    disabled

on property:sys.boot_completed=1
    enable irq_assigner
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;We checked all files it opens(which are few) and verified the UNIX
permissions(those in &lt;code&gt;rwxrwxrwx&lt;/code&gt; format) were all correct, i.e. &lt;code&gt;root&lt;/code&gt; had
sufficient permissions to access them.&lt;/p&gt;
&lt;p&gt;Android&amp;rsquo;s SELinux stack has no option to print the file for which &lt;code&gt;dac_override&lt;/code&gt;
was requested, so we need some trickery.&lt;/p&gt;
&lt;p&gt;First, let&amp;rsquo;s try to find what even is causing the issue, the blunt way with a
&lt;code&gt;WARN_ON&lt;/code&gt; to dump a stack trace:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-diff&#34; data-lang=&#34;diff&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000080;font-weight:bold&#34;&gt;diff --git a/security/selinux/avc.c b/security/selinux/avc.c
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000080;font-weight:bold&#34;&gt;index 84d9a2e2bbaf..c845db70ed73 100644
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000080;font-weight:bold&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#a00000&#34;&gt;--- a/security/selinux/avc.c
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a00000&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+++ b/security/selinux/avc.c
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#800080;font-weight:bold&#34;&gt;@@ -734,6 +734,10 @@ static void avc_audit_post_callback(struct audit_buffer *ab, void *a)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#800080;font-weight:bold&#34;&gt;&lt;/span&gt;     if (ad-&amp;gt;selinux_audit_data-&amp;gt;denied) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;         audit_log_format(ab, &amp;#34; permissive=%u&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                  ad-&amp;gt;selinux_audit_data-&amp;gt;result ? 0 : 1);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+        if (ad-&amp;gt;u.cap == 1) {
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+            audit_log_format(ab, &amp;#34; cap=dac_override, dumping stack&amp;#34;);
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+            WARN_ON(ad-&amp;gt;u.cap == 1);
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+        }
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;&lt;/span&gt;     }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Here we go then:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;Call trace:
        : Exception stack(0xffffffc04a68f6b0 to 0xffffffc04a68f7e0)
f6a0    : 0000000000000004 0000007fffffffff

        : [&amp;lt;ffffff80083ab300&amp;gt;] avc_audit_post_callback+0x190/0x198
        : [&amp;lt;ffffff80083cc314&amp;gt;] common_lsm_audit+0xa8/0x710
        : [&amp;lt;ffffff80083ac008&amp;gt;] slow_avc_audit+0xa8/0xd4
        : [&amp;lt;ffffff80083af5d0&amp;gt;] cred_has_capability+0x11c/0x140
        : [&amp;lt;ffffff80083af640&amp;gt;] selinux_capable+0x4c/0x58
        : [&amp;lt;ffffff80083a642c&amp;gt;] security_capable+0x64/0x94
        : [&amp;lt;ffffff80080bdd38&amp;gt;] capable_wrt_inode_uidgid+0x40/0x98
        : [&amp;lt;ffffff8008253020&amp;gt;] generic_permission.part.34+0xac/0xdc
        : [&amp;lt;ffffff80082535a8&amp;gt;] __inode_permission2+0x70/0x104
        : [&amp;lt;ffffff80082536b0&amp;gt;] inode_permission2+0x38/0x74
        : [&amp;lt;ffffff80082567dc&amp;gt;] lookup_open+0x17c/0x588
        : [&amp;lt;ffffff8008257018&amp;gt;] path_openat+0x430/0xaa4
        : [&amp;lt;ffffff8008259744&amp;gt;] do_filp_open+0x70/0x104
        : [&amp;lt;ffffff8008244648&amp;gt;] do_sys_open+0x154/0x268
        : [&amp;lt;ffffff80082447e0&amp;gt;] SyS_openat+0x3c/0x48
        : [&amp;lt;ffffff8008083e00&amp;gt;] el0_svc_naked+0x34/0x38
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The access vector is a dir/file opened with wrong permissions, as expected.&lt;/p&gt;
&lt;p&gt;After some probing, a good way to intercept the relavant call is to modify
&lt;code&gt;generic_permission()&lt;/code&gt; to print if a &lt;code&gt;DAC_OVERRIDE&lt;/code&gt; was denied:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-diff&#34; data-lang=&#34;diff&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000080;font-weight:bold&#34;&gt;diff --git a/fs/namei.c b/fs/namei.c
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000080;font-weight:bold&#34;&gt;index d8f858484538..234d7cd1a572 100644
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000080;font-weight:bold&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#a00000&#34;&gt;--- a/fs/namei.c
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a00000&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+++ b/fs/namei.c
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#800080;font-weight:bold&#34;&gt;@@ -39,6 +39,8 @@
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#800080;font-weight:bold&#34;&gt;&lt;/span&gt; #include &amp;lt;linux/init_task.h&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; #include &amp;lt;asm/uaccess.h&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+#include &amp;lt;linux/printk.h&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;&lt;/span&gt; #include &amp;#34;internal.h&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; #include &amp;#34;mount.h&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#800080;font-weight:bold&#34;&gt;@@ -341,8 +343,12 @@ int generic_permission(struct inode *inode, int mask)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#800080;font-weight:bold&#34;&gt;&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;     if (S_ISDIR(inode-&amp;gt;i_mode)) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;         /* DACs are overridable for directories */
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a00000&#34;&gt;-        if (capable_wrt_inode_uidgid(inode, CAP_DAC_OVERRIDE))
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a00000&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+        if (capable_wrt_inode_uidgid(inode, CAP_DAC_OVERRIDE)) {
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;&lt;/span&gt;             return 0;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+        } else {
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+            pr_err(&amp;#34;dac_override(dir) denied for cap=%3o inode=%lu with uid=%u gid=%u&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+                   mask&amp;amp;0777, inode-&amp;gt;i_ino, inode-&amp;gt;i_uid, inode-&amp;gt;i_gid);
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+        }
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;&lt;/span&gt;         if (!(mask &amp;amp; MAY_WRITE))
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;             if (capable_wrt_inode_uidgid(inode,
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                              CAP_DAC_READ_SEARCH))
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#800080;font-weight:bold&#34;&gt;@@ -354,9 +360,21 @@ int generic_permission(struct inode *inode, int mask)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#800080;font-weight:bold&#34;&gt;&lt;/span&gt;      * Executable DACs are overridable when there is
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      * at least one exec bit set.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      */
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a00000&#34;&gt;-    if (!(mask &amp;amp; MAY_EXEC) || (inode-&amp;gt;i_mode &amp;amp; S_IXUGO))
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a00000&#34;&gt;-        if (capable_wrt_inode_uidgid(inode, CAP_DAC_OVERRIDE))
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a00000&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+    /* IXUGO = (S_IXUSR|S_IXGRP|S_IXOTH) */
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+    if (!(mask &amp;amp; MAY_EXEC) || (inode-&amp;gt;i_mode &amp;amp; S_IXUGO)) {
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+        if (capable_wrt_inode_uidgid(inode, CAP_DAC_OVERRIDE)) {
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;&lt;/span&gt;             return 0;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+        } else {
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+            /* struct inode { */
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+            /*     i_uid is of uid32_t = unsigned int */
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+            /*     i_gid same */
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+            /*     i_ino is of unsigned long */
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+            /* } */
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+            /* pr_err(&amp;#34;dac_override denied for cap=%o inode=%lu with uid=%d gid=%d&amp;#34;, */
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+            pr_err(&amp;#34;dac_override(file) denied for cap=%3o inode=%lu with uid=%u gid=%u&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+                   mask&amp;amp;0777, inode-&amp;gt;i_ino, inode-&amp;gt;i_uid, inode-&amp;gt;i_gid);
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+        }
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;+    }
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00a000&#34;&gt;&lt;/span&gt;     /*
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      * Searching includes executable on directories, else just read.
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;With the logging and &lt;code&gt;WARN_ON&lt;/code&gt; in place, time for a test run:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt; ------------[ cut here ]------------
WARNING: CPU: 3 PID: 1681 at avc_audit_post_callback+0x190/0x198
Modules linked in:
CPU: 3 PID: 1681 Comm: irq_assigner Tainted: G        W       4.9.160-ge2af85baed78-dirty #6
name: SoMC Kagura-ROW (DT)
PC is at avc_audit_post_callback+0x190/0x198
LR is at avc_audit_post_callback+0x184/0x198
[...]
---[ end trace 0db9c115d7e8753c ]---
        : dac_override(dir) denied for cap=  3 inode=4026533027 with uid=0 gid=0
        : dac_override(dir) denied for cap=  3 inode=4026531862 with uid=0 gid=0
        : dac_override(dir) denied for cap=  3 inode=1146882 with uid=0 gid=0
irq_assigner: type=1400 audit(0.0:11): avc: denied { dac_override } for \
  capability=1 scontext=u:r:irq_assigner:s0 tcontext=u:r:irq_assigner:s0 \
  tclass=capability permissive=0 cap=dac_override, dumping stack
[...]
---[ end trace 0db9c115d7e87539 ]---
Call trace:
Exception stack(0xffffffc04a68f6b0 to 0xffffffc04a68f7e0)
[...]
dac_override(dir) denied for cap=  3 inode=4026532260 with uid=0 gid=0
------------[ cut here ]------------
WARNING: CPU: 2 PID: 1681 at avc_audit_post_callback+0x190/0x198
CPU: 2 PID: 1681 Comm: irq_assigner Tainted: G W 4.9.160-ge2af85baed78-dirty #6
PC is at avc_audit_post_callback+0x190/0x198
LR is at avc_audit_post_callback+0x184/0x198
[...]
Call trace:
[...]
dac_override(dir) denied for cap=  3 inode=4026532239 with uid=0 gid=0
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The high &lt;code&gt;inode&lt;/code&gt; numbers in the &lt;code&gt;4.000.000.000&lt;/code&gt; range correspond to &lt;em&gt;directories&lt;/em&gt; in
&lt;code&gt;/proc/irq&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;kagura:/ # find /proc -inum 4026533027 2&amp;amp;&amp;gt;/dev/null
/proc/irq/531
kagura:/ # find /proc -inum 4026532260 2&amp;amp;&amp;gt;/dev/null
/proc/irq/82
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Permissions on &lt;code&gt;/proc/irq&lt;/code&gt; and its subdirs are &lt;code&gt;dr-xr-xr-x&lt;/code&gt;, as created by
&lt;a href=&#34;https://github.com/sonyxperiadev/kernel/blob/aosp/LE.UM.2.3.2.r1.4/kernel/irq/proc.c#L356&#34;&gt;proc_create_data()&lt;/a&gt; (parent dir with
&lt;a href=&#34;https://github.com/sonyxperiadev/kernel/blob/aosp/LE.UM.2.3.2.r1.4/fs/proc/generic.c#L501&#34;&gt;S_IRUGO=(S_IRUSR|S_IRGRP|S_IROTH)&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;Interesting, so we now the handling of dirs/files in &lt;code&gt;/proc/irq/&lt;/code&gt; is the issue.
Let&amp;rsquo;s &lt;code&gt;strace&lt;/code&gt; the relevant parts:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;[...]
openat(AT_FDCWD, &amp;#34;/proc/irq/74/smp_affinity&amp;#34;, O_RDONLY) = 8
fstat(8, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
read(8, &amp;#34;1\n&amp;#34;, 1024)                    = 2
close(8)                                = 0
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;And later:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;openat(AT_FDCWD, &amp;#34;/proc/irq/81/smp_affinity&amp;#34;, O_WRONLY|O_CREAT|O_TRUNC, 0666) = 8
fstat(8, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
write(8, &amp;#34;2&amp;#34;, 1)                        = 1
close(8)                                = 0
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Compare that to the behaviour of a different version that does not have the
issue:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;openat(AT_FDCWD, &amp;#34;/proc/irq/105/smp_affinity&amp;#34;, O_RDWR) = 6
fstat(6, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
write(6, &amp;#34;1&amp;#34;, 1)                        = 1
close(6)                                = 0
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Quite different&amp;hellip;&lt;/p&gt;
&lt;p&gt;The fix should be easy, change the &lt;code&gt;fopen()&lt;/code&gt; mode from
&lt;code&gt;O_WRONLY|O_CREAT|O_TRUNC&lt;/code&gt; to &lt;code&gt;O_RDWR&lt;/code&gt;(=&lt;code&gt;0664&lt;/code&gt;).&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Strace Tricks</title>
      <link>https://sx.ix5.org/info/post/strace-tricks/</link>
      <pubDate>Wed, 06 Mar 2019 19:25:06 +0100</pubDate>
      
      <guid>https://sx.ix5.org/info/post/strace-tricks/</guid>
      <description>&lt;p&gt;To shim strace into service startup so it gets started with correct permissions
and environment:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;service irq_balancer /system/bin/strace -o /data/local/tmp/msm_irqb.strace
/odm/bin/irq_balancer -f /vendor/etc/irq_balancer.conf
    socket irq_balancer seqpacket 0660 root root
    user root
    group root
    disabled
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Remount &lt;code&gt;/system&lt;/code&gt; as read-write, then:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;chcon u:object_r:irq_balancer_exec:s0 /system/bin/strace
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;For more information, see the &lt;a href=&#34;https://source.android.com/devices/tech/debug/strace&#34;&gt;article on strace at Android source&lt;/a&gt;.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Treble Properties</title>
      <link>https://sx.ix5.org/info/treble-properties/</link>
      <pubDate>Sat, 02 Mar 2019 18:42:43 +0100</pubDate>
      
      <guid>https://sx.ix5.org/info/treble-properties/</guid>
      <description>&lt;h2 id=&#34;full-treble&#34;&gt;Full treble?&lt;/h2&gt;
&lt;p&gt;To make a device treble-compatible, just set &lt;code&gt;PRODUCT_FULL_TREBLE_OVERRIDE := true&lt;/code&gt; and be done? But what does that even mean?&lt;/p&gt;
&lt;p&gt;For treble requirements, see &lt;a href=&#34;https://android.googlesource.com/platform/build/+/12fe6f01e355619c9584390a4561dd734f6cf003/core/config.mk#788&#34;&gt;build/make/core/config.mk&lt;/a&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;PRODUCT_TREBLE_LINKER_NAMESPACES
PRODUCT_SEPOLICY_SPLIT
PRODUCT_ENFORCE_VINTF_MANIFEST
PRODUCT_NOTICE_SPLIT
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;(&lt;code&gt;PRODUCT_NOTICE_SPLIT&lt;/code&gt; is always true and cannot be altered)&lt;/p&gt;
&lt;p&gt;Further requirements for devices &lt;em&gt;launching&lt;/em&gt; on Oreo and up:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;TARGET_COPY_OUT_VENDOR := vendor
BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED := true
BOARD_BUILD_SYSTEM_ROOT_IMAGE := true
BOARD_USES_RECOVERY_AS_BOOT := true
BOARD_AVB_ENABLE := true
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;vndk---vendor-native-development-kit&#34;&gt;VNDK - Vendor Native Development Kit&lt;/h2&gt;
&lt;p&gt;Defining &lt;code&gt;BOARD_VNDK_VERSION&lt;/code&gt; means the generated build will restrict access to
libraries to only those explicitly made available to vendor programs.
Usually you&amp;rsquo;d set it to &lt;code&gt;current&lt;/code&gt;, meaning the latest VNDK version will be used.&lt;/p&gt;
&lt;p&gt;You can test building with VNDK but disable it at runtime:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;BOARD_VNDK_RUNTIME_DISABLE := false
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;There is much more to to it, read about
&lt;a href=&#34;https://source.android.com/devices/architecture/vndk#vndk-versioning&#34;&gt;the VNDK at source.android.com&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;linker-namespaces&#34;&gt;Linker namespaces&lt;/h2&gt;
&lt;p&gt;Example full-treble config:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;BOARD_VNDK_VERSION := current
# BOARD_VNDK_VERSION obsoletes TREBLE_LINKER_NAMESPACES
PRODUCT_TREBLE_LINKER_NAMESPACES := false
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;c.f. &lt;a href=&#34;https://android.googlesource.com/platform/system/core/+/93d837f3a90acec007647f21ed4573f044fa6f1e/rootdir/Android.mk#220&#34;&gt;system/core/rootdir/Android.mk&lt;/a&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;_enforce_vndk_at_runtime := false
ifdef BOARD_VNDK_VERSION
  ifneq ($(BOARD_VNDK_RUNTIME_DISABLE),true)
    _enforce_vndk_at_runtime := true
  endif
endif
[...]
ld_config_template := $(LOCAL_PATH)/etc/ld.config.txt

_enforce_vndk_lite_at_runtime := false
ifeq ($(_enforce_vndk_at_runtime),false)
  ifeq ($(PRODUCT_TREBLE_LINKER_NAMESPACES)|$(SANITIZE_TARGET),true|)
    _enforce_vndk_lite_at_runtime := true
  endif
endif
[...]
ld_config_template := $(LOCAL_PATH)/etc/ld.config.vndk_lite.txt

# for legacy non-treblized devices
LOCAL_SRC_FILES := etc/ld.config.legacy.txt
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;So, to conclude linker paths stuff:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Setting &lt;code&gt;BOARD_VNDK_VERSION&lt;/code&gt; enforces usage of the latest
&lt;code&gt;ld.config.txt&lt;/code&gt;(&lt;code&gt;ld.config.28.txt&lt;/code&gt; for Pie), unless
&lt;code&gt;BOARD_VNDK_RUNTIME_DISABLE&lt;/code&gt; is set. This means &lt;code&gt;_enforce_vndk_at_runtime&lt;/code&gt; is
set internally.&lt;/li&gt;
&lt;li&gt;If &lt;code&gt;_enforce_vndk_at_runtime&lt;/code&gt; is not set, &lt;code&gt;PRODUCT_TREBLE_LINKER_NAMESPACES&lt;/code&gt;
enforces usage of &lt;code&gt;ld.config.vndk_lite.txt&lt;/code&gt;, which is less restrictive.&lt;/li&gt;
&lt;li&gt;Not setting any of these props means &lt;code&gt;ld.config.legacy.txt&lt;/code&gt; is used, which is
meant for pre-treble devices and very permissive.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;More on &lt;a href=&#34;https://source.android.com/devices/architecture/vndk/linker-namespace&#34;&gt;linker namespaces at source.android.com&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;vintf---vendor-interface-manifest&#34;&gt;vintf - Vendor Interface Manifest&lt;/h2&gt;
&lt;p&gt;After creating the device manifest, define &lt;code&gt;DEVICE_MANIFEST_FILE&lt;/code&gt; and set
&lt;code&gt;PRODUCT_ENFORCE_VINTF_MANIFEST_OVERRIDE := true&lt;/code&gt; as explained in
&lt;a href=&#34;https://source.android.com/devices/architecture/vintf/dm#develop-new-devices&#34;&gt;vintf: develop for a new device&lt;/a&gt;. This will alert you if you
a mismatch between HALs defined in the &lt;em&gt;Device Manifest(DM)&lt;/em&gt; and those defined
in your &lt;em&gt;Device Compatibility Matrix.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;You can also be alerted if you have defined HALs in your manifest but not told
the framework about them in your &lt;em&gt;Compatibility Matrix&lt;/em&gt; with
&lt;code&gt;VINTF_ENFORCE_NO_UNUSED_HALS := true&lt;/code&gt;. This invokes &lt;code&gt;assemble_vintf&lt;/code&gt; in strict
mode when checking at build time.&lt;/p&gt;
&lt;p&gt;c.f. &lt;a href=&#34;https://android.googlesource.com/platform/system/libvintf/+/9adf115f40240d1f8bfd0266c2445f7a9b3e0262/AssembleVintf.cpp#266&#34;&gt;AssembleVintf.cpp&lt;/a&gt;(simplified here):&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;// If -c is provided, check it.
bool checkDualFile(const HalManifest&amp;amp; manifest, const CompatibilityMatrix&amp;amp; matrix) {
    if (getBooleanFlag(&amp;#34;PRODUCT_ENFORCE_VINTF_MANIFEST&amp;#34;)) {
        if (!manifest.checkCompatibility(matrix, &amp;amp;error)) {
            std::cerr &amp;lt;&amp;lt; &amp;#34;Not compatible: &amp;#34; &amp;lt;&amp;lt; error &amp;lt;&amp;lt; std::endl;

    // Check HALs in device manifest that are not in framework matrix.
    if (getBooleanFlag(&amp;#34;VINTF_ENFORCE_NO_UNUSED_HALS&amp;#34;)) {
        auto unused = manifest.checkUnusedHals(matrix);
        if (!unused.empty()) {
            std::cerr &amp;lt;&amp;lt; &amp;#34;Error: The following instances are in the device manifest but &amp;#34;
                      &amp;lt;&amp;lt; &amp;#34;not specified in framework compatibility matrix: &amp;#34; &amp;lt;&amp;lt; std::endl
                      &amp;lt;&amp;lt; &amp;#34;    &amp;#34; &amp;lt;&amp;lt; android::base::Join(unused, &amp;#34;\n    &amp;#34;) &amp;lt;&amp;lt; std::endl
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The other place &lt;code&gt;PRODUCT_ENFORCE_VINTF_MANIFEST&lt;/code&gt; has an effect is with the
Android &lt;a href=&#34;https://android.googlesource.com/platform/system/libhidl/+/7637124c991c36700956159e57f11c755f94f60a/transport/ServiceManagement.cpp#689&#34;&gt;HIDL service manager&lt;/a&gt; (configured via
&lt;a href=&#34;https://android.googlesource.com/platform/system/libhidl/+/22a3454d4f78075e261aa64991f75c724a8bd99d/transport/Android.bp#76&#34;&gt;transport/Android.bp&lt;/a&gt;).
If &lt;code&gt;ENFORCE_VINTF_MANIFEST&lt;/code&gt; is defined, &lt;code&gt;bool vintfLegacy = false;&lt;/code&gt;
applies.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;getRawServiceInternal(descriptor, instance, bool retry, bool getStub) {
    [...]
    #ifdef ENFORCE_VINTF_MANIFEST
    bool vintfLegacy = false;
    #else
    bool vintfLegacy = (transport == Transport::EMPTY);
    #endif
    bool vintfHwbinder = (transport == Transport::HWBINDER);
    bool vintfPassthru = (transport == Transport::PASSTHROUGH);
    for (int tries = 0; !getStub &amp;amp;&amp;amp; (vintfHwbinder || vintfLegacy); tries++) {
        if (getStub || vintfPassthru || vintfLegacy) {
            Return&amp;lt;sp&amp;lt;IBase&amp;gt;&amp;gt; ret = sm-&amp;gt;get(descriptor, instance);
            [...]
            waiter-&amp;gt;done(); // exit loop
        }
    }
    if (getStub || vintfPassthru || vintfLegacy) {
        sp&amp;lt;IServiceManager&amp;gt; pm = getPassthroughServiceManager();
    }
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;code&gt;ENFORCE_VINTF_MANIFEST&lt;/code&gt; closes a loophole in &lt;code&gt;getRawServiceInternal&lt;/code&gt; which
means &lt;code&gt;libhidltransport&lt;/code&gt; will no longer fetch services which are not &lt;code&gt;hwbinder&lt;/code&gt;
or &lt;code&gt;passthrough&lt;/code&gt;, i.e. &lt;code&gt;EMPTY&lt;/code&gt; transports will no longer be fetched.&lt;/p&gt;
&lt;p&gt;To list all HALs and HAL services activity on-device, use the &lt;code&gt;lshal&lt;/code&gt; command.&lt;/p&gt;
&lt;p&gt;More on &lt;a href=&#34;https://source.android.com/devices/architecture/vintf&#34;&gt;vintf at source.android.com&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;split-selinux-policy&#34;&gt;Split SELinux policy&lt;/h2&gt;
&lt;p&gt;Pre-treble, the policy files for SElinux were situated on the ramdisk of the
&lt;code&gt;boot&lt;/code&gt; partition&lt;sup id=&#34;fnref:1&#34;&gt;&lt;a href=&#34;#fn:1&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt;. They consisted of an &lt;code&gt;sepolicy&lt;/code&gt; binary and &lt;code&gt;file_contexts&lt;/code&gt;
files in the root directory ramdisk.&lt;/p&gt;
&lt;p&gt;With &lt;code&gt;PRODUCT_SEPOLICY_SPLIT_OVERRIDE&lt;/code&gt; set, the &lt;code&gt;sepolicy&lt;/code&gt; binary will be split
up into &lt;em&gt;platform&lt;/em&gt;(system) and &lt;em&gt;vendor&lt;/em&gt; policy files. They policy is also no
longer a binary file but rather uses the new &lt;code&gt;.cil&lt;/code&gt; plain-text format.&lt;/p&gt;
&lt;p&gt;The &lt;em&gt;platform&lt;/em&gt; &lt;code&gt;.cil&lt;/code&gt; policy and context files will be pushed to
&lt;code&gt;/system/etc/selinux/&lt;/code&gt;, while the &lt;em&gt;vendor&lt;/em&gt; &lt;code&gt;.cil&lt;/code&gt; policy and context files will
be pushed to &lt;code&gt;/vendor/etc/selinux/&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Another change in behaviour when enabling the split is the effect of
&lt;a href=&#34;https://android.googlesource.com/platform/system/sepolicy/+/0fa3d2766f4d9d84dd01d2e2d75d366734cfcc5f/public/te_macros#462&#34;&gt;not_full_treble() macros&lt;/a&gt;: With &lt;code&gt;SEPOLICY_SPLIT&lt;/code&gt; set,
&lt;a href=&#34;https://android.googlesource.com/platform/system/sepolicy/+/053cb34130b763d93e2181062ebe1b5f8bf3ad9c/definitions.mk#11&#34;&gt;target_full_treble is set to true&lt;/a&gt; and the macros are now
simply ignored, i.e.  all the policy that you inclosed in
&lt;code&gt;not_full_treble(allow ...)&lt;/code&gt; statements is ignored.&lt;/p&gt;
&lt;p&gt;There are also a lot of new &lt;code&gt;neverallow&lt;/code&gt;s introduced, so your policies might
need updating. Finally, three &lt;a href=&#34;https://android.googlesource.com/platform/system/sepolicy/+/0fa3d2766f4d9d84dd01d2e2d75d366734cfcc5f/tests/treble_sepolicy_tests.py#285&#34;&gt;violator` attributes&lt;/a&gt; are now
banned:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;binder_in_vendor_violators&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;socket_between_core_and_vendor_violators&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;vendor_executes_system_violators&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;More on &lt;a href=&#34;https://source.android.com/security/selinux/build#android-o&#34;&gt;implementing SELinux on source.android.com&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;compatible-properties&#34;&gt;Compatible Properties&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;PRODUCT_COMPATIBLE_PROPERTY&lt;/code&gt; enables the whitelist for &amp;ldquo;compatible&amp;rdquo; properties,
meaning vendor services only get access to &lt;code&gt;vendor&lt;/code&gt;-namespaced properties (with
some expections).&lt;/p&gt;
&lt;p&gt;Manual override in &lt;code&gt;device.mk&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE := true
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Enabled by default for &lt;a href=&#34;https://android.googlesource.com/platform/build/+/51b00a10cc3ab5cafb9d90909ef6dda8853738b5/core/config.mk#765&#34;&gt;SHIPPING_API_LEVEL &amp;gt;= 28&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Side effects:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;service &lt;code&gt;ril-daemon&lt;/code&gt; -&amp;gt; &lt;code&gt;vendor.ril-daemon&lt;/code&gt;
(see &lt;a href=&#34;https://android.googlesource.com/platform/hardware/ril/+/1b4e637ead1aff57cf7b9cb142e33dea8e15fe8e/rild/Android.mk#32&#34;&gt;hardware/ril/rild/Android.mk&lt;/a&gt;: &lt;a href=&#34;https://android.googlesource.com/platform/hardware/ril/+/082e32effc07dddd06b67d2be2c2c6ee554d5d52/rild/rild.legacy.rc&#34;&gt;rild.legacy.rc&lt;/a&gt;
with &lt;code&gt;service ril-daemon&lt;/code&gt; when non-compatible, &lt;a href=&#34;https://android.googlesource.com/platform/hardware/ril/+/082e32effc07dddd06b67d2be2c2c6ee554d5d52/rild/rild.rc&#34;&gt;rild.rc&lt;/a&gt; with
&lt;code&gt;service vendor.ril-daemon&lt;/code&gt; when using compatible)&lt;/li&gt;
&lt;li&gt;prop &lt;code&gt;rild.libpath&lt;/code&gt; -&amp;gt; &lt;code&gt;vendor.rild.libpath&lt;/code&gt; (see &lt;a href=&#34;https://android.googlesource.com/platform/hardware/ril/+/082e32effc07dddd06b67d2be2c2c6ee554d5d52/rild/rild.c#38&#34;&gt;rild/rild.c&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;prop &lt;code&gt;rild.libargs&lt;/code&gt; -&amp;gt; &lt;code&gt;vendor.rild.libargs&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;compatible_property_only()&lt;/code&gt; and &lt;code&gt;not_compatible_property()&lt;/code&gt; sepolicy macros&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In &lt;code&gt;init&lt;/code&gt;, only whitelisted &lt;a href=&#34;https://android.googlesource.com/platform/system/core/+/20ac1203a3201ac3e6d05a19325f5569033f3d08/init/action_parser.cpp#37&#34;&gt;properties are &amp;ldquo;actionable&amp;rdquo;&lt;/a&gt;,
meaning they are allowed as triggers for e.g. &lt;code&gt;on property:vendor.prop=1&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The whitelist - &lt;strong&gt;for init only&lt;/strong&gt; - can be disabled at runtime by setting:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;PRODUCT_ACTIONABLE_COMPATIBLE_PROPERTY_DISABLE := true
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The whitelist resides in
&lt;a href=&#34;https://android.googlesource.com/platform/system/core/+/20ac1203a3201ac3e6d05a19325f5569033f3d08/init/stable_properties.h#26&#34;&gt;system/core/init/stable_properties.h&lt;/a&gt; and consists of a
list of allowed prefixes and a list of allowed full property names.&lt;/p&gt;
&lt;div class=&#34;message warning&#34;&gt;
These lists of properties are lifted straight from the `android-9.0.0_r34`
branch and might not be complete, considering development for Android Q is in
full swing. Please confirm the correctness yourself instead of relying on this
article.
&lt;/div&gt;
&lt;p&gt;Allowed prefixes(&lt;code&gt;kPartnerPrefixes&lt;/code&gt;):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;init.svc.vendor.&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ro.vendor.&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;persist.vendor.&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;vendor.&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;init.svc.odm.&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ro.odm.&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;persist.odm.&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;odm.&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ro.boot.&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Allowed exported actionable properties(&lt;code&gt;kExportedActionableProperties&lt;/code&gt;):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;dev.bootcomplete&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;init.svc.console&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;init.svc.mediadrm&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;init.svc.surfaceflinger&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;init.svc.zygote&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;persist.bluetooth.btsnoopenable&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;persist.sys.crash_rcu&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;persist.sys.usb.usbradio.config&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;persist.sys.zram_enabled&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ro.board.platform&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ro.bootmode&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ro.build.type&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ro.crypto.state&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ro.crypto.type&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ro.debuggable&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sys.boot_completed&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sys.boot_from_charger_mode&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sys.retaildemo.enabled&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sys.shutdown.requested&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sys.usb.config&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sys.usb.configfs&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sys.usb.ffs.mtp.ready&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sys.usb.ffs.ready&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sys.user.0.ce_available&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sys.vdso&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;vold.decrypt&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;vold.post_fs_data_done&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;vts.native_server.on&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;wlan.driver.status&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;footnotes&#34; role=&#34;doc-endnotes&#34;&gt;
&lt;hr&gt;
&lt;ol&gt;
&lt;li id=&#34;fn:1&#34;&gt;
&lt;p&gt;Exception: When using &lt;code&gt;system-as-root&lt;/code&gt;, the &lt;code&gt;sepolicy&lt;/code&gt; binary was not on the boot ramdisk but rather on the root of the &lt;code&gt;system&lt;/code&gt; partition.  For more, see &lt;a href=&#34;./../post/gotcha-sepolicy-for-system-as-root-devices/&#34;&gt;Gotcha: sepolicy for system-as-root devices&lt;/a&gt;.&amp;#160;&lt;a href=&#34;#fnref:1&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
</description>
    </item>
    
    <item>
      <title>Quick: Media CTS</title>
      <link>https://sx.ix5.org/info/post/quick-media-cts/</link>
      <pubDate>Fri, 01 Mar 2019 08:18:00 +0100</pubDate>
      
      <guid>https://sx.ix5.org/info/post/quick-media-cts/</guid>
      <description>&lt;!-- # Setup --&gt;
&lt;p&gt;CTS stands for Compatibility Test suite and is a tool normally distributed to
vendors of Android devices.&lt;/p&gt;
&lt;p&gt;The CTS media tests can help benchmark your device to help you adjust the
expected framerates, e.g. for video recording for a given codec.&lt;/p&gt;
&lt;h2 id=&#34;media-tests&#34;&gt;Media tests&lt;/h2&gt;
&lt;p&gt;Download &lt;a href=&#34;https://source.android.com/compatibility/cts/downloads#cts-media-files&#34;&gt;CTS media files&lt;/a&gt; and push them to the device with the
provided script.&lt;/p&gt;
&lt;p&gt;Need to adjust &lt;code&gt;CtsMediaTestCases.config&lt;/code&gt; to find your media files under
&lt;code&gt;path/to/android-cts-media&lt;/code&gt; or else it will complain about missing media files:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;lt;configuration description=&amp;#34;Config for CTS Media test cases&amp;#34;&amp;gt;
    [...]
    &amp;lt;target_preparer class=&amp;#34;com.android.compatibility.common.tradefed.targetprep.MediaPreparer&amp;#34;&amp;gt;
        &amp;lt;option name=&amp;#34;images-only&amp;#34; value=&amp;#34;false&amp;#34; /&amp;gt;
        &amp;lt;option name=&amp;#34;local-media-path&amp;#34; value=&amp;#34;/path/to/android-cts-media&amp;#34; /&amp;gt;
        &amp;lt;option name=&amp;#34;skip-media-download&amp;#34; value=&amp;#34;true&amp;#34; /&amp;gt;
    &amp;lt;/target_preparer&amp;gt;
    [...]
&amp;lt;/configuration&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To run &lt;a href=&#34;https://source.android.com/devices/media/oem&#34;&gt;media tests&lt;/a&gt;, use this
command, the documentation on the source.android.com page is out of date:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;run cts \
  --module CtsMediaTestCases \
  --test android.media.cts.MediaCodecCapabilitiesTest#testGetMaxSupportedInstances
&lt;/code&gt;&lt;/pre&gt;&lt;!-- run -\-plan CTS android.media.cts.MediaCodecCapabilitiesTest#testGetMaxSupportedInstances --&gt;
&lt;p&gt;Also make sure to save the results of &lt;code&gt;get_achievable_rates&lt;/code&gt; for later.&lt;/p&gt;
&lt;h2 id=&#34;wrapping-up&#34;&gt;Wrapping up&lt;/h2&gt;
&lt;p&gt;More general info about running CTS is available at the
&lt;a href=&#34;https://source.android.com/compatibility/cts/run&#34;&gt;androidsource page&lt;/a&gt;.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>SailfishOS RPM packaging - Part 2</title>
      <link>https://sx.ix5.org/info/post/sailfishos-rpm-packaging-part-2/</link>
      <pubDate>Thu, 28 Feb 2019 17:18:41 +0100</pubDate>
      
      <guid>https://sx.ix5.org/info/post/sailfishos-rpm-packaging-part-2/</guid>
      <description>&lt;p&gt;The most common use case for packaging is to have the output of a GNU &lt;code&gt;make&lt;/code&gt;
setup be wrapped into a neat &lt;code&gt;.rpm&lt;/code&gt; file. But we will take something more simple
for this example - we only want to install a single configuration file.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;You can view the finished project at &lt;a href=&#34;https://github.com/marina-bay/marina-porter-tools/tree/e7dafefc1afbdbe8b7bda2415c6a64ad20c23806&#34;&gt;github&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;So, first we need to decide what we want to install and where to. In our case,
the file is a &lt;a href=&#34;https://github.com/marina-bay/marina-porter-tools/blob/e7dafefc1afbdbe8b7bda2415c6a64ad20c23806/sparse/etc/systemd/journald.conf.d/journald-porting.conf&#34;&gt;configuration file&lt;/a&gt; that tells &lt;code&gt;journald&lt;/code&gt; to
save the system logs across reboots. It shall end up in
&lt;code&gt;/etc/system/journald.conf.d/journald-porting.conf&lt;/code&gt;.
We now put the source files of the package into &lt;code&gt;sparse/*&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Now we need to tell the packaging system some metadata about our project.&lt;br&gt;
&lt;a href=&#34;https://github.com/marina-bay/marina-porter-tools/blob/e7dafefc1afbdbe8b7bda2415c6a64ad20c23806/rpm/marina-porter-tools.spec&#34;&gt;marina-porter-tools.spec&lt;/a&gt;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;Name:	    marina-porter-tools
Summary:    Extra debugging tools and configs for porting
Version:    1
Release:    1
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The interesting part is the &lt;code&gt;%install&lt;/code&gt; section:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;%install
mkdir -p %{buildroot}/
cp -r sparse/* %{buildroot}/
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This tells the packaging system to install all files from &lt;code&gt;sparse&lt;/code&gt; to the RPM
temporary &lt;code&gt;buildroot&lt;/code&gt;, creating the final filesystem hierarchy already.&lt;/p&gt;
&lt;p&gt;Now we need to tell rpm &lt;em&gt;explicitly&lt;/em&gt; which files are contained inside the
finished package. We could do it the easy way:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;%files
/etc/systemd/journald.conf.d/journald-porting.conf
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;But we can tell the package manager more about the installed files. In our case,
we want the user to be able to overwrite the config files we installed, so we
supply more metadata:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;%files
%defattr(-,root,root,-)
%config /etc/systemd/journald.conf.d/journald-porting.conf
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;And that&amp;rsquo;s it. Assuming you cloned &lt;a href=&#34;https://github.com/marina-bay/marina-porter-tools/tree/e7dafefc1afbdbe8b7bda2415c6a64ad20c23806&#34;&gt;the example repo&lt;/a&gt; to
&lt;code&gt;hybris/mw/marina-porter-tools&lt;/code&gt;, you can now use the &lt;code&gt;droid-hal-device&lt;/code&gt; helper
script to build the finished &lt;code&gt;.rpm&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;./rpm/dhd/helpers/build_packages.sh \
    --build hybris/mw/marina-porter-tools \
    --spec rpm/marina-porter-tools.spec
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Copy the generated &lt;code&gt;.rpm&lt;/code&gt; file from &lt;code&gt;droid-local-repo/$DEVICE&lt;/code&gt; to your phone and
install it via &lt;code&gt;pkcon&lt;/code&gt; - or add the package to your device&amp;rsquo;s build requirements
to ease early porting.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&#34;further-references&#34;&gt;Further references&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Maximum RPM: Taking the RPM Package Manager to the Limit:&lt;/em&gt;
&lt;a href=&#34;http://ftp.rpm.org/max-rpm/s1-rpm-build-creating-spec-file.html&#34;&gt;Creating the Spec File&lt;/a&gt;
and &lt;a href=&#34;http://ftp.rpm.org/max-rpm/s1-rpm-inside-files-list-directives.html&#34;&gt;Directives For the %files list&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://docs.fedoraproject.org/en-US/Fedora_Draft_Documentation/0.1/html/Packagers_Guide/sect-Packagers_Guide-Creating_a_Basic_Spec_File.html&#34;&gt;Fedora docs: Creating a Basic Spec file&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
    </item>
    
    <item>
      <title>SailfishOS RPM Packaging - Part 1</title>
      <link>https://sx.ix5.org/info/post/sailfishos-rpm-packaging-part-1/</link>
      <pubDate>Wed, 27 Feb 2019 21:37:10 +0100</pubDate>
      
      <guid>https://sx.ix5.org/info/post/sailfishos-rpm-packaging-part-1/</guid>
      <description>&lt;p&gt;A short word on how &lt;code&gt;.spec&lt;/code&gt; and &lt;code&gt;.inc&lt;/code&gt; files work then using &lt;code&gt;rpm&lt;/code&gt; packaging for
Sailfish.&lt;/p&gt;
&lt;h2 id=&#34;internal-variables&#34;&gt;Internal variables&lt;/h2&gt;
&lt;p&gt;Rpm-internal variables - i.e. variables defined in &lt;code&gt;.spec&lt;/code&gt; or &lt;code&gt;.inc&lt;/code&gt; files - can
be used as follows:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;First, define the variable, e.g. via &lt;code&gt;%define device kagura&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Then use the variable via &lt;code&gt;%{device}&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;inclusion&#34;&gt;Inclusion&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;.spec&lt;/code&gt; files can include &lt;code&gt;.inc&lt;/code&gt; files via &lt;code&gt;%include&lt;/code&gt; statements, e.g.
&lt;code&gt;%include common-defs.inc&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;It makes most sense to first define a variable in a device-specific &lt;code&gt;.spec&lt;/code&gt; file
and then call an &lt;code&gt;.inc&lt;/code&gt; file which uses the variable.&lt;/p&gt;
&lt;h2 id=&#34;packaging&#34;&gt;Packaging&lt;/h2&gt;
&lt;p&gt;When using a single &lt;code&gt;.spec&lt;/code&gt; or &lt;code&gt;.inc&lt;/code&gt; file to define multiple packages, it makes
sense to use the following pattern:&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/mer-hybris/droid-hal-device/blob/31c62347e952ff7ac2da79c29020e92ed8a56008/droid-hal-device.inc#L128&#34;&gt;droid-hal-device.inc&lt;/a&gt;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-rpm&#34; data-lang=&#34;rpm&#34;&gt;%define rpm_device f8331
[...]
Summary: 	Droid HAL package for %{rpm_device}
Name: 		droid-hal-%{rpm_device}
Version: 	0.0.6
Provides:	droid-hal
BuildRequires:  systemd
[...]
%description
%{summary}.
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The main name (or &lt;em&gt;stem&lt;/em&gt;) for all packages is &lt;code&gt;droid-hal-%{rpm_device}&lt;/code&gt;, e.g.
&lt;code&gt;droid-hal-f8331&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Then, &lt;a href=&#34;https://github.com/mer-hybris/droid-hal-device/blob/31c62347e952ff7ac2da79c29020e92ed8a56008/droid-hal-device.inc#L176&#34;&gt;further down the file&lt;/a&gt;, the sub-packages inherit the stem:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-rpm&#34; data-lang=&#34;rpm&#34;&gt;%package devel
Provides: droid-hal-devel
Summary: Development files for droid-hal device: %{rpm_device}
%description devel
Device specific droid headers for %{rpm_device}.
Needed by libhybris
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The &lt;code&gt;%package&lt;/code&gt; macro takes the &lt;em&gt;stem&lt;/em&gt; and prepends it.
Thus, with &lt;code&gt;Name = droid-hal-f8331&lt;/code&gt;, &lt;code&gt;%package devel&lt;/code&gt; gets expanded to
&lt;code&gt;droid-hal-f8331-devel&lt;/code&gt;.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Gotcha: sepolicy for system-as-root devices</title>
      <link>https://sx.ix5.org/info/post/gotcha-sepolicy-for-system-as-root-devices/</link>
      <pubDate>Tue, 12 Feb 2019 22:12:00 +0100</pubDate>
      
      <guid>https://sx.ix5.org/info/post/gotcha-sepolicy-for-system-as-root-devices/</guid>
      <description>&lt;p&gt;For testing a new SELinux policy, it used to be enough to update only the
&lt;code&gt;sepolicy&lt;/code&gt; binary file in &lt;code&gt;out/target/product/&amp;lt;device&amp;gt;/root/sepolicy&lt;/code&gt; and
re-pack the boot image. That way, one avoids having to rebuild the whole boot
image, which may or may not include rebuilding the kernel, which could take
time.&lt;/p&gt;
&lt;p&gt;On &lt;a href=&#34;https://source.android.com/devices/bootloader/system-as-root&#34;&gt;system-as-root devices&lt;/a&gt; - all A/B devices thus far - things are
a bit different. &lt;code&gt;sepolicy&lt;/code&gt; is still located under &lt;code&gt;/&lt;/code&gt;(if the policy is not
split, more on that later), but it actually lives on the system partition(under
&lt;code&gt;/system_root/&lt;/code&gt;).
That means that updating &lt;code&gt;sepolicy&lt;/code&gt; on such devices means manually copying the
new policy to &lt;code&gt;/sepolicy&lt;/code&gt;, assuming one has already mounted &lt;code&gt;system_root&lt;/code&gt; in rw
mode.&lt;/p&gt;
&lt;div class=&#34;message warning&#34;&gt;
  &lt;h5&gt;Note&lt;/h5&gt;
Pushing an updated `boot.img` to the device will not update the used
&lt;code&gt;sepolicy&lt;/code&gt;. The file inside the boot partition is an unused duplicate
on system-as-root devices!
&lt;/div&gt;
&lt;p&gt;On &lt;code&gt;FULL_TREBLE&lt;/code&gt; devices, &lt;code&gt;PRODUCT_SEPOLICY_SPLIT&lt;/code&gt; is true, which means the
sepolicy will no longer be built as a unified binary, but rather pushed as
&lt;code&gt;.cil&lt;/code&gt; plain-text files under &lt;code&gt;/system/etc/selinux/&lt;/code&gt; and &lt;code&gt;/vendor/etc/selinux/&lt;/code&gt;.
There is no longer a single &lt;code&gt;sepolicy&lt;/code&gt; binary to update in the ramdisk, making
GSIs possible.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Quick: USB kernel things</title>
      <link>https://sx.ix5.org/info/post/quick-usb-kernel-things/</link>
      <pubDate>Fri, 08 Feb 2019 13:00:30 +0100</pubDate>
      
      <guid>https://sx.ix5.org/info/post/quick-usb-kernel-things/</guid>
      <description>&lt;p&gt;While pondering how to get USB3/PCI-E(via QMP PHY) to work on mainline
Linux(instead of our own Qcom/Codeaurora-based 4.9), we ran a quick test to
check which &lt;code&gt;phy&lt;/code&gt;s are critical to get &lt;code&gt;peripheral&lt;/code&gt; mode working(&lt;code&gt;host&lt;/code&gt; is for
another day, OTG comes later).&lt;/p&gt;
&lt;p&gt;First, check which usb controller is involved:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;kagura:/ $ getprop sys.usb.controller
6a00000.dwc3
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;That gives us &lt;code&gt;6a00000&lt;/code&gt; via &lt;a href=&#34;http://processors.wiki.ti.com/index.php/Linux_Core_DWC3_User&#39;s_Guide&#34;&gt;DWC3&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;To find out which &lt;code&gt;phy&lt;/code&gt;(≙ &lt;a href=&#34;https://en.wikipedia.org/wiki/Physical_layer&#34;&gt;Physical layer&lt;/a&gt;) is needed for baseline USB
connectivity, we turned them off one by one: First &lt;code&gt;&amp;lt;&amp;amp;qusb_phy0&amp;gt;&lt;/code&gt;, then
&lt;code&gt;&amp;lt;&amp;amp;ssphy&amp;gt;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/sonyxperiadev/kernel/blob/e17b3925fe2a3579a29cc8278138025d8ac72642/arch/arm64/boot/dts/qcom/msm8996.dtsi#L2100-L2111&#34;&gt;arch/arm64/boot/dts/qcom/msm8996.dtsi&lt;/a&gt;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;amp;soc {
    [...]
    usb3: ssusb@6a00000{
        [...]
        dwc3@6a00000 {
            compatible = &amp;#34;snps,dwc3&amp;#34;;
            // TEST: Set:
            //dr_mode = &amp;#34;peripheral&amp;#34;;

            reg = &amp;lt;0x06a00000 0xc8d0&amp;gt;;
            interrupt-parent = &amp;lt;&amp;amp;intc&amp;gt;;
            interrupts = &amp;lt;0 131 0&amp;gt;;

            usb-phy = &amp;lt;&amp;amp;qusb_phy0&amp;gt;, &amp;lt;&amp;amp;ssphy&amp;gt;;
            //TEST: Set only one of the two:
            //usb-phy = &amp;lt;&amp;amp;qusb_phy0&amp;gt;;
            //usb-phy = &amp;lt;&amp;amp;ssphy&amp;gt;;

            tx-fifo-resize;
            snps,usb3-u1u2-disable;
            snps,nominal-elastic-buffer;
            snps,is-utmi-l1-suspend;
            snps,hird-threshold = /bits/ 8 &amp;lt;0x0&amp;gt;;
        };
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Turns out that both are needed on Kernel 4.9 though.&lt;/p&gt;
&lt;p&gt;In general, one can see that the Qcom DWC3 implementation is a hacked-together
beast that takes possession of the whole &lt;code&gt;PHY&lt;/code&gt; layer, as opposed to the mainline
&lt;code&gt;DWC3&lt;/code&gt; framework.&lt;/p&gt;
&lt;p&gt;Compare:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Our CAF 4.9 driver: &lt;a href=&#34;https://github.com/sonyxperiadev/kernel/blob/e17b3925fe2a3579a29cc8278138025d8ac72642/drivers/usb/dwc3/dwc3-msm.c&#34;&gt;drivers/usb/dwc3/dwc3-msm.c&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Mainline driver: &lt;a href=&#34;https://github.com/torvalds/linux/blob/9925e6ebe5c2da9601037cca73462782900b9190/drivers/usb/dwc3/dwc3-qcom.c&#34;&gt;drivers/usb/dwc3/dwc3-qcom.c&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
    </item>
    
    <item>
      <title>DSP file relabling for SODP</title>
      <link>https://sx.ix5.org/info/post/dsp-file-relabling-for-sodp/</link>
      <pubDate>Tue, 29 Jan 2019 12:33:55 +0100</pubDate>
      
      <guid>https://sx.ix5.org/info/post/dsp-file-relabling-for-sodp/</guid>
      <description>&lt;p&gt;If you have previously flashed &lt;em&gt;any&lt;/em&gt; version of a Sony-Open-Devices-based ROM
from before &lt;strong&gt;December 17th 2018&lt;/strong&gt;, your &lt;code&gt;dsp&lt;/code&gt; partition might have wrong
SELinux labels and you might thus have problems with audio.&lt;/p&gt;
&lt;h2 id=&#34;short-version&#34;&gt;Short version&lt;/h2&gt;
&lt;p&gt;Either re-flash the &lt;code&gt;dsp&lt;/code&gt; partition with stock firmware via Sony&amp;rsquo;s own
&lt;a href=&#34;https://software.sonymobile.com/www/&#34;&gt;Emma&lt;/a&gt; or the open-source &lt;a href=&#34;https://forum.xda-developers.com/showthread.php?t=920746&#34;&gt;FlashTool&lt;/a&gt;, or manually force
the correct file labels. You need to be root via &lt;code&gt;adb shell&lt;/code&gt; or in recovery:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;su
# It might be either /system/vendor/dsp or /vendor/dsp depending on your device
# Just try both until one succeeds
mount -o remount,rw /system/vendor/dsp
chcon -R u:object_r:adsprpcd_file:s0 /dsp
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Reboot, et voilà - you should have proper audio again.&lt;/p&gt;
&lt;p&gt;If you only want to fix your audio problem, you can stop reading now.&lt;/p&gt;
&lt;h2 id=&#34;long-version&#34;&gt;Long version&lt;/h2&gt;
&lt;p&gt;Sony devices have a &lt;code&gt;dsp&lt;/code&gt; partition that holds firmware files and libraries
needed for the &lt;a href=&#34;https://en.wikipedia.org/wiki/Qualcomm_Hexagon&#34;&gt;Qualcomm &amp;ldquo;Hexagon&amp;rdquo; DSP&lt;/a&gt; - &lt;em&gt;Digital Signal Processor&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;The partition is shippped with the &lt;a href=&#34;https://source.android.com/security/selinux/implement#context-files&#34;&gt;SELinux file label&lt;/a&gt;
&lt;code&gt;u:object_r:adsprpcd_file:s0&lt;/code&gt; by default, and stock firmware uses this label
as well when flashed via &lt;code&gt;Emma&lt;/code&gt; or &lt;code&gt;FlashTool&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;When stellirin rewrote the SODP sepolicy in late 2017, they
&lt;a href=&#34;https://github.com/sonyxperiadev/device-sony-sepolicy/commit/14fe403ac06cdb2d1338795a9f6dc169f0a54f19#diff-a0a34322e457d2d0a31d35c32ca9ef01R31&#34;&gt;chose to use &lt;code&gt;qdsp_file&lt;/code&gt;&lt;/a&gt; instead of &lt;code&gt;adsprpcd_file&lt;/code&gt; for &lt;code&gt;/dsp&lt;/code&gt;.
A few lines of code &lt;a href=&#34;https://github.com/sonyxperiadev/device-sony-tone/commit/0bfc628924d467b8b916c7ed4ff681e6dfbc535d&#34;&gt;were added in &lt;code&gt;init.$device.rc&lt;/code&gt;&lt;/a&gt; - which gets
run under the label &lt;code&gt;vendor_init&lt;/code&gt; - to re-mount the dsp partition and update it
to use the &lt;code&gt;qdsp_file&lt;/code&gt; label.&lt;/p&gt;
&lt;p&gt;Because re-labeling these files as &lt;code&gt;vendor_init&lt;/code&gt; is a
&lt;a href=&#34;https://android.googlesource.com/platform/system/sepolicy/+/android-9.0.0_r30/public/domain.te#423&#34;&gt;neverallow in Pie&lt;/a&gt;, we noticed that we should rather be
re-using the stock file labels, i.e. &lt;code&gt;adsprpcd_file&lt;/code&gt;.&lt;br&gt;
The relabeling bit(&lt;code&gt;restorecon_recursive&lt;/code&gt;) &lt;a href=&#34;https://github.com/sonyxperiadev/device-sony-common/commit/ec07d05d7d7cd7830a6f756cc06e3d2278e2a071&#34;&gt;was removed&lt;/a&gt;
from its new location in &lt;code&gt;init.common.rc&lt;/code&gt; and the &amp;ldquo;new&amp;rdquo; old label
&lt;a href=&#34;https://github.com/sonyxperiadev/device-sony-sepolicy/commit/633d33919acc1328115a688c412d1e7435bb60b4&#34;&gt;was restored&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;As stated in the &amp;ldquo;short version&amp;rdquo;, fixing the problem is easy: Run &lt;code&gt;chcon&lt;/code&gt; or run
&lt;code&gt;Emma&lt;/code&gt; - Emma &lt;a href=&#34;https://developer.sony.com/posts/flash-tool-updated-with-new-feature/&#34;&gt;can now flash single partitions&lt;/a&gt;, which is great.&lt;/p&gt;
&lt;h2 id=&#34;conclusion&#34;&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;A small inconsistency can cause a whole lot of trouble. Who could have predicted
back in 2017 that Google would tighten the security around re-labeling files?&lt;br&gt;
The transition is going to be a bit painful, but in the end, re-using
&lt;code&gt;adsprpcd_file&lt;/code&gt; is the better solution.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Android Kernel Suspend Debugging and Tracing</title>
      <link>https://sx.ix5.org/info/post/android-kernel-suspend-debugging-and-tracing/</link>
      <pubDate>Fri, 25 Jan 2019 08:18:00 +0100</pubDate>
      
      <guid>https://sx.ix5.org/info/post/android-kernel-suspend-debugging-and-tracing/</guid>
      <description>&lt;p&gt;While &lt;a href=&#34;https://sx.ix5.org/info/info/post/debugging-suspend-ideas/&#34;&gt;debugging suspend&lt;/a&gt; on the Sony Xperia XZ,
it turned out that the Android kernel has some great tracing function built in.
Pretty much any event available in &lt;code&gt;/d/tracing/event/*&lt;/code&gt; can be traced, logged
and analyzed.&lt;/p&gt;
&lt;p&gt;We wanted to know the source of wakeups, and also investigate whether the device
might have been awoken by hardware interrupts(&amp;ldquo;IRQs&amp;rdquo;).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;You need to be root for the following commands.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;To turn on tracing for wakeup sources:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;echo 1 &amp;gt; /d/tracing/events/power/wakeup_source_activate/enable
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To trace interrupts:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;echo 1 &amp;gt; /d/tracing/events/irq/irq_handler_entry/enable
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;But also filter out some noise:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;# filter out arch_timer irqs, (qcom,smd-rpm, qcom,glink-smem-native-xprt-rpm):
echo &amp;#34;irq != 5 &amp;amp;&amp;amp; irq != 7 &amp;amp;&amp;amp; irq != 131&amp;#34; &amp;gt; /d/tracing/events/irq/irq_handler_entry/filter
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Timers might also be of interest:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;echo 1 &amp;gt; /d/tracing/events/timer/timer_expire_entry/enable
echo 1 &amp;gt; /d/tracing/events/timer/timer_start/enable
echo &amp;#34;function != calculate_load_timer &amp;amp;&amp;amp; function != process_timeout&amp;#34; \
  &amp;gt; /d/tracing/events/timer/timer_start/filter
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;strong&gt;To start the actual tracing:&lt;/strong&gt;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;echo 1 &amp;gt; /d/tracing/tracing_on
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Then pull the resulting trace, easiest is to use adb and analyze on the computer:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;adb shell cat /d/tracing/trace
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To stop tracing again, write a &lt;code&gt;0&lt;/code&gt; into &lt;code&gt;/d/tracing/tracing_on&lt;/code&gt;&lt;/p&gt;
&lt;h2 id=&#34;analysis&#34;&gt;Analysis&lt;/h2&gt;
&lt;p&gt;After letting the device idle and try to enter deep sleep, some culprits quickly showed up.&lt;/p&gt;
&lt;p&gt;First was &lt;code&gt;dev_pn547&lt;/code&gt;, which is the NFC driver in use. Disabling it in the
kernel defconfig was done via:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;-CONFIG_NFC_PN547=y
-CONFIG_NFC_PN547_PMC_CLK_REQ=y
+CONFIG_NFC_PN547=n
+CONFIG_NFC_PN547_PMC_CLK_REQ=n
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The next suspect was the mmc driver for the internal sdcard. It turned out the
tone platform was the only one not to have &lt;code&gt;CONFIG_MMC_BLOCK_DEFERRED_RESUME=y&lt;/code&gt;,
while both loire and yoshino had it set.&lt;/p&gt;
&lt;p&gt;Sadly, both of those ideas lead to nowhere.&lt;/p&gt;
&lt;p&gt;Next, we tried to find out what function might be waking up the kernel, since
there was still a lot of noise(we&amp;rsquo;re talking about logs 20MB big in only a
matter of minutes).&lt;/p&gt;
&lt;p&gt;We tried inserting &lt;code&gt;WARN_ON(1);&lt;/code&gt; at various places, e.g. in &lt;code&gt;__pm_stay_awake&lt;/code&gt;,
but it turns out this function is called so often that the resulting dmesg is
being filled in a matter of seconds and thus completely useless for analysis.&lt;/p&gt;
&lt;p&gt;Our next hunch was to disallow the creation of alarms via eventpoll, but
preventing &lt;code&gt;ep_wakeup_source_register&lt;/code&gt; in the kernel meant the device would
crash too fast to yield any useful results.&lt;/p&gt;
&lt;p&gt;So next we tried preventing all wakeup sources created by eventpoll from waking
up the device:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;drivers/base/power/wakeup.c
static void wakeup_source_activate(struct wakeup_source *ws)
[...]
	if (!strncmp(&amp;#34;epoll_&amp;#34;, ws-&amp;gt;name, 6)) {
		pr_err(&amp;#34;%s: skipping ws %s\n&amp;#34;, __func__, ws-&amp;gt;name);
		return;
	}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;But since the &lt;code&gt;wakeup_source_activate&lt;/code&gt; function is called only when the device
is already awake, this is already too late to prevent the wakeup&lt;sup id=&#34;fnref:1&#34;&gt;&lt;a href=&#34;#fn:1&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt;, and adding
&lt;code&gt;WARN_ON&lt;/code&gt; to trace the calling function yet again yielded too much noise to
investigate.&lt;/p&gt;
&lt;h2 id=&#34;wrapping-up&#34;&gt;Wrapping up&lt;/h2&gt;
&lt;p&gt;Even though we didn&amp;rsquo;t find the root cause for the weird suspend bug, we learned
a lot about the tracing system, which is really neat.&lt;/p&gt;
&lt;p&gt;For more info, check &lt;a href=&#34;https://source.android.com/devices/tech/debug/ftrace&#34;&gt;Android source: ftrace&lt;/a&gt; and
&lt;a href=&#34;https://jvns.ca/blog/2017/03/19/getting-started-with-ftrace/&#34;&gt;ftrace: trace your kernel functions!&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;addendum&#34;&gt;(Addendum)&lt;/h3&gt;
&lt;p&gt;Idea: &lt;code&gt;echo 1 &amp;gt; /sys/kernel/debug/clk/debug_suspend&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Force a device to go to sleep:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;adb shell dumpsys battery unplug
adb shell dumpsys deviceidle step
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;from &lt;a href=&#34;https://stackoverflow.com/questions/3417308/force-an-android-phone-to-sleep-in-order-to-test#40465627&#34;&gt;stackoverflow&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&#34;footnotes&#34; role=&#34;doc-endnotes&#34;&gt;
&lt;hr&gt;
&lt;ol&gt;
&lt;li id=&#34;fn:1&#34;&gt;
&lt;p&gt;See the &lt;a href=&#34;https://github.com/sonyxperiadev/kernel/blob/aosp/LE.UM.2.3.2.r1.4/drivers/base/power/wakeup.c#L490-L525&#34;&gt;documentation in wakeup.c&lt;/a&gt;&amp;#160;&lt;a href=&#34;#fnref:1&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
</description>
    </item>
    
    <item>
      <title>Debugging suspend ideas</title>
      <link>https://sx.ix5.org/info/post/debugging-suspend-ideas/</link>
      <pubDate>Thu, 24 Jan 2019 08:18:00 +0100</pubDate>
      
      <guid>https://sx.ix5.org/info/post/debugging-suspend-ideas/</guid>
      <description>&lt;h2 id=&#34;the-problem&#34;&gt;The problem&lt;/h2&gt;
&lt;p&gt;When porting the Sony Xperia XZ from Kernel 4.4 to 4.9, a nasty bug showed up:
It wouldn&amp;rsquo;t deep sleep for more than ~5.2-5.7 seconds.&lt;/p&gt;
&lt;p&gt;A lot had changed between the kernel versions, especially since the Sony Open
Devices Project is not using the standard Linux kernel, but rather a heavily
modified version based on Qualcomm&amp;rsquo;s CodeAurora Forum(&amp;ldquo;CAF&amp;rdquo;) releases.&lt;/p&gt;
&lt;p&gt;There are also a lot of modifications to bring the kernel in line with upstream
mainline Linux, so we find ourselves in a weird in-between state where drivers
may be slightly incompatible in weird ways.&lt;/p&gt;
&lt;h2 id=&#34;ideas&#34;&gt;Ideas&lt;/h2&gt;
&lt;p&gt;Kernel wakeup-sources report an epoll from system_server to be the reason:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;wakeup_source_activate: epoll_system_server_file:[timerfd7_system_server] state=0x13680002
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;(To have the wakeup_source formatted not only as &lt;code&gt;eventpoll&lt;/code&gt;, cherry-pick this
commit: &lt;a href=&#34;https://github.com/sonyxperiadev/kernel/commit/c1c412fc03c9817dac8cae3353bce1c32af3196a&#34;&gt;fs: Improve eventpoll logging to stop indicting timerfd&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;system_server(a.k.a. SystemServer in frameworks/base) seems to set
alarms(&lt;code&gt;CLOCK_REALTIME_ALARM=8&lt;/code&gt; and &lt;code&gt;CLOCK_BOOTTIME_ALARM=9&lt;/code&gt;) that have the
capability to wake up the system only in &lt;a href=&#34;https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-9.0.0_r31/services/core/jni/com_android_server_AlarmManagerService.cpp&#34;&gt;AlarmManagerService&lt;/a&gt;.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;diff --git a/services/core/jni/com_android_server_AlarmManagerService.cpp \
  b/services/core/jni/com_android_server_AlarmManagerService.cpp
index 47350c11f95..8da96d1e9a2 100644
--- a/services/core/jni/com_android_server_AlarmManagerService.cpp
+++ b/services/core/jni/com_android_server_AlarmManagerService.cpp
@@ -60,6 +60,7 @@ static constexpr int ANDROID_ALARM_TIME_CHANGE_MASK = 1 &amp;lt;&amp;lt; 16;
  */
 static const size_t ANDROID_ALARM_TYPE_COUNT = 5;
 static const size_t N_ANDROID_TIMERFDS = ANDROID_ALARM_TYPE_COUNT + 1;
+/* typedef int clockid_t */
 static const clockid_t android_alarm_to_clockid[N_ANDROID_TIMERFDS] = {
     CLOCK_REALTIME_ALARM,
     CLOCK_REALTIME,
@@ -115,6 +116,8 @@ int AlarmImpl::set(int type, struct timespec *ts)
     memset(&amp;amp;spec, 0, sizeof(spec));
     memcpy(&amp;amp;spec.it_value, ts, sizeof(spec.it_value));
 
+    ALOGE(&amp;#34;AlarmManagerService: Setting alarm (type %d) for %lu ns&amp;#34;, type, ts-&amp;gt;tv_nsec);
+
     return timerfd_settime(fds[type], TFD_TIMER_ABSTIME, &amp;amp;spec, NULL);
 }
 
@@ -184,6 +187,7 @@ int AlarmImpl::waitForAlarm()
         uint64_t unused;
         ssize_t err = read(fds[alarm_idx], &amp;amp;unused, sizeof(unused));
         if (err &amp;lt; 0) {
+            /* ANDROID_ALARM_TYPE_COUNT = CLOCK_REALTIME_ALARM*/
             if (alarm_idx == ANDROID_ALARM_TYPE_COUNT &amp;amp;&amp;amp; errno == ECANCELED) {
                 result |= ANDROID_ALARM_TIME_CHANGE_MASK;
             } else {
@@ -191,6 +195,10 @@ int AlarmImpl::waitForAlarm()
             }
         } else {
             result |= (1 &amp;lt;&amp;lt; alarm_idx);
+            if ((int)alarm_idx == CLOCK_REALTIME_ALARM ||
+                (int)alarm_idx == CLOCK_BOOTTIME_ALARM) {
+                ALOGE(&amp;#34;AlarmManagerService: woke up from alarm %d&amp;#34;, alarm_idx);
+            }
         }
     }
 
@@ -337,6 +345,7 @@ static jlong android_server_AlarmManagerService_init(JNIEnv*, jobject)
     }
 
     for (size_t i = 0; i &amp;lt; fds.size(); i++) {
+        /* timerfd_create() creates a timerfd object and returns the fd */
         fds[i] = timerfd_create(android_alarm_to_clockid[i], 0);
         if (fds[i] &amp;lt; 0) {
             log_timerfd_create_error(android_alarm_to_clockid[i]);
@@ -346,6 +355,7 @@ static jlong android_server_AlarmManagerService_init(JNIEnv*, jobject)
             }
             return 0;
         }
+        ALOGE(&amp;#34;AlarmManagerService: fds[%d] points to fd %d&amp;#34;, (int)i, fds[i]);
     }
 
     AlarmImpl *ret = new AlarmImpl(fds, epollfd, wall_clock_rtc());
@@ -368,6 +378,7 @@ static jlong android_server_AlarmManagerService_init(JNIEnv*, jobject)
     /* 0 = disarmed; the timerfd doesn&amp;#39;t need to be armed to get
        RTC change notifications, just set up as cancelable */
 
+    /* Seems this is just for testing that settime works */
     int err = timerfd_settime(fds[ANDROID_ALARM_TYPE_COUNT],
             TFD_TIMER_ABSTIME | TFD_TIMER_CANCEL_ON_SET, &amp;amp;spec, NULL);
     if (err &amp;lt; 0) {
&lt;/code&gt;&lt;/pre&gt;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;diff --git a/services/core/jni/com_android_server_AlarmManagerService.cpp \
  b/services/core/jni/com_android_server_AlarmManagerService.cpp
index 47350c11f95..9ade11af60a 100644
--- a/services/core/jni/com_android_server_AlarmManagerService.cpp
+++ b/services/core/jni/com_android_server_AlarmManagerService.cpp
@@ -338,6 +338,8 @@ static jlong android_server_AlarmManagerService_init(JNIEnv*, jobject)
 
     for (size_t i = 0; i &amp;lt; fds.size(); i++) {
         fds[i] = timerfd_create(android_alarm_to_clockid[i], 0);
+        ALOGE(&amp;#34;%s: Created timerfd no=%d for clock %d at fd=%d&amp;#34;,
+                __func__, (int)i, android_alarm_to_clockid[i], fds[i]);
         if (fds[i] &amp;lt; 0) {
             log_timerfd_create_error(android_alarm_to_clockid[i]);
             close(epollfd);
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;However, after letting the device run and looking at the &lt;code&gt;dmesg&lt;/code&gt; log statements,
it seems no alarms of type &lt;code&gt;CLOCK_REALTIME_ALARM&lt;/code&gt; or &lt;code&gt;CLOCK_BOOTTIME_ALARM&lt;/code&gt; are
being set, only timers of type 2 and 3.&lt;/p&gt;
&lt;p&gt;Next idea would be &lt;code&gt;min_futurity&lt;/code&gt;, &lt;code&gt;listener_timeout&lt;/code&gt;, &lt;code&gt;allow_while_idle_short_time&lt;/code&gt;
All of these are seem suspicious since they&amp;rsquo;re set to exactly 5 seconds. So test
increasing them to 10 seconds:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;diff --git a/services/core/java/com/android/server/AlarmManagerService.java \
  b/services/core/java/com/android/server/AlarmManagerService.java
index 20bb7fb4789..76bf5de75e4 100644
--- a/services/core/java/com/android/server/AlarmManagerService.java
+++ b/services/core/java/com/android/server/AlarmManagerService.java
@@ -297,13 +297,13 @@ class AlarmManagerService extends SystemService {
                 &amp;#34;standby_never_delay&amp;#34;,
         };
 
-        private static final long DEFAULT_MIN_FUTURITY = 5 * 1000;
+        private static final long DEFAULT_MIN_FUTURITY = 10 * 1000;
         private static final long DEFAULT_MIN_INTERVAL = 60 * 1000;
         private static final long DEFAULT_MAX_INTERVAL = 365 * DateUtils.DAY_IN_MILLIS;
         private static final long DEFAULT_ALLOW_WHILE_IDLE_SHORT_TIME = DEFAULT_MIN_FUTURITY;
         private static final long DEFAULT_ALLOW_WHILE_IDLE_LONG_TIME = 9*60*1000;
         private static final long DEFAULT_ALLOW_WHILE_IDLE_WHITELIST_DURATION = 10*1000;
-        private static final long DEFAULT_LISTENER_TIMEOUT = 5 * 1000;
+        private static final long DEFAULT_LISTENER_TIMEOUT = 10 * 1000;
         private final long[] DEFAULT_APP_STANDBY_DELAYS = {
                 0,                       // Active
                 6 * 60_000,              // Working
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Unfortunately, the suspend still only last 5 seconds, so this was a dead end.&lt;/p&gt;
&lt;hr&gt;
&lt;!-- TODO: --&gt;
&lt;p&gt;Another approach: kernel bcmdhd, there&amp;rsquo;s a 5 second timeout in there, but it&amp;rsquo;s not it
either&lt;/p&gt;
&lt;p&gt;Better timerfd patch:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;diff --git a/fs/timerfd.c b/fs/timerfd.c
index 147b72349d3b..0aefe5e55097 100644
--- a/fs/timerfd.c
+++ b/fs/timerfd.c
@@ -430,14 +430,17 @@ SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flags)
 
        instance = atomic_inc_return(&amp;amp;instance_count);
        get_task_comm(task_comm_buf, current);
-       snprintf(file_name_buf, sizeof(file_name_buf), &amp;#34;[timerfd%d_%.*s]&amp;#34;,
-                instance, (int)sizeof(task_comm_buf), task_comm_buf);
+       /* snprintf(file_name_buf, sizeof(file_name_buf), &amp;#34;[timerfd%d_%.*s]&amp;#34;, */
+       /*       instance, (int)sizeof(task_comm_buf), task_comm_buf); */
 
        ufd = anon_inode_getfd(file_name_buf, &amp;amp;timerfd_fops, ctx,
                               O_RDWR | (flags &amp;amp; TFD_SHARED_FCNTL_FLAGS));
        if (ufd &amp;lt; 0)
                kfree(ctx);
 
+       snprintf(file_name_buf, sizeof(file_name_buf), &amp;#34;[timerfd%d-fd%d_%.*s]&amp;#34;,
+               instance, ufd, (int)sizeof(task_comm_buf), task_comm_buf);
+
        return ufd;
 }
&lt;/code&gt;&lt;/pre&gt;&lt;hr&gt;
&lt;p&gt;To be continued in &lt;a href=&#34;https://sx.ix5.org/info/info/post/android-kernel-suspend-debugging-and-tracing/&#34;&gt;&amp;ldquo;Android Kernel Suspend and Tracing&amp;rdquo;&lt;/a&gt;.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Omni build tips</title>
      <link>https://sx.ix5.org/info/post/omni-build-tips/</link>
      <pubDate>Tue, 01 Jan 2019 09:18:00 +0100</pubDate>
      
      <guid>https://sx.ix5.org/info/post/omni-build-tips/</guid>
      <description>&lt;h2 id=&#34;faster-rebuilds&#34;&gt;Faster rebuilds&lt;/h2&gt;
&lt;p&gt;No need to re-read and re-evaluate all the &lt;code&gt;Android.mk&lt;/code&gt; files, just leave the
ROM fingerprints/timestamps as they are for development.&lt;/p&gt;
&lt;p&gt;E.g. the ROM_FINGERPRINT is dynamically set(based on &lt;code&gt;$(shell date ...)&lt;/code&gt;), so it
triggers a full re-read of build variables:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;ROM_FINGERPRINT := OmniROM/$(PLATFORM_VERSION)/$(TARGET_PRODUCT_SHORT)/$(shell date +%Y%m%d.%H:%M)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Change all these values so they are no longer tied to the current date:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;# vendor/omni/config/version.mk
ROM_VERSION := current
ROM_FINGERPRINT := OmniROM/current
PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
    ro.omni.fingerprint=current
&lt;/code&gt;&lt;/pre&gt;</description>
    </item>
    
    <item>
      <title>Android blueprint files</title>
      <link>https://sx.ix5.org/info/post/android-blueprint-files/</link>
      <pubDate>Tue, 01 Jan 2019 08:18:00 +0100</pubDate>
      
      <guid>https://sx.ix5.org/info/post/android-blueprint-files/</guid>
      <description>&lt;p&gt;&lt;code&gt;androidmk&lt;/code&gt; is a tool to convert Makefile-style &lt;code&gt;Android.mk&lt;/code&gt; files to
&lt;code&gt;Android.bp&lt;/code&gt; &amp;ldquo;blueprint&amp;rdquo; files, which look like json and are faster to parse.&lt;br&gt;
YMMV, but they also seem more readable and largely prevent you from doing crazy
if-else and convoluted stuff as you&amp;rsquo;d be drawn to if using makefiles.&lt;br&gt;
As a downside, they&amp;rsquo;re an &amp;ldquo;Android-ism&amp;rdquo; and make it harder for people to port
your software to a project that is not Android.&lt;/p&gt;
&lt;p&gt;Use &lt;code&gt;make blueprint_tools&lt;/code&gt; inside the AOSP tree to build the &lt;code&gt;androidmk&lt;/code&gt; go
binary.&lt;/p&gt;
&lt;p&gt;You can then copy the binary from &lt;code&gt;out/soong/host/linux-x86/bin/androidmk&lt;/code&gt; to
your &lt;code&gt;~/.local/bin/&lt;/code&gt; to use it outside the AOSP tree. Beware that the tool is
constantly being updated, so you might need to re-build it from time to time.&lt;/p&gt;
&lt;p&gt;For the internal workings, and to get a mapping of make and soong variables, see
the source code inside &lt;a href=&#34;https://android.googlesource.com/platform/build/soong/+/refs/tags/android-10.0.0_r39/androidmk/cmd/androidmk/android.go#43&#34;&gt;cmd/androidmk/android.go&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;See this question about &lt;a href=&#34;https://stackoverflow.com/questions/51207766/where-can-i-find-androidmk-tool-to-convert-android-mk-to-android-bp&#34;&gt;androidmk on StackOverflow&lt;/a&gt;.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>WiFi notes</title>
      <link>https://sx.ix5.org/info/post/wifi-notes/</link>
      <pubDate>Tue, 01 Jan 2019 08:18:00 +0100</pubDate>
      
      <guid>https://sx.ix5.org/info/post/wifi-notes/</guid>
      <description>&lt;p&gt;&lt;em&gt;Sorry this is such a mess, this is more of a braindump&amp;hellip;&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&#34;terms&#34;&gt;Terms&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;DFS&lt;/code&gt; = Dynamic Frequency selction&lt;/li&gt;
&lt;li&gt;&lt;code&gt;STA&lt;/code&gt; = Station mode = Client&lt;/li&gt;
&lt;li&gt;&lt;code&gt;AP&lt;/code&gt; = Access point = Router&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;chre&#34;&gt;CHRE&lt;/h2&gt;
&lt;blockquote&gt;
&lt;p&gt;This daemon loads the Context Hub Runtime Environment (CHRE) dynamic modules
onto the SLPI using FastRPC, and exposes a sockets interface for clients on
the applications processor to interact CHRE&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&#34;tethering-5ghz&#34;&gt;Tethering 5Ghz&lt;/h2&gt;
&lt;p&gt;Uses &lt;code&gt;getAvailable5gNonDFSChannels&lt;/code&gt; internally, discards DFS frequencies.&lt;/p&gt;
&lt;h2 id=&#34;more-tethering&#34;&gt;More tethering&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;frameworks/opt/net/wifi/service/java/com/android/server/wifi/WificondControl.java&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;frameworks/opt/net/wifi/service/java/com/android/server/wifi/SoftApManager.java&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;frameworks/opt/net/wifi/service/java/com/android/server/wifi/util/ApConfigUtil.java&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;needed-patches&#34;&gt;Needed patches&lt;/h2&gt;
&lt;p&gt;external/libnl/lib/msg.c&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;-static void print_hdr(FILE *ofd, struct nl_msg *msg)
+// Needs to be non-static to be used elsewhere
+void print_hdr(FILE *ofd, struct nl_msg *msg)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;external/wpa_supplicant_8: see &lt;a href=&#34;https://sx.ix5.org/info/info/files/wpa_supplicant_8.patch&#34;&gt;wpa_supplicant_8.patch&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;frameworks/base&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;diff --git a/services/art-profile b/services/art-profile
index a372a9c2f2a..8f46d8d0367 100644
--- a/services/art-profile
+++ b/services/art-profile
@@ -702,6 +702,7 @@ HSPLandroid/net/wifi/IWificond;-&amp;gt;disableSupplicant()Z
 HSPLandroid/net/wifi/IWificond;-&amp;gt;enableSupplicant()Z
 HSPLandroid/net/wifi/IWificond;-&amp;gt;getAvailable2gChannels()[I
 HSPLandroid/net/wifi/IWificond;-&amp;gt;getAvailable5gNonDFSChannels()[I
+HSPLandroid/net/wifi/IWificond;-&amp;gt;getAvailable5gWithDFSChannels()[I
 HSPLandroid/net/wifi/IWificond;-&amp;gt;getAvailableDFSChannels()[I
 HSPLandroid/net/wifi/IWificond;-&amp;gt;tearDownApInterface(Ljava/lang/String;)Z
 HSPLandroid/net/wifi/IWificond;-&amp;gt;tearDownClientInterface(Ljava/lang/String;)Z
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;kernel: drivers/staging/wlan-qc/qca-wifi-host-cmn&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;diff --git a/wmi/src/wmi_unified_non_tlv.c b/wmi/src/wmi_unified_non_tlv.c
index a55fea25..35d3334b 100644
--- a/wmi/src/wmi_unified_non_tlv.c
+++ b/wmi/src/wmi_unified_non_tlv.c
@@ -2682,6 +2682,14 @@ send_pdev_set_regdomain_cmd_non_tlv(wmi_unified_t wmi_handle,
        wmi_buf_t buf;
 
        int len = sizeof(wmi_pdev_set_regdomain_cmd);
+       /* TODO */
+       qdf_print(&amp;#34;%s: sending regdomain: domain=%d, 2g=%d, 5g=%d, dfs_domain=%s\n&amp;#34;,
+                               __func__,
+                               param-&amp;gt;currentRDinuse,
+                               param-&amp;gt;currentRD2G,
+                               param-&amp;gt;currentRD5G,
+                               param-&amp;gt;dfsDomain
+                               );
 
        buf = wmi_buf_alloc(wmi_handle, len);
        if (!buf) {
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;device/sony/tone&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;diff --git a/PlatformConfig.mk b/PlatformConfig.mk
index 24c0bfb..0148bf6 100644
--- a/PlatformConfig.mk
+++ b/PlatformConfig.mk
@@ -44,12 +44,13 @@ BOARD_KERNEL_CMDLINE += androidboot.bootdevice=7464900.sdhci
 TARGET_RECOVERY_FSTAB ?= $(PLATFORM_COMMON_PATH)/rootdir/vendor/etc/fstab.tone
 
 # Wi-Fi definitions for Broadcom solution
-BOARD_WLAN_DEVICE           := bcmdhd
+BOARD_WLAN_DEVICE           := qcwcn
+BOARD_HAS_QCOM_WLAN := true
 BOARD_WPA_SUPPLICANT_DRIVER := NL80211
 WPA_SUPPLICANT_VERSION      := VER_0_8_X
-BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_bcmdhd
+BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_qcwcn
 BOARD_HOSTAPD_DRIVER        := NL80211
-BOARD_HOSTAPD_PRIVATE_LIB   := lib_driver_cmd_bcmdhd
+BOARD_HOSTAPD_PRIVATE_LIB   := lib_driver_cmd_qcwcn
 # define firmware paths if not using brcmfmac driver
 ifneq ($(WIFI_DRIVER_BUILT),brcmfmac)
 WIFI_DRIVER_FW_PATH_PARAM   := &amp;#34;/sys/module/bcmdhd/parameters/firmware_path&amp;#34;
diff --git a/rootdir/vendor/etc/wifi/p2p_supplicant_overlay.conf b/rootdir/vendor/etc/wifi/p2p_supplicant_overlay.conf
index e44c477..f58d42b 100644
--- a/rootdir/vendor/etc/wifi/p2p_supplicant_overlay.conf
+++ b/rootdir/vendor/etc/wifi/p2p_supplicant_overlay.conf
@@ -2,4 +2,6 @@ disable_scan_offload=1
 wowlan_triggers=any
 p2p_no_go_freq=5170-5740
 p2p_search_delay=0
-no_ctrl_interface=
\ No newline at end of file
+no_ctrl_interface=
+p2p_no_group_iface=1
+p2p_go_vht=1
diff --git a/rootdir/vendor/etc/wifi/wpa_supplicant_overlay.conf b/rootdir/vendor/etc/wifi/wpa_supplicant_overlay.conf
index 740792b..5099e4e 100644
--- a/rootdir/vendor/etc/wifi/wpa_supplicant_overlay.conf
+++ b/rootdir/vendor/etc/wifi/wpa_supplicant_overlay.conf
@@ -2,4 +2,13 @@ disable_scan_offload=1
 wowlan_triggers=any
 p2p_disabled=1
 filter_rssi=-75
-no_ctrl_interface=
\ No newline at end of file
+no_ctrl_interface=
+
+eapol_version=2
+ap_scan=1
+country=DE
+tdls_external_control=1
+bss_max_count=512
+
+# Seems not a good idea, with system+vendor being read-only
+#update_config=1
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;brcmfmac&#34;&gt;BRCMFMAC&lt;/h2&gt;
&lt;p&gt;device/sony/kagura&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;diff --git a/device.mk b/device.mk
index eff2375..1c908d2 100644
--- a/device.mk
+++ b/device.mk
@@ -18,6 +18,9 @@ DEVICE_PATH := device/sony/kagura/rootdir
 DEVICE_PACKAGE_OVERLAYS += \
     device/sony/kagura/overlay
 
+# declare brcmfmac as the wifi driver
+WIFI_DRIVER_BUILT := brcmfmac
+
 # Device Specific Permissions
 PRODUCT_COPY_FILES := \
     frameworks/native/data/etc/handheld_core_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/handheld_core_hardware.xml \
@@ -70,6 +73,10 @@ PRODUCT_COPY_FILES += \
 # WIFI FW patch
 PRODUCT_COPY_FILES += \
     $(DEVICE_PATH)/vendor/firmware/bcmdhd.cal:$(TARGET_COPY_OUT_VENDOR)/firmware/bcmdhd.cal
+ifeq ($(WIFI_DRIVER_BUILT),brcmfmac)
+PRODUCT_COPY_FILES += \
+    $(DEVICE_PATH)/vendor/firmware/bcmdhd.cal:$(TARGET_COPY_OUT_VENDOR)/firmware/brcm/brcmfmac43455-sdio.txt
+endif
 
 # Device Init
 PRODUCT_PACKAGES += \
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;miscellaneous-notes&#34;&gt;Miscellaneous notes&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;system/connectivity/wificond/net/netlink_utils.h&lt;/code&gt;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;struct BandInfo {
  BandInfo() = default;
  BandInfo(std::vector&amp;lt;uint32_t&amp;gt;&amp;amp; band_2g_,
           std::vector&amp;lt;uint32_t&amp;gt;&amp;amp; band_5g_,
           std::vector&amp;lt;uint32_t&amp;gt;&amp;amp; band_dfs_)
      : band_2g(band_2g_),
        band_5g(band_5g_),
        band_dfs(band_dfs_) {}
  // Frequencies for 2.4 GHz band.
  std::vector&amp;lt;uint32_t&amp;gt; band_2g;
  // Frequencies for 5 GHz band without DFS.
  std::vector&amp;lt;uint32_t&amp;gt; band_5g;
  // Frequencies for DFS.
  std::vector&amp;lt;uint32_t&amp;gt; band_dfs;
};
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;frameworks/base/wifi/java/android/net/wifi/WifiScanner.java&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;public class WifiScanner {
    /** no band specified; use channel list instead */
    public static final int WIFI_BAND_UNSPECIFIED = 0;      /* not specified */

    /** 2.4 GHz band */
    public static final int WIFI_BAND_24_GHZ = 1;           /* 2.4 GHz band */
    /** 5 GHz band excluding DFS channels */
    public static final int WIFI_BAND_5_GHZ = 2;            /* 5 GHz band without DFS channels */
    /** DFS channels from 5 GHz band only */
    public static final int WIFI_BAND_5_GHZ_DFS_ONLY  = 4;  /* 5 GHz band with DFS channels */
    /** 5 GHz band including DFS channels */
    public static final int WIFI_BAND_5_GHZ_WITH_DFS  = 6;  /* 5 GHz band with DFS channels */
    /** Both 2.4 GHz band and 5 GHz band; no DFS channels */
    public static final int WIFI_BAND_BOTH = 3;             /* both bands without DFS channels */
    /** Both 2.4 GHz band and 5 GHz band; with DFS channels */
    public static final int WIFI_BAND_BOTH_WITH_DFS = 7;    /* both bands with DFS channels */
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;external/iw/util.c&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;static const char *commands[NL80211_CMD_MAX + 1] = {
/*
 * sed &amp;#39;s/^\tNL80211_CMD_//;t n;d;:n s%^\([^=]*\),.*%\t[NL80211_CMD_\1] = \&amp;#34;\L\1\&amp;#34;,%;t;d&amp;#39; nl80211.h
 */
	[NL80211_CMD_UNSPEC] = &amp;#34;unspec&amp;#34;,
	[NL80211_CMD_GET_WIPHY] = &amp;#34;get_wiphy&amp;#34;,
    [...]
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;linux/nl80211.h&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;/**
 * enum nl80211_dfs_regions - regulatory DFS regions
 *
 * @NL80211_DFS_UNSET: Country has no DFS master region specified
 * @NL80211_DFS_FCC: Country follows DFS master rules from FCC
 * @NL80211_DFS_ETSI: Country follows DFS master rules from ETSI
 * -&amp;gt; a.k.a Europe
 * @NL80211_DFS_JP: Country follows DFS master rules from JP/MKK/Telec
 */
enum nl80211_dfs_regions {
	NL80211_DFS_UNSET	= 0,
	NL80211_DFS_FCC		= 1,
	NL80211_DFS_ETSI	= 2,
	NL80211_DFS_JP		= 3,
};
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;kernel netlink.h&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;# Netlink Messages and Attributes Interface
#
# Message Format:
#    &amp;lt;--- nlmsg_total_size(payload)  ---&amp;gt;
#    &amp;lt;-- nlmsg_msg_size(payload) -&amp;gt;
#   +----------+- - -+-------------+- - -+-------- - -
#   | nlmsghdr | Pad |   Payload   | Pad | nlmsghdr
#   +----------+- - -+-------------+- - -+-------- - -
#   nlmsg_data(nlh)---^                   ^
#   nlmsg_next(nlh)-----------------------+
#
# Payload Format:
#    &amp;lt;---------------------- nlmsg_len(nlh) ---------------------&amp;gt;
#    &amp;lt;------ hdrlen ------&amp;gt;       &amp;lt;- nlmsg_attrlen(nlh, hdrlen) -&amp;gt;
#   +----------------------+- - -+--------------------------------+
#   |     Family Header    | Pad |           Attributes           |
#   +----------------------+- - -+--------------------------------+
#   nlmsg_attrdata(nlh, hdrlen)---^

static inline void *nla_data(const struct nlattr *nla) {
	return (char *) nla + NLA_HDRLEN; }
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;wifi_concurrency_cfg.txt&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;ENABLE_STA_SAP_CONCURRENCY:1
SAP_INTERFACE_NAME:softap0
SAP_CHANNEL:6
&lt;/code&gt;&lt;/pre&gt;</description>
    </item>
    
    <item>
      <title>Fixing JACK</title>
      <link>https://sx.ix5.org/info/post/fixing-jack/</link>
      <pubDate>Sun, 30 Dec 2018 09:18:00 +0100</pubDate>
      
      <guid>https://sx.ix5.org/info/post/fixing-jack/</guid>
      <description>&lt;p&gt;&lt;em&gt;Thankfully, JACK was dropped from the Android build system in version 9.0 Pie.
In case you&amp;rsquo;re stuck with Oreo, here are some tips.&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;On Android 8.x, JACK needs some extra packages. check with &lt;code&gt;jack-diagnose&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;In a bare buildroot, these might be missing, so install them:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;apt install curl lsof
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;In a buildroot, if somehow installing the JACK .jar files into &lt;code&gt;~/.jack-server&lt;/code&gt;
fails, run this on the host and bind-mount &lt;code&gt;~/.jack-server&lt;/code&gt; into the target:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;./prebuilts/sdk/tools/jack-admin install-server \
  ./prebuilts/sdk/tools/jack-launcher.jar \
  ./prebuilts/sdk/tools/jack-server-4.11.ALPHA.jar
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;(&lt;code&gt;jack-server-4.11.ALPHA.jar&lt;/code&gt; might be named differently depending on the version
of android you are building)&lt;/p&gt;
&lt;p&gt;Then ensure that &lt;code&gt;~/.jack-server&lt;/code&gt; contains these files:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;$ ls ~/.jack-server
jack/  client.jks  config.properties  server-1.jar  server.pem
logs/  client.pem  launcher.jar       server.jks
&lt;/code&gt;&lt;/pre&gt;</description>
    </item>
    
    <item>
      <title>Sony/Qualcomm device subsystems</title>
      <link>https://sx.ix5.org/info/post/sony-qualcomm-device-subsystems/</link>
      <pubDate>Sat, 22 Dec 2018 18:07:04 +0100</pubDate>
      
      <guid>https://sx.ix5.org/info/post/sony-qualcomm-device-subsystems/</guid>
      <description>&lt;ul&gt;
&lt;li&gt;&lt;code&gt;lpass&lt;/code&gt; = Low-Power Audio SubSystem&lt;/li&gt;
&lt;li&gt;&lt;code&gt;mpss&lt;/code&gt; = audio memory stuff for adsp
(mpa and mpss are the addresses for venus/adsp hexagon stuff)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;kgsl&lt;/code&gt; = adreno, kernel graphics support layer&lt;/li&gt;
&lt;li&gt;&lt;code&gt;cdsp&lt;/code&gt; is the term for adsp on newer snapdragon processors
&lt;a href=&#34;https://developer.qualcomm.com/docs/snpe/overview.html&#34;&gt;https://developer.qualcomm.com/docs/snpe/overview.html&lt;/a&gt;
(sdm835 has adsp, 845 and 855 have cdsp)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;SLPI&lt;/code&gt; = Sensor Low Power Island&lt;/li&gt;
&lt;li&gt;&lt;code&gt;mpm&lt;/code&gt; = Modem Power Manager&lt;/li&gt;
&lt;li&gt;&lt;code&gt;BIMC&lt;/code&gt; = Bus Interface Memory Controller&lt;/li&gt;
&lt;li&gt;&lt;code&gt;QRTR&lt;/code&gt; = Qualcomm&amp;rsquo;s IPC router for QMI comms&lt;/li&gt;
&lt;li&gt;&lt;code&gt;vidc&lt;/code&gt; = v4l en-/decoders, now called &lt;code&gt;venus&lt;/code&gt;. Kernel driver.
See &lt;a href=&#34;https://lwn.net/Articles/705831/&#34;&gt;lwn&lt;/a&gt;, &lt;a href=&#34;https://github.com/torvalds/linux/blob/d8924c0d76aaa52e4811b5c64115d9a7f36cc73a/Documentation/devicetree/bindings/media/qcom%2Cvenus.txt&#34;&gt;venus&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;fpc&lt;/code&gt; = Fast Power Collapse, else &amp;ldquo;Fingerprint controller&amp;rdquo;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;tlmm&lt;/code&gt; = TOP Level Mode Multiplexer, see &lt;a href=&#34;https://android.googlesource.com/kernel/msm/+/android-wear-5.0.2_r0.1/Documentation/devicetree/bindings/pinctrl/msm-pinctrl.txt&#34;&gt;msm-pinctrl&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;MPM&lt;/code&gt; = MSM sleep Power Manager&lt;/li&gt;
&lt;li&gt;&lt;code&gt;PIL&lt;/code&gt; = Peripheral Image Loader
&lt;blockquote&gt;
&lt;p&gt;used for loading QDSP6v5 (Hexagon) firmware images for modem subsystems into
memory and preparing the subsystem&amp;rsquo;s processor to execute code. It&amp;rsquo;s also
responsible for shutting down the processor when it&amp;rsquo;s not needed.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;NoC&lt;/code&gt; = Network-on-Chip&lt;/li&gt;
&lt;li&gt;Clock ending in &lt;code&gt;_a&lt;/code&gt;: Always-on RPM set clock&lt;/li&gt;
&lt;li&gt;&lt;code&gt;IBS&lt;/code&gt; = Instruction Based Sampling, could also be In-Band Switching&lt;/li&gt;
&lt;li&gt;&lt;code&gt;HBM&lt;/code&gt; = If in display context: High Brightness mode, else High Bandwidth
Memory&lt;/li&gt;
&lt;li&gt;&lt;code&gt;SPMI&lt;/code&gt; = System Power Management Interface - see &lt;a href=&#34;https://github.com/torvalds/linux/commit/5a86bf343976b9c8ab2f240bc866451fa67e5573&#34;&gt;inclusion commit&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;PMIC&lt;/code&gt; = Power management integrated circuit&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;More information, collected unofficially: &lt;a href=&#34;https://osmocom.org/projects/quectel-modems/wiki/Qualcomm_Kernel&#34;&gt;Qualcomm Kernel&lt;/a&gt;&lt;/p&gt;
</description>
    </item>
    
  </channel>
</rss>
