edk2-porting / edk2-sm7150

9 stars 3 forks source link

How to build for Xioami Redmi Note 10 Pro #6

Open adamnickster opened 2 years ago

adamnickster commented 2 years ago

Could you give me some hints how to build/port for Xiaomi Redmi Note 10 Pro (SM7150) ?

Cl1nkkk commented 2 years ago

send here a file located /sys/firmware/fdt

Cl1nkkk commented 2 years ago

how much ram does your phone have?

Cl1nkkk commented 2 years ago

Check this https://github.com/Cl1nkkk/edk2-note10pro

adamnickster commented 2 years ago

I tried build myself but getting this error:

bash sweetbuild.sh Loading previous configuration from /home/adam/git/edk2-sm7150/../edk2/Conf/BuildEnv.sh Using EDK2 in-source Basetools WORKSPACE: /home/adam/git/edk2-sm7150/ EDK_TOOLS_PATH: /home/adam/git/edk2-sm7150/../edk2/BaseTools CONF_PATH: /home/adam/git/edk2-sm7150/../edk2/Conf Build environment: Linux-5.13.0-40-generic-x86_64-with-Ubuntu-20.04-focal Build start time: 21:55:41, May.07 2022

WORKSPACE = /home/adam/git/edk2-sm7150 PACKAGES_PATH = /home/adam/git/edk2:/home/adam/git/edk2-platforms:/home/adam/git/edk2-sm7150 EDK_TOOLS_PATH = /home/adam/git/edk2-sm7150/../edk2/BaseTools CONF_PATH = /home/adam/git/edk2/Conf PYTHON_COMMAND = python2.7

Processing meta-data Architecture(s) = AARCH64 .Build target = DEBUG Toolchain = GCC5

Active Platform = /home/adam/git/edk2-sm7150/F11/sweet.dsc

build.py... /home/adam/git/edk2-sm7150/F11/sweet.dsc(...): error 4000: Instance of library class [RegisterFilterLib] is not found in [/home/adam/git/edk2/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf] [AARCH64] consumed by module [/home/adam/git/edk2/ArmPlatformPkg/PrePi/PeiUniCore.inf]

Here is zip with extractred fdt file and dsc and sh

Redmi_Note_10_Pro.zip

RAM: 6GB

Resolution: 1080x2400x120x183275 1080x2400x60x183275

adamnickster commented 2 years ago

Check this https://github.com/Cl1nkkk/edk2-note10pro

This looks like fork for Xiaomi Mi Note 10 Pro 2019 (tucana), but I have Xiaomi Redmi Note 10 Pro 2021 (sweet).

Cl1nkkk commented 2 years ago

Remove edk2 and edk2-platrorms folders, download this https://drive.google.com/file/d/12QZxmXwmjEcv6pBuFAA3n_1ZFmsTyqMM/view?usp=drivesdk to root folder, tar -xvzf edk2.tgz, and check it again https://github.com/Cl1nkkk/edk2-note10pro, for sweet now

adamnickster commented 2 years ago

Hi @Cl1nkkk Thank you for your help, but still not able to build. I'm using your edk2 and edk2-platrorms folders and this repo edk2-sm7150 and also your edk2-note10pro throwing same error:

./build.sh 
Loading previous configuration from /home/adam/git/edk2-note10pro/../edk2/Conf/BuildEnv.sh
WORKSPACE: /home/adam/git/edk2-note10pro/
EDK_TOOLS_PATH: /home/adam/git/edk2-note10pro/../edk2/BaseTools
CONF_PATH: /home/adam/git/edk2-note10pro/../edk2/Conf
Build environment: Linux-5.13.0-40-generic-x86_64-with-Ubuntu-20.04-focal
Build start time: 20:06:42, May.08 2022

WORKSPACE        = /home/adam/git/edk2-note10pro
PACKAGES_PATH    = /home/adam/git/edk2:/home/adam/git/edk2-platforms:/home/adam/git/edk2-note10pro
EDK_TOOLS_PATH   = /home/adam/git/edk2-note10pro/../edk2/BaseTools
CONF_PATH        = /home/adam/git/edk2/Conf
PYTHON_COMMAND   = python2.7

Architecture(s)  = AARCH64
Build target     = DEBUG

Processing meta-data .Toolchain        = GCC5

Active Platform          = /home/adam/git/edk2-note10pro/F11/F11.dsc
.. done!
Building ... /home/adam/git/edk2/MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf [AARCH64]
Building ... /home/adam/git/edk2-note10pro/F11/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf [AARCH64]
gcc: error: unrecognized command line option ‘-mlittle-endian’
gcc: error: unrecognized command line option ‘-mstrict-align’; did you mean ‘-Wstrict-aliasing’?
make: *** [GNUmakefile:308: /home/adam/git/edk2-note10pro/Build/F11/DEBUG_GCC5/AARCH64/MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib/OUTPUT/BaseStackCheckGcc.obj] Error 1

build.py...
 : error 7000: Failed to execute command
    make -s tbuild [/home/adam/git/edk2-note10pro/Build/F11/DEBUG_GCC5/AARCH64/MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib]

build.py...
 : error 7000: Failed to execute command
    make -s tbuild [/home/adam/git/edk2-note10pro/Build/F11/DEBUG_GCC5/AARCH64/F11/Library/PlatformBootManagerLib/PlatformBootManagerLib]

build.py...
 : error F002: Failed to build module
    /home/adam/git/edk2/MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf [AARCH64, GCC5, DEBUG]

- Failed -
Build end time: 20:06:45, May.08 2022
Build total time: 00:00:02

any idea what is wrong ? Should I try run build directly on smartphone ?

Cl1nkkk commented 2 years ago

try sudo apt install build-essential uuid-dev iasl git nasm python3-distutils gcc-aarch64-linux-gnu abootimg && cd /home/adam/git/edk2-note10pro && git pull && bash build.sh

Cl1nkkk commented 2 years ago

if that doesn't work build via linux deploy container on your phone

Cl1nkkk commented 2 years ago

Test it https://github.com/Cl1nkkk/edk2-note10pro/releases/download/1/uefi_sweet.img

adamnickster commented 2 years ago

Test result: after booting your uefi_sweet.img I get only black screen (tried also press/hold buttons) but I don't have WinPE partition yet because of encryption of Android 12. Should I get some response/screen/message without boot partition with stock Android partition layout ?

Build result: moving forward but another error. looks like different architecture of the binary? I will try linux deploy tomorrow. here is end of the build log:

Building ... /home/adam/git/edk2/MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf [AARCH64]
Building ... /home/adam/git/edk2/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf [AARCH64]
Building ... /home/adam/git/edk2/MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf [AARCH64]
/home/adam/git/edk2-note10pro/../edk2/BaseTools/BinWrappers/PosixLike/VfrCompile: line 18: /home/adam/git/edk2-note10pro/../edk2/BaseTools/Source/C/bin/VfrCompile: cannot execute binary file: Exec format error
/home/adam/git/edk2-note10pro/../edk2/BaseTools/BinWrappers/PosixLike/VfrCompile: line 18: /home/adam/git/edk2-note10pro/../edk2/BaseTools/Source/C/bin/VfrCompile: Success
make: *** [GNUmakefile:310: /home/adam/git/edk2-note10pro/Build/F11/DEBUG_GCC5/AARCH64/MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib/DEBUG/BootManagerVfr.c] Error 126

build.py...
 : error 7000: Failed to execute command
    make -s tbuild [/home/adam/git/edk2-note10pro/Build/F11/DEBUG_GCC5/AARCH64/MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib]

build.py...
 : error 7000: Failed to execute command
    make -s tbuild [/home/adam/git/edk2-note10pro/Build/F11/DEBUG_GCC5/AARCH64/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib]

build.py...
 : error 7000: Failed to execute command
    make -s tbuild [/home/adam/git/edk2-note10pro/Build/F11/DEBUG_GCC5/AARCH64/MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib]

build.py...
 : error F002: Failed to build module
    /home/adam/git/edk2/MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf [AARCH64, GCC5, DEBUG]

- Failed -
Build end time: 21:59:44, May.08 2022
Build total time: 00:00:07
adamnickster commented 2 years ago

Update: I'm able to build UEFI image via Linux deploy container on my phone ✅ (Ubuntu 18.04) Created esp, pe, win partitions, flag as boot and copy WinPE files (by this guide: https://forum.renegade-project.org/t/faq/95) boot UEFI image and get only black screen like a dead phone. (same behaviour with the image provided by @Cl1nkkk )

adamnickster commented 2 years ago

Update 2: fixed the black screen by reducing RAM to 3664MB. gArmTokenSpaceGuid.PcdSystemMemorySize|0xE5000000 I saw this value in commit history and it's working but stuck on windows logo screen without dots loading :( looks like same issue as @Cl1nkkk created

With 6GB value 0x180000000 = black screen With 5,75GB, 5GB, 4GB = screen is working and stuck with 3 lines of logs at Loading DxeCore at 0x017E28C000 etc... (with change RAM size hex value in log is different)

adamnickster commented 2 years ago

Progress: I reverted this commit Expanded ram size to 6g (b8c0f56) and windows start loading, but after a few seconds BSOD: IRQL NOT LESS OR EQUAL

Screenshot

Any idea how to fix memory mapping/settings?

Idonotkno commented 2 years ago

@adamnickster acpi or map, And which pe are you using?