diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2008-01-18 16:51:29 +0200 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2008-01-18 16:51:29 +0200 |
commit | 0b342ea86668987e5dfd4f5ddd98ba6fdb3702c7 (patch) | |
tree | 7f237ac1c96eba0967ce985c6ea542f03df58a29 | |
parent | ffa6141172265076fc376bbd8cdea10113591c89 (diff) |
ubi-utils: move more stuff to sort-me-out
Also remove error messages stuff from pfi2bin
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
-rw-r--r-- | ubi-utils/Makefile | 10 | ||||
-rw-r--r-- | ubi-utils/sort-me-out/README | 5 | ||||
-rw-r--r-- | ubi-utils/sort-me-out/error.c (renamed from ubi-utils/src/error.c) | 0 | ||||
-rw-r--r-- | ubi-utils/sort-me-out/error.h (renamed from ubi-utils/src/error.h) | 0 | ||||
-rw-r--r-- | ubi-utils/sort-me-out/libpfiflash.c (renamed from ubi-utils/src/libpfiflash.c) | 0 | ||||
-rw-r--r-- | ubi-utils/sort-me-out/libubimirror.c (renamed from ubi-utils/src/libubimirror.c) | 0 | ||||
-rw-r--r-- | ubi-utils/sort-me-out/ubimirror.c (renamed from ubi-utils/src/ubimirror.c) | 0 | ||||
-rw-r--r-- | ubi-utils/sort-me-out/ubimirror.h (renamed from ubi-utils/src/ubimirror.h) | 0 | ||||
-rw-r--r-- | ubi-utils/src/pfi2bin.c | 57 |
9 files changed, 34 insertions, 38 deletions
diff --git a/ubi-utils/Makefile b/ubi-utils/Makefile index 4fbdedc..a6062a2 100644 --- a/ubi-utils/Makefile +++ b/ubi-utils/Makefile @@ -14,8 +14,8 @@ CFLAGS := -I./inc -I./src -I$(KERNELHDR) $(OPTFLAGS) -Werror \ -Wwrite-strings -W -std=gnu99 -DPACKAGE_VERSION=\"1.0\" PERLPROGS = mkpfi -TARGETS = ubiupdate ubimkvol ubirmvol ubimirror unubi pfi2bin ubicrc32 ubinfo \ - ubiattach ubidetach +TARGETS = ubiupdate ubimkvol ubirmvol ubicrc32 ubinfo ubiattach ubidetach \ + unubi pfi2bin vpath %.c ./src @@ -57,14 +57,10 @@ ubirmvol: ubirmvol.o common.o libubi.o ubicrc32: ubicrc32.o crc32.o $(CC) $(LDFLAGS) -o $@ $^ -ubimirror: ubimirror.o error.o libubimirror.o bootenv.o hashmap.o \ - libubi.o crc32.o - $(CC) $(LDFLAGS) -o $@ $^ - unubi: unubi.o crc32.o unubi_analyze.o eb_chain.o $(CC) $(LDFLAGS) -o $@ $^ -pfi2bin: pfi2bin.o peb.o error.o list.o crc32.o libubigen.o bootenv.o \ +pfi2bin: pfi2bin.o common.o peb.o list.o crc32.o libubigen.o bootenv.o \ hashmap.o reader.o pfi.o $(CC) $(LDFLAGS) -o $@ $^ diff --git a/ubi-utils/sort-me-out/README b/ubi-utils/sort-me-out/README index ddeee73..fa09c96 100644 --- a/ubi-utils/sort-me-out/README +++ b/ubi-utils/sort-me-out/README @@ -58,3 +58,8 @@ This directory contains various stuff that has to be cleaned up and sorted out. better. * pddcustomize: not sure what is this for, seems to be IBM-specific. + +* ubimirror: not exactly sure what is this for - if it is neede, it should be + cleaned-up and moved to src/ + +* error.[ch]: strange and rather IBM-specific error messages output infrastructure. diff --git a/ubi-utils/src/error.c b/ubi-utils/sort-me-out/error.c index 4aaedad..4aaedad 100644 --- a/ubi-utils/src/error.c +++ b/ubi-utils/sort-me-out/error.c diff --git a/ubi-utils/src/error.h b/ubi-utils/sort-me-out/error.h index 05d8078..05d8078 100644 --- a/ubi-utils/src/error.h +++ b/ubi-utils/sort-me-out/error.h diff --git a/ubi-utils/src/libpfiflash.c b/ubi-utils/sort-me-out/libpfiflash.c index 7e3d3b3..7e3d3b3 100644 --- a/ubi-utils/src/libpfiflash.c +++ b/ubi-utils/sort-me-out/libpfiflash.c diff --git a/ubi-utils/src/libubimirror.c b/ubi-utils/sort-me-out/libubimirror.c index d06770e..d06770e 100644 --- a/ubi-utils/src/libubimirror.c +++ b/ubi-utils/sort-me-out/libubimirror.c diff --git a/ubi-utils/src/ubimirror.c b/ubi-utils/sort-me-out/ubimirror.c index 2cc4596..2cc4596 100644 --- a/ubi-utils/src/ubimirror.c +++ b/ubi-utils/sort-me-out/ubimirror.c diff --git a/ubi-utils/src/ubimirror.h b/ubi-utils/sort-me-out/ubimirror.h index d7ae2ad..d7ae2ad 100644 --- a/ubi-utils/src/ubimirror.h +++ b/ubi-utils/sort-me-out/ubimirror.h diff --git a/ubi-utils/src/pfi2bin.c b/ubi-utils/src/pfi2bin.c index 7f31938..1474482 100644 --- a/ubi-utils/src/pfi2bin.c +++ b/ubi-utils/src/pfi2bin.c @@ -37,15 +37,14 @@ #include <ubigen.h> #include <mtd/ubi-header.h> - -#include "config.h" +#include "common.h" #include "list.h" -#include "error.h" #include "reader.h" #include "peb.h" #include "crc32.h" -#define PROGRAM_VERSION "1.4" +#define PROGRAM_VERSION "1.5" +#define PROGRAM_NAME "pfi2bin" #define MAX_FNAME 255 #define DEFAULT_ERASE_COUNT 0 /* Hmmm.... Perhaps */ @@ -155,8 +154,6 @@ parse_opt(int argc, char **argv, myargs *args) printf("pfi2bin [OPTION...] pfifile\n"); printf("%s", doc); printf("%s", optionsstr); - printf("\nReport bugs to %s\n", - PACKAGE_BUGREPORT); exit(0); break; @@ -449,15 +446,15 @@ write_remaining_raw_ebs(pdd_data_t pdd, list_t raw_blocks, size_t *ebs_written, } if (peb->num < *ebs_written) { - err_msg("eb_num: %d\n", peb->num); - err_msg("Bug: This should never happen. %d %s", + errmsg("eb_num: %d\n", peb->num); + errmsg("Bug: This should never happen. %d %s", __LINE__, __FILE__); goto err; } delta = peb->num - *ebs_written; if (((delta + *ebs_written) * pdd->eb_size) > pdd->flash_size) { - err_msg("RAW block outside of flash_size."); + errmsg("RAW block outside of flash_size."); goto err; } for (j = 0; j < delta; j++) { @@ -518,23 +515,21 @@ create_raw(io_t io) rc = init_vol_tab (&vol_tab, &vol_tab_size); if (rc != 0) { - err_msg("Cannot initialize volume table."); + errmsg("cannot initialize volume table"); goto err; } rc = read_pdd_data(io->fp_pdd, &pdd, err_buf, ERR_BUF_SIZE); if (rc != 0) { - err_msg("Cannot read necessary pdd_data: %s rc: %d", - err_buf, rc); + errmsg("cannot read necessary pdd_data: %s rc: %d", err_buf, rc); goto err; } rc = read_pfi_headers(&pfi_raws, &pfi_ubis, io->fp_pfi, err_buf, ERR_BUF_SIZE); if (rc != 0) { - err_msg("Cannot read pfi header: %s rc: %d", - err_buf, rc); + errmsg("cannot read pfi header: %s rc: %d", err_buf, rc); goto err; } @@ -543,8 +538,7 @@ create_raw(io_t io) rc = memorize_raw_eb(pfi_raw, pdd, &raw_pebs, io); if (rc != 0) { - err_msg("Cannot create raw_block in mem. rc: %d\n", - rc); + errmsg("cannot create raw_block in mem. rc: %d\n", rc); goto err; } } @@ -554,7 +548,7 @@ create_raw(io_t io) rc = convert_ubi_volume(pfi_ubi, pdd, raw_pebs, vol_tab, &ebs_written, io); if (rc != 0) { - err_msg("Cannot convert UBI volume. rc: %d\n", rc); + errmsg("cannot convert UBI volume. rc: %d\n", rc); goto err; } } @@ -562,7 +556,7 @@ create_raw(io_t io) rc = write_ubi_volume_table(pdd, raw_pebs, vol_tab, vol_tab_size, &ebs_written, io); if (rc != 0) { - err_msg("Cannot write UBI volume table. rc: %d\n", rc); + errmsg("cannot write UBI volume table. rc: %d\n", rc); goto err; } @@ -571,7 +565,7 @@ create_raw(io_t io) goto err; if (io->fp_out != stdout) - info_msg("Physical eraseblocks written: %8d\n", ebs_written); + printf("Physical eraseblocks written: %8d\n", ebs_written); err: free(vol_tab); pfi_raws = remove_all((free_func_t)&free_pfi_raw, pfi_raws); @@ -589,13 +583,13 @@ open_io_handle(myargs *args, io_t io) /* set PDD input */ io->fp_pdd = fopen(args->f_in_pdd, "r"); if (io->fp_pdd == NULL) { - err_sys("Cannot open: %s", args->f_in_pdd); + errmsg("cannot open: %s", args->f_in_pdd); } /* set PFI input */ io->fp_pfi = fopen(args->f_in_pfi, "r"); if (io->fp_pfi == NULL) { - err_sys("Cannot open PFI input file: %s", args->f_in_pfi); + errmsg("cannot open PFI input file: %s", args->f_in_pfi); } /* set output prefix */ @@ -604,7 +598,7 @@ open_io_handle(myargs *args, io_t io) else { io->fp_out = fopen(args->f_out, "wb"); if (io->fp_out == NULL) { - err_sys("Cannot open output file: %s", args->f_out); + errmsg("cannot open output file: %s", args->f_out); } } } @@ -613,14 +607,14 @@ static void close_io_handle(io_t io) { if (fclose(io->fp_pdd) != 0) { - err_sys("Cannot close PDD file."); + errmsg("cannot close PDD file"); } if (fclose(io->fp_pfi) != 0) { - err_sys("Cannot close PFI file."); + errmsg("cannot close PFI file"); } if (io->fp_out != stdout) { if (fclose(io->fp_out) != 0) { - err_sys("Cannot close output file."); + errmsg("cannot close output file"); } } @@ -629,8 +623,7 @@ close_io_handle(io_t io) io->fp_out = NULL; } -int -main(int argc, char *argv[]) +int main(int argc, char *argv[]) { int rc = 0; @@ -655,19 +648,21 @@ main(int argc, char *argv[]) parse_opt(argc, argv, &args); if (strcmp(args.f_in_pfi, "") == 0) { - err_quit("No PFI input file specified!"); + errmsg("no PFI input file specified"); + exit(EXIT_FAILURE); } if (strcmp(args.f_in_pdd, "") == 0) { - err_quit("No PDD input file specified!"); + errmsg("no PDD input file specified"); + exit(EXIT_FAILURE); } open_io_handle(&args, &io); - info_msg("[ Creating RAW..."); + printf("Creating RAW..."); rc = create_raw(&io); if (rc != 0) { - err_msg("Creating RAW failed."); + errmsg("creating RAW failed"); goto err; } |