Skip to content

Commit

Permalink
tools: bring back genext2fs for apm821xx
Browse files Browse the repository at this point in the history
This reverts commit 8c68c10.
It is used for apm821xx, which needs ext2 (not ext4) images for some
devices.

Signed-off-by: Felix Fietkau <[email protected]>
  • Loading branch information
nbd168 committed Jul 23, 2016
1 parent 18f368f commit 07577c5
Show file tree
Hide file tree
Showing 7 changed files with 688 additions and 4 deletions.
4 changes: 0 additions & 4 deletions target/linux/apm821xx/sata/target.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,3 @@ define Target/Description
Build firmware images for APM82181 boards that boot from SATA.
For NAS like the MyBook Live Series.
endef

$(eval $(call $(if $(CONFIG_TARGET_ROOTFS_EXT4FS),RequireCommand,Ignore),genext2fs, \
Please install genext2fs. \
))
1 change: 1 addition & 0 deletions tools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ tools-$(BUILD_B43_TOOLS) += b43-tools
tools-$(BUILD_PPL_CLOOG) += ppl cloog
tools-$(BUILD_ISL) += isl
tools-$(CONFIG_USE_SPARSE) += sparse
tools-$(CONFIG_TARGET_apm821xx) += genext2fs

# builddir dependencies
$(curdir)/bison/compile := $(curdir)/flex/install
Expand Down
51 changes: 51 additions & 0 deletions tools/genext2fs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#
# Copyright (C) 2006 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=genext2fs
PKG_VERSION:=1.4.1

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@SF/genext2fs
PKG_MD5SUM:=b7b6361bcce2cedff1ae437fadafe53b

include $(INCLUDE_DIR)/host-build.mk

HOST_CONFIGURE_ARGS = \
--target=$(GNU_HOST_NAME) \
--host=$(GNU_HOST_NAME) \
--build=$(GNU_HOST_NAME) \
--program-prefix="" \
--program-suffix="" \
--prefix=/usr \
--exec-prefix=/usr \
--bindir=/usr/bin \
--sbindir=/usr/sbin \
--libexecdir=/usr/lib \
--sysconfdir=/etc \
--datadir=/usr/share \
--localstatedir=/var \
--mandir=/usr/man \
--infodir=/usr/info \

define Host/Compile
$(MAKE) -C $(HOST_BUILD_DIR) \
CFLAGS="$(HOST_CFLAGS)" \
LDFLAGS="$(HOST_LDFLAGS)" \
all
endef

define Host/Install
install -m0755 $(HOST_BUILD_DIR)/genext2fs $(STAGING_DIR_HOST)/bin/
endef

define Host/Clean
rm -f $(STAGING_DIR_HOST)/bin/genext2fs
endef

$(eval $(call HostBuild))
21 changes: 21 additions & 0 deletions tools/genext2fs/patches/100-c99_scanf.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
commit 3b8ca0ce9a0b58287a780747c90c449bdebfe464
Author: Xavier Bestel <[email protected]>
Date: Mon Jan 14 08:52:44 2008 +0000

removed use of %as is scanf (GNU conflicts with C99) by Giacomo Catenazzi <[email protected]>

diff --git a/genext2fs.c b/genext2fs.c
index 070b270..f0d797d 100644
--- a/genext2fs.c
+++ b/genext2fs.c
@@ -286,7 +286,9 @@ typedef unsigned int uint32;
// older solaris. Note that this is still not very portable, in that
// the return value cannot be trusted.

-#if SCANF_CAN_MALLOC
+#if 0 // SCANF_CAN_MALLOC
+// C99 define "a" for floating point, so you can have runtime surprise
+// according the library versions
# define SCANF_PREFIX "a"
# define SCANF_STRING(s) (&s)
#else
13 changes: 13 additions & 0 deletions tools/genext2fs/patches/200-autoconf.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Index: genext2fs/m4/ac_func_scanf_can_malloc.m4
===================================================================
--- genext2fs.orig/m4/ac_func_scanf_can_malloc.m4 2011-09-03 21:28:49.000000000 +0200
+++ genext2fs/m4/ac_func_scanf_can_malloc.m4 2011-09-03 21:29:41.000000000 +0200
@@ -9,7 +9,7 @@
# --------------------------------------
AC_DEFUN([AC_FUNC_SCANF_CAN_MALLOC],
[ AC_CHECK_HEADERS([stdlib.h])
- AC_CACHE_CHECK([whether scanf can malloc], [ac_scanf_can_malloc],
+ AC_CACHE_CHECK([whether scanf can malloc], [ac_cv_func_scanf_can_malloc],
[ AC_RUN_IFELSE(
[ AC_LANG_PROGRAM(
[
Loading

0 comments on commit 07577c5

Please sign in to comment.