Raxone / amlogic-usbdl_s905x3

Dump s905x3
3 stars 1 forks source link

question about u-boot for Armbian #1

Open araczkowski opened 11 months ago

araczkowski commented 11 months ago

Hi, thanks for this brilliant script :)

I was able to decrypt bootloader on X88proX3

USB Connect
Dump Bootloader
Dump DTB'S
Dump Boot
Reboot to BL1
Board is in secure mode
Dump Efuse 0xFFFE0000
Run Amlogic-usbdl playload
- exploit: starting.
- exploit: sending payload...
- exploit: sending 823 dummy transfers...
- exploit: sending last transfer to overwrite RAM...
- exploit: done.
Received data saved to file EFuse.bin (2048 bytes).
Board is in secure mode
Decrypt bootloader
Extract All
Decrypt U-boot
Decrypt Boot
Extract_DTB
Dumped 00_kernel, start=0 end=0
Dumped 01_dtbdump_Amlogic.dtb, start=0 end=92160
Dumped 02_dtbdump_Amlogic.dtb, start=92160 end=196608
Extracted 2 appended dtbs + kernel to dts
DTB_to_DTS
Done

now in the dump_all I have:

-rw-r--r--  1 root    root          64 sie  8 12:51 bl2aeskey
-rw-r--r--  1 root    root       61440 sie  8 12:51 bl2_cfg.bin
-rw-r--r--  1 root    root          32 sie  8 12:51 bl2ivkey
-rw-r--r--  1 root    root        1036 sie  8 12:51 bl2key.bin
-rw-r--r--  1 root    root          64 sie  8 12:51 bl3xaeskey
-rw-r--r--  1 root    root    16777216 sie  8 12:51 boot.bin
-rw-r--r--  1 root    root    16777216 sie  8 12:51 boot_dec.bin
-rw-r--r--  1 root    root     2097152 sie  8 12:51 bootloader.bin
-rw-r--r--  1 root    root     2097152 sie  8 12:51 bootloader_dec.bin
-rw-r--r--  1 root    root      196608 sie  8 12:51 dtb.bin
drwxr-xr-x  2 root    root        4096 sie  8 12:51 dts/
-rw-r--r--  1 root    root        2048 sie  8 12:51 EFuse.bin
-rw-r--r--  1 root    root       16384 sie  8 12:51 fip.bin
-rw-r--r--  1 root    root          64 sie  8 12:51 kernelaeskey
-rw-r--r--  1 root    root          64 sie  8 12:51 pattern.secureboot.efuse
-rw-r--r--  1 root    root        1036 sie  8 12:51 rootkey.bin
-rw-r--r--  1 root    root          64 sie  8 12:51 root_rsa_key.sha
-rw-r--r--  1 root    root      787968 sie  8 12:51 u-boot_dec.bin
-rw-r--r--  1 root    root      787968 sie  8 12:51 u-boot_enc.bin

now I want to use this method to prepare u-boot for armbian: https://github.com/unifreq/u-boot/blob/master/doc/board/amlogic/h96max-x3.rst

and finally add X88proX3 as a supported device according to this instruction: https://github.com/araczkowski/amlogic-s9xxx-armbian/blob/main/documents/README.md#1215-how-to-add-new-supported-devices

Do you have any experience with Linux on X88proX3? Perhaps you are trying to do the same, maybe we can share the knowledge and do this together?

Thanks in advance :+1:

Raxone commented 11 months ago

Hi. Thx but i just sort out the script from aml-flash-tool and add some to aml-usbdl and another script from google. I have x88pro x3 and a non encrypted s905x3 box. All boards work very well with all linux based images. From my experience encrypted or unencrypted board work with stock/factory bootloaders. I build/try to build probably all source code for amlogic and just can say it is not easy, experience is important but time and test/debug is probably most important. I like to develop/test bootloader and kernel level, ask me and I will try to help. All systems are connected from the bootloader to kernel to system. If the bootloader is not good, the system does not work ok. DTB is the most important thing but not easy, you can't just copy/paste from one working dtb to another dtb/dts and everything works.

On Tue, Aug 8, 2023 at 1:14 PM Andrzej Raczkowski @.***> wrote:

Hi, thanks for this brilliant script :)

I was able to decrypt bootloader on X88proX3

USB Connect Dump Bootloader Dump DTB'S Dump Boot Reboot to BL1 Board is in secure mode Dump Efuse 0xFFFE0000 Run Amlogic-usbdl playload

  • exploit: starting.
  • exploit: sending payload...
  • exploit: sending 823 dummy transfers...
  • exploit: sending last transfer to overwrite RAM...
  • exploit: done. Received data saved to file EFuse.bin (2048 bytes). Board is in secure mode Decrypt bootloader Extract All Decrypt U-boot Decrypt Boot Extract_DTB Dumped 00_kernel, start=0 end=0 Dumped 01_dtbdump_Amlogic.dtb, start=0 end=92160 Dumped 02_dtbdump_Amlogic.dtb, start=92160 end=196608 Extracted 2 appended dtbs + kernel to dts DTB_to_DTS Done

now in the dump_all I have:

-rw-r--r-- 1 root root 64 sie 8 12:51 bl2aeskey -rw-r--r-- 1 root root 61440 sie 8 12:51 bl2_cfg.bin -rw-r--r-- 1 root root 32 sie 8 12:51 bl2ivkey -rw-r--r-- 1 root root 1036 sie 8 12:51 bl2key.bin -rw-r--r-- 1 root root 64 sie 8 12:51 bl3xaeskey -rw-r--r-- 1 root root 16777216 sie 8 12:51 boot.bin -rw-r--r-- 1 root root 16777216 sie 8 12:51 boot_dec.bin -rw-r--r-- 1 root root 2097152 sie 8 12:51 bootloader.bin -rw-r--r-- 1 root root 2097152 sie 8 12:51 bootloader_dec.bin -rw-r--r-- 1 root root 196608 sie 8 12:51 dtb.bin drwxr-xr-x 2 root root 4096 sie 8 12:51 dts/ -rw-r--r-- 1 root root 2048 sie 8 12:51 EFuse.bin -rw-r--r-- 1 root root 16384 sie 8 12:51 fip.bin -rw-r--r-- 1 root root 64 sie 8 12:51 kernelaeskey -rw-r--r-- 1 root root 64 sie 8 12:51 pattern.secureboot.efuse -rw-r--r-- 1 root root 1036 sie 8 12:51 rootkey.bin -rw-r--r-- 1 root root 64 sie 8 12:51 root_rsa_key.sha -rw-r--r-- 1 root root 787968 sie 8 12:51 u-boot_dec.bin -rw-r--r-- 1 root root 787968 sie 8 12:51 u-boot_enc.bin

now I want to use this method to prepare u-boot for armbian:

https://github.com/unifreq/u-boot/blob/master/doc/board/amlogic/h96max-x3.rst

and finally add X88proX3 as a supported device according to this instruction:

https://github.com/araczkowski/amlogic-s9xxx-armbian/blob/main/documents/README.md#1215-how-to-add-new-supported-devices

Do you have any experience with Linux on X88proX3? Perhaps you are trying to do the same, maybe we can share the knowledge and do this together?

Thanks in advance 👍

— Reply to this email directly, view it on GitHub https://github.com/Raxone/amlogic-usbdl_s905x3/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAN7JFGHLCKMMUU5MUYSKVTXUINTBANCNFSM6AAAAAA3IJ3BGY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

araczkowski commented 11 months ago

Hi :) thanks for your response :+1:

I have x88pro x3 and a non encrypted s905x3 box. All boards work very well with all linux based images.

Linux based images... but you mean Android images, not pure Linux? Or maybe you are have some Linux that works on this x88pro x3 ?

Here you can find 2 Linux images for X88proX3, one is Coreelec and second is Armbian

https://ai-speaker.discourse.group/t/coreelec-i-armbian-z-pendrive-na-bramce-dev3

But my idea is to have mainline Linux on x88pro x3 :)... but I'm not sure if this is possible...

I like to develop/test bootloader and kernel level, ask me and I will try to help.

I'm trying to prepare the U-Boot for X88proX3 , according to this description:

https://github.com/araczkowski/amlogic-s9xxx-armbian/blob/main/documents/README.md#1211-how-to-create-a-u-boot-file

Now I'm using the bootloader_dec.bin - decoded bootloader after your script -> all.sh

image

What is bothering me is the size of bootloader_dec.bin it has only 2.1 MB

image

but the bootloader extracted via this "raw" method:

image

has 4 MB (of course I can not use the adb method bacause the manufacturer's bootloader on my x88pro x3 is encrypted)

I will continue tomorrow :)

Raxone commented 11 months ago

My script dump from git amlogic-usbdl_s905x3 is 2mb, you dump all bootloader partition what is 4mb. Real size of bootloader is 1,3-1,6mb.

Raxone commented 11 months ago

If you build bootloader for amlogic (s905x*) we use prebuild/nosourced bl2.bin,bl30.bin,bl31.bin,and we use timing.c from uboot source and bl33(u-boot). Compile timing.c from u-boot produce acs.bin, that is timing and size for ram(ddr3,lpddr3,lpddr4).

araczkowski commented 10 months ago

I made some progress :)

this was my goal

image

there are still some issues described here: https://github.com/ophub/amlogic-s9xxx-armbian/issues/1621 I will try to work on this especially I need to fix the installation on eMMC