diff options
author | Andrea Adami <andrea.adami@gmail.com> | 2012-05-02 23:53:00 +0000 |
---|---|---|
committer | Koen Kooi <koen@dominion.thruhere.net> | 2012-05-10 16:38:14 +0200 |
commit | 3ba480f4b53d564be73f770db05d449da065efc6 (patch) | |
tree | 23aca2c1a8cf817774008f0804004d912d8710e8 | |
parent | 32d316edae416b88159472a3b4f904a830090000 (diff) | |
download | meta-openembedded-3ba480f4b53d564be73f770db05d449da065efc6.tar.gz |
ubi-utils-klibc: add the remaining ubicrc32, ubinize, ubiformat
* add more hacks to compile
* binaries tested on Zaurus poodle/corgi (with patched kernel)
* bump PR
* NOTES
* strange behavior wrt getopt for at least ubiformat:
* you should pass the options first, i.e.
* ubiformat -O 512 /dev/mtd3 *works*
* ubiformat /dev/mtd3 -O 512 *fails*
Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
5 files changed, 83 insertions, 30 deletions
diff --git a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/Makefile.patch b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/Makefile.patch index 2802afe7b..b7dad878b 100644 --- a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/Makefile.patch +++ b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/Makefile.patch | |||
@@ -1,6 +1,6 @@ | |||
1 | --- a/Makefile 2012-04-29 18:15:30.000000000 +0200 | 1 | --- a/Makefile 2012-05-01 19:46:47.000000000 +0200 |
2 | +++ b/Makefile 2012-04-29 00:43:03.000000000 +0200 | 2 | +++ b/Makefile 2012-05-01 19:48:01.000000000 +0200 |
3 | @@ -16,27 +16,11 @@ | 3 | @@ -16,27 +16,13 @@ |
4 | 4 | ||
5 | TESTS = tests | 5 | TESTS = tests |
6 | 6 | ||
@@ -13,16 +13,14 @@ | |||
13 | - rfddump rfdformat \ | 13 | - rfddump rfdformat \ |
14 | - serve_image recv_image \ | 14 | - serve_image recv_image \ |
15 | - sumtool jffs2reader | 15 | - sumtool jffs2reader |
16 | -UBI_BINS = \ | 16 | UBI_BINS = \ |
17 | - ubiupdatevol ubimkvol ubirmvol ubicrc32 ubinfo ubiattach \ | 17 | ubiupdatevol ubimkvol ubirmvol ubicrc32 ubinfo ubiattach \ |
18 | - ubidetach ubinize ubiformat ubirename mtdinfo ubirsvol | 18 | ubidetach ubinize ubiformat ubirename mtdinfo ubirsvol |
19 | - | 19 | |
20 | -BINS = $(MTD_BINS) | 20 | -BINS = $(MTD_BINS) |
21 | -BINS += mkfs.ubifs/mkfs.ubifs | 21 | -BINS += mkfs.ubifs/mkfs.ubifs |
22 | -BINS += $(addprefix ubi-utils/,$(UBI_BINS)) | 22 | -BINS += $(addprefix ubi-utils/,$(UBI_BINS)) |
23 | -SCRIPTS = flash_eraseall | 23 | -SCRIPTS = flash_eraseall |
24 | +UBI_BINS = ubiupdatevol ubimkvol ubirmvol ubinfo ubiattach ubidetach ubirename mtdinfo ubirsvol | ||
25 | + | ||
26 | +BINS = $(addprefix ubi-utils/,$(UBI_BINS)) | 24 | +BINS = $(addprefix ubi-utils/,$(UBI_BINS)) |
27 | 25 | ||
28 | TARGETS = $(BINS) | 26 | TARGETS = $(BINS) |
@@ -31,7 +29,7 @@ | |||
31 | 29 | ||
32 | OBJDEPS = $(BUILDDIR)/include/version.h | 30 | OBJDEPS = $(BUILDDIR)/include/version.h |
33 | 31 | ||
34 | @@ -58,7 +42,7 @@ | 32 | @@ -58,12 +44,9 @@ |
35 | rm -f $(BUILDDIR)/include/version.h | 33 | rm -f $(BUILDDIR)/include/version.h |
36 | $(MAKE) -C $(TESTS) clean | 34 | $(MAKE) -C $(TESTS) clean |
37 | 35 | ||
@@ -39,8 +37,13 @@ | |||
39 | +install:: $(addprefix $(BUILDDIR)/,${BINS}) | 37 | +install:: $(addprefix $(BUILDDIR)/,${BINS}) |
40 | mkdir -p ${DESTDIR}/${SBINDIR} | 38 | mkdir -p ${DESTDIR}/${SBINDIR} |
41 | install -m 0755 $^ ${DESTDIR}/${SBINDIR}/ | 39 | install -m 0755 $^ ${DESTDIR}/${SBINDIR}/ |
42 | mkdir -p ${DESTDIR}/${MANDIR}/man1 | 40 | - mkdir -p ${DESTDIR}/${MANDIR}/man1 |
43 | @@ -88,7 +72,6 @@ | 41 | - install -m 0644 mkfs.jffs2.1 ${DESTDIR}/${MANDIR}/man1/ |
42 | - -gzip -9f ${DESTDIR}/${MANDIR}/man1/*.1 | ||
43 | |||
44 | tests:: | ||
45 | $(MAKE) -C $(TESTS) | ||
46 | @@ -88,7 +71,6 @@ | ||
44 | LDFLAGS_jffs2reader = $(ZLIBLDFLAGS) $(LZOLDFLAGS) | 47 | LDFLAGS_jffs2reader = $(ZLIBLDFLAGS) $(LZOLDFLAGS) |
45 | LDLIBS_jffs2reader = -lz $(LZOLDLIBS) | 48 | LDLIBS_jffs2reader = -lz $(LZOLDLIBS) |
46 | 49 | ||
diff --git a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/libiniparser.c.patch b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/libiniparser.c.patch new file mode 100644 index 000000000..8be8ac32a --- /dev/null +++ b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/libiniparser.c.patch | |||
@@ -0,0 +1,13 @@ | |||
1 | --- a/ubi-utils/libiniparser.c 2012-04-30 23:59:40.000000000 +0200 | ||
2 | +++ b/ubi-utils/libiniparser.c 2012-04-30 23:55:15.000000000 +0200 | ||
3 | @@ -333,7 +333,9 @@ | ||
4 | |||
5 | str = iniparser_getstring(d, key, INI_INVALID_KEY); | ||
6 | if (str==INI_INVALID_KEY) return notfound ; | ||
7 | - return atof(str); | ||
8 | + double value; | ||
9 | + sscanf(str,"%lf",&value); | ||
10 | + return value; | ||
11 | } | ||
12 | |||
13 | /*-------------------------------------------------------------------------*/ | ||
diff --git a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/libubi.c.patch b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/libubi.c.patch index e60385904..97c4fa3ab 100644 --- a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/libubi.c.patch +++ b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/libubi.c.patch | |||
@@ -1,5 +1,5 @@ | |||
1 | --- a/ubi-utils/libubi.c 2012-04-29 21:44:52.000000000 +0200 | 1 | --- a/ubi-utils/libubi.c 2012-05-01 01:57:51.000000000 +0200 |
2 | +++ b/ubi-utils/libubi.c 2012-04-29 21:43:52.000000000 +0200 | 2 | +++ b/ubi-utils/libubi.c 2012-05-01 01:55:14.000000000 +0200 |
3 | @@ -36,6 +36,26 @@ | 3 | @@ -36,6 +36,26 @@ |
4 | #include "libubi_int.h" | 4 | #include "libubi_int.h" |
5 | #include "common.h" | 5 | #include "common.h" |
@@ -49,6 +49,15 @@ | |||
49 | 49 | ||
50 | if (minor != 0) { | 50 | if (minor != 0) { |
51 | errno = EINVAL; | 51 | errno = EINVAL; |
52 | @@ -686,7 +706,7 @@ | ||
53 | * success and %-1 in case of failure. @r->ubi_num contains newly created UBI | ||
54 | * device number. | ||
55 | */ | ||
56 | -static int do_attach(const char *node, const struct ubi_attach_req *r) | ||
57 | +static int do_attach(const char *node, struct ubi_attach_req *r) | ||
58 | { | ||
59 | int fd, ret; | ||
60 | |||
52 | @@ -757,8 +777,8 @@ | 61 | @@ -757,8 +777,8 @@ |
53 | mtd_dev_node); | 62 | mtd_dev_node); |
54 | } | 63 | } |
diff --git a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/ubiformat.c.patch b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/ubiformat.c.patch new file mode 100644 index 000000000..7539d76e3 --- /dev/null +++ b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/ubiformat.c.patch | |||
@@ -0,0 +1,30 @@ | |||
1 | --- a/ubi-utils/ubiformat.c 2012-05-03 01:14:39.000000000 +0200 | ||
2 | +++ b/ubi-utils/ubiformat.c 2012-05-03 01:00:57.000000000 +0200 | ||
3 | @@ -246,7 +246,11 @@ | ||
4 | |||
5 | while (1) { | ||
6 | normsg_cont("continue? (yes/no) "); | ||
7 | - if (scanf("%3s", buf) == EOF) { | ||
8 | + | ||
9 | + fflush(stderr); | ||
10 | + fflush(stdout); | ||
11 | + | ||
12 | + if (fgets(buf,4,stdin) == NULL) { | ||
13 | sys_errmsg("scanf returned unexpected EOF, assume \"yes\""); | ||
14 | return 1; | ||
15 | } | ||
16 | @@ -259,10 +263,13 @@ | ||
17 | |||
18 | static int answer_is_yes(void) | ||
19 | { | ||
20 | + fflush(stderr); | ||
21 | + fflush(stdout); | ||
22 | + | ||
23 | char buf[4]; | ||
24 | |||
25 | while (1) { | ||
26 | - if (scanf("%3s", buf) == EOF) { | ||
27 | + if (fgets(buf,4,stdin) == NULL) { | ||
28 | sys_errmsg("scanf returned unexpected EOF, assume \"no\""); | ||
29 | return 0; | ||
30 | } | ||
diff --git a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc_1.4.9.bb b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc_1.4.9.bb index da0efc0fc..c46ded53a 100644 --- a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc_1.4.9.bb +++ b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc_1.4.9.bb | |||
@@ -6,20 +6,17 @@ LICENSE = "GPLv2+" | |||
6 | LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3 \ | 6 | LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3 \ |
7 | file://include/common.h;beginline=1;endline=17;md5=ba05b07912a44ea2bf81ce409380049c" | 7 | file://include/common.h;beginline=1;endline=17;md5=ba05b07912a44ea2bf81ce409380049c" |
8 | 8 | ||
9 | 9 | PR = "r1" | |
10 | PR = "r0" | ||
11 | 10 | ||
12 | inherit klibc | 11 | inherit klibc |
13 | 12 | ||
14 | # ubicrc32 needs 'feof' (in klibc_2.0) | ||
15 | # ubinize needs 'atof' | ||
16 | # ubiformat needs 'scanf'equivalent for klibc | ||
17 | |||
18 | SRC_URI = "git://git.infradead.org/mtd-utils.git;protocol=git;tag=995cfe51b0a3cf32f381c140bf72b21bf91cef1b \ | 13 | SRC_URI = "git://git.infradead.org/mtd-utils.git;protocol=git;tag=995cfe51b0a3cf32f381c140bf72b21bf91cef1b \ |
19 | file://Makefile.patch \ | 14 | file://Makefile.patch \ |
20 | file://common.mk.patch \ | 15 | file://common.mk.patch \ |
21 | file://libmtd.c.patch \ | 16 | file://libmtd.c.patch \ |
22 | file://libubi.c.patch \ | 17 | file://libubi.c.patch \ |
18 | file://libiniparser.c.patch \ | ||
19 | file://ubiformat.c.patch \ | ||
23 | " | 20 | " |
24 | 21 | ||
25 | S = "${WORKDIR}/git/" | 22 | S = "${WORKDIR}/git/" |
@@ -27,21 +24,19 @@ S = "${WORKDIR}/git/" | |||
27 | EXTRA_OEMAKE = "'CC=${CC}' 'RANLIB=${RANLIB}' 'AR=${AR}' 'CFLAGS=${CFLAGS} -I${S}include -I${S}ubi-utils/include -DWITHOUT_XATTR' 'BUILDDIR=${S}'" | 24 | EXTRA_OEMAKE = "'CC=${CC}' 'RANLIB=${RANLIB}' 'AR=${AR}' 'CFLAGS=${CFLAGS} -I${S}include -I${S}ubi-utils/include -DWITHOUT_XATTR' 'BUILDDIR=${S}'" |
28 | 25 | ||
29 | do_install () { | 26 | do_install () { |
27 | |||
30 | install -d ${D}${sbindir} | 28 | install -d ${D}${sbindir} |
31 | install -m 755 ubi-utils/ubinfo ${D}${sbindir}/ubinfo | 29 | oe_runmake DESTDIR="${D}" install |
32 | install -m 755 ubi-utils/ubiattach ${D}${sbindir}/ubiattach | 30 | |
33 | install -m 755 ubi-utils/ubidetach ${D}${sbindir}/ubidetach | ||
34 | install -m 755 ubi-utils/mtdinfo ${D}${sbindir}/mtdinfo | ||
35 | install -m 755 ubi-utils/ubiupdatevol ${D}${sbindir}/ubiupdatevol | ||
36 | install -m 755 ubi-utils/ubimkvol ${D}${sbindir}/ubimkvol | ||
37 | install -m 755 ubi-utils/ubirename ${D}${sbindir}/ubirename | ||
38 | install -m 755 ubi-utils/ubirmvol ${D}${sbindir}/ubirmvol | ||
39 | install -m 755 ubi-utils/ubirsvol ${D}${sbindir}/ubirsvol | ||
40 | } | 31 | } |
41 | 32 | ||
33 | PACKAGES = "ubi-utils-klibc-dbg" | ||
34 | |||
42 | PACKAGES =+ "ubinfo-klibc ubiattach-klibc ubidetach-klibc mtdinfo-klibc ubiupdatevol-klibc \ | 35 | PACKAGES =+ "ubinfo-klibc ubiattach-klibc ubidetach-klibc mtdinfo-klibc ubiupdatevol-klibc \ |
43 | ubimkvol-klibc ubirename-klibc ubirmvol-klibc ubirsvol-klibc" | 36 | ubimkvol-klibc ubirename-klibc ubirmvol-klibc ubirsvol-klibc \ |
37 | ubinize-klibc ubiformat-klibc ubicrc32-klibc" | ||
44 | 38 | ||
39 | FILES_ubicrc32-klibc = "${sbindir}/ubicrc32" | ||
45 | FILES_ubinfo-klibc = "${sbindir}/ubinfo" | 40 | FILES_ubinfo-klibc = "${sbindir}/ubinfo" |
46 | FILES_ubiattach-klibc = "${sbindir}/ubiattach" | 41 | FILES_ubiattach-klibc = "${sbindir}/ubiattach" |
47 | FILES_ubidetach-klibc = "${sbindir}/ubidetach" | 42 | FILES_ubidetach-klibc = "${sbindir}/ubidetach" |
@@ -51,3 +46,6 @@ FILES_ubimkvol-klibc = "${sbindir}/ubimkvol" | |||
51 | FILES_ubirename-klibc = "${sbindir}/ubirename" | 46 | FILES_ubirename-klibc = "${sbindir}/ubirename" |
52 | FILES_ubirmvol-klibc = "${sbindir}/ubirmvol" | 47 | FILES_ubirmvol-klibc = "${sbindir}/ubirmvol" |
53 | FILES_ubirsvol-klibc = "${sbindir}/ubirsvol" | 48 | FILES_ubirsvol-klibc = "${sbindir}/ubirsvol" |
49 | FILES_ubinize-klibc = "${sbindir}/ubinize" | ||
50 | FILES_ubiformat-klibc = "${sbindir}/ubiformat" | ||
51 | |||