Jump to content

[TUTO] SAFE FLASH method to avoiding sdcard block issues and compressed data are corrupted when flashing emmc


Recommended Posts

Posted

Hello All,

 

To all striking with sdcard issues , I have a good news today!

 

NORMAL AND FIGHTING WAY

Normally you put your sdcard on a adapter on a big computer you have flashed with a working and booting sbc to be able to flash the emmc
and then you copy the .img.xz you have downloaded on it , put the card in the sbc and boot on it
to have access to the dd command from there.

Unfortunately the result will depend on your sdcard quality, I experienced many bad block so I get bored. Yesterday have a flash,

 

LET'S TAKE THE BUNNY HIGHWAY!

 

I found a way faster and safer to do it to circonvent the sdcard: tempfs!


On the desktop computer, a linux machine,  I download the images for the sbc

wget https://imola.armbian.com/archive/bananapim5/archive/Armbian_22.08.7_Bananapim5_jammy_edge_5.19.16_cinnamon_desktop.img.xz
wget https://imola.armbian.com/archive/bananapim5/archive/Armbian_22.08.7_Bananapim5_jammy_edge_5.19.16_cinnamon_desktop.img.xz.sha

 

I retrieved the size
 

du -h Armbian_22.08.7_Bananapim5_jammy_edge_5.19.16_cinnamon_desktop.img.xz
1,3G	Armbian_22.08.7_Bananapim5_jammy_edge_5.19.16_cinnamon_desktop.img.xz


 

I issued with the USER=pi created during the first boot install on the sbc, for me HOST=bananapim5 a ssh session, ip maye change
depending on your setting in armbian_first_run.txt if you have set a static ip. Mine is 192.168.0.8

 

sosie@rainbow:~$ ssh pi@192.168.0.8


I tried the ubuntu tutorial to create tmpfs at a size a little bigger than the image .img.xz I want to flash

 

#create the target directory for tempfs
sudo mkdir /media/virtuelram

#let only user access to their own temp files with the sticky bit
sudo chmod 1777 /media/virtuelram

#mount to have size M or g for gigas vitual drive
sudo mount -t tmpfs -o size=1.5g tmpfs /media/virtuelram


Exit to transfer the img.xz files by sftp IN THE BUNNY HIGHWAY ^o^
 

exit
sosie@rainbow:~$ sftp pi@192.168.0.8
cd /media/virtualram
mget Arm*.xz.* 
exit

 

Now you are hundred percent to pass the exam (without cheating), the proof :

 

sosie@rainbow:~$ ssh pi@192.168.0.8
cd /media/virtualram
sha256sum -c Armbian_22.08.7_Bananapim5_jammy_edge_5.19.16_cinnamon_desktop.img.xz.sha 
Armbian_22.08.7_Bananapim5_jammy_edge_5.19.16_cinnamon_desktop.img.xz: Success

 

The  flash size is around 16go, we see can locate the EMMC, it's mmcblk1 , real size is 14.6Go

USER@HOST:/media/virtuelram$ lsblk

NAME         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
mmcblk0      179:0    0 59,5G  0 disk  <== SDCARD 64Go
└─mmcblk0p1  179:1    0 58,9G  0 part /
mmcblk1      179:32   0 14,6G  0 disk   <== EMMC
└─mmcblk1p1  179:33   0 14,6G  0 part 
mmcblk1boot0 179:64   0    4M  1 disk 
mmcblk1boot1 179:96   0    4M  1 disk 

 

Now the fun part:

sudo apt install xzcat pv dd
sudo xzcat Armbian_22.08.7_Bananapim5_jammy_edge_5.19.16_cinnamon_desktop.img.xz | pv | dd of=/dev/mmcblk1 bs=10M status=noxfer


 

Posted

Now, who want to be the Lord of the Flash and automatize this with a nice menu - why not in armbian-config which is a nice tool -  to select the img.xz in live...this would simplify the task.?

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