diff --git a/.gitignore b/.gitignore index 89f9ac0..33c6b5e 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ out/ +build/ +ota/ +workdir/ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 08c4de3..276039a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,41 +1,5 @@ -image: ubuntu:20.04 +include: + - https://gitlab.com/ubports/porting/community-ports/halium-generic-adaptation-build-tools/-/raw/main/gsi-port-ci.yml -build: - stage: build - script: - - apt update - - apt install android-tools-mkbootimg bc build-essential ca-certificates cpio curl git kmod libssl-dev libtinfo5 python2 sudo unzip wget xz-utils -y --no-install-recommends - - ln -sf python2.7 /usr/bin/python - - ./build.sh - artifacts: - paths: - - out/* - -flashable: - stage: deploy - script: - - apt update - - apt install -y img2simg jq sudo wget xz-utils - - DEVICE="$(source deviceinfo && echo $deviceinfo_codename)" - - ./build/fetch-and-prepare-latest-ota.sh "16.04/arm64/android9/devel" "$DEVICE" ota - - mkdir -p out - - ./build/system-image-from-ota.sh ota/ubuntu_command out - artifacts: - paths: - - out/boot.img - - out/system.img - when: manual - -devel-flashable: - stage: deploy - script: - - apt update - - apt install -y img2simg jq sudo wget xz-utils - - DEVICE="$(source deviceinfo && echo $deviceinfo_codename)" - - ./build/prepare-fake-ota.sh out/device_$DEVICE.tar.xz ota - - mkdir -p out - - ./build/system-image-from-ota.sh ota/ubuntu_command out - artifacts: - paths: - - out/boot.img - - out/system.img +variables: + BUILD_DEVEL_FLASHABLE_FOCAL: "1" diff --git a/build.sh b/build.sh index 55f0be1..386a937 100755 --- a/build.sh +++ b/build.sh @@ -1,93 +1,5 @@ #!/bin/bash set -xe -BUILD_DIR= -OUT= - -while [ $# -gt 0 ] -do - case "$1" in - (-b) BUILD_DIR="$(realpath "$2")"; shift;; - (-o) OUT="$2"; shift;; - (-*) echo "$0: Error: unknown option $1" 1>&2; exit 1;; - (*) OUT="$2"; break;; - esac - shift -done - -OUT="$(realpath "$OUT" 2>/dev/null || echo 'out')" -mkdir -p "$OUT" - -if [ -z "$BUILD_DIR" ]; then - TMP=$(mktemp -d) - TMPDOWN=$(mktemp -d) -else - TMP="$BUILD_DIR/tmp" - mkdir -p "$TMP" - TMPDOWN="$BUILD_DIR/downloads" - mkdir -p "$TMPDOWN" -fi - -HERE=$(pwd) -SCRIPT="$(dirname "$(realpath "$0")")"/build - -mkdir -p "${TMP}/system" -mkdir -p "${TMP}/partitions" - -source "${HERE}/deviceinfo" - -case $deviceinfo_arch in - "armhf") RAMDISK_ARCH="armhf";; - "aarch64") RAMDISK_ARCH="arm64";; - "x86") RAMDISK_ARCH="i386";; -esac - -cd "$TMPDOWN" - [ -d aarch64-linux-android-4.9 ] || git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9 -b pie-gsi --depth 1 - GCC_PATH="$TMPDOWN/aarch64-linux-android-4.9" - if [ -n "$deviceinfo_kernel_clang_compile" ] && $deviceinfo_kernel_clang_compile; then - [ -d linux-x86 ] || git clone https://github.com/UbuntuTouch-sagit/prebuilts_clang_host_linux-x86_clang-r428724 -b 11 --depth 1 linux-x86 - CLANG_PATH="$TMPDOWN/linux-x86" - fi - [ -d arm-linux-androideabi-4.9 ] || git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9 -b pie-gsi --depth 1 - GCC_ARM32_PATH="$TMPDOWN/arm-linux-androideabi-4.9" - - KERNEL_DIR="$(basename "${deviceinfo_kernel_source}")" - KERNEL_DIR="${KERNEL_DIR%.*}" - [ -d "$KERNEL_DIR" ] || git clone "$deviceinfo_kernel_source" -b $deviceinfo_kernel_source_branch --depth 1 - - [ -f halium-boot-ramdisk.img ] || curl --location --output halium-boot-ramdisk.img \ - "https://github.com/halium/initramfs-tools-halium/releases/download/continuous/initrd.img-touch-${RAMDISK_ARCH}" - - if [ -n "$deviceinfo_kernel_apply_overlay" ] && $deviceinfo_kernel_apply_overlay; then - [ -d libufdt ] || git clone https://android.googlesource.com/platform/system/libufdt -b pie-gsi --depth 1 - [ -d dtc ] || git clone https://android.googlesource.com/platform/external/dtc -b pie-gsi --depth 1 - fi - ls . -cd "$HERE" - -if [ -n "$deviceinfo_kernel_apply_overlay" ] && $deviceinfo_kernel_apply_overlay; then - "$SCRIPT/build-ufdt-apply-overlay.sh" "${TMPDOWN}" -fi - -if [ -n "$deviceinfo_kernel_clang_compile" ] && $deviceinfo_kernel_clang_compile; then - CC=clang \ - CLANG_TRIPLE=${deviceinfo_arch}-linux-gnu- \ - PATH="$CLANG_PATH/bin:$GCC_PATH/bin:$GCC_ARM32_PATH/bin:${PATH}" \ - "$SCRIPT/build-kernel.sh" "${TMPDOWN}" "${TMP}/system" -else - PATH="$GCC_PATH/bin:$GCC_ARM32_PATH/bin:${PATH}" \ - "$SCRIPT/build-kernel.sh" "${TMPDOWN}" "${TMP}/system" -fi - -"$SCRIPT/make-bootimage.sh" "${TMPDOWN}/KERNEL_OBJ" "${TMPDOWN}/halium-boot-ramdisk.img" "${TMP}/partitions/boot.img" - -cp -av overlay/* "${TMP}/" -"$SCRIPT/build-tarball-mainline.sh" "${deviceinfo_codename}" "${OUT}" "${TMP}" - -if [ -z "$BUILD_DIR" ]; then - rm -r "${TMP}" - rm -r "${TMPDOWN}" -fi - -echo "done" +[ -d build ] || git clone https://gitlab.com/ubports/community-ports/halium-generic-adaptation-build-tools build +./build/build.sh "$@" diff --git a/build/build-kernel.sh b/build/build-kernel.sh deleted file mode 100755 index 3634382..0000000 --- a/build/build-kernel.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -set -ex - -TMPDOWN=$1 -INSTALL_MOD_PATH=$2 -HERE=$(pwd) -source "${HERE}/deviceinfo" - -KERNEL_DIR="${TMPDOWN}/$(basename "${deviceinfo_kernel_source}")" -KERNEL_DIR="${KERNEL_DIR%.*}" -OUT="${TMPDOWN}/KERNEL_OBJ" - -mkdir -p "$OUT" - -case "$deviceinfo_arch" in - aarch64*) ARCH="arm64" ;; - arm*) ARCH="arm" ;; - x86_64) ARCH="x86_64" ;; - x86) ARCH="x86" ;; -esac - -export ARCH -export CROSS_COMPILE=$TMPDOWN/aarch64-linux-android-4.9/bin/aarch64-linux-android- -export CROSS_COMPILE_ARM32=$TMPDOWN/arm-linux-androideabi-4.9/bin/arm-linux-androideabi- -MAKEOPTS="" -if [ -n "$CC" ]; then - MAKEOPTS="CC=$CC" -fi - -cd "$KERNEL_DIR" -make O="$OUT" $deviceinfo_kernel_defconfig -make O="$OUT" $MAKEOPTS -j$(nproc --all) -make O="$OUT" $MAKEOPTS INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH="$INSTALL_MOD_PATH" modules_install -ls "$OUT/arch/$ARCH/boot/"*Image* - -if [ -n "$deviceinfo_kernel_apply_overlay" ] && $deviceinfo_kernel_apply_overlay; then - ${TMPDOWN}/ufdt_apply_overlay "$OUT/arch/arm64/boot/dts/qcom/${deviceinfo_kernel_appended_dtb}.dtb" \ - "$OUT/arch/arm64/boot/dts/qcom/${deviceinfo_kernel_dtb_overlay}.dtbo" \ - "$OUT/arch/arm64/boot/dts/qcom/${deviceinfo_kernel_dtb_overlay}-merged.dtb" - cat "$OUT/arch/$ARCH/boot/Image.gz" \ - "$OUT/arch/arm64/boot/dts/qcom/${deviceinfo_kernel_dtb_overlay}-merged.dtb" > "$OUT/arch/$ARCH/boot/Image.gz-dtb" -fi diff --git a/build/build-tarball-mainline.sh b/build/build-tarball-mainline.sh deleted file mode 100755 index 078e378..0000000 --- a/build/build-tarball-mainline.sh +++ /dev/null @@ -1,18 +0,0 @@ -set -ex - -device=$1 -output=$(realpath $2) -dir=$(realpath $3) - -echo "Working on device: $device" -if [ ! -f "$dir/partitions/boot.img" ]; then - echo "boot.img does not exist!" -exit 1; fi - -if [ ! -f "$dir/partitions/recovery.img" ]; then - echo "recovery.img does not exist!" -#exit 1 -fi - -tar -cJf "$output/device_"$device".tar.xz" -C $dir partitions/ system/ -echo "$(date +%Y%m%d)-$RANDOM" > "$output/device_"$device".tar.build" diff --git a/build/build-ufdt-apply-overlay.sh b/build/build-ufdt-apply-overlay.sh deleted file mode 100755 index 96df00b..0000000 --- a/build/build-ufdt-apply-overlay.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -set -ex - -SOURCES=$1 - -cd "$SOURCES" -cat > Makefile <<'EOF' -CFLAGS = -Ilibufdt/include -Ilibufdt/sysdeps/include -Idtc/libfdt -OBJS_APPLY = libufdt/tests/src/util.o libufdt/tests/src/ufdt_overlay_test_app.o -OBJS_UFDT = libufdt/ufdt_convert.o libufdt/ufdt_node_pool.o libufdt/ufdt_prop_dict.o libufdt/ufdt_node.o libufdt/ufdt_overlay.o libufdt/sysdeps/libufdt_sysdeps_posix.o -OBJS_FDT = dtc/libfdt/fdt_addresses.o dtc/libfdt/fdt_overlay.o dtc/libfdt/fdt_strerror.o dtc/libfdt/fdt.o dtc/libfdt/fdt_ro.o dtc/libfdt/fdt_sw.o dtc/libfdt/fdt_empty_tree.o dtc/libfdt/fdt_rw.o dtc/libfdt/fdt_wip.o - -all: ufdt_apply_overlay - -ufdt_apply_overlay: $(OBJS_APPLY) $(OBJS_UFDT) $(OBJS_FDT) - $(CC) -o $@ $(LDFLAGS) $(OBJS_APPLY) $(OBJS_UFDT) $(OBJS_FDT) - -clean: - $(RM) ufdt_apply_overlay $(OBJS_APPLY) $(LDFLAGS) $(OBJS_UFDT) $(OBJS_FDT) -EOF - -make ufdt_apply_overlay diff --git a/build/fetch-and-prepare-latest-ota.sh b/build/fetch-and-prepare-latest-ota.sh deleted file mode 100755 index 8010a75..0000000 --- a/build/fetch-and-prepare-latest-ota.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash - -# Fetches and prepares latest ota update from system server - -URL='https://system-image.ubports.com' - -CHANNEL="$1" -DEVICE="$2" -OUTPUT="$3" - -mkdir -p "$OUTPUT" || true - -download_file_and_asc() { - wget "$1" -P "$2" - wget "$1.asc" -P "$2" -} - -# Gets the latest image from the system-image server -latest_image=$(wget -qO- "${URL}/${CHANNEL}/${DEVICE}/index.json" | jq '.images | map(select(.type == "full")) | sort_by(.version) | .[-1]') - -# Gets a list of files to download -files=$(echo "${latest_image}" | jq --raw-output '.files[].path') - -# Downloads master and signing keyrings -download_file_and_asc "${URL}/gpg/image-signing.tar.xz" "$OUTPUT" -download_file_and_asc "${URL}/gpg/image-master.tar.xz" "$OUTPUT" - -# Start to generate ubuntu_command file -echo '# Generated by ubports rootfs-builder-debos' > "$OUTPUT/ubuntu_command" - -cat << EOF >> "$OUTPUT/ubuntu_command" -format system -load_keyring image-master.tar.xz image-master.tar.xz.asc -load_keyring image-signing.tar.xz image-signing.tar.xz.asc -mount system -EOF - -# Download and fill ubuntu_command -for file_path in ${files}; do - file=$(basename ${file_path}) - download_file_and_asc "${URL}/${file_path}" "$OUTPUT" - echo "update $file $file.asc" >> "$OUTPUT/ubuntu_command" -done - -# End ubuntu_command -echo 'unmount system' >> "$OUTPUT/ubuntu_command" diff --git a/build/make-bootimage.sh b/build/make-bootimage.sh deleted file mode 100755 index e15970f..0000000 --- a/build/make-bootimage.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash -set -ex - -KERNEL_OBJ=$(realpath $1) -RAMDISK=$(realpath $2) -OUT=$(realpath $3) - -HERE=$(pwd) -source "${HERE}/deviceinfo" - -case "$deviceinfo_arch" in - aarch64*) ARCH="arm64" ;; - arm*) ARCH="arm" ;; - x86_64) ARCH="x86_64" ;; - x86) ARCH="x86" ;; -esac - -if [ -d "$HERE/ramdisk-overlay" ]; then - cp "$RAMDISK" "${RAMDISK}-merged" - RAMDISK="${RAMDISK}-merged" - cd "$HERE/ramdisk-overlay" - find . | cpio -o -H newc | gzip >> "$RAMDISK" -fi - -if [ -d "$HERE/recovery/overlay" ] && [ -e "$HERE/recovery/ramdisk-recovery.img" ]; then - mkdir -p "$HERE/ramdisk-recovery" - cd "$HERE/ramdisk-recovery" - - gzip -dc "$HERE/recovery/ramdisk-recovery.img" | cpio -i - cp -r "$HERE/recovery/overlay"/* "$HERE/ramdisk-recovery" - - # Set values in prop.default based on deviceinfo - sed -i 's/^\(ro\.product\.\(vendor\.\)\?brand=\).*$/\1'"$deviceinfo_manufacturer"'/' prop.default - sed -i 's/^\(ro\.product\.\(vendor\.\)\?manufacturer=\).*$/\1'"$deviceinfo_manufacturer"'/' prop.default - sed -i 's/^\(ro\.product\.vendor\.name=\).*$/\1'"$deviceinfo_manufacturer"'/' prop.default - - sed -i 's/^\(ro\.product\.\(vendor\.\)\?device=\).*$/\1'"$deviceinfo_codename"'/' prop.default - sed -i 's/^\(ro\.product\.name=\).*$/\1'"$deviceinfo_codename"'/' prop.default - sed -i 's/^\(ro\.build\.product=\).*$/\1'"$deviceinfo_codename"'/' prop.default - - sed -i 's/^\(ro\.product\.\(vendor\.\)\?model=\).*$/\1'"$deviceinfo_name"'/' prop.default - - find . | cpio -o -H newc | gzip > "$HERE/recovery/ramdisk-recovery-overlayed.img" -fi - -mkbootimg --kernel "$KERNEL_OBJ/arch/$ARCH/boot/Image.gz-dtb" --ramdisk "$RAMDISK" --base $deviceinfo_flash_offset_base --kernel_offset $deviceinfo_flash_offset_kernel --ramdisk_offset $deviceinfo_flash_offset_ramdisk --second_offset $deviceinfo_flash_offset_second --tags_offset $deviceinfo_flash_offset_tags --pagesize $deviceinfo_flash_pagesize --os_version $deviceinfo_os_version --os_patch_level $deviceinfo_os_patch_level --cmdline "$deviceinfo_kernel_cmdline" -o "$OUT" - -mkbootimg --kernel "$KERNEL_OBJ/arch/$ARCH/boot/Image.gz-dtb" --ramdisk "$HERE/recovery/ramdisk-recovery-overlayed.img" --base $deviceinfo_flash_offset_base --kernel_offset $deviceinfo_flash_offset_kernel --ramdisk_offset $deviceinfo_flash_offset_ramdisk --second_offset $deviceinfo_flash_offset_second --tags_offset $deviceinfo_flash_offset_tags --pagesize $deviceinfo_flash_pagesize --os_version $deviceinfo_os_version --os_patch_level $deviceinfo_os_patch_level --cmdline "$deviceinfo_kernel_cmdline" -o "$(dirname $OUT)/recovery.img" diff --git a/build/prepare-fake-ota.sh b/build/prepare-fake-ota.sh deleted file mode 100755 index b012e14..0000000 --- a/build/prepare-fake-ota.sh +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/bash - -# Fetches android9 rootfs and generic system image to prepare flashable image from CI-built device tarball -URL='https://system-image.ubports.com' -ROOTFS_URL='https://ci.ubports.com/job/xenial-hybris-android9-rootfs-arm64/lastSuccessfulBuild/artifact/ubuntu-touch-android9-arm64.tar.gz' -DEVICE_GENERIC_URL='https://ci.ubports.com/job/UBportsCommunityPortsJenkinsCI/job/ubports%252Fcommunity-ports%252Fjenkins-ci%252Fgeneric_arm64/job/main/lastSuccessfulBuild/artifact/halium_halium_arm64.tar.xz' -OTA_CHANNEL='16.04/arm64/android9/devel' - -DEVICE_TARBALL="$1" -OUTPUT="$2" - -mkdir -p "$OUTPUT" || true - -download_file_and_asc() { - wget "$1" -P "$2" - wget "$1.asc" -P "$2" -} - -# Downloads master and signing keyrings -download_file_and_asc "${URL}/gpg/image-signing.tar.xz" "$OUTPUT" -download_file_and_asc "${URL}/gpg/image-master.tar.xz" "$OUTPUT" - -# Start to generate ubuntu_command file -echo '# Generated by ubports rootfs-builder-debos' > "$OUTPUT/ubuntu_command" - -cat << EOF >> "$OUTPUT/ubuntu_command" -format system -load_keyring image-master.tar.xz image-master.tar.xz.asc -load_keyring image-signing.tar.xz image-signing.tar.xz.asc -mount system -EOF - -# Download and prepare rootfs -file=$(basename "$ROOTFS_URL") -wget "$ROOTFS_URL" -P "$OUTPUT" -mkdir -p "$OUTPUT/rootfs/system" -cd "$OUTPUT/rootfs" -sudo tar xpzf "../$file" --numeric-owner -C system -sudo XZ_OPT=-1 tar cJf "../rootfs.tar.xz" system -cd - -sudo rm -rf "./$OUTPUT/rootfs" - -file="rootfs.tar.xz" -touch "$OUTPUT/$file.asc" -echo "update $file $file.asc" >> "$OUTPUT/ubuntu_command" - -# Device-generic tarball (Halium GSI) -file=$(basename "$DEVICE_GENERIC_URL") -wget "$DEVICE_GENERIC_URL" -P "$OUTPUT" -touch "$OUTPUT/$file.asc" -echo "update $file $file.asc" >> "$OUTPUT/ubuntu_command" - -# Device tarball -file=$(basename "$DEVICE_TARBALL") -cp "$DEVICE_TARBALL" "$OUTPUT" -touch "$OUTPUT/$file.asc" -echo "update $file $file.asc" >> "$OUTPUT/ubuntu_command" - -device=${file%%.*} # remove extension from device tarball -device=${device##*_} # remove part before _ - -# Version tarball -mkdir "$OUTPUT/version" -cd "$OUTPUT/version" -mkdir -p system/etc/system-image -cat << EOF >> system/etc/system-image/channel.ini -[service] -base: system-image.ubports.com -http_port: 80 -https_port: 443 -channel: $OTA_CHANNEL -device: $device -EOF - -mkdir -p system/etc/system-image/config.d -ln -s ../client.ini system/etc/system-image/config.d/00_default.ini -ln -s ../channel.ini system/etc/system-image/config.d/01_channel.ini -tar cvJf "../version.tar.xz" system -cd - -rm -r "$OUTPUT/version" - -file="version.tar.xz" -touch "$OUTPUT/$file.asc" -echo "update $file $file.asc" >> "$OUTPUT/ubuntu_command" - -# End ubuntu_command -echo 'unmount system' >> "$OUTPUT/ubuntu_command" diff --git a/build/system-image-from-ota.sh b/build/system-image-from-ota.sh deleted file mode 100755 index 4ec7823..0000000 --- a/build/system-image-from-ota.sh +++ /dev/null @@ -1,304 +0,0 @@ -#!/bin/sh -# Based on https://raw.githubusercontent.com/ubports/Jumpdrive/ubports-recovery/initramfs/system-image-upgrader -# Modified and simplified to create flashable system.img from OTA files -set -e - -HERE=$(pwd) -SRC="$(realpath $(dirname "$1" 2>/dev/null || echo 'src'))" -OUT="$(realpath "$2" 2>/dev/null || echo 'out')" - -logit() { - echo "System image: $1" - echo "System image: $1" >> /tmp/system-image/system-image-upgrader.log -} - -mkdir -p /tmp/system-image -echo "-- System image log --" > /tmp/system-image/system-image-upgrader.log -logit "Starting image Upgrade pre" -if [ ! -e "$1" ]; then - logit "Command file doesn't exist: $1" - exit 1 -fi - -COMMAND_FILE=$(realpath "$1") - -REMOVE_LIST="$COMMAND_FILE" - -# Used as a security check to see if we would change the password -DATA_FORMAT=0 - -TMP=$(mktemp -d -p /tmp/system-image) -mkdir -p "$OUT" - -# System Mountpoint -SYSTEM_MOUNTPOINT="$TMP/system" -mkdir -p "$SYSTEM_MOUNTPOINT" - -logit "Starting image upgrader: $(date)" - -TOTAL=$(cat $COMMAND_FILE | wc -l) - -progress() { - # Devide by 0 will make go boom! - if [ "$1" == "0" ]; then - # echo "0" > cmd_pipe - @ - fi - PRE=$(awk -vn="$1" -vt="$TOTAL" 'BEGIN{printf("%.0f\n",n/t*100)}') - # echo "$PRE" > cmd_pipe -} - -# Functions -check_filesystem() { - return 0 -} - -verify_signature() { - return 0 -} - -install_keyring() { - # $1 => full path to tarball - # $2 => full path to signature - - # Some basic checks - if [ ! -e "$1" ] || [ ! -e "$2" ]; then - logit "Missing keyring files: $1 => $2" - return 1 - fi - - # Unpacking - TMPDIR=$(mktemp -dt -p /tmp/system-image/ tmp.XXXXXXXXXX) - cd $TMPDIR - xzcat $1 | tar --numeric-owner -xf - - if [ ! -e keyring.json ] || [ ! -e keyring.gpg ]; then - rm -Rf $TMPDIR - logit "Invalid keyring: $1" - return 1 - fi - - # Extract the expiry - keyring_expiry=$(grep "^ \"expiry\": " keyring.json | cut -d: -f2 | sed -e "s/[ \",]//g") - if [ -n "$keyring_expiry" ] && [ "$keyring_expiry" -lt "$(date +%s)" ]; then - rm -Rf $TMPDIR - logit "Keyring expired: $1" - return 1 - fi - - # Extract the keyring type - keyring_type=$(grep "^ \"type\": " keyring.json | cut -d: -f2 | sed -e "s/[, \"]//g") - if [ -z "$keyring_type" ]; then - rm -Rf $TMPDIR - logit "Missing keyring type: $1" - return 1 - fi - - if [ -e /tmp/system-image/$keyring_type ]; then - rm -Rf $TMPDIR - logit "Keyring already loaded: $1" - return 1 - fi - - signer="unknown" - case "$keyring_type" in - archive-master) - signer="" - ;; - - image-master) - signer="archive-master" - ;; - - image-signing|blacklist) - signer="image-master" - ;; - - device-signing) - signer="image-signing" - ;; - esac - - if [ -n "$signer" ] && ! verify_signature $signer $2; then - rm -Rf $TMPDIR - logit "Invalid signature: $1" - return 1 - fi - - mkdir /tmp/system-image/$keyring_type - # chmod 700 /tmp/system-image/$keyring_type - mv $TMPDIR/keyring.gpg /tmp/system-image/$keyring_type/pubring.gpg - # chmod 600 /tmp/system-image/$keyring_type/pubring.gpg - # chown 0:0 /tmp/system-image/$keyring_type/pubring.gpg - rm -Rf $TMPDIR - return 0 -} - -factory_wipe() { - # only set this flag if coming from a data wipe - if [ "$DATA_FORMAT" -eq 0 ]; then - return 1 - fi - - flag="/data/.factory_wipe" - # if the param != "true" we just delete the flag - case $1 in - true) - touch "$flag" - ;; - - false) - rm -f "$flag" - ;; - - *) - logit "Unkown parameter $1, disabling" - rm -f "$flag" - ;; - esac -} - -# Initialize GPG -rm -Rf /tmp/system-image -mkdir -p /tmp/system-image -if [ -e /etc/system-image/archive-master.tar.xz ]; then - logit "Loading keyring: archive-master.tar.xz" - install_keyring /etc/system-image/archive-master.tar.xz /etc/system-image/archive-master.tar.xz.asc -fi - -# Process the command file -FULL_IMAGE=0 -logit "Processing the command file" - -count=0 -while read line -do - set -- $line - case "$1" in - format) - logit "Formating: $2" - case "$2" in - system) - FULL_IMAGE=1 - rm -f "$OUT/rootfs.img" - dd if=/dev/zero of="$OUT/rootfs.img" seek=750K bs=4096 count=0 - mkfs.ext4 -F "$OUT/rootfs.img" - ;; - - *) - logit "Unknown format target: $2" - ;; - esac - ;; - - load_keyring) - if [ ! -e "$SRC/$2" ] || [ ! -e "$SRC/$3" ]; then - logit "Skipping missing file: $SRC/$2" - continue - fi - REMOVE_LIST="$REMOVE_LIST $SRC/$2 $SRC/$3" - - logit "Loading keyring: $2" - install_keyring $SRC/$2 $SRC/$3 - ;; - - mount) - case "$2" in - system) - mkdir -p "$SYSTEM_MOUNTPOINT" - LOOPDEV=$(losetup -f) - - if [ ! -e "$LOOPDEV" ]; then - sudo mknod "$LOOPDEV" b 7 $(echo "$LOOPDEV" | grep -Eo '[0-9]+$') - sudo losetup "$LOOPDEV" "$OUT/rootfs.img" - sudo mount "$LOOPDEV" "$SYSTEM_MOUNTPOINT/" - else - sudo mount -o loop "$OUT/rootfs.img" "$SYSTEM_MOUNTPOINT/" - fi - ;; - - *) - logit "Unknown mount target: $2" - ;; - esac - ;; - - unmount) - case "$2" in - system) - sudo umount "$SYSTEM_MOUNTPOINT" - rmdir "$SYSTEM_MOUNTPOINT" - # Create fastboot flashable image - img2simg "$OUT/rootfs.img" "$OUT/system.img" - ;; - - *) - logit "Unknown mount target: $2" - ;; - esac - ;; - - update) - if [ ! -e "$SRC/$2" ] || [ ! -e "$SRC/$3" ]; then - logit "Skipping missing file: $2" - continue - fi - - REMOVE_LIST="$REMOVE_LIST $SRC/$3" - - if ! verify_signature device-signing $SRC/$3 && \ - ! verify_signature image-signing $SRC/$3; then - logit "Invalid signature" - exit 1 - fi - - logit "Applying update: $2" - cd "$TMP" - rm -Rf partitions - - # Start by removing any file listed in "removed" - if [ "$FULL_IMAGE" != "1" ]; then - xzcat "$SRC/$2" | tar --numeric-owner -xf - removed >/dev/null 2>&1 || true - if [ -e removed ]; then - while read file; do - rm -Rf $file - done < removed - fi - rm -f removed - fi - - # Unpack everything else on top of the system partition - sudo sh -c "xzcat \"$SRC/$2\" | tar --numeric-owner -xf -" - rm -f removed - - # Move things to data - cp partitions/* "$OUT" || true - sudo rm -Rf partitions || true - - # Remove tarball to free up space, since device tarballs - # extract partitions/blobs that might fill up cache, - # this way we ensure we got space for the partitions/blobs - # rm -f recovery/$2 - ;; - - *) - logit "Unknown command: $1" - ;; - esac - - count=$((count+=1)) - progress $count -done < $COMMAND_FILE - -if [ -e "$LOOPDEV" ]; then - sudo losetup -d "$LOOPDEV" || true -fi - -# Remove the update files -#for file in $REMOVE_LIST; do -# rm -f $file -#done -logit "Can be removed: $REMOVE_LIST" - -sync - -logit "Done upgrading: $(date)" diff --git a/deviceinfo b/deviceinfo index d22e36f..7284e32 100644 --- a/deviceinfo +++ b/deviceinfo @@ -2,8 +2,7 @@ deviceinfo_name="Mi 6" deviceinfo_manufacturer="Xiaomi" deviceinfo_codename="sagit" deviceinfo_arch="aarch64" -deviceinfo_os_version="9.0.0" -deviceinfo_os_patch_level="2018-12" +deviceinfo_halium_version="9" deviceinfo_kernel_source="https://gitlab.com/ubports/community-ports/android9/xiaomi-mi-6/android_kernel_xiaomi_msm8998.git" deviceinfo_kernel_source_branch="halium-9.0" deviceinfo_kernel_defconfig="sagit_defconfig" @@ -11,7 +10,11 @@ deviceinfo_kernel_cmdline="androidboot.console=ttyMSM0 androidboot.hardware=qcom deviceinfo_kernel_clang_compile="false" deviceinfo_kernel_apply_overlay="false" deviceinfo_generate_bootimg="true" +deviceinfo_bootimg_header_version="1" +deviceinfo_bootimg_os_version="9" +deviceinfo_bootimg_os_patch_level="2018-12" deviceinfo_bootimg_qcdt="false" +deviceinfo_system_partition_size="5120M" deviceinfo_flash_offset_base="0x00000000" deviceinfo_flash_offset_kernel="0x00008000" deviceinfo_flash_offset_ramdisk="0x01000000" diff --git a/overlay/system/etc/default/usb-moded.d/device-specific-config.conf b/overlay/system/etc/default/usb-moded.d/device-specific-config.conf new file mode 100644 index 0000000..46f963c --- /dev/null +++ b/overlay/system/etc/default/usb-moded.d/device-specific-config.conf @@ -0,0 +1,8 @@ +IDVENDOR=18D1 +IDPRODUCT_MTP=F003 +IDPRODUCT_MTP_ADB=9011 +IDPRODUCT_RNDIS=F00E +IDPRODUCT_RNDIS_ADB=9024 +MANUFACTURER=Xiaomi +PRODUCT=Xiaomi6 +USB_MODED_ARGS= diff --git a/overlay/system/etc/deviceinfo/devices/halium.yaml b/overlay/system/etc/deviceinfo/devices/halium.yaml new file mode 100644 index 0000000..e4d1d39 --- /dev/null +++ b/overlay/system/etc/deviceinfo/devices/halium.yaml @@ -0,0 +1,27 @@ +sagit: + Names: + - mi6 + - MI6 + - Xiaomi 6 + + PrettyName: Xiaomi 6 + DeviceType: phone + GridUnit: 24 + SupportedOrientations: + - Portrait + - Landscape + - InvertedLandscape + MirAndroidPlatformServerBackpressure: + - false + MirAndroidPlatformServerPartialUpdates: + - true + MirAndroidPlatformServerEglSync: + - false + MirAndroidPlatformClientEglFlush: + - "!/usr/bin/unity8,!/usr/bin/lomiri,all" + + FlashlightSysfsPath: "/sys/class/leds/led:torch_0/brightness" + FlashlightSwitchPath: "/sys/class/leds/led:switch_0/brightness" + DoubleTapToWake: "/sys/devices/platform/goodix_ts.0/gesture/double_en|1|0" + OfonoPlugin: binder + OfonoImplementsIms: true diff --git a/overlay/system/etc/gbinder.conf b/overlay/system/etc/gbinder.conf new file mode 100644 index 0000000..d88b701 --- /dev/null +++ b/overlay/system/etc/gbinder.conf @@ -0,0 +1,2 @@ +[General] +ApiLevel = 28 diff --git a/overlay/system/etc/ofono/binder.d/qti.conf b/overlay/system/etc/ofono/binder.d/qti.conf new file mode 100644 index 0000000..e7a8e47 --- /dev/null +++ b/overlay/system/etc/ofono/binder.d/qti.conf @@ -0,0 +1,14 @@ +# This device do have 2 slots, but the other is eSIM only and we currently do not have +# a way to install or modify those +[Settings] +ExpectSlots = slot1 +extPlugin = qti +radioInterface = 1.1 + +[slot1] +path = /ril_0 +slot = 0 + +[slot2] +path = /ril_1 +slot = 1 diff --git a/overlay/system/etc/ofono/main.conf b/overlay/system/etc/ofono/main.conf deleted file mode 100644 index cff37d0..0000000 --- a/overlay/system/etc/ofono/main.conf +++ /dev/null @@ -1,2 +0,0 @@ -[ModemManager] -AutoSelectDataSim=always diff --git a/overlay/system/etc/ofono/phonesim.conf b/overlay/system/etc/ofono/phonesim.conf deleted file mode 100644 index 74bb645..0000000 --- a/overlay/system/etc/ofono/phonesim.conf +++ /dev/null @@ -1,14 +0,0 @@ -# This is a sample file for the phonesim configuration -# -# It should be installed in your oFono system directory, -# e.g. /etc/ofono/phonesim.conf -# -# Each group is parsed as a modem device -# -# Each group shall at least define the address and port -# Address = -# Port = - -#[phonesim] -#Address=127.0.0.1 -#Port=12345 diff --git a/overlay/system/etc/ofono/ril_subscription.d/sagit.conf b/overlay/system/etc/ofono/ril_subscription.d/sagit.conf index 94b2098..36c743c 100644 --- a/overlay/system/etc/ofono/ril_subscription.d/sagit.conf +++ b/overlay/system/etc/ofono/ril_subscription.d/sagit.conf @@ -17,4 +17,4 @@ name=slot1 [ril_1] transport=binder:name=slot2 -name=slot2 +name=slot2 diff --git a/overlay/system/etc/ubuntu-touch-session.d/android.conf b/overlay/system/etc/ubuntu-touch-session.d/android.conf deleted file mode 100644 index 55a28d1..0000000 --- a/overlay/system/etc/ubuntu-touch-session.d/android.conf +++ /dev/null @@ -1,3 +0,0 @@ -GRID_UNIT_PX=21 -QTWEBKIT_DPR=2.0 -FORM_FACTOR=handset diff --git a/overlay/system/etc/umtprd/umtprd.conf b/overlay/system/etc/umtprd/umtprd.conf new file mode 100644 index 0000000..995e268 --- /dev/null +++ b/overlay/system/etc/umtprd/umtprd.conf @@ -0,0 +1,46 @@ +# +# uMTP Responder config file +# + +# UBports: Don't show hidden files +show_hidden_files 0 + +# UBports: Use phablet user as default for all storage file operations +default_uid 32011 +default_gid 32011 + +# Add home folder as default "internal storage" entry +storage "/home/phablet" "Internal Storage" "rw,locked" + +# Set the USB strings visible to host systems +manufacturer "Volla" +product "Volla Phone X23" +# FIXME: set to something proper! +serial "UT2004" + +# Set the MTP firmware version +firmware_version "Rev A" + +# Set the USB interface string. Should be always "MTP" +interface "MTP" + +# Set the USB Vendor ID, Product ID and class +# FIXME: set to something proper! +usb_vendor_id 0x1D6B # Linux Foundation +usb_product_id 0x0100 # PTP Gadget +usb_class 0x6 # Image +usb_subclass 0x1 # Still Imaging device +usb_protocol 0x1 # + +# Device version +usb_dev_version 0x3008 + +# Generic FunctionFS Mode +usb_functionfs_mode 0x1 + +usb_dev_path "/dev/usb-ffs/mtp/ep0" +usb_epin_path "/dev/usb-ffs/mtp/ep1" +usb_epout_path "/dev/usb-ffs/mtp/ep2" +usb_epint_path "/dev/usb-ffs/mtp/ep3" + +usb_max_packet_size 0x200 diff --git a/overlay/system/lib/udev/rules.d/70-sagit.rules b/overlay/system/usr/lib/udev/rules.d/70-sagit.rules similarity index 100% rename from overlay/system/lib/udev/rules.d/70-sagit.rules rename to overlay/system/usr/lib/udev/rules.d/70-sagit.rules diff --git a/overlay/system/usr/share/halium-overlay/vendor/etc/init/hw/init.qcom.rc b/overlay/system/usr/share/halium-overlay/vendor/etc/init/hw/init.qcom.rc new file mode 100644 index 0000000..5846d2d --- /dev/null +++ b/overlay/system/usr/share/halium-overlay/vendor/etc/init/hw/init.qcom.rc @@ -0,0 +1,393 @@ +# Copyright (c) 2009-2012, 2014-2017, The Linux Foundation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of The Linux Foundation nor +# the names of its contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +import /vendor/etc/init/hw/init.qcom.usb.rc +import /vendor/etc/init/hw/init.target.rc +import /vendor/etc/init/hw/init.target.performance.rc +import /vendor/etc/init/init.parts.rc +import /vendor/etc/init/hw/init.sagit.rc + +import /init.spectrum.rc + +on early-init + mount debugfs debugfs /sys/kernel/debug + chmod 0755 /sys/kernel/debug + +on post-fs + chmod 0755 /sys/kernel/debug/tracing + + chmod 0664 /sys/devices/virtual/graphics/fb0/idle_time + chown system graphics /sys/devices/virtual/graphics/fb0/idle_time + write /sys/devices/virtual/graphics/fb0/idle_time 100 + +on post-fs-data + mkdir /data/vendor/misc 01771 system system + + # Create directory used by display clients + mkdir /data/vendor/display 0770 system graphics + + # Change lm related dirs + mkdir /data/vendor/lm 0700 root root + + # Create directory used by media clients + mkdir /data/vendor/media 0770 mediacodec media + + # Create directory for TZ Apps + mkdir /data/misc/qsee 0770 system system + + # Create directory for apps access via QTEEConnector + mkdir /data/vendor/qtee 0770 system system + + # Create folder for mm-qcamera-daemon + mkdir /data/misc/camera 0770 camera camera + setprop persist.camera.stats.test 5 + + # Create directories for tombstones + mkdir /data/tombstones/modem 0771 system system + mkdir /data/tombstones/lpass 0771 system system + mkdir /data/tombstones/wcnss 0771 system system + mkdir /data/tombstones/dsps 0771 system system + + # Create directory for tftp + mkdir /data/vendor/tombstones 0771 system system + + mkdir /data/vendor/ramdump 0771 root system + mkdir /data/vendor/bluetooth 0770 bluetooth bluetooth + mkdir /data/vendor/ramdump/bluetooth 0770 bluetooth bluetooth + + # Create the directories used by the Wireless subsystem + mkdir /data/vendor/wifi 0770 wifi wifi + mkdir /data/vendor/wifi/sockets 0770 wifi wifi + mkdir /data/vendor/wifi/hostapd 0770 wifi wifi + mkdir /data/vendor/wifi/hostapd/ctrl 0770 wifi wifi + mkdir /data/vendor/wifi/wpa_supplicant 0770 wifi wifi + mkdir /data/vendor/wifi/wpa 0770 wifi wifi + mkdir /data/vendor/wifi/wpa/sockets 0770 wifi wifi + + # Create netmgr log dir + mkdir /data/vendor/netmgr 0770 radio radio + + # Create ipacm log dir + mkdir /data/vendor/ipa 0770 radio radio + + #Create QTI dir for logs + mkdir /data/vendor/dataqti 0770 radio radio + + # Create the directories used by CnE subsystem + mkdir /data/vendor/connectivity 0771 radio radio + + # Create directory used by audio subsystem + mkdir /data/vendor/misc/audio 0770 audio audio + mkdir /data/vendor/misc/audio/acdbdata 0770 media audio + mkdir /data/vendor/misc/audio/acdbdata/delta 0770 media audio + + # Create directory for radio + mkdir /data/vendor/radio 0770 system radio + + # Create directories for Location services + mkdir /data/vendor/location 0770 gps gps + mkdir /data/vendor/location/mq 0770 gps gps + mkdir /data/vendor/location/xtwifi 0770 gps gps + mkdir /dev/socket/location 0770 gps gps + mkdir /dev/socket/location/mq 0770 gps gps + mkdir /dev/socket/location/xtra 0770 gps gps + + # SSC/SLPI sensors + mkdir /mnt/vendor/persist/sensors 0775 system root + write /mnt/vendor/persist/sensors/sensors_settings 1 + chown system root /mnt/vendor/persist/sensors/sensors_settings + chmod 0664 /mnt/vendor/persist/sensors/sensors_settings + chown system system /mnt/vendor/persist/PRSensorData.txt + chmod 0600 /mnt/vendor/persist/PRSensorData.txt + + setprop vold.post_fs_data_done 1 + + # Create perfd related dirs + mkdir /data/system/perfd 0770 root system + chmod 2770 /data/system/perfd + + # Create /data/vendor/time folder for time-services + mkdir /data/vendor/time/ 0700 system system + + # Mark the copy complete flag to not completed + write /data/vendor/radio/copy_complete 0 + chown radio radio /data/vendor/radio/copy_complete + chmod 0660 /data/vendor/radio/copy_complete + + # Setup permission for powerHAL + chown system system /dev/stune/top-app/schedtune.boost + chown system system /dev/cpu_dma_latency + chown system system /sys/class/kgsl/kgsl-3d0/devfreq/min_freq + chown system system /sys/class/kgsl/kgsl-3d0/devfreq/max_freq + chown system system /sys/class/devfreq/soc:qcom,gpubw/min_freq + chown system system /sys/devices/soc/soc:qcom,cpubw/devfreq/soc:qcom,cpubw/min_freq + +on early-boot + chown system graphics /sys/class/graphics/fb0/idle_time + chown system graphics /sys/class/graphics/fb0/dyn_pu + chown system graphics /sys/class/graphics/fb0/dynamic_fps + chown system graphics /sys/class/graphics/fb0/modes + chown system graphics /sys/class/graphics/fb0/mode + chown system graphics /sys/class/graphics/fb0/msm_cmd_autorefresh_en + chmod 0664 /sys/class/graphics/fb0/idle_time + chmod 0664 /sys/class/graphics/fb0/dyn_pu + chmod 0664 /sys/class/graphics/fb0/dynamic_fps + chmod 0664 /sys/class/graphics/fb0/modes + chmod 0664 /sys/class/graphics/fb0/mode + chmod 0664 /sys/class/graphics/fb0/msm_cmd_autorefresh_en + + chown system graphics /sys/class/graphics/fb0/msm_fb_persist_mode + chown system graphics /sys/class/graphics/fb0/lineptr_value + chmod 0664 /sys/class/graphics/fb0/msm_fb_persist_mode + chmod 0664 /sys/class/graphics/fb0/lineptr_value + + chown system graphics /sys/class/graphics/fb1/msm_fb_persist_mode + chown system graphics /sys/class/graphics/fb1/lineptr_value + chmod 0664 /sys/class/graphics/fb1/msm_fb_persist_mode + chmod 0664 /sys/class/graphics/fb1/lineptr_value + + # SSR setup + write /sys/bus/msm_subsys/devices/subsys0/restart_level "related" + write /sys/bus/msm_subsys/devices/subsys1/restart_level "related" + write /sys/bus/msm_subsys/devices/subsys2/restart_level "related" + write /sys/bus/msm_subsys/devices/subsys3/restart_level "related" + write /sys/bus/msm_subsys/devices/subsys4/restart_level "related" + write /sys/bus/msm_subsys/devices/subsys5/restart_level "related" + write /sys/bus/msm_subsys/devices/subsys6/restart_level "related" + +on boot + chown bluetooth net_bt /sys/class/rfkill/rfkill0/device/extldo + chown bluetooth net_bt /sys/class/rfkill/rfkill0/state + chown bluetooth net_bt /sys/class/rfkill/rfkill0/type + chmod 0660 /sys/class/rfkill/rfkill0/device/extldo + chmod 0660 /sys/class/rfkill/rfkill0/state + + chown system system /sys/module/msm_core/parameters/polling_interval + chown system system /sys/module/msm_core/parameters/disabled + chown system system /sys/kernel/debug/msm_core/enable + chown system system /sys/kernel/debug/msm_core/ptable + + # Create QMUX deamon socket area + mkdir /dev/socket/qmux_radio 2770 radio radio + mkdir /dev/socket/qmux_audio 2770 media audio + mkdir /dev/socket/qmux_bluetooth 2770 bluetooth bluetooth + mkdir /dev/socket/qmux_gps 2770 gps gps + + # Create NETMGR daemon socket area + mkdir /dev/socket/netmgr 0750 radio radio + + # KeyDisabler permissions + chown system system /sys/devices/soc/soc:fingerprint_fpc/enable_key_events + chown system system /sys/devices/soc/soc:fingerprint_goodix/enable_key_events + chmod 0660 /sys/devices/soc/soc:fingerprint_fpc/enable_key_events + chmod 0660 /sys/devices/soc/soc:fingerprint_goodix/enable_key_events + + chown system system /proc/touchpanel/capacitive_keys_enable + chown system system /proc/touchpanel/reversed_keys_enable + chown system system /proc/touchpanel/wake_gesture + chmod 0660 /proc/touchpanel/capacitive_keys_enable + chmod 0660 /proc/touchpanel/reversed_keys_enable + chmod 0660 /proc/touchpanel/wake_gesture + + # sweep2sleep permissions + chown system system /sys/sweep2sleep/vib_strength + chown system system /sys/sweep2sleep/sweep2sleep + + # USB Fastcharge + chown system system /sys/kernel/fast_charge/force_fast_charge + chmod 0660 /sys/kernel/fast_charge/force_fast_charge + + # KCAL permissions + chown system system /sys/devices/platform/kcal_ctrl.0/kcal + chown system system /sys/devices/platform/kcal_ctrl.0/kcal_enable + chown system system /sys/devices/platform/kcal_ctrl.0/kcal_cont + chown system system /sys/devices/platform/kcal_ctrl.0/kcal_sat + chown system system /sys/devices/platform/kcal_ctrl.0/kcal_hue + chown system system /sys/devices/platform/kcal_ctrl.0/kcal_min + chown system system /sys/devices/platform/kcal_ctrl.0/kcal_val + chmod 0660 /sys/devices/platform/kcal_ctrl.0/kcal + chmod 0660 /sys/devices/platform/kcal_ctrl.0/kcal_enable + chmod 0660 /sys/devices/platform/kcal_ctrl.0/kcal_cont + chmod 0660 /sys/devices/platform/kcal_ctrl.0/kcal_sat + chmod 0660 /sys/devices/platform/kcal_ctrl.0/kcal_hue + chmod 0660 /sys/devices/platform/kcal_ctrl.0/kcal_min + chmod 0660 /sys/devices/platform/kcal_ctrl.0/kcal_val + + # DT2W + chown system system /dev/input/event1 + chmod 0666 /dev/input/event1 + + # Assign TCP buffer thresholds to be ceiling value of technology maximums + # Increased technology maximums should be reflected here. + write /proc/sys/net/core/rmem_max 8388608 + write /proc/sys/net/core/wmem_max 8388608 + + # To prevent out of order acknowledgements from making + # connection tracking to treat them as not belonging to + # the connection they belong to. + # Otherwise, a weird issue happens in which some long + # connections on high-throughput links get dropped when + # an ack packet comes out of order + write /proc/sys/net/netfilter/nf_conntrack_tcp_be_liberal 1 + + # Wifi firmware reload path + chown wifi wifi /sys/module/wlan/parameters/fwpath + +on property:sys.boot_completed=1 + # Used by sound trigger HAL + chown media audio /sys/kernel/wdsp0/boot + chown media audio /sys/kernel/wcd_cpe0/fw_name + +service vendor.cnd /vendor/bin/cnd + class main + user system + group system wifi inet radio wakelock net_admin + writepid /dev/cpuset/system-background/tasks + +service vendor.dpmQmiMgr /vendor/bin/dpmQmiMgr + class main + user system + group system + +service vendor.irsc_util /vendor/bin/irsc_util "/vendor/etc/sec_config" + class core + user root + oneshot + writepid /dev/cpuset/system-background/tasks + +service vendor.rmt_storage /vendor/bin/rmt_storage + class core + user root + shutdown critical + ioprio rt 0 + +service vendor.tftp_server /vendor/bin/tftp_server + class core + user root + group root system + +on property:sys.post_boot.parsed=1 + # Setup permission for powerHAL + chown system system /sys/devices/soc/soc:qcom,cpubw/devfreq/soc:qcom,cpubw/bw_hwmon/hyst_trigger_count + chown system system /sys/devices/soc/soc:qcom,cpubw/devfreq/soc:qcom,cpubw/bw_hwmon/hist_memory + chown system system /sys/devices/soc/soc:qcom,cpubw/devfreq/soc:qcom,cpubw/bw_hwmon/hyst_length + +service vendor.atfwd /vendor/bin/ATFWD-daemon + class late_start + user system + group system radio + writepid /dev/cpuset/system-background/tasks + +service vendor.netmgrd /vendor/bin/netmgrd + class main + writepid /dev/cpuset/system-background/tasks + +service vendor.ipacm /vendor/bin/ipacm + class main + user radio + group radio inet + writepid /dev/cpuset/system-background/tasks + +service vendor.dataqti /vendor/bin/qti + class main + user radio + group radio oem_2901 diag usb net_admin + writepid /dev/cpuset/system-background/tasks + +service vendor.sensors /vendor/bin/sensors.qti + class main + user root + group root + writepid /dev/cpuset/system-background/tasks + +service wpa_supplicant /vendor/bin/hw/wpa_supplicant \ + -O/data/vendor/wifi/wpa/sockets -puse_p2p_group_interface=1 \ + -g@android:wpa_wlan0 + interface android.hardware.wifi.supplicant@1.0::ISupplicant default + interface android.hardware.wifi.supplicant@1.1::ISupplicant default + class main + socket wpa_wlan0 dgram 660 wifi wifi + disabled + oneshot + writepid /dev/cpuset/system-background/tasks + +service vendor.cnss-daemon /vendor/bin/cnss-daemon -n -l + class late_start + user system + group system inet net_admin wifi + capabilities NET_ADMIN + writepid /dev/cpuset/system-background/tasks + +on property:sys.shutdown.requested=* + stop vendor.cnss-daemon + +service vendor.loc_launcher /vendor/bin/loc_launcher + class late_start + user gps + group gps + writepid /dev/cpuset/system-background/tasks + +service vendor.qcom-sh /vendor/bin/init.qcom.sh + class late_start + user root + oneshot + +service vendor.qcom-post-boot /vendor/bin/init.qcom.post_boot.sh + class late_start + user root + disabled + oneshot + +service vendor.panel-info /vendor/bin/init.panel_info.sh + class core + user root + oneshot + +service vendor.ril-daemon2 /vendor/bin/hw/rild -c 2 + class main + socket rild2 stream 660 root radio + socket rild-debug2 stream 660 radio system + user radio + group radio cache inet misc audio sdcard_r sdcard_rw diag log + capabilities BLOCK_SUSPEND NET_ADMIN NET_RAW + +service charger /charger + class charger + group system graphics + seclabel u:r:healthd:s0 + +service vendor.msm_irqbalance /vendor/bin/msm_irqbalance -f /vendor/etc/msm_irqbalance.conf + class core + user root + group root + +service vendor.time_daemon /vendor/bin/time_daemon + disabled + class main + user root + group root + writepid /dev/cpuset/system-background/tasks