sysutils/genimage: New port: Tool to generate multiple filesystem and flash images from a tree

This commit is contained in:
Yuri Victorovich 2023-01-06 07:31:22 -08:00
parent 0c830c543d
commit f5858d0bce
9 changed files with 101 additions and 0 deletions

View file

@ -472,6 +472,7 @@
SUBDIR += gdisk
SUBDIR += gdmap
SUBDIR += gdu
SUBDIR += genimage
SUBDIR += genisoimage
SUBDIR += geomWatch
SUBDIR += getdelta

View file

@ -0,0 +1,26 @@
PORTNAME= genimage
DISTVERSIONPREFIX= v
DISTVERSION= 16-10
DISTVERSIONSUFFIX= -g2b9d870
#MASTER_SITES= https://github.com/pengutronix/genimage/releases/download/v${DISTVERSION}/
CATEGORIES= sysutils
MAINTAINER= yuri@FreeBSD.org
COMMENT= Tool to generate multiple filesystem and flash images from a tree
WWW= https://github.com/pengutronix/genimage
LICENSE= GPLv2
LICENSE_FILE= ${WRKSRC}/COPYING
LIB_DEPENDS= libconfuse.so:devel/libconfuse
USES= autoreconf gettext-runtime pkgconfig #tar:xz
USE_GITHUB= yes
GH_ACCOUNT= pengutronix
GNU_CONFIGURE= yes
PLIST_FILES= bin/genimage
.include <bsd.port.mk>

View file

@ -0,0 +1,3 @@
TIMESTAMP = 1673027507
SHA256 (pengutronix-genimage-v16-10-g2b9d870_GH0.tar.gz) = b6de4e7e14216e1a79a5ea4ee2703c1f5ffa84ec4cfa5b72dc63905bc31fcaed
SIZE (pengutronix-genimage-v16-10-g2b9d870_GH0.tar.gz) = 87753

View file

@ -0,0 +1,19 @@
--- config.c.orig 2023-01-06 17:56:22 UTC
+++ config.c
@@ -21,6 +21,7 @@
#include <errno.h>
#include <getopt.h>
#include <unistd.h>
+#include <sys/syslimits.h>
#include "genimage.h"
@@ -259,7 +260,7 @@ static char *abspath(const char *path)
if (*path == '/')
return strdup(path);
- xasprintf(&p, "%s/%s", get_current_dir_name(), path);
+ xasprintf(&p, "%s/%s", getcwd(NULL, PATH_MAX), path);
return p;
}

View file

@ -0,0 +1,11 @@
--- image-android-sparse.c.orig 2023-01-06 17:52:40 UTC
+++ image-android-sparse.c
@@ -15,7 +15,7 @@
*/
#include <confuse.h>
-#include <endian.h>
+#include <sys/endian.h>
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>

View file

@ -0,0 +1,11 @@
--- image-hd.c.orig 2023-01-06 17:53:09 UTC
+++ image-hd.c
@@ -22,7 +22,7 @@
#include <stdlib.h>
#include <errno.h>
#include <inttypes.h>
-#include <endian.h>
+#include <sys/endian.h>
#include <stdbool.h>
#include <unistd.h>
#include <sys/types.h>

View file

@ -0,0 +1,11 @@
--- image-rauc.c.orig 2023-01-06 17:59:29 UTC
+++ image-rauc.c
@@ -95,7 +95,7 @@ static int rauc_generate(struct image *image)
}
/* create parent directories if target needs it */
- path = strdupa(target);
+ path = strdup(target); // XXX causes memory leak
tmp = strrchr(path, '/');
if (tmp) {
*tmp = '\0';

View file

@ -0,0 +1,11 @@
--- image-vfat.c.orig 2023-01-06 18:01:33 UTC
+++ image-vfat.c
@@ -47,7 +47,7 @@ static int vfat_generate(struct image *image)
struct image *child = image_get(part->image);
const char *file = imageoutfile(child);
const char *target = part->name;
- char *path = strdupa(target);
+ char *path = strdup(target); // XXX causes memory leak
char *next = path;
while ((next = strchr(next, '/')) != NULL) {

View file

@ -0,0 +1,8 @@
genimage is a tool to generate multiple filesystem and flash/disk images
from a given root filesystem tree. genimage is intended to be run in a
fakeroot environment. It also supports creating flash/disk images out of
different file-system images and files.
Configuration is done in a config file parsed by libconfuse. Options like the
path to tools can be given via environment variables, the config file or from
commandline switches.