boot: kobs-ng: update kobs-ng for newer kernels
[openwrt/openwrt.git] / package / boot / kobs-ng / patches / 002-add-init-size-param.patch
1 Add --chip_0_size param to override the size of the mtd partition which is
2 required if the SPL does not occupy the entire partition. For Gateworks
3 Ventana boards the 'uboot' partition contains both the SPL and uboot.
4 --- a/src/main.c
5 +++ b/src/main.c
6 @@ -94,6 +94,7 @@ void usage(void)
7 " [KOBS] boot structures config options\n"
8 " --chip_0_device_path=<path> .......... Device of boot (default /dev/mtd0)\n"
9 " --chip_1_device_path=<path> .......... The second chip in case of multichip NAND\n"
10 + " --chip_0_size=<size> ................. Override size of chip_0 device\n"
11 " --search_exponent=<value> ............ NCB field (default 2)\n"
12 " --data_setup_time=<value> ............ NCB field (default 80)\n"
13 " --data_hold_time=<value> ............. NCB field (default 60)\n"
14 --- a/src/mtd.c
15 +++ b/src/mtd.c
16 @@ -876,6 +876,11 @@ struct mtd_data *mtd_open(const struct m
17 goto out;
18 }
19
20 + /* override MTD size */
21 + if (md->cfg.chip_0_size) {
22 + miu->size = md->cfg.chip_0_size;
23 + }
24 +
25 /* verify it's a nand */
26 if (miu->type != MTD_NANDFLASH
27 && miu->type != MTD_MLCNANDFLASH) {
28 @@ -3385,7 +3390,7 @@ static const struct {
29 } mtd_int_args[] = {
30 ARG_IGNORE(chip_count),
31 ARG_IGNORE(chip_0_offset),
32 - ARG_IGNORE(chip_0_size),
33 + ARG(chip_0_size),
34 ARG_IGNORE(chip_1_offset),
35 ARG_IGNORE(chip_1_size),
36 ARG(search_exponent),
37 @@ -3578,7 +3583,7 @@ void mtd_cfg_dump(struct mtd_config *cfg
38 // Pd(chip_count);
39 Ps(chip_0_device_path);
40 // Pd(chip_0_offset);
41 -// Pd(chip_0_size);
42 + Pd(chip_0_size);
43 Ps(chip_1_device_path);
44 // Pd(chip_1_offset);
45 // Pd(chip_1_size);