Initial Commit

- initial default booting image
This commit is contained in:
2026-11-06 20:45:42 +01:00
commit b8783708ae
15201 changed files with 602532 additions and 0 deletions

View File

@@ -0,0 +1,459 @@
From b15b6cc56ac7764be17acbdbf96448f388992adc Mon Sep 17 00:00:00 2001
From: Waldemar Brodkorb <wbx@openadk.org>
Date: Wed, 23 Aug 2023 15:41:28 +0200
Subject: [PATCH] f2fs-tools: convert to lseek() and kill lseek64
This patch replaces lseek64 with lseek() having #define _FILE_OFFSET_BITS 64.
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Upstream: https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-tools.git/commit/?id=b15b6cc56ac7764be17acbdbf96448f388992adc
---
configure.ac | 2 --
fsck/Makefile.am | 2 +-
include/android_config.h | 4 ----
lib/Makefile.am | 2 +-
lib/libf2fs.c | 3 ---
lib/libf2fs_io.c | 47 +++++++++++++++------------------------
lib/libf2fs_zoned.c | 1 -
mkfs/Makefile.am | 4 ++--
mkfs/f2fs_format.c | 2 --
mkfs/f2fs_format_main.c | 2 --
mkfs/f2fs_format_utils.c | 10 ---------
mkfs/f2fs_format_utils.h | 2 --
tools/Makefile.am | 2 +-
tools/f2fs_io/Makefile.am | 2 +-
tools/f2fs_io/f2fs_io.c | 6 -----
tools/f2fs_io_parse.c | 1 -
tools/f2fscrypt.c | 9 --------
tools/fibmap.c | 7 ------
18 files changed, 24 insertions(+), 84 deletions(-)
diff --git a/configure.ac b/configure.ac
index efab8d8..123ddbb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -187,8 +187,6 @@ AC_CHECK_FUNCS_ONCE([
getmntent
getuid
keyctl
- llseek
- lseek64
memset
setmntent
clock_gettime
diff --git a/fsck/Makefile.am b/fsck/Makefile.am
index 579dd26..40d31b8 100644
--- a/fsck/Makefile.am
+++ b/fsck/Makefile.am
@@ -1,7 +1,7 @@
## Makefile.am
AM_CPPFLAGS = ${libuuid_CFLAGS} -I$(top_srcdir)/include
-AM_CFLAGS = -Wall
+AM_CFLAGS = -Wall -D_FILE_OFFSET_BITS=64
sbin_PROGRAMS = fsck.f2fs
noinst_HEADERS = common.h dict.h dqblk_v2.h f2fs.h fsck.h node.h quotaio.h \
quotaio_tree.h quotaio_v2.h xattr.h compress.h
diff --git a/include/android_config.h b/include/android_config.h
index 141fe06..da8abcb 100644
--- a/include/android_config.h
+++ b/include/android_config.h
@@ -30,8 +30,6 @@
#define HAVE_FSTAT 1
#define HAVE_FSTAT64 1
#define HAVE_GETMNTENT 1
-#define HAVE_LLSEEK 1
-#define HAVE_LSEEK64 1
#define HAVE_MEMSET 1
#define HAVE_SELINUX_ANDROID_H 1
#define HAVE_SETMNTENT 1
@@ -67,7 +65,6 @@
#define HAVE_FSTAT 1
#define HAVE_FSTAT64 1
#define HAVE_GETMNTENT 1
-#define HAVE_LLSEEK 1
#define HAVE_MEMSET 1
#define HAVE_SPARSE_SPARSE_H 1
#define HAVE_LIBLZ4 1
@@ -78,6 +75,5 @@
#endif
#if defined(_WIN32)
-#define HAVE_LSEEK64
#define HAVE_SPARSE_SPARSE_H 1
#endif
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 871d773..69d46f8 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -3,7 +3,7 @@
lib_LTLIBRARIES = libf2fs.la
libf2fs_la_SOURCES = libf2fs.c libf2fs_io.c libf2fs_zoned.c nls_utf8.c
-libf2fs_la_CFLAGS = -Wall
+libf2fs_la_CFLAGS = -Wall -D_FILE_OFFSET_BITS=64
libf2fs_la_CPPFLAGS = -I$(top_srcdir)/include
libf2fs_la_LDFLAGS = -version-info $(LIBF2FS_CURRENT):$(LIBF2FS_REVISION):$(LIBF2FS_AGE)
diff --git a/lib/libf2fs.c b/lib/libf2fs.c
index 577a7e8..c3d5744 100644
--- a/lib/libf2fs.c
+++ b/lib/libf2fs.c
@@ -6,9 +6,6 @@
*
* Dual licensed under the GPL or LGPL version 2 licenses.
*/
-#define _LARGEFILE64_SOURCE
-#define _FILE_OFFSET_BITS 64
-
#include <f2fs_fs.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/lib/libf2fs_io.c b/lib/libf2fs_io.c
index 1a8167d..74e5f3a 100644
--- a/lib/libf2fs_io.c
+++ b/lib/libf2fs_io.c
@@ -11,8 +11,6 @@
*
* Dual licensed under the GPL or LGPL version 2 licenses.
*/
-#define _LARGEFILE64_SOURCE
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -67,22 +65,13 @@ static int __get_device_fd(__u64 *offset)
return -1;
}
-#ifndef HAVE_LSEEK64
-typedef off_t off64_t;
-
-static inline off64_t lseek64(int fd, __u64 offset, int set)
-{
- return lseek(fd, offset, set);
-}
-#endif
-
/* ---------- dev_cache, Least Used First (LUF) policy ------------------- */
/*
* Least used block will be the first victim to be replaced when max hash
* collision exceeds
*/
static bool *dcache_valid; /* is the cached block valid? */
-static off64_t *dcache_blk; /* which block it cached */
+static off_t *dcache_blk; /* which block it cached */
static uint64_t *dcache_lastused; /* last used ticks for cache entries */
static char *dcache_buf; /* cached block data */
static uint64_t dcache_usetick; /* current use tick */
@@ -172,7 +161,7 @@ static int dcache_alloc_all(long n)
{
if (n <= 0)
return -1;
- if ((dcache_blk = (off64_t *) malloc(sizeof(off64_t) * n)) == NULL
+ if ((dcache_blk = (off_t *) malloc(sizeof(off_t) * n)) == NULL
|| (dcache_lastused = (uint64_t *)
malloc(sizeof(uint64_t) * n)) == NULL
|| (dcache_buf = (char *) malloc (F2FS_BLKSIZE * n)) == NULL
@@ -257,7 +246,7 @@ static inline long dcache_relocate(long entry, int n)
dcache_config.num_cache_entry;
}
-static long dcache_find(off64_t blk)
+static long dcache_find(off_t blk)
{
register long n = dcache_config.num_cache_entry;
register unsigned m = dcache_config.max_hash_collision;
@@ -278,10 +267,10 @@ static long dcache_find(off64_t blk)
}
/* Physical read into cache */
-static int dcache_io_read(int fd, long entry, off64_t offset, off64_t blk)
+static int dcache_io_read(int fd, long entry, off_t offset, off_t blk)
{
- if (lseek64(fd, offset, SEEK_SET) < 0) {
- MSG(0, "\n lseek64 fail.\n");
+ if (lseek(fd, offset, SEEK_SET) < 0) {
+ MSG(0, "\n lseek fail.\n");
return -1;
}
if (read(fd, dcache_buf + entry * F2FS_BLKSIZE, F2FS_BLKSIZE) < 0) {
@@ -308,12 +297,12 @@ static int dcache_io_read(int fd, long entry, off64_t offset, off64_t blk)
* 1: cache not available (uninitialized)
* -1: error
*/
-static int dcache_update_rw(int fd, void *buf, off64_t offset,
+static int dcache_update_rw(int fd, void *buf, off_t offset,
size_t byte_count, bool is_write)
{
- off64_t blk;
+ off_t blk;
int addr_in_blk;
- off64_t start;
+ off_t start;
if (!dcache_initialized)
dcache_init(); /* auto initialize */
@@ -377,13 +366,13 @@ static int dcache_update_rw(int fd, void *buf, off64_t offset,
* return value: 1: cache not available
* 0: success, -1: I/O error
*/
-int dcache_update_cache(int fd, void *buf, off64_t offset, size_t count)
+int dcache_update_cache(int fd, void *buf, off_t offset, size_t count)
{
return dcache_update_rw(fd, buf, offset, count, true);
}
/* handles read into cache + read into buffer */
-int dcache_read(int fd, void *buf, off64_t offset, size_t count)
+int dcache_read(int fd, void *buf, off_t offset, size_t count)
{
return dcache_update_rw(fd, buf, offset, count, false);
}
@@ -395,7 +384,7 @@ int dev_read_version(void *buf, __u64 offset, size_t len)
{
if (c.sparse_mode)
return 0;
- if (lseek64(c.kd, (off64_t)offset, SEEK_SET) < 0)
+ if (lseek(c.kd, (off_t)offset, SEEK_SET) < 0)
return -1;
if (read(c.kd, buf, len) < 0)
return -1;
@@ -534,10 +523,10 @@ int dev_read(void *buf, __u64 offset, size_t len)
/* err = 1: cache not available, fall back to non-cache R/W */
/* err = 0: success, err=-1: I/O error */
- err = dcache_read(fd, buf, (off64_t)offset, len);
+ err = dcache_read(fd, buf, (off_t)offset, len);
if (err <= 0)
return err;
- if (lseek64(fd, (off64_t)offset, SEEK_SET) < 0)
+ if (lseek(fd, (off_t)offset, SEEK_SET) < 0)
return -1;
if (read(fd, buf, len) < 0)
return -1;
@@ -580,9 +569,9 @@ int dev_write(void *buf, __u64 offset, size_t len)
* dcache_update_cache() just update cache, won't do I/O.
* Thus even no error, we need normal non-cache I/O for actual write
*/
- if (dcache_update_cache(fd, buf, (off64_t)offset, len) < 0)
+ if (dcache_update_cache(fd, buf, (off_t)offset, len) < 0)
return -1;
- if (lseek64(fd, (off64_t)offset, SEEK_SET) < 0)
+ if (lseek(fd, (off_t)offset, SEEK_SET) < 0)
return -1;
if (write(fd, buf, len) < 0)
return -1;
@@ -596,7 +585,7 @@ int dev_write_block(void *buf, __u64 blk_addr)
int dev_write_dump(void *buf, __u64 offset, size_t len)
{
- if (lseek64(c.dump_fd, (off64_t)offset, SEEK_SET) < 0)
+ if (lseek(c.dump_fd, (off_t)offset, SEEK_SET) < 0)
return -1;
if (write(c.dump_fd, buf, len) < 0)
return -1;
@@ -618,7 +607,7 @@ int dev_fill(void *buf, __u64 offset, size_t len)
/* Only allow fill to zero */
if (*((__u8*)buf))
return -1;
- if (lseek64(fd, (off64_t)offset, SEEK_SET) < 0)
+ if (lseek(fd, (off_t)offset, SEEK_SET) < 0)
return -1;
if (write(fd, buf, len) < 0)
return -1;
diff --git a/lib/libf2fs_zoned.c b/lib/libf2fs_zoned.c
index a0dd8bd..2ab2497 100644
--- a/lib/libf2fs_zoned.c
+++ b/lib/libf2fs_zoned.c
@@ -6,7 +6,6 @@
*
* Dual licensed under the GPL or LGPL version 2 licenses.
*/
-#define _LARGEFILE64_SOURCE
#include <f2fs_fs.h>
#include <stdio.h>
diff --git a/mkfs/Makefile.am b/mkfs/Makefile.am
index af5b1c7..bfffd88 100644
--- a/mkfs/Makefile.am
+++ b/mkfs/Makefile.am
@@ -1,7 +1,7 @@
## Makefile.am
AM_CPPFLAGS = ${libuuid_CFLAGS} ${libblkid_CFLAGS} -I$(top_srcdir)/include
-AM_CFLAGS = -Wall -DWITH_BLKDISCARD
+AM_CFLAGS = -Wall -DWITH_BLKDISCARD -D_FILE_OFFSET_BITS=64
sbin_PROGRAMS = mkfs.f2fs
noinst_HEADERS = f2fs_format_utils.h
include_HEADERS = $(top_srcdir)/include/f2fs_fs.h
@@ -10,7 +10,7 @@ mkfs_f2fs_LDADD = ${libuuid_LIBS} ${libblkid_LIBS} $(top_builddir)/lib/libf2fs.l
lib_LTLIBRARIES = libf2fs_format.la
libf2fs_format_la_SOURCES = f2fs_format_main.c f2fs_format.c f2fs_format_utils.c
-libf2fs_format_la_CFLAGS = -DWITH_BLKDISCARD
+libf2fs_format_la_CFLAGS = -DWITH_BLKDISCARD -D_FILE_OFFSET_BITS=64
libf2fs_format_la_LDFLAGS = ${libblkid_LIBS} ${libuuid_LIBS} -L$(top_builddir)/lib -lf2fs \
-version-info $(FMT_CURRENT):$(FMT_REVISION):$(FMT_AGE)
diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c
index 019fb3a..d937eda 100644
--- a/mkfs/f2fs_format.c
+++ b/mkfs/f2fs_format.c
@@ -6,8 +6,6 @@
*
* Dual licensed under the GPL or LGPL version 2 licenses.
*/
-#define _LARGEFILE64_SOURCE
-
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
diff --git a/mkfs/f2fs_format_main.c b/mkfs/f2fs_format_main.c
index d8c9cea..08c1b25 100644
--- a/mkfs/f2fs_format_main.c
+++ b/mkfs/f2fs_format_main.c
@@ -6,8 +6,6 @@
*
* Dual licensed under the GPL or LGPL version 2 licenses.
*/
-#define _LARGEFILE64_SOURCE
-
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
diff --git a/mkfs/f2fs_format_utils.c b/mkfs/f2fs_format_utils.c
index 448fbaa..437f113 100644
--- a/mkfs/f2fs_format_utils.c
+++ b/mkfs/f2fs_format_utils.c
@@ -6,20 +6,10 @@
*
* Dual licensed under the GPL or LGPL version 2 licenses.
*/
-#ifndef _LARGEFILE_SOURCE
-#define _LARGEFILE_SOURCE
-#endif
-#ifndef _LARGEFILE64_SOURCE
-#define _LARGEFILE64_SOURCE
-#endif
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
-#ifndef _FILE_OFFSET_BITS
-#define _FILE_OFFSET_BITS 64
-#endif
-
#include <f2fs_fs.h>
#include <stdio.h>
diff --git a/mkfs/f2fs_format_utils.h b/mkfs/f2fs_format_utils.h
index 807e7c3..6a7f687 100644
--- a/mkfs/f2fs_format_utils.h
+++ b/mkfs/f2fs_format_utils.h
@@ -6,8 +6,6 @@
*
* Dual licensed under the GPL or LGPL version 2 licenses.
*/
-#define _LARGEFILE64_SOURCE
-
#include "f2fs_fs.h"
extern struct f2fs_configuration c;
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 6b03814..7dfffb1 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -1,7 +1,7 @@
## Makefile.am
AM_CPPFLAGS = ${libuuid_CFLAGS} -I$(top_srcdir)/include
-AM_CFLAGS = -Wall
+AM_CFLAGS = -Wall -D_FILE_OFFSET_BITS=64
sbin_PROGRAMS =
if !WINDOWS
sbin_PROGRAMS += fibmap.f2fs parse.f2fs
diff --git a/tools/f2fs_io/Makefile.am b/tools/f2fs_io/Makefile.am
index bc4f9d0..f5227ce 100644
--- a/tools/f2fs_io/Makefile.am
+++ b/tools/f2fs_io/Makefile.am
@@ -2,7 +2,7 @@
if LINUX
AM_CPPFLAGS = -I$(top_srcdir)/include
-AM_CFLAGS = -Wall
+AM_CFLAGS = -Wall -D_FILE_OFFSET_BITS=64
sbin_PROGRAMS = f2fs_io
f2fs_io_SOURCES = f2fs_io.c
endif
diff --git a/tools/f2fs_io/f2fs_io.c b/tools/f2fs_io/f2fs_io.c
index 771fd16..1f6549b 100644
--- a/tools/f2fs_io/f2fs_io.c
+++ b/tools/f2fs_io/f2fs_io.c
@@ -9,12 +9,6 @@
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
-#ifndef _LARGEFILE_SOURCE
-#define _LARGEFILE_SOURCE
-#endif
-#ifndef _LARGEFILE64_SOURCE
-#define _LARGEFILE64_SOURCE
-#endif
#ifndef O_LARGEFILE
#define O_LARGEFILE 0
#endif
diff --git a/tools/f2fs_io_parse.c b/tools/f2fs_io_parse.c
index 47f1194..c3c1005 100644
--- a/tools/f2fs_io_parse.c
+++ b/tools/f2fs_io_parse.c
@@ -8,7 +8,6 @@
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
-#define _LARGEFILE64_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
diff --git a/tools/f2fscrypt.c b/tools/f2fscrypt.c
index 8640ffa..d5222fb 100644
--- a/tools/f2fscrypt.c
+++ b/tools/f2fscrypt.c
@@ -7,15 +7,6 @@
* Authors: Michael Halcrow <mhalcrow@google.com>,
* Ildar Muslukhov <ildarm@google.com>
*/
-
-#ifndef _LARGEFILE_SOURCE
-#define _LARGEFILE_SOURCE
-#endif
-
-#ifndef _LARGEFILE64_SOURCE
-#define _LARGEFILE64_SOURCE
-#endif
-
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
diff --git a/tools/fibmap.c b/tools/fibmap.c
index bda8238..3acc77b 100644
--- a/tools/fibmap.c
+++ b/tools/fibmap.c
@@ -1,13 +1,6 @@
#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__)
#define _XOPEN_SOURCE 600
#define _DARWIN_C_SOURCE
-#define _FILE_OFFSET_BITS 64
-#ifndef _LARGEFILE_SOURCE
-#define _LARGEFILE_SOURCE
-#endif
-#ifndef _LARGEFILE64_SOURCE
-#define _LARGEFILE64_SOURCE
-#endif
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
--
2.39.2

View File

@@ -0,0 +1,41 @@
From ec0f9d07792298f89e71cee1e692ad60bf6b8d5c Mon Sep 17 00:00:00 2001
From: Jaegeuk Kim <jaegeuk@kernel.org>
Date: Thu, 24 Oct 2024 20:33:38 +0000
Subject: [PATCH] f2fs-tools: use stdbool.h instead of bool
The existing bool definition is broken for c23, where bool is now a keyword.
Signed-off-by: Elliott Hughes <enh@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Upstream: https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-tools.git/commit/?id=6617d15a660becc23825007ab3fc2d270b5b250f
[Florian: rebased to 1.16.0]
Signed-off-by: Florian Larysch <fl@n621.de>
---
include/f2fs_fs.h | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h
index f890634..a968380 100644
--- a/include/f2fs_fs.h
+++ b/include/f2fs_fs.h
@@ -26,6 +26,7 @@
#include <stddef.h>
#include <string.h>
#include <time.h>
+#include <stdbool.h>
#ifdef HAVE_CONFIG_H
#include <config.h>
@@ -103,9 +104,6 @@ typedef uint16_t u16;
typedef uint8_t u8;
typedef u32 block_t;
typedef u32 nid_t;
-#ifndef bool
-typedef u8 bool;
-#endif
typedef unsigned long pgoff_t;
typedef unsigned short umode_t;
--
2.49.0

View File

@@ -0,0 +1,12 @@
config BR2_PACKAGE_F2FS_TOOLS
bool "f2fs-tools"
depends on BR2_USE_WCHAR # uses wchar_t
select BR2_PACKAGE_UTIL_LINUX
select BR2_PACKAGE_UTIL_LINUX_LIBUUID
help
Tools for Flash-Friendly File System (F2FS)
https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-tools.git
comment "f2fs-tools needs a toolchain w/ wchar"
depends on !BR2_USE_WCHAR

View File

@@ -0,0 +1,7 @@
config BR2_PACKAGE_HOST_F2FS_TOOLS
bool "host f2fs-tools"
select BR2_PACKAGE_HOST_UTIL_LINUX
help
Tools for Flash-Friendly File System (F2FS)
https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-tools.git

View File

@@ -0,0 +1,3 @@
# Locally computed
sha256 208c7a07e95383fbd7b466b5681590789dcb41f41bf197369c41a95383b57c5e f2fs-tools-1.16.0.tar.gz
sha256 662abb3a8a80b36ae7036c289dd1e03b361ee5dd2e6fd5211d0d8d029146449f COPYING

View File

@@ -0,0 +1,57 @@
################################################################################
#
# f2fs-tools
#
################################################################################
F2FS_TOOLS_VERSION = 1.16.0
F2FS_TOOLS_SITE = https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-tools.git/snapshot
F2FS_TOOLS_CONF_ENV = ac_cv_file__git=no
F2FS_TOOLS_DEPENDENCIES = host-pkgconf util-linux
HOST_F2FS_TOOLS_DEPENDENCIES = host-pkgconf host-util-linux
# GIT version, shipped without configure
F2FS_TOOLS_AUTORECONF = YES
F2FS_TOOLS_INSTALL_STAGING = YES
F2FS_TOOLS_LICENSE = GPL-2.0
F2FS_TOOLS_LICENSE_FILES = COPYING
F2FS_TOOLS_CPE_ID_VALID = YES
ifeq ($(BR2_PACKAGE_LIBSELINUX),y)
F2FS_TOOLS_CONF_OPTS += --with-selinux
F2FS_TOOLS_DEPENDENCIES += libselinux
else
F2FS_TOOLS_CONF_OPTS += --without-selinux
endif
ifeq ($(BR2_PACKAGE_LZ4),y)
F2FS_TOOLS_CONF_OPTS += --with-lz4
F2FS_TOOLS_DEPENDENCIES += lz4
else
F2FS_TOOLS_CONF_OPTS += --without-lz4
endif
ifeq ($(BR2_PACKAGE_LZO),y)
F2FS_TOOLS_CONF_OPTS += --with-lzo2
F2FS_TOOLS_DEPENDENCIES += lzo
else
F2FS_TOOLS_CONF_OPTS += --without-lzo2
endif
ifeq ($(BR2_PACKAGE_UTIL_LINUX_LIBBLKID),y)
# util-linux is a dependency already, no need to list it again
F2FS_TOOLS_CONF_OPTS += --with-blkid
else
F2FS_TOOLS_CONF_OPTS += --without-blkid
endif
# blkid is only used to detect if we're overwriting a filesystem
# during mkfs, which only makes sense on the target, so we disable
# blkid support even if we have host-util-linux
HOST_F2FS_TOOLS_CONF_OPTS = \
--without-selinux \
--without-blkid \
--without-lz4 \
--without-lzo2
$(eval $(autotools-package))
$(eval $(host-autotools-package))