Some checks failed
Build Kernel / Build all affected Kernels (push) Has been cancelled
Build all core packages / Build all core packages for selected target (push) Has been cancelled
Build and Push prebuilt tools container / Build and Push all prebuilt containers (push) Has been cancelled
Build Toolchains / Build Toolchains for each target (push) Has been cancelled
Build host tools / Build host tools for linux and macos based systems (push) Has been cancelled
Coverity scan build / Coverity x86/64 build (push) Has been cancelled
36 lines
901 B
Plaintext
36 lines
901 B
Plaintext
# SPDX-License-Identifier: GPL-2.0-or-later OR BSD-2-Clause
|
|
|
|
. /lib/functions/bcm4908.sh
|
|
|
|
rootfs_create() {
|
|
local blocks
|
|
|
|
blocks=$(cat /sys/class/ubi/ubi0/avail_eraseblocks)
|
|
[ -z "$blocks" ] && {
|
|
echo "Failed to read amount of available erase blocks" >&2
|
|
return
|
|
}
|
|
|
|
# Use 80% of remaining flash size for "rootfs_data"
|
|
ubimkvol /dev/ubi0 -n 20 -N rootfs_data --lebs $((blocks / 100 * 80))
|
|
mknod -m 0600 /dev/ubi0_20 c 252 21
|
|
|
|
bcm4908_verify_rootfs_data ubi0_20
|
|
}
|
|
|
|
rootfs_prepare() {
|
|
# Do nothing on CFE devices
|
|
ubinfo /dev/ubi0 -N metadata1 > /dev/null 2>&1 || return
|
|
|
|
# Find UBI volume device (e.g. ubi0_123)
|
|
local ubivol="$(grep rootfs_data /sys/class/ubi/ubi*/name | sed -n 's/.*\(ubi\d*_\d*\).*/\1/p')"
|
|
if [ -n "$ubivol" ]; then
|
|
bcm4908_verify_rootfs_data $ubivol
|
|
else
|
|
echo "Creating \"rootfs_data\" UBI volume"
|
|
rootfs_create
|
|
fi
|
|
}
|
|
|
|
boot_hook_add preinit_main rootfs_prepare
|