Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ void usage(void)
" [KOBS] boot structures config options\n"
" --chip_0_device_path=<path> .......... Device of boot (default /dev/mtd0)\n"
" --chip_1_device_path=<path> .......... The second chip in case of multichip NAND\n"
" --chip_0_size=<size> ................. Override size of chip_0 device\n"
" --search_exponent=<value> ............ NCB field (default 2)\n"
" --data_setup_time=<value> ............ NCB field (default 80)\n"
" --data_hold_time=<value> ............. NCB field (default 60)\n"
Expand Down
9 changes: 7 additions & 2 deletions src/mtd.c
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,11 @@ struct mtd_data *mtd_open(const struct mtd_config *cfg, int flags)
goto out;
}

/* override MTD size */
if (md->cfg.chip_0_size) {
miu->size = md->cfg.chip_0_size;
}

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will apply for chip 0 and 1. It should be rather easy to actually make it chip 0/1 compatible, just check for i as it is done above with chip_[0|1]_device_path, e.g.

if (i == 0 && md->cfg.chip_0_size)
    miu->size = md->cfg.chip_0_size;
else if (i == 1 && md->cfg.chip_1_size)
    miu->size = md->cfg.chip_1_size;

/* verify it's a nand */
if (miu->type != MTD_NANDFLASH
&& miu->type != MTD_MLCNANDFLASH) {
Expand Down Expand Up @@ -3398,7 +3403,7 @@ static const struct {
} mtd_int_args[] = {
ARG_IGNORE(chip_count),
ARG_IGNORE(chip_0_offset),
ARG_IGNORE(chip_0_size),
ARG(chip_0_size),
ARG_IGNORE(chip_1_offset),
ARG_IGNORE(chip_1_size),
ARG(search_exponent),
Expand Down Expand Up @@ -3591,7 +3596,7 @@ void mtd_cfg_dump(struct mtd_config *cfg)
// Pd(chip_count);
Ps(chip_0_device_path);
// Pd(chip_0_offset);
// Pd(chip_0_size);
Pd(chip_0_size);
Ps(chip_1_device_path);
// Pd(chip_1_offset);
// Pd(chip_1_size);
Expand Down