Jump to content

Updated uboot causes Armbian kernel hang during boot.


Go to solution Solved by mirkobe_89,

Recommended Posts

Posted

Hi all,

thanks in advance for taking the time to read this topic.

 

I'm working with the Banana Pi P2-zero board, on which I successfully installed the armbian buster image (on SD card) from here:

https://www.armbian.com/bananapi-m2-zero/

Note that the image is for M2-zero, not P2 zero... which by the way has pretty much the same hardware, and things work fine on SD card.

 

But then I needed to install the whole system on the on board eMMC.

Such eMMC was not visible at first, so I edited the /boot/dtb/sun8i-h2-plus-bananapi-m2-zero.dts  file to include mmc2 (mmc@1c11000) and compiled it as dtb.

After this, I was able to see the eMMC as /dev/mmcblk2.

Then I used the armbian utility "nand-sata-install" to install boot and kernel on eMMC.

After this, /dev/mmcblk2 has the same partition table as my sd card (/dev/mmcblk0), and in general the eMMC gets flashed properly.

 

FIRST ISSUE: I removed the SD card, and the system doesn't boot from eMMC.

 

I also tried to update the bootloader through armbian-config utility, I tried the apt update/upgrade, but still could not get the eMMC booting properly.

I went deeper, and learned that this bootloader (which seems to be an SPL+Uboot image) includes its own dtb file in its image. Such dtb does not include the eMMC (same problem as the kernel's dtb).

Unfortunately, there is no way to recover the sources of the bootloader to change just the dtb file (or at least, I don't know any way, if anyone does, please tell me :)).

That's why I decided to compile my own bootloader from scratch, from here

https://linux-sunxi.org/U-Boot

 

So I was able to generate my u-boot-sunxi-with-spl.bin file, flashed it on eMMC with:

dd if=u-boot-sunxi-with-spl.bin of=/dev/mmcblk2 bs=1024 seek=8

and finally the bootloader is able to fully run from eMMC!... But here comes the second issue (i.e. the title of this topic):

 

SECOND ISSUE: the bootloader starts loading the kernel, but then suddenly hangs!

 

Here's the last part of the console output:

[   12.460907] platform regulatory.0: Falling back to sysfs fallback for: regulaory.db
[   12.506653] Bluetooth: Core ver 2.22
[   12.510682] NET: Registered protocol family 31
[   12.515250] Bluetooth: HCI device and connection manager initialized
[   12.521753] Bluetooth: HCI socket layer initialized
[   12.526780] Bluetooth: L2CAP socket layer initialized
[   12.532004] Bluetooth: SCO socket layer initialized
[   12.598366] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43430-sdio fr chip BCM43430/1
[   12.690139] cfg80211: failed to load regulatory.db
[   12.719537] brcmfmac mmc1:0001:1: Direct firmware load for brcm/brcmfmac43430sdio.sinovoip,bpi-m2-zero.txt failed with error -2
[   12.731402] brcmfmac mmc1:0001:1: Falling back to sysfs fallback for: brcm/brmfmac43430-sdio.sinovoip,bpi-m2-zero.txt
[   12.776242] Bluetooth: HCI UART driver ver 2.3
[   12.780781] Bluetooth: HCI UART protocol H4 registered
[   12.785964] Bluetooth: HCI UART protocol BCSP registered
[   12.791536] Bluetooth: HCI UART protocol LL registered
[   12.796728] Bluetooth: HCI UART protocol ATH3K registered
[   12.802293] Bluetooth: HCI UART protocol Three-wire (H5) registered
[   12.808981] Bluetooth: HCI UART protocol Broadcom registered
[   12.907387] Internal error: Oops - undefined instruction: 0 [#1] SMP THUMB2

 

This happens both from SD card and eMMC, which would lead me think that the problem is in my bootloader... But then I tried to used another bootloader downloaded here

https://pkgs.org/download/u-boot-bananapi-p2-zero

and the result is the same.

 

I'm lost, has anyone any clue about why the kernel loading is hanging this way?

If yes, which could be the solution/workaround?

 

Last thing: is there a better/alternative way to make my armbian image capable of booting from eMMC?

 

Any suggestion is very much appreciated :)

Thanks in advance!

BR

 

  • Solution
Posted

Hi,

I've been finally able to boot armbian from emmc on banana pi p2 zero, and I'm going to share how I solved my issues.

 

Basically, somehow it seems that the bootloader was actually the culprit of my issue.

I compiled a new bootloader from armbian sources (following these instructions https://docs.armbian.com/Developer-Guide_Build-Preparation/), after applying 2 patches. I'm sharing the full procedure, I think it would be the clearest explanation possible.

 

  1. git clone --depth 1 https://github.com/armbian/build; cd build;

     

  2. copy files banana_dts.patch and banana_defconfig.patch (attached below) inside both the userpatches folder and the userpatches/u-boot (perhaps only this last folder is usefull, I don't know)
  3. ./compile.sh BOARD=bananapim2zero
  4. Done!

    NOTE: This last command will build a full boot+kernel image. Since I was interested on the bootloader only, I extracted the first 4M from that image with dd command, and saved it into a u-boot-with-spl.bin file. Perhaps it would have been faster and easier to build directly the bootloader only through the command (which I did not try):
    ./compile.sh BOARD=bananapim2zero 'compile_uboot'

     

Here are the 2 patch files:

banana_dts.patch:

diff --git a/arch/arm/dts/sun8i-h2-plus-bananapi-m2-zero.dts b/arch/arm/dts/sun8i-h2-plus-bananapi-m2-zero.dts
index d277d043..be57ce08 100644
--- a/arch/arm/dts/sun8i-h2-plus-bananapi-m2-zero.dts
+++ b/arch/arm/dts/sun8i-h2-plus-bananapi-m2-zero.dts
@@ -107,6 +107,25 @@
 	};
 };
 
+&mmc2 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&mmc2_8bit_pins>;
+	vmmc-supply = <&reg_vcc3v3>;
+	vqmmc-supply = <&reg_vcc3v3>;
+	bus-width = <8>;
+	non-removable;
+	status = "okay";
+};
+
+
+&mmc2_8bit_pins {
+	pins = "PC5\0PC6\0PC8\0PC9\0PC10\0PC11\0PC12\0PC13\0PC14\0PC15\0PC16";
+	function = "mmc2";
+	drive-strength = < 0x1e >;
+	bias-pull-up;
+	phandle = < 0x54 >;
+};
+
 &ohci0 {
 	status = "okay";
 };

 

banana_defconfig.patch:

diff --git a/configs/bananapi_m2_zero_defconfig b/configs/bananapi_m2_zero_defconfig
index 09d0517c..e47e7808 100644
--- a/configs/bananapi_m2_zero_defconfig
+++ b/configs/bananapi_m2_zero_defconfig
@@ -6,3 +6,6 @@ CONFIG_DRAM_CLK=408
 CONFIG_MMC0_CD_PIN=""
 CONFIG_DEFAULT_DEVICE_TREE="sun8i-h2-plus-bananapi-m2-zero"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
+CONFIG_VIDEO_DE2=n
+CONFIG_MMC_SUNXI_SLOT_EXTRA=2
+CONFIG_SUN8I_EMAC=y

 

BR

 

This thread is quite old. Please consider starting a new thread rather than reviving this one.

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