[Sony Xperia XZ Premium Guides, News, & Discussion] munjeni:
I'm unsure right now but can you chech this:

default.prop:

ro.loader.production=true
ro.loader.test=false

init.rc:

on early-init
# Mount debug file system
mount debugfs debugfs /sys/kernel/debug
# Set init and its forked children's oom_adj.
write /proc/1/oom_score_adj -1000

start ueventd

on init
chmod 755 /system/bin/loader
chmod 744 adb.sh
chmod 744 loader.sh
export PATH /sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin
export ANDROID_BOOTLOGO 1
export ANDROID_ROOT /system
export ANDROID_DATA /data

sysclktz 0
loglevel 3

symlink /system/etc /etc
symlink /sys/kernel/debug /d
mkdir /system
mkdir /data 0771 system system
mkdir /cache 0770 system cache
mkdir /config 0770 root root
mkdir /etc/firmware
mkdir /dev/fs 0777 shell shell
mkdir /tmp/ldr
mkdir /tmp/ldr/boot

mount configfs none /config
setprop sys.usb.controller "a800000.dwc3"

# extract tzloader apps
exec u:r:toolbox:s0 -- /system/bin/toybox tar -xf /dev/block/bootdevice/by-name/tzxfl -C /etc/firmware

mkdir /config/usb_gadget/g1 0770 shell shell
mkdir /config/usb_gadget/g1/strings/0x409 0770 shell shell
write /config/usb_gadget/g1/bcdUSB 0x0200
write /config/usb_gadget/g1/os_desc/use 1
write /config/usb_gadget/g1/strings/0x409/serialnumber
write /config/usb_gadget/g1/strings/0x409/manufacturer "Sony"
write /config/usb_gadget/g1/strings/0x409/product "Android"
mkdir /config/usb_gadget/g1/functions/ffs.adb
mkdir /config/usb_gadget/g1/functions/ffs.serial
mkdir /config/usb_gadget/g1/configs/b.1 0770 shell shell
mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell
write /config/usb_gadget/g1/os_desc/b_vendor_code 0x1
write /config/usb_gadget/g1/os_desc/qw_sign "MSFT100"
symlink /config/usb_gadget/g1/configs/b.1 /config/usb_gadget/g1/os_desc/b.1

# Increase min_free_kbytes to reduce risk of getting out of memory when doing USB read.
# The value 56766 was created by adding 12*4096 to the default value of 7614. I.e. we
# add 12 4MB buffers and this seems to be big enough for our use case.
write /proc/sys/vm/min_free_kbytes 56766

class_start core
class_start main
setprop fs.serial_adb 1

on property:sys.powerctl=*
powerctl ${sys.powerctl}

on property:ro.loader.production=false
setprop ro.debuggable 1
setprop service.adb.root 1

on property:ro.debuggable=1
# Change reset behavior to warm reset
write /sys/kernel/debug/spmi/spmi-0/address 0x846
write /sys/kernel/debug/spmi/spmi-0/data 0x01
write /sys/kernel/debug/spmi/spmi-0/address 0x2085a
write /sys/kernel/debug/spmi/spmi-0/data 0x01)
start console

on property:fs.serial_adb=1 && property:ro.loader.production=false
mkdir /dev/usb-ffs 0770 shell shell
mkdir /dev/usb-ffs/adb 0770 shell shell
mount functionfs serial /dev/fs uid=2000,gid=2000
mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000
start logd
start loader-dbg
start adbd

on property:fs.serial_adb=1 && property:ro.loader.production=true
mkdir /dev/usb-ffs 0770 shell shell
mount functionfs serial /dev/fs uid=2000,gid=2000
start loader

on property:fs.serial_adb=1 && property:ro.loader.production=false && property:ro.loader.test=true
mkdir /dev/usb-ffs 0770 shell shell
mkdir /dev/usb-ffs/adb 0770 shell shell
mount functionfs adb /dev/adb uid=2000,gid=2000
start adbd

on property:sys.usb.ffs.ready=1 && property:ro.loader.production=true && property:ro.loader.test=false
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "serial"
rm /config/usb_gadget/g1/configs/b.1/f1
rm /config/usb_gadget/g1/configs/b.1/f2
write /config/usb_gadget/g1/idVendor 0x0FCE
write /config/usb_gadget/g1/idProduct 0xB00B
symlink /config/usb_gadget/g1/functions/ffs.serial /config/usb_gadget/g1/configs/b.1/f1
write /config/usb_gadget/g1/UDC ${sys.usb.controller}

on property:sys.usb.ffs.ready=1 && property:ro.loader.production=false && property:ro.loader.test=false
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "serial_adb"
rm /config/usb_gadget/g1/configs/b.1/f1
rm /config/usb_gadget/g1/configs/b.1/f2
write /config/usb_gadget/g1/idVendor 0x0FCE
write /config/usb_gadget/g1/idProduct 0xB00B
symlink /config/usb_gadget/g1/functions/ffs.serial /config/usb_gadget/g1/configs/b.1/f1
symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2
write /config/usb_gadget/g1/UDC ${sys.usb.controller}

on property:sys.usb.ffs.ready=1 && property:ro.loader.production=false && property:ro.loader.test=true
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "adb"
rm /config/usb_gadget/g1/configs/b.1/f1
rm /config/usb_gadget/g1/configs/b.1/f2
write /config/usb_gadget/g1/idVendor 0x0FCE
write /config/usb_gadget/g1/idProduct 0xB00B
symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f2
write /config/usb_gadget/g1/UDC ${sys.usb.controller}

service console /system/bin/sh
class core
disabled
console
seclabel u:r:shell:s0

## Daemon processes to be run by init.
##

service adbd /sbin/adbd
class main
socket adbd stream 660 system system
disabled
seclabel u:r:adbd:s0

service ueventd /sbin/ueventd
class core
critical
seclabel u:r:ueventd:s0

service loader-dbg /system/bin/logwrapper -k /system/bin/loader -g/dev/fs -llog.log -sufs
class main
disabled
oneshot
seclabel u:r:s1loader:s0

service loader /system/bin/loader -g/dev/fs -llog.log -sufs
class main
disabled
oneshot
seclabel u:r:s1loader:s0

service loader-trf /system/bin/loader -g/fbcmd -llog.log -sufs
class main
disabled
oneshot
seclabel u:r:s1loader:s0

[COLOR="Red"]service stty /system/bin/busybox stty -F /dev/ttyHSL0 115200
oneshot
seclabel u:r:s1loader:s0[/COLOR]

service gdbserver /system/bin/gdbserver --multi /dev/ttyHSL0
seclabel u:r:s1loader:s0

service gdbserver64 /system/bin/gdbserver64 --multi /dev/ttyHSL0
seclabel u:r:s1loader:s0

service logd /system/bin/logd
socket logd stream 0666 logd logd
socket logdr seqpacket 0666 logd logd
socket logdw dgram 0222 logd logd
group root system readproc
writepid /dev/cpuset/system-background/tasks
seclabel u:r:shell:s0

kernel.cmdline:

androidboot.hardware=qcom user_debug=31 msm_rtb.filter=0x237 ehci-hcd.park=3 lpm_levels.sleep_disabled=1 sched_enable_hmp=1 sched_enable_power_aware=1 service_locator.enable=1 swiotlb=2048 androidboot.configfs=true androidboot.usbcontroller=a800000.dwc3 zram.backend=z3fold buildvariant=userdebug androidboot.selinux=permissive

I'm unsure if adb is started in uart mode, but I'm believing we can start it with (setprop ro.loader.production false)? Selinux is in permissive mode! :)

Edit:

Did you check if serial device is available during s1 mode inside your linux machine? See red part!