002-add-init-size-param.patch 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. --- a/src/main.c
  2. +++ b/src/main.c
  3. @@ -94,6 +94,7 @@ void usage(void)
  4. " [KOBS] boot structures config options\n"
  5. " --chip_0_device_path=<path> .......... Device of boot (default /dev/mtd0)\n"
  6. " --chip_1_device_path=<path> .......... The second chip in case of multichip NAND\n"
  7. + " --chip_0_size=<size> ................. Override size of chip_0 device\n"
  8. " --search_exponent=<value> ............ NCB field (default 2)\n"
  9. " --data_setup_time=<value> ............ NCB field (default 80)\n"
  10. " --data_hold_time=<value> ............. NCB field (default 60)\n"
  11. --- a/src/mtd.c
  12. +++ b/src/mtd.c
  13. @@ -716,6 +716,11 @@ struct mtd_data *mtd_open(const struct m
  14. goto out;
  15. }
  16. + /* override MTD size */
  17. + if (md->cfg.chip_0_size) {
  18. + miu->size = md->cfg.chip_0_size;
  19. + }
  20. +
  21. /* verify it's a nand */
  22. if (miu->type != MTD_NANDFLASH) {
  23. fprintf(stderr, "mtd: device %s not NAND\n", mp->name);
  24. @@ -2914,7 +2919,7 @@ static const struct {
  25. } mtd_int_args[] = {
  26. ARG_IGNORE(chip_count),
  27. ARG_IGNORE(chip_0_offset),
  28. - ARG_IGNORE(chip_0_size),
  29. + ARG(chip_0_size),
  30. ARG_IGNORE(chip_1_offset),
  31. ARG_IGNORE(chip_1_size),
  32. ARG(search_exponent),
  33. @@ -3107,7 +3112,7 @@ void mtd_cfg_dump(struct mtd_config *cfg
  34. // Pd(chip_count);
  35. Ps(chip_0_device_path);
  36. // Pd(chip_0_offset);
  37. -// Pd(chip_0_size);
  38. + Pd(chip_0_size);
  39. Ps(chip_1_device_path);
  40. // Pd(chip_1_offset);
  41. // Pd(chip_1_size);