mirror of
https://github.com/hanwckf/immortalwrt-mt798x.git
synced 2025-01-07 01:53:34 +08:00
update fstools to master version
This commit is contained in:
parent
7edbdbbf68
commit
514e9497eb
@ -12,15 +12,15 @@ PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL=$(PROJECT_GIT)/project/fstools.git
|
||||
PKG_MIRROR_HASH:=a485792d90c71cd4fb396ce97f42a57ee4d2a3d78e5f3fd0748270ffb14209e6
|
||||
PKG_SOURCE_DATE:=2021-01-04
|
||||
PKG_SOURCE_VERSION:=c53b18820756f6f32ad0782d3bf489422b7c4ad3
|
||||
PKG_MIRROR_HASH:=e9953b038a2c2ed2c4783b66d1c0d0cea0deab2f2bfa6712929243e3197c3bdd
|
||||
PKG_SOURCE_DATE:=2023-05-28
|
||||
PKG_SOURCE_VERSION:=3a07943e1e60699ba952e605f0cf23c82de356cb
|
||||
CMAKE_INSTALL:=1
|
||||
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
PKG_LICENSE_FILES:=
|
||||
|
||||
PKG_USE_MIPS16:=0
|
||||
PKG_BUILD_FLAGS:=no-mips16
|
||||
PKG_FLAGS:=nonshared
|
||||
|
||||
PKG_BUILD_DEPENDS := util-linux
|
||||
@ -31,7 +31,6 @@ PKG_MAINTAINER:=John Crispin <john@phrozen.org>
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
|
||||
TARGET_LDFLAGS += $(if $(CONFIG_USE_GLIBC),-lrt)
|
||||
CMAKE_OPTIONS += $(if $(CONFIG_FSTOOLS_UBIFS_EXTROOT),-DCMAKE_UBIFS_EXTROOT=y)
|
||||
CMAKE_OPTIONS += $(if $(CONFIG_FSTOOLS_OVL_MOUNT_FULL_ACCESS_TIME),-DCMAKE_OVL_MOUNT_FULL_ACCESS_TIME=y)
|
||||
CMAKE_OPTIONS += $(if $(CONFIG_FSTOOLS_OVL_MOUNT_COMPRESS_ZLIB),-DCMAKE_OVL_MOUNT_COMPRESS_ZLIB=y)
|
||||
@ -39,7 +38,7 @@ CMAKE_OPTIONS += $(if $(CONFIG_FSTOOLS_OVL_MOUNT_COMPRESS_ZLIB),-DCMAKE_OVL_MOUN
|
||||
define Package/fstools
|
||||
SECTION:=base
|
||||
CATEGORY:=Base system
|
||||
DEPENDS:=+ubox +USE_GLIBC:librt +NAND_SUPPORT:ubi-utils
|
||||
DEPENDS:=+ubox +NAND_SUPPORT:ubi-utils
|
||||
TITLE:=OpenWrt filesystem tools
|
||||
MENU:=1
|
||||
endef
|
||||
@ -75,18 +74,22 @@ define Package/snapshot-tool
|
||||
DEPENDS:=+libubox +fstools
|
||||
endef
|
||||
|
||||
define Package/block-mount/conffiles
|
||||
/etc/config/fstab
|
||||
endef
|
||||
|
||||
define Package/block-mount
|
||||
SECTION:=base
|
||||
CATEGORY:=Base system
|
||||
TITLE:=Block device mounting and checking
|
||||
DEPENDS:=+ubox +libubox +libuci +libblobmsg-json +libjson-c +fstools
|
||||
DEPENDS:=+ubox +libubox +libuci +libblobmsg-json +libjson-c
|
||||
endef
|
||||
|
||||
define Package/blockd
|
||||
SECTION:=base
|
||||
CATEGORY:=Base system
|
||||
TITLE:=Block device automounting
|
||||
DEPENDS:=+block-mount +libubus +kmod-fs-autofs4 +libblobmsg-json +libjson-c
|
||||
DEPENDS:=+block-mount +fstools +libubus +kmod-fs-autofs4 +libblobmsg-json +libjson-c
|
||||
endef
|
||||
|
||||
define Package/fstools/install
|
||||
|
@ -16,6 +16,7 @@ reload_service() {
|
||||
start_service() {
|
||||
procd_open_instance
|
||||
procd_set_param command "$PROG"
|
||||
procd_set_param watch block
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
|
@ -1,7 +1,9 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# (C) 2013 openwrt.org
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
# Copyright (C) 2013-2020 OpenWrt.org
|
||||
|
||||
START=40
|
||||
START=11
|
||||
|
||||
boot() {
|
||||
/sbin/block mount
|
||||
|
@ -1,121 +0,0 @@
|
||||
From: Qi Liu <liuqi_colin@msn.com>
|
||||
|
||||
In order to support extroot, block extroot command has to be able to
|
||||
discover and properly mount the rootfs_data volume in order to discover
|
||||
the extroot volume. Currently this process can only discover MTD devices.
|
||||
This patch leverages libfstools in a similar way as mount_root to
|
||||
discover, initialize, and mount rootfs_data volume. It would enable any
|
||||
device with non-MTD rootfs_data volume to support extroot, including x86.
|
||||
|
||||
Signed-off-by: Qi Liu <liuqi_colin@msn.com>
|
||||
---
|
||||
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -75,9 +75,9 @@ INSTALL(TARGETS blockd RUNTIME DESTINATION sbin)
|
||||
ADD_EXECUTABLE(block block.c probe.c probe-libblkid.c)
|
||||
IF(DEFINED CMAKE_UBIFS_EXTROOT)
|
||||
ADD_DEFINITIONS(-DUBIFS_EXTROOT)
|
||||
- TARGET_LINK_LIBRARIES(block blkid-tiny dl uci ubox ubus blobmsg_json ubi-utils ${json})
|
||||
+ TARGET_LINK_LIBRARIES(block blkid-tiny dl fstools uci ubox ubus blobmsg_json ubi-utils ${json})
|
||||
ELSE(DEFINED CMAKE_UBIFS_EXTROOT)
|
||||
- TARGET_LINK_LIBRARIES(block blkid-tiny dl uci ubox ubus blobmsg_json ${json})
|
||||
+ TARGET_LINK_LIBRARIES(block blkid-tiny dl fstools uci ubox ubus blobmsg_json ${json})
|
||||
ENDIF(DEFINED CMAKE_UBIFS_EXTROOT)
|
||||
INSTALL(TARGETS block RUNTIME DESTINATION sbin)
|
||||
|
||||
--- a/block.c
|
||||
+++ b/block.c
|
||||
@@ -46,6 +46,9 @@
|
||||
#include <libubox/vlist.h>
|
||||
#include <libubus.h>
|
||||
|
||||
+#include "libfstools/fstype.h"
|
||||
+#include "libfstools/volume.h"
|
||||
+
|
||||
#include "probe.h"
|
||||
|
||||
#define AUTOFS_MOUNT_PATH "/tmp/run/blockd/"
|
||||
@@ -1579,6 +1582,44 @@ static int main_extroot(int argc, char **argv)
|
||||
}
|
||||
#endif
|
||||
|
||||
+ /* Find volume using libfstools */
|
||||
+ struct volume *data = volume_find("rootfs_data");
|
||||
+ if (data) {
|
||||
+ volume_init(data);
|
||||
+
|
||||
+ switch (volume_identify(data)) {
|
||||
+ case FS_EXT4: {
|
||||
+ char cfg[] = "/tmp/ext4_cfg";
|
||||
+
|
||||
+ /* Mount volume and try extroot (using fstab from that vol) */
|
||||
+ mkdir_p(cfg, 0755);
|
||||
+ if (!mount(data->blk, cfg, "ext4", MS_NOATIME, NULL)) {
|
||||
+ err = mount_extroot(cfg);
|
||||
+ umount2(cfg, MNT_DETACH);
|
||||
+ }
|
||||
+ if (err < 0)
|
||||
+ rmdir("/tmp/overlay");
|
||||
+ rmdir(cfg);
|
||||
+ return err;
|
||||
+ }
|
||||
+
|
||||
+ case FS_F2FS: {
|
||||
+ char cfg[] = "/tmp/f2fs_cfg";
|
||||
+
|
||||
+ /* Mount volume and try extroot (using fstab from that vol) */
|
||||
+ mkdir_p(cfg, 0755);
|
||||
+ if (!mount(data->blk, cfg, "f2fs", MS_NOATIME, NULL)) {
|
||||
+ err = mount_extroot(cfg);
|
||||
+ umount2(cfg, MNT_DETACH);
|
||||
+ }
|
||||
+ if (err < 0)
|
||||
+ rmdir("/tmp/overlay");
|
||||
+ rmdir(cfg);
|
||||
+ return err;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
/* As a last resort look for /etc/config/fstab on "rootfs" partition */
|
||||
return mount_extroot(NULL);
|
||||
}
|
||||
--- /dev/null
|
||||
+++ b/libfstools/fstype.h
|
||||
@@ -0,0 +1,12 @@
|
||||
+#ifndef _FS_TYPE_H__
|
||||
+#define _FS_TYPE_H__
|
||||
+enum {
|
||||
+ FS_NONE,
|
||||
+ FS_SNAPSHOT,
|
||||
+ FS_JFFS2,
|
||||
+ FS_DEADCODE,
|
||||
+ FS_UBIFS,
|
||||
+ FS_F2FS,
|
||||
+ FS_EXT4,
|
||||
+};
|
||||
+#endif
|
||||
--- a/libfstools/libfstools.h
|
||||
+++ b/libfstools/libfstools.h
|
||||
@@ -18,19 +18,10 @@
|
||||
#include <libubox/blob.h>
|
||||
#include <libubox/ulog.h>
|
||||
#include <libubox/utils.h>
|
||||
+#include "fstype.h"
|
||||
|
||||
struct volume;
|
||||
|
||||
-enum {
|
||||
- FS_NONE,
|
||||
- FS_SNAPSHOT,
|
||||
- FS_JFFS2,
|
||||
- FS_DEADCODE,
|
||||
- FS_UBIFS,
|
||||
- FS_F2FS,
|
||||
- FS_EXT4,
|
||||
-};
|
||||
-
|
||||
enum fs_state {
|
||||
FS_STATE_UNKNOWN,
|
||||
FS_STATE_PENDING,
|
Loading…
x
Reference in New Issue
Block a user