mirror of
https://github.com/pengutronix/genimage.git
synced 2024-11-26 19:23:55 +08:00
Initial F2FS support
Signed-off-by: Tomas Mudrunka <tomas@mudrunka.cz>
This commit is contained in:
parent
8aa3138cbe
commit
1c5457cacd
4
.github/workflows/tests.yml
vendored
4
.github/workflows/tests.yml
vendored
@ -9,9 +9,9 @@ jobs:
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-20.04
|
||||
pkgs: device-tree-compiler rauc simg2img u-boot-tools
|
||||
pkgs: device-tree-compiler rauc simg2img u-boot-tools f2fs-tools
|
||||
- os: ubuntu-18.04
|
||||
pkgs: device-tree-compiler simg2img u-boot-tools
|
||||
pkgs: device-tree-compiler simg2img u-boot-tools f2fs-tools
|
||||
|
||||
steps:
|
||||
- name: Inspect environment
|
||||
|
@ -22,6 +22,7 @@ genimage_SOURCES = \
|
||||
image-cpio.c \
|
||||
image-cramfs.c \
|
||||
image-ext2.c \
|
||||
image-f2fs.c \
|
||||
image-file.c \
|
||||
image-fit.c \
|
||||
image-flash.c \
|
||||
@ -66,6 +67,7 @@ EXTRA_DIST += \
|
||||
test/ext4.config \
|
||||
test/ext4test.0.dump \
|
||||
test/ext4test.1.dump \
|
||||
test/f2fs.config \
|
||||
test/fit.its \
|
||||
test/fit.config \
|
||||
test/flash-types.config \
|
||||
|
10
config.c
10
config.c
@ -398,6 +398,16 @@ static struct config opts[] = {
|
||||
.opt = CFG_STR("mkfsjffs2", NULL, CFGF_NONE),
|
||||
.env = "GENIMAGE_MKFJFFS2",
|
||||
.def = "mkfs.jffs2",
|
||||
}, {
|
||||
.name = "mkfsf2fs",
|
||||
.opt = CFG_STR("mkfsf2fs", NULL, CFGF_NONE),
|
||||
.env = "GENIMAGE_MKFSF2FS",
|
||||
.def = "mkfs.f2fs",
|
||||
}, {
|
||||
.name = "sloadf2fs",
|
||||
.opt = CFG_STR("sloadf2fs", NULL, CFGF_NONE),
|
||||
.env = "GENIMAGE_SLOADF2FS",
|
||||
.def = "sload.f2fs",
|
||||
}, {
|
||||
.name = "mkfsubifs",
|
||||
.opt = CFG_STR("mkfsubifs", NULL, CFGF_NONE),
|
||||
|
@ -44,6 +44,7 @@ static struct image_handler *handlers[] = {
|
||||
&ext2_handler,
|
||||
&ext3_handler,
|
||||
&ext4_handler,
|
||||
&f2fs_handler,
|
||||
&file_handler,
|
||||
&fit_handler,
|
||||
&flash_handler,
|
||||
|
@ -105,6 +105,7 @@ extern struct image_handler cramfs_handler;
|
||||
extern struct image_handler ext2_handler;
|
||||
extern struct image_handler ext3_handler;
|
||||
extern struct image_handler ext4_handler;
|
||||
extern struct image_handler f2fs_handler;
|
||||
extern struct image_handler file_handler;
|
||||
extern struct image_handler flash_handler;
|
||||
extern struct image_handler hdimage_handler;
|
||||
|
68
image-f2fs.c
Normal file
68
image-f2fs.c
Normal file
@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Tomas Mudrunka <harviecz@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <confuse.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "genimage.h"
|
||||
|
||||
static int f2fs_generate(struct image *image)
|
||||
{
|
||||
int ret;
|
||||
|
||||
char *extraargs = cfg_getstr(image->imagesec, "extraargs");
|
||||
char *label = cfg_getstr(image->imagesec, "label");
|
||||
|
||||
extraargs = cfg_getstr(image->imagesec, "extraargs");
|
||||
|
||||
ret = prepare_image(image, image->size);
|
||||
if(ret)
|
||||
return ret;
|
||||
|
||||
ret = systemp(image, "%s %s %s%s%s %s '%s'",
|
||||
get_opt("mkfsf2fs"),
|
||||
label ? "-l" : "",
|
||||
label ? "'" : "",
|
||||
label ? label : "",
|
||||
label ? "'" : "",
|
||||
extraargs,
|
||||
imageoutfile(image));
|
||||
|
||||
if(ret || image->empty)
|
||||
return ret;
|
||||
|
||||
ret = systemp(image, "%s -f '%s' '%s'",
|
||||
get_opt("sloadf2fs"),
|
||||
mountpath(image),
|
||||
imageoutfile(image));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static cfg_opt_t f2fs_opts[] = {
|
||||
CFG_STR("extraargs", "", CFGF_NONE),
|
||||
CFG_STR("label", NULL, CFGF_NONE),
|
||||
CFG_END()
|
||||
};
|
||||
|
||||
struct image_handler f2fs_handler = {
|
||||
.type = "f2fs",
|
||||
.generate = f2fs_generate,
|
||||
.opts = f2fs_opts,
|
||||
};
|
@ -339,6 +339,14 @@ test_expect_success mkfs_jffs2 "jffs2" "
|
||||
md5sum -c '${testdir}/jffs2.md5'
|
||||
"
|
||||
|
||||
exec_test_set_prereq mkfs.f2fs
|
||||
exec_test_set_prereq sload.f2fs
|
||||
exec_test_set_prereq fsck.f2fs
|
||||
test_expect_success mkfs_f2fs,sload_f2fs,fsck_f2fs "f2fs" "
|
||||
run_genimage f2fs.config test.f2fs &&
|
||||
fsck.f2fs images/test.f2fs
|
||||
"
|
||||
|
||||
exec_test_set_prereq dd
|
||||
exec_test_set_prereq diff
|
||||
exec_test_set_prereq qemu-img
|
||||
|
6
test/f2fs.config
Normal file
6
test/f2fs.config
Normal file
@ -0,0 +1,6 @@
|
||||
image test.f2fs {
|
||||
f2fs {
|
||||
label = "f2fstest"
|
||||
}
|
||||
size = 64M
|
||||
}
|
Loading…
Reference in New Issue
Block a user