Jump to content

Orange pi 5b doesnt boot (from emmc) when even an empty sd card is inserted


Recommended Posts

I am a newbie to linux. I installed orange pi os with arch linux from the official site, using rkdevtool and pressing maskrom button. I installed xfce and uninstalled gnome. The OS is stored in the emmc of the pi, and everything boots fine unless i insert the sd card in the designated sd card slot. At first, i had OS arch in that sd card, and when i first plugged it in the pi, the sd card OS booted. I figured that the pi gave priority to the boot section of the sd card, and since i dont need 2 OS on my pi, i decided not to investigate further, and just avoid the problem by wiping the sd card clean. I deleted all the partitions through the Windows Disk Partition app, formated the sd card in exFat, and the problem started. Even after reformating the sd card in linux, whenever i try to reboot or even boot, with the sd card plugged in, i get a blank screen. When i boot, and then plug in the sd card, everything works as expected and i can use the card. If i put the card in an sd to usb adapter, i can boot with the adapter plugged in without issue. I have found some posts reguarding this problem here : https://forum.armbian.com/topic/1702-orange-pi-plus-2e-where-is-16ghz-and-sd/ but the post is solved and closed. I dont have the /boot/script.bin anywhere, and thus, i cant change sdc_detmode to 1. I did sudo find / "script*", with no luck. I even searched files for the contents that i am supposed to change (e.g. "mmc0","sdc_detmode") but the pi crashed both times that i tried it. What can i do? I simply want to have my sd card plugged in, for extra storage, and have my os and other stuff in the emmc storage, from where i will boot. Mind you, all these are done in fresh and updated with pacman -Syu installations of Arch.

 

Link to comment
Share on other sites

I solved similar problem for ubuntu and I think similar steps can be used for armbian.

 

Orange pi 5B and other boards based on some Rockchip CPU have a booting issue. 
When the eMMC is flashed with ubuntu (or other OS such as armbian as I believe), then if a blank SD is inserted, the board will not boot.
Investigation of the problem through serial debug cable show that the bootloader select SD as the first boot device,
and try to boot from it. Since there is no valid image, the system will panic and just halt. On x86 systems, the bootloader will
fallback to the next boot device.

The problem is related to the module "config_distro_bootcmd.h" in the u-boot section which contains boot steps.
The system tries to boot from the SD without checking whether it has a valid imag or not.

 

A quick and solid solution is to patch this moudle and rebuilt the u-boot. The following steps are used to solve the problem:

1. On the development Linux PC, such as virtual machine, with updated ubuntu, create a directory on the home/user folder

mkdir $HOME/orangepi
cd orangepi
git clone https://github.com/orangepi-xunlong/orangepi-build.git -b next
cd orangepi-build

2. Run build script to install the required files:
sudo ./build.sh

then select u-boot only and select board type (ornage pi 5B in my case)

Note: build.sh will install the required cross compile toolchain and source files when it runs first time.

3. To enable code editing without comparing with the git, edit the following file :
sudo nano userpatches/config-default.conf
set:
IGNORE_UPDATES="yes"

4. Edit the following file using gedit or any other editor with root permission
 $HOME/orangepi/orangepi-build/u-boot/v2017.09-rk3588/include/config_distro_bootcmd.h
 
 Change line 81 from: "if mmc dev 0; then "    \
 to:                  "if mmc dev 0 && rkimgtest mmc 0; then "    \

This will force the bootloader to check if there exist a valid image on the SD or not.
I know this solution may be insuitable for other brands, but, of course, it can be applied for all Rockchip boards.
Developers of other boards may implement their checking moudle.

5. repeat building process:
sudo ./build.sh BOARD=orangepi5b BRANCH=legacy BUILD_OPT=u-boot KERNEL_CONFIGURE=no

6. Copy the generated deb package from output directory: orangepi-build/output/debs/u-boot to the home directory of the target board.

7. Install generated linux-u-boot-legacy-orangepi5b_1.0.8_arm64.deb package to the target board

Important: Remove the SD from the board, 
power cycle ornage pi 5B and login using terminal emulator, then issue:

sudo apt purge -y linux-u-boot-orangepi5b-legacy 
sudo dpkg -i linux-u-boot-legacy-orangepi5b_1.0.8_arm64.deb
sudo nand-sata-install
When asked select : 5 Install/Update the bootloader on SD/eMMC
it will update the u-boot section on the eMMC.

Note: orange pi 5B has no SPI flash. u-boot is stored in eMMC or SD.
 

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