diff options
author | Tim Harvey <tharvey@gateworks.com> | 2016-09-01 07:45:37 -0700 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2016-09-04 13:36:09 +0200 |
commit | a4b86b292a0bce95b9874d6c757a709c5a5269b4 (patch) | |
tree | 7922e9c3677adc852b5812519866586fd9fb2c80 /package/boot/kobs-ng/patches/003-raw-mode.patch | |
parent | f8c7e935ef8060b8ab2f5ca52832ef8dfea361bc (diff) | |
download | upstream-a4b86b292a0bce95b9874d6c757a709c5a5269b4.tar.gz upstream-a4b86b292a0bce95b9874d6c757a709c5a5269b4.tar.bz2 upstream-a4b86b292a0bce95b9874d6c757a709c5a5269b4.zip |
boot: kobs-ng: update kobs-ng for newer kernels
This allows kobs-ng to flash the SPL successfully on the 4.4 kernel used by
the Gateworks IMX boards supporting NAND. The previous version of kobs-ng
worked with the 3.14 kernel but will brick a board making its SPL unbootable
for the 4.4 kernel.
See http://trac.gateworks.com/wiki/ventana/bootloader#nandspl for instructions
on updating the SPL from Linux.
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Diffstat (limited to 'package/boot/kobs-ng/patches/003-raw-mode.patch')
-rw-r--r-- | package/boot/kobs-ng/patches/003-raw-mode.patch | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/package/boot/kobs-ng/patches/003-raw-mode.patch b/package/boot/kobs-ng/patches/003-raw-mode.patch new file mode 100644 index 0000000000..5a3be5f058 --- /dev/null +++ b/package/boot/kobs-ng/patches/003-raw-mode.patch @@ -0,0 +1,45 @@ +The downstream Freescale vendor kernel has a patch that allows determining +if raw NAND flash mode is provided via a debugfs file. This is not present +in upstream kernels, but the raw access support was added in the 3.19 +kernel, so we will check the kernel version if we can't find the file. +--- a/src/mtd.c ++++ b/src/mtd.c +@@ -34,6 +34,7 @@ + #include <errno.h> + #include <sys/types.h> + #include <sys/ioctl.h> ++#include <sys/utsname.h> + + #include "mtd.h" + #include "rand.h" +@@ -808,15 +809,27 @@ struct mtd_data *mtd_open(const struct m + md->cfg = *cfg; + + /* check if use new raw access mode */ ++ /* by looking for debugfs from fsl patch */ ++ md->raw_mode_flag = 0; + fp = fopen("/sys/kernel/debug/gpmi-nand/raw_mode", "r"); + if (!fp) { +- md->raw_mode_flag = 0; +- vp(md, "mtd: use legacy raw access mode\n"); ++ /* fallback to kernel version: raw access added in 3.19 */ ++ struct utsname uts; ++ if (!uname(&uts)) { ++ int major = 0, minor = 0; ++ sscanf(uts.release, "%d.%d", &major, &minor); ++ vp(md, "mtd: Linux %d.%d\n", major, minor); ++ if ((major << 8 | minor) > (3 << 8 | 18)) ++ md->raw_mode_flag = 1; ++ } + } else { + fclose(fp); + md->raw_mode_flag = 1; +- vp(md, "mtd: use new bch layout raw access mode\n"); + } ++ if (md->raw_mode_flag) ++ vp(md, "mtd: use new bch layout raw access mode\n"); ++ else ++ vp(md, "mtd: use legacy raw access mode\n"); + + if (plat_config_data->m_u32UseMultiBootArea) { + |