Jump to content

nanopi-r5s SD card and EMMC


sami

Recommended Posts

hello guys,

 

i ve been lately working with nanopi-r5s which comes with a default openwrt os installed on EMMC.

but i prefer working on the armbian images. that is why i installed debian 12 bookworm from https://www.armbian.com/nanopi-r5s/

anyway, r5s refuses to boot from sd card for no matter what. until i corrupted the emmc by mistake(i started flashing a default image to emmc but then took the power off before it is done). 

so now it boots from sd card.  but now when m trying to install the image from sd card to emmc through armbian-install. it only shows option 5 and 6. as if it can not detect the emmc.

 

so what m trying to figure out is:

how to force nanopi r5s to boot from sd card even though there is openwrt at emmc and how then could i flash my sd os to the emmc.

 

thanks in advance

Link to comment
Share on other sites

Armbian & Khadas are rewarding contributors

1 час назад, sami сказал:

trying to install the image from sd card to emmc through armbian-install. it only shows option 5 and 6.

Please try to replace the /usr/sbin/armbian-install file with this new version:

packages/bsp/common/usr/sbin/armbian-install

 

Please show the output of the `lsblk` command.
Please post screenshots of the armbian-install dialog.

Link to comment
Share on other sites

Posted (edited)

lsblk:

lsblk
NAME         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
mmcblk1      179:0    0 28.9G  0 disk
└─mmcblk1p1  179:1    0  1.2G  0 part
mmcblk1boot0 179:32   0    4M  1 disk
mmcblk1boot1 179:64   0    4M  1 disk
mmcblk0      179:96   0 29.1G  0 disk
└─mmcblk0p1  179:97   0 28.8G  0 part /var/log.hdd
                                      /
zram0        251:0    0  1.8G  0 disk [SWAP]
zram1        251:1    0   50M  0 disk /var/log
zram2        251:2    0    0B  0 disk
 

 

 

 

 

 

 

and there i posted three screenshots of the output of armbian-install

where i choose second option and then i confirmed then it says done in less than one second. 

and i did replace the file with what u proposed.

 

 

 

1.png

2.png

 

editted:

sorry m adding this extra picture:

 

 

3.png

4.png

Edited by sami
Link to comment
Share on other sites

19 минут назад, sami сказал:

and i did replace the file with what u proposed.

It looks very strange.

 

It looks like this to me:

leo@bananapim3:~$ lsblk
NAME         MAJ:MIN RM    SIZE RO TYPE MOUNTPOINTS
sda            8:0    0      0B  0 disk 
mmcblk0      179:0    0    7,4G  0 disk 
└─mmcblk0p1  179:1    0    7,4G  0 part /var/log.hdd
                                        /
mmcblk2      179:8    0    7,3G  0 disk 
└─mmcblk2p1  179:9    0    7,2G  0 part 
mmcblk2boot0 179:16   0      4M  1 disk 
mmcblk2boot1 179:24   0      4M  1 disk 
zram0        253:0    0 1005,7M  0 disk [SWAP]
zram1        253:1    0     50M  0 disk /var/log
zram2        253:2    0      0B  0 disk

leo@bananapim3:~$ bash --version
GNU bash, версия 5.2.15(1)-release (arm-unknown-linux-gnueabihf)

leo@bananapim3:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Armbian_community 24.8.0-trunk.104 bookworm
Release:        12
Codename:       bookworm

 

I booted from the SD card and

sudo armbian-install

armbian-install-boot-from-sd.png.e3e6fa3cf24a5785de4bee6dbdbf30ee.png

Link to comment
Share on other sites

root@nanopi-r5s:/usr/sbin# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Armbian 24.8.0-trunk.525 bookworm
Release:        12
Codename:       bookworm
 

 

 

 

 

root@nanopi-r5s:~# bash --version
GNU bash, version 5.2.15(1)-release (aarch64-unknown-linux-gnu)
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
 

Link to comment
Share on other sites

3 минуты назад, sami сказал:

Codename:       bookworm

I'm shocked. We use the same versions of the system packages.
There is something else that needs to be checked.
Wait for me to type it now.

Link to comment
Share on other sites

14 минут назад, sami сказал:

i believe it has to do with the hardware m using.

i just cant figure it out as well.

No

 

Create a check-command.sh file:

#!/bin/bash

cm="ls grep awk blkid tr lsblk xargs sync mount df head cat sed mktemp nl chroot lsof parted partprobe mkfs fdisk"

for c in $cm
do
	echo "#  $c =: $(command -v $c)"
done
echo "====="

root_uuid=$(sed -e 's/^.*root=//' -e 's/ .*$//' < /proc/cmdline)

root_partition=$(blkid | tr -d '":' | grep "${root_uuid}" | awk '{print $1}')
root_partition_name=$(echo $root_partition | sed 's/\/dev\///g')
root_partition_device_name=$(lsblk -ndo pkname $root_partition)
root_partition_device=/dev/$root_partition_device_name
emmccheck=$(ls -d -1 /dev/mmcblk* 2>/dev/null | grep -w 'mmcblk[0-9]' | grep -v "$root_partition_device")
diskcheck=$(lsblk -l | awk -F" " '/ disk / {print $1}' | grep -E '^sd|^nvme|^mmc' | grep -v "$root_partition_device_name" | grep -v boot)

echo "root_partition_device=$root_partition_device"
echo "emmccheck=$emmccheck"
echo "diskcheck=$diskcheck"

 

and make it executable.

chmod +x check-command.sh

 

Run on board and publish

 

sudo ./check-command.sh

 

Link to comment
Share on other sites

leo@bananapim3:~$ sudo ./check-command.sh 
[sudo] пароль для leo: 
#  ls =: /usr/bin/ls
#  grep =: /usr/bin/grep
#  awk =: /usr/bin/awk
#  blkid =: /usr/sbin/blkid
#  tr =: /usr/bin/tr
#  lsblk =: /usr/bin/lsblk
#  xargs =: /usr/bin/xargs
#  sync =: /usr/bin/sync
#  mount =: /usr/bin/mount
#  df =: /usr/bin/df
#  head =: /usr/bin/head
#  cat =: /usr/bin/cat
#  sed =: /usr/bin/sed
#  mktemp =: /usr/bin/mktemp
#  nl =: /usr/bin/nl
#  chroot =: /usr/sbin/chroot
#  lsof =: /usr/bin/lsof
#  parted =: /usr/sbin/parted
#  partprobe =: /usr/sbin/partprobe
#  mkfs =: /usr/sbin/mkfs
#  fdisk =: /usr/sbin/fdisk
=====
root_partition_device=/dev/mmcblk0
emmccheck=/dev/mmcblk2
diskcheck=sda
mmcblk2

 

Link to comment
Share on other sites

this is my output!!!! 

very strange!!!!!

 

 

 

root@nanopi-r5s:~# sudo ./check-command.sh
#  ls =: /usr/bin/ls
#  grep =: /usr/bin/grep
#  awk =: /usr/bin/awk
#  blkid =: /usr/sbin/blkid
#  tr =: /usr/bin/tr
#  lsblk =: /usr/bin/lsblk
#  xargs =: /usr/bin/xargs
#  sync =: /usr/bin/sync
#  mount =: /usr/bin/mount
#  df =: /usr/bin/df
#  head =: /usr/bin/head
#  cat =: /usr/bin/cat
#  sed =: /usr/bin/sed
#  mktemp =: /usr/bin/mktemp
#  nl =: /usr/bin/nl
#  chroot =: /usr/sbin/chroot
#  lsof =: /usr/bin/lsof
#  parted =: /usr/sbin/parted
#  partprobe =: /usr/sbin/partprobe
#  mkfs =: /usr/sbin/mkfs
#  fdisk =: /usr/sbin/fdisk
=====
root_partition_device=/dev/mmcblk1
mmcblk0
emmccheck=
diskcheck=
 

Link to comment
Share on other sites

10 минут назад, sami сказал:

root_partition_device=/dev/mmcblk1

Is your OS loaded from eMMC?

Your OS is loaded from eMMC!!

Insert the SD card on running OS and run armbian-install

Link to comment
Share on other sites

I inserted my sd card on a new r5s which contains a friendlywrt os on its emmc, but the problem is that i can not choose to boot from sd card!!!!

it always boots from emmc!

 

and how is it loaded from emmc? since whenever i remove the sd card then it wont boot again! at all!

Link to comment
Share on other sites

22 минуты назад, sami сказал:

I inserted my sd card on a new r5s which contains a friendlywrt os on its emmc, but the problem is that i can not choose to boot from sd card!!!!

it always boots from emmc!

 

and how is it loaded from emmc? since whenever i remove the sd card then it wont boot again! at all!

 

Let's try to figure out where you are.

Boot from the SD and print the output of the df -h command

Link to comment
Share on other sites

that;s what m trying to say bro.

this r5s would not boot from any external environment if the emmc is loaded with an OS.

it only booted from sd card because i corrupted the emmc by mistake.

well this is exactly my main concern: how could i force boot from an external environment if the emmc is loaded with the default friendlywrt os?

Link to comment
Share on other sites

9 минут назад, sami сказал:

it only booted from sd card

 

Boot from the SD.

2 часа назад, sami сказал:

lsblk
NAME         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
mmcblk1      179:0    0 28.9G  0 disk
└─mmcblk1p1  179:1    0  1.2G  0 part
mmcblk1boot0 179:32   0    4M  1 disk
mmcblk1boot1 179:64   0    4M  1 disk
mmcblk0      179:96   0 29.1G  0 disk
└─mmcblk0p1  179:97   0 28.8G  0 part /var/log.hdd
                                      /

Try to clear (write zeros) the first 10 megabytes on the /dev/mmcblk1 disk.

Try the installation again from the CD.

Link to comment
Share on other sites

20 часов назад, sami сказал:

that;s what m trying to say bro.

If your device is in the same condition, I will ask you to provide some additional information about the downloaded operating system.

Your case is unique.
Your device and mine have the same OS and the same set of packages installed.


But the armbian-install script behaves completely differently and crashes in your case.
I need to understand why this is happening and correct the erroneous behavior.

Please post the output of the following commands:

cat /proc/cmdline | tr " " "\n"

lsblk -Py

df -h

sudo blkid

 

21 час назад, sami сказал:

how could i force boot from an external environment if the emmc is loaded with the default friendlywrt os?

1) You can use a utility from the manufacturer of the chip or device. If this software exists.

2) You can become a hacker, listen to the following harmful tips, or find them on the Internet:

Boot the device in any way and get access to the command line with superuser rights.

The bootloader, u-boot or other, can be written in whole or in parts to three locations on the eMMC:

/dev/mmcblkXboot0
/dev/mmcblkXboot1
/dev/mmcblkX

X - This is the number for your eMMC

In order for the device not to boot from eMMC, it is necessary to clear those areas in which parts of the bootloader can be placed.

sudo su
echo 0 > /sys/block/mmcblkXboot0/force_ro
dd if=/dev/zero of=/dev/mmcblkXboot0 bs=1M count=4

echo 0 > /sys/block/mmcblkXboot1/force_ro
dd if=/dev/zero of=/dev/mmcblkXboot1 bs=1M count=4

dd if=/dev/zero of=/dev/mmcblkX bs=1M count=10

After these steps, your device will be able to boot from the SD card correctly.

 

You can also use the helpful tips described in great detail in the wiki documentation for NanoPi R5S.

 

With respect

 

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