Project

General

Profile

Actions

Feature #969

closed

Either mount SD by partition label or synlink to device mount point

Added by Hammel 11 months ago. Updated 8 months ago.

Status:
Closed
Priority:
Immediate
Assignee:
Category:
04 - Root File System
Target version:
Start date:
14 May 2023
Due date:
% Done:

100%

Estimated time:
Severity:
02 - High

Description

Currently the blockhandler.sh mounts mmc devices using their mmc names.

A better idea is to mount them to directories that use their disk labels. Since PiBox installation tools put the labels on the partitions, blockhandler.sh can retrieve the label from the device partition using

lsblk -o name,mountpoint,label|grep mmcblk1p1|cut -c29-
Actions #1

Updated by Hammel 9 months ago

  • Priority changed from Urgent to Immediate
Actions #2

Updated by Hammel 9 months ago

lsblk is not included on the current dev system. It comes from Buildroot->Target Packages->System Tools->util-linux->basic set. However, we could also parse the data from /dev/disk/by-label.

$ readlink -f /dev/disk/by-label/rootfs
/dev/mmcblk0p2

The change required is to make blockhandler.sh:findMount() check if the device name passed to it is an mmc device. If it is, check if it is one of the named partitions (BOOT (uppercase), rootfs, data). If so, mount using the named partitions. If not, do what it currently does.

In postbuild.sh , create symlinks from the /media directory from each of the named partitions to their old mmc names, just so old stuff works (until I figure out what else needs to be changed).

)$ grep mmcblk /etc/init.d/*
S21packages:PKGDIR=/media/mmcblk0p3/opkg/pkg
S21packages:INCOMINGDIR=/media/mmcblk0p3/opkg/incoming
S99zzreboot:INCOMINGDIR=/media/mmcblk0p3/opkg/incoming
firstboot:    sed -i 's/rootwait /lpj='"${LPJ}"' rootwait /' /media/mmcblk0p1/cmdline.txt
functions:CONFIG=/media/mmcblk0p1/config.txt
functions:LOGDIR=/media/mmcblk0p3/log
$ find pi* ironman appmgr launcher lcdshow libpibox metabuild mjpg-streamer omxplayer musicfe pmsui pnc psplash raspi2fb videofe videolib -type f -exec grep -l "mmcblk" {} \;
pibox86/src/src/buildroot/skeleton/usr/bin/blockhandler.sh
pibox86/src/src/buildroot/skeleton/etc/mdev.conf
pidock/src/src/pidock/S90docker
pinet/src/opkg/postinst
pinet/src/opkg/prerm
pistore/src/opkg/postinst
pistore/src/opkg/prerm
lcdshow/src/configs/lcdshow.mk
lcdshow/src/src/opkg/postinst
lcdshow/src/src/opkg/prerm
lcdshow/src/src/scripts/pibox-hdmi
pmsui/src/src/opkg/postinst
Actions #3

Updated by Hammel 9 months ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 10
Actions #4

Updated by Hammel 8 months ago

  • % Done changed from 10 to 20
Actions #5

Updated by Hammel 8 months ago

  • % Done changed from 20 to 50

Added code to firstboot to deal with this. A symlink will be created from the blockhandler.sh created mount point to the appropriately named file under /media, as in /media/boot or /media/data.

This works because the drivers will be the same until a system update is installed and only the drivers could change the blockhandler.sh mount point name. And since an update is a reinstall (if we ever get to a real update, that is) then we would always setup the proper partition-named /media files during firstboot.

Code needs to be tested on a fresh install.

Actions #6

Updated by Hammel 8 months ago

Using /dev/disk/by-label on firstboot doesn't work because that tree is empty at that moment. This is likely because firstboot needs to be cleaned up to properly start required init scripts, which now includes udev.

Actions #7

Updated by Hammel 8 months ago

  • Status changed from In Progress to Closed
  • % Done changed from 50 to 100

Fixed firstboot to start correct init scripts so by-label is populated.
Updated script to create symlinks.
Fixed firstboot init script startup - it was messy and slightly broken.
Added logging to some functions in the functions script that were missing.
Added header to log messages (from functions script) to make them easier to find.

Code updated and tested on hardware.
Committed and pushed.
Closing issue.

Actions

Also available in: Atom PDF