[Xiaomi Mi A2 Lite Guides, News, & Discussion] robotusr:
I'm in the way but I've found some problems to create the new device tree.

Because daisy doesn't exists yet on remote repos, I need to create the device tree as new.

The way I've found is to use mkvendor.sh. After it, we can use extractfiles.sh to extract propietary blobs.

Extracted boot.img and get script from git because it does not coming more with lineageos (cannot make otatools).

Errors in the script (tested with unpack_bootimg and unmkbootimg):

cat: /tmp/bootimg/boot.img-base: No such file or directory

cat: /tmp/bootimg/boot.img-cmdline: No such file or directory

cat: /tmp/bootimg/boot.img-pagesize: No such file or directory

cp: `stat' '/tmp/bootimg/boot.img-zImage': No such file or directory

mv: `stat' '/home/robotusr/android/lineage/device/xiaomi/daisy_prout/device.mk': No such file or directory

Seems that the script is not working correctly.

Maybe we need to modifiy it. This is the code:

#!/bin/bash

function usage
{
echo Usage:
echo " $(basename $0) manufacturer device [boot.img]"
echo " The boot.img argument is the extracted recovery or boot image."
echo " The boot.img argument should not be provided for devices"
echo " that have non standard boot images (ie, Samsung)."
echo
echo Example:
echo " $(basename $0) motorola sholes ~/Downloads/recovery-sholes.img"
exit 0
}

MANUFACTURER=$1
DEVICE=$2
BOOTIMAGE=$3

UNPACKBOOTIMG=$(which unpack_bootimg)

if [ -z "$MANUFACTURER" ]
then
usage
fi

if [ -z "$DEVICE" ]
then
usage
fi

ANDROID_TOP=$(dirname $0)/../../../
pushd $ANDROID_TOP > /dev/null
ANDROID_TOP=$(pwd)
popd > /dev/null

TEMPLATE_DIR=$(dirname $0)
pushd $TEMPLATE_DIR > /dev/null
TEMPLATE_DIR=$(pwd)
popd > /dev/null

DEVICE_DIR=$ANDROID_TOP/device/$MANUFACTURER/$DEVICE

if [ ! -z "$BOOTIMAGE" ]
then
if [ -z "$UNPACKBOOTIMG" ]
then
echo unpackbootimg not found. Is your android build environment set up and have the host tools been built?
exit 0
fi

BOOTIMAGEFILE=$(basename $BOOTIMAGE)

echo Output will be in $DEVICE_DIR
mkdir -p $DEVICE_DIR

TMPDIR=/tmp/bootimg
rm -rf $TMPDIR
mkdir -p $TMPDIR
cp $BOOTIMAGE $TMPDIR
pushd $TMPDIR > /dev/null
unpack_bootimg --boot_img $BOOTIMAGEFILE > /dev/null
BASE=$(cat $TMPDIR/$BOOTIMAGEFILE-base)
CMDLINE=$(cat $TMPDIR/$BOOTIMAGEFILE-cmdline)
PAGESIZE=$(cat $TMPDIR/$BOOTIMAGEFILE-pagesize)
export SEDCMD="s#__CMDLINE__#$CMDLINE#g"
echo $SEDCMD > $TMPDIR/sedcommand
cp $TMPDIR/$BOOTIMAGEFILE-zImage $DEVICE_DIR/kernel
popd > /dev/null

RECOVERY_FSTAB=$TMPDIR/ramdisk/etc/recovery.fstab
if [ -f "$RECOVERY_FSTAB" ]
then
cp $RECOVERY_FSTAB $DEVICE_DIR/recovery.fstab
fi

else
mkdir -p $DEVICE_DIR
touch $DEVICE_DIR/kernel
BASE=10000000
CMDLINE=no_console_suspend
PAGESIZE=00000800
export SEDCMD="s#__CMDLINE__#$CMDLINE#g"
echo $SEDCMD > $TMPDIR/sedcommand
fi

for file in $(find $TEMPLATE_DIR -name '*.template')
do
OUTPUT_FILE=$DEVICE_DIR/$(basename $(echo $file | sed s/\\.template//g))
cat $file | sed s/__DEVICE__/$DEVICE/g | sed s/__MANUFACTURER__/$MANUFACTURER/g | sed -f $TMPDIR/sedcommand | sed s/__BASE__/$BASE/g | sed s/__PAGE_SIZE__/$PAGESIZE/g > $OUTPUT_FILE
done

mv $DEVICE_DIR/device.mk $DEVICE_DIR/device_$DEVICE.mk

echo Done!
echo Use the following command to set up your build environment:
echo ' 'lunch full_$DEVICE-eng
echo And use the follwowing command to build a recovery:
echo ' '. build/tools/device/makerecoveries.sh full_$DEVICE-eng

Regards,

Daniel