Jump to content

x96q h313


Blaize

Recommended Posts

@svsruof

 

FEL is a low-level subroutine contained in the BootROM on Allwinner devices. It is used for initial programming and recovery of devices using USB.

 

In order to Enter to FEL mode you need a Male to Male USB cable.

 

1> Disconnect power supply from your TV-BOX.

2> connect the USB cable to your PC USB port.

3> with a tooth pick  PRESS continuously  the button inside AV port and connect the other end of USB cable to the USB (OTG ) of your TV-BOX

( Note: if you have 2 usb ports on your tv-box try the left first )

4> Release the the button you pressed with the tooth Pick (after 3 - 4 seconds)

 

Now you must be FEL mode. if your tv-box is booting to android then you an not in FEL mode. (repeat the procedure and/or change the USB port on TV-BOx )

 

When you successfully enter into FEL mode you will see nothing on Serial console output and your device will not boot to installed os.

 

 

To ensure that you are in FEL mode you (if you are using Windows)

go to Device Manager and examine the USB devices root tree

you must see a device with the bellow IDs

 

USB Device(VID_1f3a_PID_efe8)

 

if you are using linux open a terminal and give the lsusb command and exam the device IDs.

 

if you see above IDs then you are in FEL mode and you can use sunxi tools for further investigation.

 

 

 

 

 

 

 

 

 

 

 

Link to comment
Share on other sites

Armbian & Khadas are rewarding contributors

@rafman

I'm sorry, I thought we only needed FEL to confirm that it was Alwinner. I can go to FEL, but what can I do there? I thought that it was possible to understand from the UART logs why the boot from the SD card was not happening, but I could not see anything

Link to comment
Share on other sites

@svsruof

 

Yes entering to FEL mode and verify the IDs is a Safe method that indicates that your board is Allwinner and not a Fake board like RK322x or something else.

in FEL mode you can flash your device firmware with PhoenixSuit if your device is bricked,  or to investigate your board with sunxi-tools. Both operations  requires

knowledge of your hardware otherwise you may easily brick your device.

 

From your serial log you posted your device seems to have secure boot enabled by the manufacturer firmware. (SBOOT / [01.260]secure enable bit: 1)

this does not allow non trusted boot environmet and probably this is the reason that you can not boot from SD card.

I am still looking for a way to override this situation and unlock the boot process  (as i have also a similar bricked board) on some Chinese boxes and is very difficult

to find the original manufacturer firmware (for investigation)  because they don't publish it. 

I also have tried sunxi-fel in order to boot linux via USB but without success (usb_bulk_send() ERROR -7: Operation timed out on H616)

 

If someone knows a method to override this situation on Allwinner (H313 / H616)  is welcome to help.

Link to comment
Share on other sites

For Allwinner boxes you need to add this line to your u-boot defconfig.

CONFIG_SPL_IMAGE_TYPE_SUNXI_TOC0=y

 

To generate a TOC0 image from a binary, you will need an RSA key (pair) file. As most secure-boot enabled devices do not burn the VENDOR_ID eFUSE, you can use any RSA key, so just generate one, for instance with the openssl tool (would only need to be done once):

openssl genrsa -out root_key.pem

 

Your root_key.pem needs to be in the u-boot root directory. 

 

 

 

 

Edited by Nick A
Link to comment
Share on other sites

Bonjour, // Hi
vous savez si il y a un OS fonctionnel pour ce modèle ? //  Did you know if there is an OS that i can install on this model ?
il y a quelques  mois j'en ai testé plusieurs mais en vain aucun n'a daigné lancer quoi que ce soit. // Months ago, i've tried to install somes OS like Armbian but no one seems to work
Merci d'avance. // Thanks in advance !
20240919_151054.webp.8e9cca49764cac0177c98168deef461c.webp

Link to comment
Share on other sites

@Lancoly

Your board seems to be a x96Q Board v5.1

You can try to boot your board with  following image : "MiniArch-20240715-6.10.10-board-h313.x96_q_v5.1-SD-Image.img.xz" 

if your board is booting then you can install also Armbian by modify the extlinux.conf

 

 

 

 

Link to comment
Share on other sites

@Nick A

I have trouble with this bricked board is a x96q variant (new) (older version with differen emmc boot miniarch),  manufacturer firmware is not available but i am able to boot it with  (iATV Q5 Stock Firmware)

The board is booting from SD card (i used PhoenixCard.v4.2.4 to burn it as startup) and i am able to see the bootlogo but android does not start because on serial log i see that (rotpk is not written yet).

 

I also decompiled the  iATV Q5 Stock Firmware to fex files. firmware contains toc0.fex and toc1.fex

The problem is that the board requires secure boot in order  to boot.

I am able to produce Open SSL certificate via (openssl genrsa -out root_key.pem) .

 

How can I boot or compile Ambian for this secure boot device ?

 

 

PS: if anyone has a working firmware for this device please provide link.

 

Board Specifications are:

Processor: H313

Emmc: Kingston 16EMCP16  (2GB Ram - 16GB Rom)

pmic: AXP313a

wifi : SV6256P

BlueTooth: BR8052A01

 

 

IMG_20240919_153624.jpg

IMG_20240919_153649.jpg

IMG_20240919_153658.jpg

IMG_20240919_153709.jpg

IMG_20240919_153833.jpg

IMG_20240919_153901.jpg

Link to comment
Share on other sites

@rafman Thx for your answer, so i've tried the MiniArch img and the tv box launch the penguin screen and so on but i can't do the update/installation because it's seems like i dont have internet... You said that i have to change something in extlinux.conf to install an Armbian, can you tell me exactly what i have to do? Thx !

20240922_153547.webp

Edited by Lancoly
more precisions
Link to comment
Share on other sites

You can clone the original armbian build (git clone https://github.com/armbian/build.git),

sicXnull build (git clone https://github.com/sicXnull/armbian-build.git --branch X96Q-TVBOX-LPDDR3 --single-branch)

or my build (git clone https://github.com/NickAlilovic/build.git --branch v20240918)

 

SicXnull has the latest fixes for X96Q LPDDR3.

If you want to use the 6.10 kernel with hdmi support I can modify the X96Q config on my build to include both current and edge kernels.

 

git clone https://github.com/sicXnull/armbian-build.git --branch X96Q-TVBOX-LPDDR3 --single-branch

cd armbian-build

./compile.sh

 

In the choose board menu click on "Show CSC/WIP/EOS/TVB" option then choose "x96q".  Choose "current", "bookworm", server or desktop doesn't matter. Any desktop environment. Any software. 

 

(After the u-boot patches are applied and u-boot starts to build)

ctrl C

 

Create patches for u-boot:

cd cache/sources/u-boot-worktree/u-boot/v2024.01

sudo git add .

(For the first line patch title you can put "test" and the second line patch description put "test". Doesn't matter right now.)  

sudo git commit --signoff

 

sudo pico configs/x96q_lpddr3_defconfig

 

Add this line to your defconfig. 

CONFIG_SPL_IMAGE_TYPE_SUNXI_TOC0=y

 

sudo openssl genrsa -out root_key.pem

 

sudo git status

sudo git add configs/x96q_lpddr3_defconfig

sudo git add root_key.pem

sudo git commit --signoff

(Remember the first line patch title and the second line patch description.) 

sudo git format-patch v2024.01

 

Copy the patch to this armbian build directory.

~/build/patch/u-boot/u-boot-sunxi/

 

./compile.sh

 

Your new image should be in output/images directory.

Edited by Nick A
Link to comment
Share on other sites

@Nick A

I am following your instructions step by step and i stucked on last step :

I do the following steps :

 

git clone https://github.com/sicXnull/armbian-build.git --branch X96Q-TVBOX-LPDDR3 --single-branch   --OK (Resolving deltas: 100% (85645/85645), done.)

cd ~/armbian-build  --OK

./compile.sh  --OK

Ι Choose not to Change Kernel Configuration. --OK

I choose board menu click on "Show CSC/WIP/EOS/TVB" option then choose "x96q" --OK

I choose current/bookworm/server/Standard --OK

I  stop the compilation process with Ctrl-C  (after u-boot Receiving objects) --Ok

Then :

cd cache/sources/u-boot-worktree/u-boot/v2024.01 --OK

sudo git add .    --OK  (but here nothing asked about test)

 

sudo git commit --signoff   -- OK

sudo pico configs/x96q_lpddr3_defconfig  --OK

 I add  CONFIG_SPL_IMAGE_TYPE_SUNXI_TOC0=y  to the end of file and Save it. --OK

sudo openssl genrsa -out root_key.pem   --OK (file root_key.pem exists ok)

 

sudo git status --OK (output bellow)

-------------------------------------

  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
    modified:   configs/x96q_lpddr3_defconfig

Untracked files:
  (use "git add <file>..." to include in what will be committed)
    root_key.pem

----------------------------------------

sudo git add configs/x96q_lpddr3_defconfig --OK

sudo git add root_key.pem --OK

sudo git commit --signoff --OK

sudo git format-patch v2024.01 --OK

 

At this point i don't see any .patch file to copy to ~/armbian-build/patch/u-boot/u-boot-sunxi/  

with sudo git status I can see a list of files that are modified  and root_key.pem  is included as new file.

 

if i do :

 

sudo git diff --staged --patch > ~/armbian-build/patch/u-boot/u-boot-sunxi/test.patch

or

sudo git diff --cached > ~/armbian-build/patch/u-boot/u-boot-sunxi/mypatch.patch

 

compilation fails with (Problem with ->mypatch(:1) (+804/-18)[52M, 5A] {sun50i-a64-recore.dts,cannot apply patch.....)

 

something is wrong with the patch !

 

what do i make wrong ?

FYI:  (my git version is 2.34.1)

 

 

Link to comment
Share on other sites

@Lancoly

 

Great news  your board is booting. so you have a x96q v5.1 board.

 

You will need to have a usb to ethernet adapter in order to complete installation on both ( miniarch and armbian) as on both the onboard ethernet is not working at this moment.

 

The other way is to use USB tethering if you have a mobile phone (to share your data or wifi with your tv box) to complete your installation.

instructions you can find here : https://www.geeksforgeeks.org/what-is-usb-tethering-and-how-to-enable-it/

just connect your box mobile phone enable usb tethering and you will have internet to complete installation.

 

 

Please read this article about my experience with Armbian on x96q boxes :

 

An other way is to try to compile armbian yourself and try to boot it.

do the folloing steps:

 

git clone https://github.com/sicXnull/armbian-build.git --branch X96Q-TVBOX-LPDDR3 --single-branch

cd ~/armbian-build

./compile.sh

Choose not to Change Kernel Configuration.

choose board menu click on "Show CSC/WIP/EOS/TVB" option then choose "x96q"

choose current/bookworm/server/Standard or Desktop if you prefer

 

After a succesfull compilation Your image files should be in output/images directory.

 

Burn image to sd card using balena etcher and try to boot your tv box.

 

If compiled image does not boot at all then i will give you a hack with extlinux.conf to boot it.

Note that i experienced problems with Hdmi on console, cpu temp , onboard Ethernet and eMMC/NAND boot fails.

I need to make lot of tests this time.

 

Please keep us informed about your progress.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Link to comment
Share on other sites

@Nick A

 

With your command:

sudo git format-patch -1 v2024.01  produced the file 0001-Prepare-v2024.01.patch (attached)

i copy it to ~/armbian-build/patch/u-boot/u-boot-sunxi/  

 

however patch is rejected with reason (reversed or previously applied patch detected)

 

i think that something is going wrong with the patch file (it mainly contains names)

 

FYI: i attach the patch file and the output

output.txt 0001-Prepare-v2024.01.patch

 

Untouched Armbian [ current/noble/server/Standard ] compiles successfully without issues.

Edited by rafman
Link to comment
Share on other sites

Run these commands again.
sudo git status

sudo git add configs/x96q_lpddr3_defconfig

sudo git add root_key.pem

sudo git commit --signoff

(Remember the first line patch title and the second line patch description.) 

sudo git format-patch v2024.01

 

maybe you didn’t commit the patch? Git commit usually opens up a text editor. 

When you run "sudo git status" and the output still shows "modified:   configs/x96q_lpddr3_defconfig"  then you haven't commit the changes yet. 

 

your patch should look similar to mine. 

 

Edited by Nick A
Link to comment
Share on other sites

I ran the commands above and the only changes I made was the build directory name. On sicXnull repository it's called "armbian-build" instead of "build".

 


 

From 2af52d684c05cdd7eef9123baa7a1157507b03a2 Mon Sep 17 00:00:00 2001
From: Nick Alilovic <nickalilovic@gmail.com>
Date: Mon, 23 Sep 2024 09:37:45 -0400
Subject: [PATCH 2/2] configs: x96q lpddr3: Add SECURE BOOT

Add SECURE BOOT

Signed-off-by: Nick Alilovic <nickalilovic@gmail.com>
---
 configs/x96q_lpddr3_defconfig |  1 +
 root_key.pem                  | 28 ++++++++++++++++++++++++++++
 2 files changed, 29 insertions(+)
 create mode 100644 root_key.pem

diff --git a/configs/x96q_lpddr3_defconfig b/configs/x96q_lpddr3_defconfig
index 764e77dac1..828f59a9b7 100644
--- a/configs/x96q_lpddr3_defconfig
+++ b/configs/x96q_lpddr3_defconfig
@@ -17,6 +17,7 @@ CONFIG_MACH_SUN50I_H616=y
 CONFIG_R_I2C_ENABLE=y
 CONFIG_SPL_I2C=y
 CONFIG_SPL_I2C_SUPPORT=y
+CONFIG_SPL_IMAGE_TYPE_SUNXI_TOC0=y
 CONFIG_SPL_SYS_I2C_LEGACY=y
 CONFIG_SYS_I2C_MVTWSI=y
 CONFIG_SYS_I2C_SLAVE=0x7f
diff --git a/root_key.pem b/root_key.pem
new file mode 100644
index 0000000000..cfffdbf247
--- /dev/null
+++ b/root_key.pem
@@ -0,0 +1,28 @@
+-----BEGIN PRIVATE KEY-----
+MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC4N+7DvqP4cmLP
+1u9L8dQ1fVtzXxwzt6Qrn0JEMyHtQm2ZSwxOrAjyPKt9UTfEz3G5K7v7wBLzxS+n
+KQWtrcwiFfAPrFK5wyEQU/z/ltfUBg4NCagvgngb38AGwdgAPZ9+Wl3cueB6XxpJ
+etVlLUQtiaqGb92CyUDqZsbrNaBOOcxUxNEkAtxOHzriDC9PKRi780ntXWjp+R5Z
+loDQ0SyxjnhGBPNAhEAkEHXCLhTg82JHm4tNEVi/esXfMwQRm6x/eb/p55zd/ULU
+RXdxxS0j7/DPhRpync6mYJzLl7bDRrNA9DnyyC2kgWWkJ9F/QNMl3HqHTgClehTZ
+MfO1tCM5AgMBAAECggEAAn6CJsCRUSFWHq6wF8OYupeBK/U6/ojDRmRP59TlyYsB
+oi28fIwH/ev1ASne1L+txZ8k85qYp/uUVGjaynrng8roN8OpiZKGo14qMArf6x9S
+eb2hjPfmX++vAT6jcOpkrOmDAFnf+IGDbytWPGTTxGoD5upf2PjYHnqPZQyrHY//
+yAIpYtS9zjRx44iVN8olwwXXTDVe7yigAkrYvu0f4AUUv4azv68eYWXUXDN1YaWE
+gtwjSOCnhuwHTJTyz6Vi40ju32zxq7rTbe09NV7LcU6CmJBy8GDv2KsNfwk+OwsI
+gvz31jZ1jwyLZEGAxL/ibA0ldSAsjG3Akgw8jqG1cQKBgQDunDFVljn2uWVoBwip
+QJveKIGNgVnJ6YF630JGMP4X20rkh7/9lyBJQUixlc6Z3qUcCfyKi8EJkPMLs1u+
+QSmmKnsInqp8ZkCPG0g4FZNgHkC+fIfmgO+gVNxyh+MXZNsvVVH6NtpRIfLSXeCl
+aTWv4d8rIU5Tl9hDY2UhGQ7CaQKBgQDFpPEeS5hdIaqnZaJ50/V/gzrkENAFWZuP
+zYqhS4RcD6dogAByjQvvNByIn5avrPz6N75qsZl5VY0TtaYe6hHehDOwKHM7CFZe
+FSjSTdgi7b5jL11///9W5Eztn7L1ckZo93j2ZYLl9+PuXGAY4SRcYYOQjBBmOwmj
+Qpryy2+gUQKBgCY4uuZc1BgjhoztY4PJJ66kimwiZkGjt+v4y2L3AhzMMej9ndF/
+XdqeLIjV2Gxpb8VYDC4dSOTBZU1gg7esNIG7mE2/LMwUjQ7fbegd/KeO8QwSYqqX
+yMrEDTQDdGsQ6tNgNWuBUeNhLsZn505X1hPAeMEt6qAVWL0itNZibyzRAoGBALD6
+8wKa1LPImuTM6MHI4FOvckOZHn078UXC2zl1wu8hAVpdDImG7cHj2w0oQqnK8Lkq
+w3MM145D4lFc3oVeOmQT46kBf7XD0Hrs3aH8HOeiFlMArewZk07+njhGQdzx2ETU
+HVgeLCm7YTonM9HzgTjMBSChm2m/wfCUiuWQ78MRAoGAWAElZCjb8Dxp9z8KJ0JX
+Z3d2yueOgxf3J6X+7XMW7Yv9uFOvYNI/BNT3Ii3P+u6SJpKXuQgBoDT/2FP/f8m6
+U1dMu7PHcBi3MA1IvGi6NSC+cVcIy0yYi2vYsW6lkOsDwr+HrDQWte3HjiXcIy+g
+f9CFoVb4L1ILI/SBaZSV8LQ=
+-----END PRIVATE KEY-----
-- 
2.34.1

 

configs-x96q-lpddr3-Add-SECURE-BOOT.patch

Link to comment
Share on other sites

@Nick A

Thanks for for the patch.

With your patch I was able to compile Armbian  and finally my dead box become Alive (up and running).

it boots without problems. (i will check it further tonight)

 

From your patch suppose that my mistake with git was that i did not edit the lines   after sudo git commit --signoff on editor

i just closed the editor,  and for this reason sudo git format-patch v2024.01 not produce any patch file.

 

I need more experience with git.

 

Thanks again.

 

IMG_20240923_180128.jpg

Edited by rafman
Link to comment
Share on other sites

The reason I suggested "sudo git format-patch -1 v2024.01" was because I can only generate kernel patches this way. It use to work before but branch names changed from "linux-6.7.y" to "kernel-sunxi64-6.7". 

sudo git format-patch linux-6.7.y    use to work

sudo git format-patch kernel-sunxi64-6.7     Does not work

sudo git format-patch -1 kernel-sunxi64-6.7   works

 

-<n>
           Prepare patches from the topmost <n> commits.

Edited by Nick A
Link to comment
Share on other sites

Hello everyone.

 

Here are the Test Results of my Z1 box.

in the meantime i found that  a another tv-box with almost identical hardware to Z1 (except the eMMC)  is the Q1 box (photos included)

Q1 Box also booting with the secure boot image of Armbian and runs well.

 

Boards Specifications are:

Processor: H313   (Same on Z1 and Q1)

Emmc:  (Kingston 16EMCP16  on Z1 - Micron JZ008 on Q1)

pmic: AXP313a   (Same on Z1 and Q1)

wifi : SV6256P   (Same on Z1 and Q1)

Bluetooth: BR8052A01   (Same on Z1 and Q1)

 

What Works (on both boxes)

Boot from SD --OK

Install to EMMC -- OK

HDMI on Console -- OK

Cpu Temp --Ok

Ethernet --OK

Sound --OK

Video Playpack -- OK

 

Onboard Led work only on Q1  on Z1 stays always blue.

 

What does not Work (on both boxes)

WiFi Adapter -- does not work

Bluetooth -- does not work

 

Bellow are the photos of Q1 Box (Manufacturer firmware is available for this box)

 

IMG_009.jpg.adb5625a798f7b6730326c2d3f7a1fcd.jpg  IMG_010.jpg.7483498a3ace31e4234bd0abacf7d61d.jpg   IMG_011.jpg.490348a4b96e576de5a3ee34cc855ed4.jpg  IMG_012.jpg.571f60e45fa36674573bd30c4f8bf360.jpg

 

IMG_20240924_200244.jpg.e9bdafc5eb38e5d95fdbc293dc83e2b8.jpg IMG_20240924_200721.jpg.c90e39b0a664581bc3c730984591a238.jpg  IMG_008.jpg.7ad1469c21816e0c6639c9c9e83ae536.jpg

 

 

Edited by rafman
Link to comment
Share on other sites

@Nick A I understand you.

Working with the source code and making patches within the framework of the build system is a sad business.

 

Let's try to sort it out.

I'm writing this for everyone. Don't read it if it's familiar to you.
First, basic knowledge about git:

A git is a chain of related git objects.
The git object is the compressed difference between the current state and the previous one.
The Git object has a name in the form of a 40-digit hexadecimal numeric word.

Each object is tightly linked to the previous (parent) and subsequent (child) objects.

Concepts such as HEAD, tag, branch are references to a specific git object.

The working tree is the git state extracted to the working directory.

 

In previous posts, we talked about u-boot. Let's check what we have in the build system.

My build system is located in the VM in the folder: /home/leo/armbian
 

leo@armbuild:~/armbian/cache/sources/u-boot-worktree/u-boot/v2024.01$ git branch
+ master
* u-boot-edge-bananapim3

leo@armbuild:~/armbian/cache/sources/u-boot-worktree/u-boot/v2024.01$ git log --pretty=oneline -3
866ca972d6c3cabeaf6dbac431e8e08bb30b3c8e (HEAD -> u-boot-edge-bananapim3, tag: v2024.01) Prepare v2024.01
82750ce44226e5f2b3bbcd79cf7b3ba3dfd3de4d arm: dts: iot2050: Fix by syncing from Linux
dbb124cf6888da9581834a3c17b02f958a8afacf configs: j7200: Remove HBMC_AM654 config

 

Enter your data from the github here.
It is important.

git config --global user.email "you@example.com"
git config --global user.name "Your Name"

 

Let's add all the changed files to the monitored state and make a commit:

leo@armbuild:~/armbian/cache/sources/u-boot-worktree/u-boot/v2024.01$ sudo git add --all

leo@armbuild:~/armbian/cache/sources/u-boot-worktree/u-boot/v2024.01$ sudo git commit -m "The Armbian changes"
[u-boot-edge-bananapim3 dcf395c104] The Armbian changes
 52 files changed, 682 insertions(+), 16 deletions(-)
 create mode 100644 arch/arm/dts/sun50i-a64-recore.dts
 create mode 100644 arch/arm/dts/sun50i-h313-x96q-lpddr3.dts
 create mode 100644 configs/recore_defconfig
 create mode 100644 configs/x96q_lpddr3_defconfig

 

Now we will see:

leo@armbuild:~/armbian/cache/sources/u-boot-worktree/u-boot/v2024.01$ git log --pretty=oneline -3
dcf395c1044533320913373b3b8da980ac49ac73 (HEAD -> u-boot-edge-bananapim3) The Armbian changes
866ca972d6c3cabeaf6dbac431e8e08bb30b3c8e (tag: v2024.01) Prepare v2024.01
82750ce44226e5f2b3bbcd79cf7b3ba3dfd3de4d arm: dts: iot2050: Fix by syncing from Linux

The HEAD and branch links point to the new git object.
But the v2024.01 tag continues to point to 866ca972d6c3cabeaf6dbac431e8e08bb30b3c8e
 

Let's add the debugging code and make a commit:

leo@armbuild:~/armbian/cache/sources/u-boot-worktree/u-boot/v2024.01$ sudo nano drivers/mmc/sunxi_mmc.c

leo@armbuild:~/armbian/cache/sources/u-boot-worktree/u-boot/v2024.01$ sudo git add drivers/mmc/sunxi_mmc.c
leo@armbuild:~/armbian/cache/sources/u-boot-worktree/u-boot/v2024.01$ sudo git commit -m "define DEBUG macros for sunxi mmc"

 

Look at the last commit. This is what will be extracted using the command "git format-patch -1":

leo@armbuild:~/armbian/cache/sources/u-boot-worktree/u-boot/v2024.01$ git log -p -1
commit c5a54a85e206c32c4a17aa573c8f409899c2a77a (HEAD -> u-boot-edge-bananapim3)
Author: The-going <48602507+The-going@users.noreply.github.com>
Date:   Wed Sep 25 09:09:47 2024 +0000

    define DEBUG macros for sunxi mmc

diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c
index 8b684929e0..c32c9bda28 100644
--- a/drivers/mmc/sunxi_mmc.c
+++ b/drivers/mmc/sunxi_mmc.c
@@ -33,6 +33,8 @@
 
 #include "sunxi_mmc.h"
 
+#define DEBUG
+
 #ifndef CCM_MMC_CTRL_MODE_SEL_NEW
 #define CCM_MMC_CTRL_MODE_SEL_NEW      0
 #endif

 

We will extract these changes to the target directory:

leo@armbuild:~/armbian/cache/sources/u-boot-worktree/u-boot/v2024.01$ git format-patch -1 -o /home/leo/armbian/patch/u-boot/u-boot-sunxi/
/home/leo/armbian/patch/u-boot/u-boot-sunxi/0001-define-DEBUG-macros-for-sunxi-mmc.patch
leo@armbuild:~/armbian/cache/sources/u-boot-worktree/u-boot/v2024.01$ mv /home/leo/armbian/patch/u-boot/u-boot-sunxi/0001-define-DEBUG-macros-for-sunxi-mmc.patch /home/leo/armbian/patch/u-boot/u-boot-sunxi/define-DEBUG-macros-for-sunxi-mmc.patch
leo@armbuild:~/armbian/cache/sources/u-boot-worktree/u-boot/v2024.01$ cat /home/leo/armbian/patch/u-boot/u-boot-sunxi/define-DEBUG-macros-for-sunxi-mmc.patch
From c5a54a85e206c32c4a17aa573c8f409899c2a77a Mon Sep 17 00:00:00 2001
From: The-going <48602507+The-going@users.noreply.github.com>
Date: Wed, 25 Sep 2024 09:09:47 +0000
Subject: [PATCH] define DEBUG macros for sunxi mmc

---
 drivers/mmc/sunxi_mmc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c
index 8b684929e0..c32c9bda28 100644
--- a/drivers/mmc/sunxi_mmc.c
+++ b/drivers/mmc/sunxi_mmc.c
@@ -33,6 +33,8 @@
 
 #include "sunxi_mmc.h"
 
+#define DEBUG
+
 #ifndef CCM_MMC_CTRL_MODE_SEL_NEW
 #define CCM_MMC_CTRL_MODE_SEL_NEW      0
 #endif
-- 
2.34.1

I have removed the prefix number of the patch file name so that the patch is applied last.

 

If I do git format-patch -1 v2024.01 I will get the changes that are stored in the git object referenced by this v2024.01 tag.

 

Do I need to write here how to correctly add multiple changes to the kernel?

 

Link to comment
Share on other sites

On 9/25/2024 at 1:48 PM, going said:

 

Do I need to write here how to correctly add multiple changes to the kernel?

 

Yes Keep going,  your post was very useful for me.

 

 

FYI:

After  problem is solved  with the secure boot i tied to reproduce @Nick A patch myself using Nick A instructions 

I wanted to increase my git knowledge as many times i need to modify sources.

so I deleted my old build and i make a fresh clone again and i applied the bellow instructions again.

----

git clone https://github.com/sicXnull/armbian-build.git --branch X96Q-TVBOX-LPDDR3 --single-branch 

cd ~/armbian-build

./compile.sh

Ι Choose not to Change Kernel Configuration.

I choose board menu click on "Show CSC/WIP/EOS/TVB" option then choose "x96q"

I choose current/bookworm/server/Standard

I  stop the compilation process with Ctrl-C  (after u-boot Receiving objects)

cd cache/sources/u-boot-worktree/u-boot/v2024.01

sudo git add .   

sudo git commit --signoff  

sudo pico configs/x96q_lpddr3_defconfig 

I add  CONFIG_SPL_IMAGE_TYPE_SUNXI_TOC0=y  to the end of file and Save it.

sudo openssl genrsa -out root_key.pem 

sudo git status

sudo git add configs/x96q_lpddr3_defconfig

sudo git add root_key.pem

sudo git commit --signoff

sudo git format-patch v2024.01

----

here i had 2 files 0001-test.patch and 0002-configs-x96q-lpddr3.patch

second file 0002-configs-x96q-lpddr3.patch was almost identical to Nick A file exept the (root_key.pem) contents

 

however The prefix  number was i a problem because

if i used

sudo mv 0002-configs-x96q-lpddr3.patch ~/armbian-build/patch/u-boot/u-boot-sunxi/        (without change prefix)

compilation of armbian fails with reason (can't find file to patch at line..) and the patch execution order is  1st.

 

if i remove the prefix execution order changes and the the patch is ok and armbian compiles. (after i realize that also Nick A patch does not have any prefix)

 

I suppose that patch execution order is important, but how we control this order efficiently on a build system?

 

 

Bellow are the final patches, both are working.

configs-x96q-lpddr3-rafman.patch configs-x96q-lpddr3-Add-SECURE-BOOT.patch

Link to comment
Share on other sites

Yes, sorry I forgot to mention that your patch needs to be applied last. So you need to change the name of the patch. If all the sunxi u-boot patches had a prefix in front it. It would help alot.

 

We don't have this problem with kernel patches because the build system uses series.armbian and series.conf for the patch execution order.

Edited by Nick A
Link to comment
Share on other sites

1 hour ago, Nick A said:

Yes, sorry I forgot to mention that your patch needs to be applied last. So you need to change the name of the patch. If all the sunxi u-boot patches had a prefix in front it. It would help alot.

 

No problem, everything is a lesson even if it succeeds or not.

The good point of this research is that now i have two dead boxes alive and running (well).

I made a free account on github and I order another one tv box (Transpeed 8k Android 12 TV BOX Allwinner H618 4GB Ram and 64 GB Rom)

for further research (is on the way now).

 

Link to comment
Share on other sites

6 hours ago, eibrog said:

I have the identical Q1 box however every image I flash will not boot on it.

Anything I am missing?

 

What you mean "flash"   ?  Tell us what you are doing.

 

Did you try to boot Armbian on it ?  Your box boots Android or is Bricked ?

 

Link to comment
Share on other sites

@rafman loading on sdcard and booting. currently boots android just fine by default. identical pcb and chips to your Q1. I also have another H313 box willing to experiment with for the cause. 

 

Currently have another older box booting off sd just fine. (V88 Piano - using DietPi Rock64)

Link to comment
Share on other sites

3 hours ago, eibrog said:

@rafman loading on sdcard and booting. currently boots android just fine by default. identical pcb and chips to your Q1. I also have another H313 box willing to experiment with for the cause. 

 

Currently have another older box booting off sd just fine. (V88 Piano - using DietPi Rock64)

 

Your Q1 box requires Secure boot image to boot.

 

The first option is to compile Armbian yourself for secure boot using ( git clone https://github.com/sicXnull/armbian-build.git --branch X96Q-TVBOX-LPDDR3 --single-branch )  and by adding  my patch or Nick A patch (attached above)

 

if you are not familiar with compilation procedures I have uploaded my compiled image for you.

 

Dowload it here : https://easyupload.io/86311i        (it will remain for 30 days)

 

( I suggest you  after download  to uncompress the image is about 2.1 GB  but if you use balena etcher is not necessary)

 

Use balena etcher to burn it to your SD card and try to Boot you Q1 Box

 

Normally your box will boot to Armbian.

(Note that bluetooth and Wifi does not work at the moment because the driver for SV6256P is not availble yet)

 

tell us about your results.

Edited by rafman
Link to comment
Share on other sites

@rafman Success! took a few tries to write the image - decompressing it first seemed to make etcher happier about it. (inside the archive the .img extension was missing)

 

lack of bt or wifi is no big deal as mainly looking to repurpose some of these into pi-holes.

 

Will let you know how I make out with the other box I have.

 

I have a mix of some boxes because was using some for remote android signage players for a customer, and the signage app did not perform well on some boxes.

 

Plus just other past tinkering.

 

edit: so just tested what was supposed to be an H313 (best I can tell from my buying history) - no dice. opened it up, it's an S905W. It was from primecables (branded) and board is a TX3MINI-P

If there is any other hardware that you spot or want tested, let me know. I don't mind buying & testing pre-built images. That much I have some time for. Zero programming chops here. Batch files at best. 

Edited by eibrog
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines