mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-15 18:03:30 +00:00
base-files: recognize bootdevice on devices using fitblk
This commit is contained in:
parent
ea86509cd1
commit
319b46b4bd
@ -165,6 +165,23 @@ part_magic_fat() {
|
||||
[ "$magic" = "FAT" ] || [ "$magic_fat32" = "FAT32" ]
|
||||
}
|
||||
|
||||
fitblk_get_bootdev() {
|
||||
[ -e /sys/firmware/devicetree/base/chosen/rootdisk ] || return
|
||||
|
||||
local rootdisk="$(cat /sys/firmware/devicetree/base/chosen/rootdisk)"
|
||||
local handle bootdev
|
||||
for handle in /sys/class/block/*/of_node/phandle /sys/class/block/*/device/of_node/phandle; do
|
||||
[ ! -e "$handle" ] && continue
|
||||
if [ "$rootdisk" = "$(cat $handle)" ]; then
|
||||
bootdev="${handle%/of_node/phandle}"
|
||||
bootdev="${bootdev%/device}"
|
||||
bootdev="${bootdev#/sys/class/block/}"
|
||||
echo "$bootdev"
|
||||
break
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
export_bootdevice() {
|
||||
local cmdline uuid blockdev uevent line class
|
||||
local MAJOR MINOR DEVNAME DEVTYPE
|
||||
@ -196,6 +213,7 @@ export_bootdevice() {
|
||||
done
|
||||
;;
|
||||
/dev/*)
|
||||
[ "$rootpart" = "/dev/fit0" ] && rootpart="$(fitblk_get_bootdev)"
|
||||
uevent="/sys/class/block/${rootpart##*/}/../uevent"
|
||||
;;
|
||||
0x[a-f0-9][a-f0-9][a-f0-9] | 0x[a-f0-9][a-f0-9][a-f0-9][a-f0-9] | \
|
||||
|
@ -20,6 +20,7 @@ CMAKE_INSTALL:=1
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
PKG_LICENSE_FILES:=
|
||||
|
||||
PKG_USE_MIPS16:=0
|
||||
PKG_BUILD_FLAGS:=no-mips16
|
||||
PKG_FLAGS:=nonshared
|
||||
|
||||
|
@ -13,7 +13,7 @@ KERNEL_TESTING_PATCHVER:=6.6
|
||||
|
||||
include $(INCLUDE_DIR)/target.mk
|
||||
DEFAULT_PACKAGES += \
|
||||
kmod-leds-gpio kmod-gpio-button-hotplug \
|
||||
kmod-leds-gpio kmod-gpio-button-hotplug fitblk \
|
||||
autocore-arm htop wpad-openssl uboot-envtools
|
||||
|
||||
$(eval $(call BuildTarget))
|
||||
|
Loading…
Reference in New Issue
Block a user