Khadas edge2 with TS050 about screen rotation

I want to know how to rotate like normally android phone view (vertical)

I tried rotate controll app & Edge2 Devce physically rotate…

But I cant use normal android viertical view…


It is portrait mode by rotation app

and landscape mode


kedge2:/ # more system/build.prop
####################################
# from generate-common-build-props
# These properties identify this partition image.
####################################
ro.product.system.brand=rockchip
ro.product.system.device=kedge2
ro.product.system.manufacturer=Khadas
ro.product.system.model=Edge2
ro.product.system.name=kedge2
ro.system.product.cpu.abilist=arm64-v8a,armeabi-v7a,armeabi
ro.system.product.cpu.abilist32=armeabi-v7a,armeabi
ro.system.product.cpu.abilist64=arm64-v8a
ro.system.build.date=Tue Sep 20 17:12:31 CST 2022
ro.system.build.date.utc=1663665151
ro.system.build.fingerprint=rockchip/kedge2/kedge2:12/SQ3A.220605.009.B1/haylrn0
9201712:userdebug/release-keys
ro.system.build.id=SQ3A.220605.009.B1
ro.system.build.tags=release-keys
ro.system.build.type=userdebug
ro.system.build.version.incremental=eng.haylrn.20220920.171310
ro.system.build.version.release=12
ro.system.build.version.release_or_codename=12
ro.system.build.version.sdk=32
####################################
# from out/target/product/kedge2/obj/PACKAGING/system_build_prop_intermediates/b
uildinfo.prop
####################################
# begin build properties
# autogenerated by buildinfo.sh
ro.build.id=SQ3A.220605.009.B1
ro.build.display.id=kedge2-userdebug 12 SQ3A.220605.009.B1 eng.haylrn.20220920.1
71310 release-keys
ro.build.version.incremental=eng.haylrn.20220920.171310
ro.build.version.sdk=32
ro.build.version.preview_sdk=0
ro.build.fingerprint=OnePlus/OnePlus6/OnePlus6:8.1.0/OPM1.171019.011/06140300:us
er/release-keys
ro.build.version.codename=REL
ro.build.version.all_codenames=REL
ro.build.version.release=12
ro.build.version.release_or_codename=12
ro.build.version.security_patch=2022-06-05
ro.build.version.base_os=
ro.build.version.min_supported_target_sdk=23
ro.build.date=Tue Sep 20 17:12:31 CST 2022
ro.build.date.utc=1663665151
ro.build.type=userdebug
ro.build.user=haylrn
ro.build.host=server
ro.build.tags=release-keys
ro.build.flavor=kedge2-userdebug
# ro.product.cpu.abi and ro.product.cpu.abi2 are obsolete,
# use ro.product.cpu.abilist instead.
ro.product.cpu.abi=arm64-v8a
ro.product.locale=en-US
ro.wifi.channels=
# ro.build.product is obsolete; use ro.product.device
ro.build.product=kedge2
# Do not try to parse description or thumbprint
ro.build.description=kedge2-userdebug 12 SQ3A.220605.009.B1 eng.haylrn.20220920.
171310 release-keys
# end build properties
####################################
# from device/khadas/common/build/rockchip/rksdk.prop
####################################
ro.vendor.rk_sdk=1
ro.sys.host_unhide_charge_notify=true
####################################
# from variable ADDITIONAL_SYSTEM_PROPERTIES
####################################
# Removed by post_process_props.py because ro.product.first_api_level is a disal
lowed key
#ro.product.first_api_level=31
ro.treble.enabled=true
ro.actionable_compatible_property.enabled=true
persist.debug.dalvik.vm.core_platform_api_policy=just-warn
ro.postinstall.fstab.prefix=/system
ro.secure=1
security.perf_harden=1
ro.allow.mock.location=0
ro.debuggable=1
dalvik.vm.lockprof.threshold=500
net.bt.name=Android
####################################
# from variable PRODUCT_SYSTEM_PROPERTIES
####################################
debug.atrace.tags.enableflags=0
persist.traced.enable=1
dalvik.vm.image-dex2oat-Xms=64m
dalvik.vm.image-dex2oat-Xmx=64m
dalvik.vm.dex2oat-Xms=64m
dalvik.vm.dex2oat-Xmx=512m
dalvik.vm.usejit=true
dalvik.vm.usejitprofiles=true
dalvik.vm.dexopt.secondary=true
dalvik.vm.dexopt.thermal-cutoff=2
dalvik.vm.appimageformat=lz4
ro.dalvik.vm.native.bridge=0
pm.dexopt.first-boot=verify
pm.dexopt.boot-after-ota=verify
pm.dexopt.post-boot=extract
pm.dexopt.install=speed-profile
pm.dexopt.install-fast=skip
pm.dexopt.install-bulk=speed-profile
pm.dexopt.install-bulk-secondary=verify
pm.dexopt.install-bulk-downgraded=verify
pm.dexopt.install-bulk-secondary-downgraded=extract
pm.dexopt.bg-dexopt=speed-profile
pm.dexopt.ab-ota=speed-profile
pm.dexopt.inactive=verify
pm.dexopt.cmdline=verify
pm.dexopt.shared=speed
dalvik.vm.dex2oat-updatable-bcp-packages-file=/system/etc/updatable-bcp-packages
.txt
dalvik.vm.dex2oat-resolve-startup-strings=true
dalvik.vm.dex2oat-max-image-block-size=524288
dalvik.vm.minidebuginfo=true
dalvik.vm.dex2oat-minidebuginfo=true
ro.iorapd.enable=true
dalvik.vm.madvise.vdexfile.size=104857600
dalvik.vm.madvise.odexfile.size=104857600
dalvik.vm.madvise.artfile.size=4294967295
####################################
# from variable PRODUCT_SYSTEM_DEFAULT_PROPERTIES
####################################
# Auto-added by post_process_props.py
persist.sys.usb.config=adb

++ I tried

Connect ADB

 settings put system user_rotation 0  (0,1,2,3)
4 is Invalid value```

@re_roy The firmware defaults to HDMI as the main screen and mipi as the secondary screen. When rotating, the secondary screen is only rotated in a zooming way. However, your requirement environment needs to change the mipi to the main screen, so you need to make the following modifications:

--- a/kedge2/kedge2.mk
+++ b/kedge2/kedge2.mk
@@ -48,12 +48,12 @@ PRODUCT_PROPERTY_OVERRIDES += ro.sf.lcd_density=240
 PRODUCT_PROPERTY_OVERRIDES += ro.wifi.sleep.power.down=true
 PRODUCT_PROPERTY_OVERRIDES += persist.wifi.sleep.delay.ms=0
 PRODUCT_PROPERTY_OVERRIDES += persist.bt.power.down=true
-PRODUCT_PROPERTY_OVERRIDES += vendor.hwc.device.primary=HDMI-A,DP
-PRODUCT_PROPERTY_OVERRIDES += vendor.hwc.device.extend=DSI
+PRODUCT_PROPERTY_OVERRIDES += vendor.hwc.device.primary=DSI
+PRODUCT_PROPERTY_OVERRIDES += vendor.hwc.device.extend=HDMI-A,DP

could you explain how to modifiy kedge2.mk ?

is it possiblee useing ADB?

kedge2:/ # ls
acct        d              init             odm          sdcard                  vendor
apex        data           init.environ.rc  odm_dlkm     second_stage_resources  vendor_dlkm
bin         data_mirror    linkerconfig     oem          storage
bugreports  debug_ramdisk  lost+found       postinstall  sys
cache       dev            metadata         proc         system
config      etc            mnt              product      system_ext

It is work!!

I EDIT

  • vendor.hwc.device.primary=HDMI-A,DP → DSI
  • vendor.hwc.device.extend=DSI → HDMI-A,DP
  • persist.vendor.framebuffer.main=1920x1080@60 → 1080x1920@60

finally display show portrait mode correctly

BUT there are Touch-pannel Upside down problem

1 Like

@re_roy Modify the corresponding tp drive–kernel-5.10/drivers/input/touchscreen/edt-ft5x06.c
image

Thank you for replying

I found “edt_ft5x06” folder not “edt-ft5x06.c”

I tried

adb shell
cd ~
find . */edt*

# result:
d/edt_ft5x06
d/edt_ft5x06/raw_data
d/edt_ft5x06/mode
d/edt_ft5x06/num_y
d/edt_ft5x06/num_x

I think if i change mode value 0 to 1 then touch screen work correctly

But mode value changing didn’t work

@re_roy You need to download the code to compile. The adb cannot be modified. Please be informed.

could you explain how to compile & applying

@re_roy Edge2 Build Android [Khadas Docs]

If i want to use portrait mode default then I have to build Android Img??

1 Like

If i want to use portrait mode default then I have to build Android Img??===>yes

1 Like

Okay Let’s go!!! to build android Img

I follow the android build solution But i got error message…

I use ubuntu 18.04 (64bit)

When i try this command

./build.sh -AUCKu

This error occurred

  LZ4C    arch/arm64/boot/Image.lz4
Incorrect parameters
Usage :
      lz4 [arg] [input] [output]

input   : a filename
          with no FILE, or when FILE is - or stdin, read standard input
Arguments :
 -1     : Fast compression (default) 
 -9     : High compression 
 -d     : decompression (default for .lz4 extension)
 -z     : force compression
 -f     : overwrite output without prompting 
 -h/-H  : display help/long help and exit
arch/arm64/boot/Makefile:31: recipe for target 'arch/arm64/boot/Image.lz4' failed
make[2]: *** [arch/arm64/boot/Image.lz4] Error 1
make[2]: *** Deleting file 'arch/arm64/boot/Image.lz4'
arch/arm64/Makefile:170: recipe for target 'Image.lz4' failed
make[1]: *** [Image.lz4] Error 2
make[1]: *** Waiting for unfinished jobs....
  LD [M]  drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_static_buf.ko
  LD [M]  drivers/net/phy/realtek.ko
  LD [M]  drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/bcmdhd.ko
  LD [M]  drivers/media/usb/gspca/gspca_main.ko
  LD [M]  drivers/net/ethernet/realtek/r8168/r8168.ko
arch/arm64/Makefile:214: recipe for target 'rk3588s-khadas-edge2.img' failed
make: *** [rk3588s-khadas-edge2.img] Error 2

#### failed to build some targets (05:58 (mm:ss)) ####

**Build kernel failed!**


@re_roy Have you finished all the preparatory work?

1 Like

Yes

Install ubuntu → source.android.com → download source code → install toolchains

then I modify “drive–kernel-5.10/drivers/input/touchscreen/edt-ft5x06.c”

and run

./build.sh -AUCKu

I try BUILD U-Boot

then i got error message

********boot_merger ver 1.2********
Info:Pack loader ok.
pack loader okay! Input: /home/alpha/edge2/rkbin/RKBOOT/RK3588MINIALL.ini
/home/alpha/edge2/u-boot

Image(no-signed, version=0): uboot.img (FIT with uboot, trust...) is ready
Image(no-signed): rk3588_spl_loader_v1.08.111.bin (with spl, ddr...) is ready
pack uboot.img okay! Input: /home/alpha/edge2/rkbin/RKTRUST/RK3588TRUST.ini

Platform RK3588 is build OK, with new .config(make kedge2_defconfig -j24)
/home/alpha/edge2/prebuilts/gcc/linux-x86/aarch64/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
2022. 12. 03. (토) 12:25:19 KST
/home/alpha/edge2
Build uboot ok!
package resoure.img with charger images

ERROR: No ../kernel-5.10/resource.img
Repacking header 2 boot...
./build.sh: line 208: mkbootfs: command not found
./build.sh: line 208: /home/alpha/edge2/out/target/product/kedge2/ramdisk.img: No such file or directory
usage: mkbootimg [-h] --kernel KERNEL [--ramdisk RAMDISK] [--second SECOND]
                 [--cmdline CMDLINE] [--base BASE]
                 [--kernel_offset KERNEL_OFFSET]
                 [--ramdisk_offset RAMDISK_OFFSET]
                 [--second_offset SECOND_OFFSET] [--os_version OS_VERSION]
                 [--os_patch_level OS_PATCH_LEVEL] [--tags_offset TAGS_OFFSET]
                 [--board BOARD] [--pagesize {2048,4096,8192,16384}] [--id] -o
                 OUTPUT
mkbootimg: error: argument --kernel: can't open '/home/alpha/edge2/out/target/product/kedge2/kernel': [Errno 2] No such file or directory: '/home/alpha/edge2/out/target/product/kedge2/kernel'
make and copy android images
./build.sh: line 215: ./mkimage.sh: No such file or directory
Make image failed!

This is my process. Did I miss anything?

1. Ubuntu 18.04(64bit) Installing required packages

sudo apt-get update
sudo apt-get install git-core gnupg flex bison build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 libncurses5 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev libgl1-mesa-dev libxml2-utils xsltproc unzip fontconfig

2. download Sourcecode

sudo apt install git-lfs

mkdir -p edge2
cd edge2

repo init -u https://github.com/khadas/android_manifest.git -b khadas-edge2-android12

repo sync -j4

cd external/camera_engine_rkaiq
git lfs pull
cd ~/edge2/prebuilts/module_sdk
git lfs pull
cd ~/edge2/device/khadas/rk3588
git lfs pull

repo start new_edge2 --all

3. edit source code edt (drive–kernel-5.10/drivers/input/touchscreen/edt-ft5x06.c)

# line number: 72
# define TP_CHANGE_X2Y   1  -->  # define TP_CHANGE_X2Y   0 
:wq!

4. install toolchain

sudo apt-get install bison g++-multilib git gperf libxml2-utils make python-networkx zip
sudo apt-get install flex curl libncurses5-dev libssl-dev zlib1g-dev gawk minicom
sudo apt-get install exfat-fuse exfat-utils device-tree-compiler liblz4-tool
sudo apt-get install openjdk-8-jdk

5. Try Build

cd ~/edge2
source build/envsetup.sh
lunch kedge2-userdebug
./build.sh -AUCKu

Then error…

error Build U-Boot

********boot_merger ver 1.2********
Info:Pack loader ok.
pack loader okay! Input: /home/alpha/edge2/rkbin/RKBOOT/RK3588MINIALL.ini
/home/alpha/edge2/u-boot

Image(no-signed, version=0): uboot.img (FIT with uboot, trust...) is ready
Image(no-signed): rk3588_spl_loader_v1.08.111.bin (with spl, ddr...) is ready
pack uboot.img okay! Input: /home/alpha/edge2/rkbin/RKTRUST/RK3588TRUST.ini

Platform RK3588 is build OK, with new .config(make kedge2_defconfig -j24)
/home/alpha/edge2/prebuilts/gcc/linux-x86/aarch64/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
2022. 12. 03. (토) 12:25:19 KST
/home/alpha/edge2
Build uboot ok!
package resoure.img with charger images

ERROR: No ../kernel-5.10/resource.img
Repacking header 2 boot...
./build.sh: line 208: mkbootfs: command not found
./build.sh: line 208: /home/alpha/edge2/out/target/product/kedge2/ramdisk.img: No such file or directory
usage: mkbootimg [-h] --kernel KERNEL [--ramdisk RAMDISK] [--second SECOND]
                 [--cmdline CMDLINE] [--base BASE]
                 [--kernel_offset KERNEL_OFFSET]
                 [--ramdisk_offset RAMDISK_OFFSET]
                 [--second_offset SECOND_OFFSET] [--os_version OS_VERSION]
                 [--os_patch_level OS_PATCH_LEVEL] [--tags_offset TAGS_OFFSET]
                 [--board BOARD] [--pagesize {2048,4096,8192,16384}] [--id] -o
                 OUTPUT
mkbootimg: error: argument --kernel: can't open '/home/alpha/edge2/out/target/product/kedge2/kernel': [Errno 2] No such file or directory: '/home/alpha/edge2/out/target/product/kedge2/kernel'
make and copy android images
./build.sh: line 215: ./mkimage.sh: No such file or directory
Make image failed!

error Build kernel

  CC [M]  drivers/media/usb/gspca/gspca_main.mod.o
  CC [M]  drivers/net/ethernet/realtek/r8168/r8168.mod.o
  CC [M]  drivers/net/phy/realtek.mod.o
  CC [M]  drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/bcmdhd.mod.o
  CC [M]  drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_static_buf.mod.o
  LZ4C    arch/arm64/boot/Image.lz4
Incorrect parameters
Usage :
      lz4 [arg] [input] [output]

input   : a filename
          with no FILE, or when FILE is - or stdin, read standard input
Arguments :
 -1     : Fast compression (default) 
 -9     : High compression 
 -d     : decompression (default for .lz4 extension)
 -z     : force compression
 -f     : overwrite output without prompting 
 -h/-H  : display help/long help and exit
arch/arm64/boot/Makefile:31: recipe for target 'arch/arm64/boot/Image.lz4' failed
make[2]: *** [arch/arm64/boot/Image.lz4] Error 1
make[2]: *** Deleting file 'arch/arm64/boot/Image.lz4'
arch/arm64/Makefile:170: recipe for target 'Image.lz4' failed
make[1]: *** [Image.lz4] Error 2
make[1]: *** Waiting for unfinished jobs....
  LD [M]  drivers/net/phy/realtek.ko
  LD [M]  drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_static_buf.ko
  LD [M]  drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/bcmdhd.ko
  LD [M]  drivers/media/usb/gspca/gspca_main.ko
  LD [M]  drivers/net/ethernet/realtek/r8168/r8168.ko
arch/arm64/Makefile:214: recipe for target 'rk3588s-khadas-edge2.img' failed
make: *** [rk3588s-khadas-edge2.img] Error 2

#### failed to build some targets (05:28 (mm:ss)) ####

Build kernel failed!

error Build Android

will build android
will build update.img
-------------------KERNEL_VERSION:5.10
-------------------KERNEL_DTS:rk3588s-khadas-edge2
Force use clang and llvm to build kernel-5.10

============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=12
TARGET_PRODUCT=kedge2
TARGET_BUILD_VARIANT=userdebug
TARGET_BUILD_TYPE=release
TARGET_ARCH=arm64
TARGET_ARCH_VARIANT=armv8-a
TARGET_CPU_VARIANT=generic
TARGET_2ND_ARCH=arm
TARGET_2ND_ARCH_VARIANT=armv8-a
TARGET_2ND_CPU_VARIANT=generic
HOST_ARCH=x86_64
HOST_2ND_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-5.4.0-135-generic-x86_64-Ubuntu-18.04.6-LTS
HOST_CROSS_OS=windows
HOST_CROSS_ARCH=x86
HOST_CROSS_2ND_ARCH=x86_64
HOST_BUILD_TYPE=release
BUILD_ID=SQ3A.220605.009.B1
OUT_DIR=out
============================================
package resoure.img with charger images

ERROR: No ../kernel-5.10/resource.img
start build android
make: *** No rule to make target 'installclean'.  Stop.

#### failed to build some targets  ####

  CHK     include/config/uboot.release
  CHK     include/generated/timestamp_autogenerated.h
  UPD     include/generated/timestamp_autogenerated.h
  CHK     include/config.h
  CFG     u-boot.cfg
cc1: error: unknown register name: x18 [-Werror]
cc1: all warnings being treated as errors
scripts/Makefile.autoconf:79: recipe for target 'u-boot.cfg' failed
make[1]: *** [u-boot.cfg] Error 1
Makefile:521: recipe for target 'u-boot.cfg' failed
make: *** [u-boot.cfg] Error 2
make: *** Waiting for unfinished jobs....

#### failed to build some targets (1 seconds) ####

Build android failed!

could you recommand other android os (default portrait mode)

The version of libz4 in ubuntu18 is relatively old, which is inconsistent with the latest parameters.
Try this command again.

sudo apt-get remove  liblz4-tool

Download the latest version:

sudo make install

1 Like

Thank you for your advice!!

It is work!!

Build U-Boot is Okay!!

Build kernel is Okay too!!

But… Build Android Failed

[ 85% 14539/16923] //packages/providers/BlockedNumberProvider:BlockedNumberProvider r8 [com
Warning: Missing class com.google.errorprone.annotations.CanIgnoreReturnValue (referenced from: java.lang.Object com.google.common.base.AbstractIterator.endOfData() and 104 other contexts)
Missing class com.google.errorprone.annotations.CompatibleWith (referenced from: boolean com.google.common.collect.Multimap.containsEntry(java.lang.Object, java.lang.Object) and 1 other context)
Missing class com.google.errorprone.annotations.DoNotMock (referenced from: com.google.common.collect.ImmutableCollection$Builder and 5 other contexts)
Missing class com.google.errorprone.annotations.ForOverride (referenced from: boolean com.google.common.base.Equivalence.doEquivalent(java.lang.Object, java.lang.Object) and 1 other context)
Missing class com.google.errorprone.annotations.concurrent.GuardedBy (referenced from: void com.google.common.collect.MapMakerInternalMap$Segment.drainKeyReferenceQueue(java.lang.ref.ReferenceQueue) and 5 other contexts)
Missing class com.google.errorprone.annotations.concurrent.LazyInit (referenced from: com.google.common.collect.ImmutableSet com.google.common.collect.ImmutableMap.entrySet and 5 other contexts)
03:27:12 ninja failed with: exit status 137

#### failed to build some targets (25:00 (mm:ss)) ####

Build android failed!

I tried Build ALL ./build.sh -AUCKu

[ 95% 125973/131674] //art/odrefresh:odrefresh clang-tidy odr_fs_utils.cc [apex3
warning: macro replacement list should be enclosed in parentheses [bugprone-macro-parentheses]
[ 95% 125975/131674] //art/odrefresh:odrefresh clang-tidy odr_metrics_record.cc 
warning: macro replacement list should be enclosed in parentheses [bugprone-macro-parentheses]
[ 95% 125980/131674] //art/odrefresh:odrefresh clang-tidy odr_metrics.cc [apex31
warning: macro replacement list should be enclosed in parentheses [bugprone-macro-parentheses]
[ 95% 125984/131674] //art/odrefresh:odrefresh clang-tidy odr_compilation_log.cc
warning: macro replacement list should be enclosed in parentheses [bugprone-macro-parentheses]
[ 95% 125985/131674] //art/odrefresh:odrefresh clang-tidy cpp/com_android_apex.c
warning: macro replacement list should be enclosed in parentheses [bugprone-macro-parentheses]
[ 95% 125989/131674] //art/odrefresh:odrefresh clang-tidy cpp/com_android_art_en
warning: macro replacement list should be enclosed in parentheses [bugprone-macro-parentheses]
[ 95% 126013/131674] //art/odrefresh:odrefresh clang-tidy gensrcs/art/odrefresh/
warning: macro replacement list should be enclosed in parentheses [bugprone-macro-parentheses]
[ 95% 126021/131674] //art/odrefresh:odrefresh clang-tidy cpp/com_android_art.cp
warning: macro replacement list should be enclosed in parentheses [bugprone-macro-parentheses]
[ 95% 126055/131674] //art/odrefresh:odrefresh clang-tidy odrefresh.cc [apex31]
warning: macro replacement list should be enclosed in parentheses [bugprone-macro-parentheses]
02:46:40 ninja failed with: exit status 137

#### failed to build some targets (02:51:24 (hh:mm:ss)) ####

Build android failed!