bbrezillon / linux-sunxi Goto Github PK
View Code? Open in Web Editor NEWsunxi linux kernel
License: Other
sunxi linux kernel
License: Other
Linux kernel release 4.x <http://kernel.org/> These are the release notes for Linux version 4. Read them carefully, as they tell you what this is all about, explain how to install the kernel, and what to do if something goes wrong. WHAT IS LINUX? Linux is a clone of the operating system Unix, written from scratch by Linus Torvalds with assistance from a loosely-knit team of hackers across the Net. It aims towards POSIX and Single UNIX Specification compliance. It has all the features you would expect in a modern fully-fledged Unix, including true multitasking, virtual memory, shared libraries, demand loading, shared copy-on-write executables, proper memory management, and multistack networking including IPv4 and IPv6. It is distributed under the GNU General Public License - see the accompanying COPYING file for more details. ON WHAT HARDWARE DOES IT RUN? Although originally developed first for 32-bit x86-based PCs (386 or higher), today Linux also runs on (at least) the Compaq Alpha AXP, Sun SPARC and UltraSPARC, Motorola 68000, PowerPC, PowerPC64, ARM, Hitachi SuperH, Cell, IBM S/390, MIPS, HP PA-RISC, Intel IA-64, DEC VAX, AMD x86-64, AXIS CRIS, Xtensa, Tilera TILE, AVR32, ARC and Renesas M32R architectures. Linux is easily portable to most general-purpose 32- or 64-bit architectures as long as they have a paged memory management unit (PMMU) and a port of the GNU C compiler (gcc) (part of The GNU Compiler Collection, GCC). Linux has also been ported to a number of architectures without a PMMU, although functionality is then obviously somewhat limited. Linux has also been ported to itself. You can now run the kernel as a userspace application - this is called UserMode Linux (UML). DOCUMENTATION: - There is a lot of documentation available both in electronic form on the Internet and in books, both Linux-specific and pertaining to general UNIX questions. I'd recommend looking into the documentation subdirectories on any Linux FTP site for the LDP (Linux Documentation Project) books. This README is not meant to be documentation on the system: there are much better sources available. - There are various README files in the Documentation/ subdirectory: these typically contain kernel-specific installation notes for some drivers for example. See Documentation/00-INDEX for a list of what is contained in each file. Please read the Changes file, as it contains information about the problems, which may result by upgrading your kernel. - The Documentation/DocBook/ subdirectory contains several guides for kernel developers and users. These guides can be rendered in a number of formats: PostScript (.ps), PDF, HTML, & man-pages, among others. After installation, "make psdocs", "make pdfdocs", "make htmldocs", or "make mandocs" will render the documentation in the requested format. INSTALLING the kernel source: - If you install the full sources, put the kernel tarball in a directory where you have permissions (e.g. your home directory) and unpack it: xz -cd linux-4.X.tar.xz | tar xvf - Replace "X" with the version number of the latest kernel. Do NOT use the /usr/src/linux area! This area has a (usually incomplete) set of kernel headers that are used by the library header files. They should match the library, and not get messed up by whatever the kernel-du-jour happens to be. - You can also upgrade between 4.x releases by patching. Patches are distributed in the xz format. To install by patching, get all the newer patch files, enter the top level directory of the kernel source (linux-4.X) and execute: xz -cd ../patch-4.x.xz | patch -p1 Replace "x" for all versions bigger than the version "X" of your current source tree, _in_order_, and you should be ok. You may want to remove the backup files (some-file-name~ or some-file-name.orig), and make sure that there are no failed patches (some-file-name# or some-file-name.rej). If there are, either you or I have made a mistake. Unlike patches for the 4.x kernels, patches for the 4.x.y kernels (also known as the -stable kernels) are not incremental but instead apply directly to the base 4.x kernel. For example, if your base kernel is 4.0 and you want to apply the 4.0.3 patch, you must not first apply the 4.0.1 and 4.0.2 patches. Similarly, if you are running kernel version 4.0.2 and want to jump to 4.0.3, you must first reverse the 4.0.2 patch (that is, patch -R) _before_ applying the 4.0.3 patch. You can read more on this in Documentation/applying-patches.txt Alternatively, the script patch-kernel can be used to automate this process. It determines the current kernel version and applies any patches found. linux/scripts/patch-kernel linux The first argument in the command above is the location of the kernel source. Patches are applied from the current directory, but an alternative directory can be specified as the second argument. - Make sure you have no stale .o files and dependencies lying around: cd linux make mrproper You should now have the sources correctly installed. SOFTWARE REQUIREMENTS Compiling and running the 4.x kernels requires up-to-date versions of various software packages. Consult Documentation/Changes for the minimum version numbers required and how to get updates for these packages. Beware that using excessively old versions of these packages can cause indirect errors that are very difficult to track down, so don't assume that you can just update packages when obvious problems arise during build or operation. BUILD directory for the kernel: When compiling the kernel, all output files will per default be stored together with the kernel source code. Using the option "make O=output/dir" allows you to specify an alternate place for the output files (including .config). Example: kernel source code: /usr/src/linux-4.X build directory: /home/name/build/kernel To configure and build the kernel, use: cd /usr/src/linux-4.X make O=/home/name/build/kernel menuconfig make O=/home/name/build/kernel sudo make O=/home/name/build/kernel modules_install install Please note: If the 'O=output/dir' option is used, then it must be used for all invocations of make. CONFIGURING the kernel: Do not skip this step even if you are only upgrading one minor version. New configuration options are added in each release, and odd problems will turn up if the configuration files are not set up as expected. If you want to carry your existing configuration to a new version with minimal work, use "make oldconfig", which will only ask you for the answers to new questions. - Alternative configuration commands are: "make config" Plain text interface. "make menuconfig" Text based color menus, radiolists & dialogs. "make nconfig" Enhanced text based color menus. "make xconfig" Qt based configuration tool. "make gconfig" GTK+ based configuration tool. "make oldconfig" Default all questions based on the contents of your existing ./.config file and asking about new config symbols. "make silentoldconfig" Like above, but avoids cluttering the screen with questions already answered. Additionally updates the dependencies. "make olddefconfig" Like above, but sets new symbols to their default values without prompting. "make defconfig" Create a ./.config file by using the default symbol values from either arch/$ARCH/defconfig or arch/$ARCH/configs/${PLATFORM}_defconfig, depending on the architecture. "make ${PLATFORM}_defconfig" Create a ./.config file by using the default symbol values from arch/$ARCH/configs/${PLATFORM}_defconfig. Use "make help" to get a list of all available platforms of your architecture. "make allyesconfig" Create a ./.config file by setting symbol values to 'y' as much as possible. "make allmodconfig" Create a ./.config file by setting symbol values to 'm' as much as possible. "make allnoconfig" Create a ./.config file by setting symbol values to 'n' as much as possible. "make randconfig" Create a ./.config file by setting symbol values to random values. "make localmodconfig" Create a config based on current config and loaded modules (lsmod). Disables any module option that is not needed for the loaded modules. To create a localmodconfig for another machine, store the lsmod of that machine into a file and pass it in as a LSMOD parameter. target$ lsmod > /tmp/mylsmod target$ scp /tmp/mylsmod host:/tmp host$ make LSMOD=/tmp/mylsmod localmodconfig The above also works when cross compiling. "make localyesconfig" Similar to localmodconfig, except it will convert all module options to built in (=y) options. You can find more information on using the Linux kernel config tools in Documentation/kbuild/kconfig.txt. - NOTES on "make config": - Having unnecessary drivers will make the kernel bigger, and can under some circumstances lead to problems: probing for a nonexistent controller card may confuse your other controllers - Compiling the kernel with "Processor type" set higher than 386 will result in a kernel that does NOT work on a 386. The kernel will detect this on bootup, and give up. - A kernel with math-emulation compiled in will still use the coprocessor if one is present: the math emulation will just never get used in that case. The kernel will be slightly larger, but will work on different machines regardless of whether they have a math coprocessor or not. - The "kernel hacking" configuration details usually result in a bigger or slower kernel (or both), and can even make the kernel less stable by configuring some routines to actively try to break bad code to find kernel problems (kmalloc()). Thus you should probably answer 'n' to the questions for "development", "experimental", or "debugging" features. COMPILING the kernel: - Make sure you have at least gcc 3.2 available. For more information, refer to Documentation/Changes. Please note that you can still run a.out user programs with this kernel. - Do a "make" to create a compressed kernel image. It is also possible to do "make install" if you have lilo installed to suit the kernel makefiles, but you may want to check your particular lilo setup first. To do the actual install, you have to be root, but none of the normal build should require that. Don't take the name of root in vain. - If you configured any of the parts of the kernel as `modules', you will also have to do "make modules_install". - Verbose kernel compile/build output: Normally, the kernel build system runs in a fairly quiet mode (but not totally silent). However, sometimes you or other kernel developers need to see compile, link, or other commands exactly as they are executed. For this, use "verbose" build mode. This is done by passing "V=1" to the "make" command, e.g. make V=1 all To have the build system also tell the reason for the rebuild of each target, use "V=2". The default is "V=0". - Keep a backup kernel handy in case something goes wrong. This is especially true for the development releases, since each new release contains new code which has not been debugged. Make sure you keep a backup of the modules corresponding to that kernel, as well. If you are installing a new kernel with the same version number as your working kernel, make a backup of your modules directory before you do a "make modules_install". Alternatively, before compiling, use the kernel config option "LOCALVERSION" to append a unique suffix to the regular kernel version. LOCALVERSION can be set in the "General Setup" menu. - In order to boot your new kernel, you'll need to copy the kernel image (e.g. .../linux/arch/i386/boot/bzImage after compilation) to the place where your regular bootable kernel is found. - Booting a kernel directly from a floppy without the assistance of a bootloader such as LILO, is no longer supported. If you boot Linux from the hard drive, chances are you use LILO, which uses the kernel image as specified in the file /etc/lilo.conf. The kernel image file is usually /vmlinuz, /boot/vmlinuz, /bzImage or /boot/bzImage. To use the new kernel, save a copy of the old image and copy the new image over the old one. Then, you MUST RERUN LILO to update the loading map! If you don't, you won't be able to boot the new kernel image. Reinstalling LILO is usually a matter of running /sbin/lilo. You may wish to edit /etc/lilo.conf to specify an entry for your old kernel image (say, /vmlinux.old) in case the new one does not work. See the LILO docs for more information. After reinstalling LILO, you should be all set. Shutdown the system, reboot, and enjoy! If you ever need to change the default root device, video mode, ramdisk size, etc. in the kernel image, use the 'rdev' program (or alternatively the LILO boot options when appropriate). No need to recompile the kernel to change these parameters. - Reboot with the new kernel and enjoy. IF SOMETHING GOES WRONG: - If you have problems that seem to be due to kernel bugs, please check the file MAINTAINERS to see if there is a particular person associated with the part of the kernel that you are having trouble with. If there isn't anyone listed there, then the second best thing is to mail them to me ([email protected]), and possibly to any other relevant mailing-list or to the newsgroup. - In all bug-reports, *please* tell what kernel you are talking about, how to duplicate the problem, and what your setup is (use your common sense). If the problem is new, tell me so, and if the problem is old, please try to tell me when you first noticed it. - If the bug results in a message like unable to handle kernel paging request at address C0000010 Oops: 0002 EIP: 0010:XXXXXXXX eax: xxxxxxxx ebx: xxxxxxxx ecx: xxxxxxxx edx: xxxxxxxx esi: xxxxxxxx edi: xxxxxxxx ebp: xxxxxxxx ds: xxxx es: xxxx fs: xxxx gs: xxxx Pid: xx, process nr: xx xx xx xx xx xx xx xx xx xx xx or similar kernel debugging information on your screen or in your system log, please duplicate it *exactly*. The dump may look incomprehensible to you, but it does contain information that may help debugging the problem. The text above the dump is also important: it tells something about why the kernel dumped code (in the above example, it's due to a bad kernel pointer). More information on making sense of the dump is in Documentation/oops-tracing.txt - If you compiled the kernel with CONFIG_KALLSYMS you can send the dump as is, otherwise you will have to use the "ksymoops" program to make sense of the dump (but compiling with CONFIG_KALLSYMS is usually preferred). This utility can be downloaded from ftp://ftp.<country>.kernel.org/pub/linux/utils/kernel/ksymoops/ . Alternatively, you can do the dump lookup by hand: - In debugging dumps like the above, it helps enormously if you can look up what the EIP value means. The hex value as such doesn't help me or anybody else very much: it will depend on your particular kernel setup. What you should do is take the hex value from the EIP line (ignore the "0010:"), and look it up in the kernel namelist to see which kernel function contains the offending address. To find out the kernel function name, you'll need to find the system binary associated with the kernel that exhibited the symptom. This is the file 'linux/vmlinux'. To extract the namelist and match it against the EIP from the kernel crash, do: nm vmlinux | sort | less This will give you a list of kernel addresses sorted in ascending order, from which it is simple to find the function that contains the offending address. Note that the address given by the kernel debugging messages will not necessarily match exactly with the function addresses (in fact, that is very unlikely), so you can't just 'grep' the list: the list will, however, give you the starting point of each kernel function, so by looking for the function that has a starting address lower than the one you are searching for but is followed by a function with a higher address you will find the one you want. In fact, it may be a good idea to include a bit of "context" in your problem report, giving a few lines around the interesting one. If you for some reason cannot do the above (you have a pre-compiled kernel image or similar), telling me as much about your setup as possible will help. Please read the REPORTING-BUGS document for details. - Alternatively, you can use gdb on a running kernel. (read-only; i.e. you cannot change values or set break points.) To do this, first compile the kernel with -g; edit arch/i386/Makefile appropriately, then do a "make clean". You'll also need to enable CONFIG_PROC_FS (via "make config"). After you've rebooted with the new kernel, do "gdb vmlinux /proc/kcore". You can now use all the usual gdb commands. The command to look up the point where your system crashed is "l *0xXXXXXXXX". (Replace the XXXes with the EIP value.) gdb'ing a non-running kernel currently fails because gdb (wrongly) disregards the starting offset for which the kernel is compiled.
Hello! I need help. Sorry fo my English.
I have a board like a cubietrack.
I try to use Micron 29F32G08CBADA
I compiled mainline U-Boot 2017.09 and Linux kernel version 4.13.0
Nand is work in u-boot.
But is not work in a linux kernel!
I followed the directions by NAND_Howto
I read many other information.
when i try to any write operations in linux I get the input/output error:
[root@alarm ~]# flash_erase /dev/mtd3 0 0
Erasing 2048 Kibyte @ 0 -- 167944 % complete libmtd: error!: MEMERASE64 ioctl failed for eraseblock 0 (mtd3)
error 5 (Input/output error)
flash_erase: error!: /dev/mtd3: MTD Erase failure
error 5 (Input/output error)
Erasing 2048 Kibyte @ b6faecb000000006 -- 167944 % complete libmtd: error!: MEMERASE64 ioctl failed for eraseblock 1 (m)
error 5 (Input/output error)
flash_erase: error!: /dev/mtd3: MTD Erase failure
error 5 (Input/output error)
Erasing 2048 Kibyte @ b6faecb00000000c -- 167944 % complete libmtd: error!: MEMERASE64 ioctl failed for eraseblock 2 (m)
error 5 (Input/output error)
flash_erase: error!: /dev/mtd3: MTD Erase failure
error 5 (Input/output error)
...
some log`s:
U-Boot 2017.09-rc3-00062-g6ef2f90-dirty (Sep 06 2017 - 02:31:55 +0700) Allwinner Technology
CPU: Allwinner A20 (SUN7I)
Model: Cubietech Cubietruck
I2C: ready
DRAM: 512 MiB
NAND: 4096 MiB
=> nand info
Device 0: nand0, sector size 2048 KiB
Page size 8192 b
OOB size 744 b
Erase size 2097152 b
subpagesize 8192 b
options 0x40001000
bbt options 0x00060000
=> nand bad
Device 0 bad blocks:
0e400000
70000000
79000000
bd000000
fe400000
ff800000
ffa00000
ffc00000
ffe00000
=> mtdparts
device nand0 , # parts = 5
#: name size offset mask_flags
0: boot0 0x00200000 0x00000000 0
1: test 0x00600000 0x00200000 0
2: uboot 0x00200000 0x00800000 0
3: boot 0x02000000 0x00a00000 0
4: rootfs 0xfd600000 0x02a00000 0
active partition: nand0,0 - (boot0) 0x00200000 @ 0x00000000
defaults:
mtdids : nand0=sunxi-nand
mtdparts: mtdparts=sunxi-nand:2m(boot0),6m(test),2m(uboot),32m(boot),-(rootfs)
=> ubi part nand0,4
ubi0: attaching mtd1
ubi0: scanning is finished
ubi0: attached mtd1 (name "mtd=4", size 4054 MiB)
ubi0: PEB size: 2097152 bytes (2048 KiB), LEB size: 2080768 bytes
ubi0: min./max. I/O unit sizes: 8192/8192, sub-page size 8192
ubi0: VID header offset: 8192 (aligned 8192), data offset: 16384
ubi0: good PEBs: 2018, bad PEBs: 9, corrupted PEBs: 0 128
ubi0: max/mean erase counter: 2/1, WL threshold: 4096, image sequence number: 0
ubi0: available PEBs: 1966, total reserved PEBs: 52, PEBs reserved for bad PEB handling: 31
=> ubi create myvol1 0x2000000 s 0
Creating static volume myvol1 of size 33554432
=> ubi info
UBI: MTD device name: "mtd=4"
UBI: MTD device size: 4054 MiB
UBI: physical eraseblock size: 2097152 bytes (2048 KiB)
UBI: logical eraseblock size: 2080768 bytes
UBI: number of good PEBs: 2018
UBI: number of bad PEBs: 9
UBI: smallest flash I/O unit: 8192
UBI: VID header offset: 8192 (aligned 8192)
UBI: data offset: 16384
UBI: max. allowed volumes: 128
UBI: wear-leveling threshold: 4096
UBI: number of internal volumes: 1
UBI: number of user volumes: 2
UBI: available PEBs: 1949
UBI: total number of reserved PEBs: 69
UBI: number of PEBs reserved for bad PEB handling: 31
UBI: max/mean erase counter: 2/1
=> ubi create myvol2 0x2000000 d 0
Creating dynamic volume myvol2 of size 33554432
exit not allowed from main input shell.
=> ubi remove myvol2
Volume myvol2 not found!
=> ubi create myvol2 0x2000000 d 1
Creating dynamic volume myvol2 of size 33554432
=> ubi info l
Volume information dump:
vol_id 0
reserved_pebs 17
alignment 1
data_pad 0
vol_type 4
name_len 6
usable_leb_size 2080768
used_ebs 0
used_bytes 0
last_eb_bytes 2080768
corrupted 0
upd_marker 0
name myvol1
Volume information dump:
vol_id 1
reserved_pebs 17
alignment 1
data_pad 0
vol_type 3
name_len 6
usable_leb_size 2080768
used_ebs 17
used_bytes 35373056
last_eb_bytes 2080768
corrupted 0
upd_marker 0
name myvol2
Volume information dump:
vol_id 2147479551
reserved_pebs 2
alignment 1
data_pad 0
vol_type 3
name_len 13
usable_leb_size 2080768
used_ebs 2
used_bytes 4161536
last_eb_bytes 2
corrupted 0
upd_marker 0
name layout volume
in U-BOOT all works good!
My devicetree additions is the same in u-boot and linux kernel:
I add to sun7i-a20.dtsi
//soc@01c00000 {
// ...
nfc: nand@01c03000 {
compatible = "allwinner,sun4i-a10-nand";
reg = <0x01c03000 0x1000>;
interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&ahb_gates 13>, <&nand_clk>;
clock-names = "ahb", "mod";
dmas = <&dma SUN4I_DMA_DEDICATED 3>;
dma-names = "rxtx";
status = "disabled";
#address-cells = <1>;
#size-cells = <0>;
};
// ...
// pio: pinctrl@01c20800 {
// ...
nand_pins_a: nand_base0@0 {
allwinner,pins = "PC0", "PC1", "PC2",
"PC5", "PC8", "PC9", "PC10",
"PC11", "PC12", "PC13", "PC14",
"PC15", "PC16";
allwinner,function = "nand0";
allwinner,drive = <SUN4I_PINCTRL_10_MA>;
allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
};
nand_cs0_pins_a: nand_cs@0 {
allwinner,pins = "PC4";
allwinner,function = "nand0";
allwinner,drive = <SUN4I_PINCTRL_10_MA>;
allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
};
nand_cs1_pins_a: nand_cs@1 {
allwinner,pins = "PC3";
allwinner,function = "nand0";
allwinner,drive = <SUN4I_PINCTRL_10_MA>;
allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
};
nand_cs2_pins_a: nand_cs@2 {
allwinner,pins = "PC17";
allwinner,function = "nand0";
allwinner,drive = <SUN4I_PINCTRL_10_MA>;
allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
};
nand_cs3_pins_a: nand_cs@3 {
allwinner,pins = "PC18";
allwinner,function = "nand0";
allwinner,drive = <SUN4I_PINCTRL_10_MA>;
allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
};
nand_cs4_pins_a: nand_cs@4 {
allwinner,pins = "PC19";
allwinner,function = "nand0";
allwinner,drive = <SUN4I_PINCTRL_10_MA>;
allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
};
nand_cs5_pins_a: nand_cs@5 {
allwinner,pins = "PC20";
allwinner,function = "nand0";
allwinner,drive = <SUN4I_PINCTRL_10_MA>;
allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
};
nand_cs6_pins_a: nand_cs@6 {
allwinner,pins = "PC21";
allwinner,function = "nand0";
allwinner,drive = <SUN4I_PINCTRL_10_MA>;
allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
};
nand_cs7_pins_a: nand_cs@7 {
allwinner,pins = "PC22";
allwinner,function = "nand0";
allwinner,drive = <SUN4I_PINCTRL_10_MA>;
allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
};
nand_rb0_pins_a: nand_rb@0 {
allwinner,pins = "PC6";
allwinner,function = "nand0";
allwinner,drive = <SUN4I_PINCTRL_10_MA>;
allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
};
nand_rb1_pins_a: nand_rb@1 {
allwinner,pins = "PC7";
allwinner,function = "nand0";
allwinner,drive = <SUN4I_PINCTRL_10_MA>;
allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
};
// ...
// };
//};
I add to sun7i-a20-cubietruck.dts
&nfc {
pinctrl-names = "default";
pinctrl-0 = <&nand_pins_a &nand_cs0_pins_a &nand_rb0_pins_a>;
status = "okay";
nand@0 {
#address-cells = <2>;
#size-cells = <2>;
reg = <0>;
allwinner,rb = <0>;
nand-ecc-mode = "hw";
nand-ecc-strength = <40>;
nand-ecc-step-size = <1024>;
nand-rnd-mode = "hw";
nand-randomizer-seeds = /bits/ 16 <
0x2b75 0x0bd0 0x5ca3 0x62d1 0x1c93 0x07e9 0x2162 0x3a72
0x0d67 0x67f9 0x1be7 0x077d 0x032f 0x0dac 0x2716 0x2436
0x7922 0x1510 0x3860 0x5287 0x480f 0x4252 0x1789 0x5a2d
0x2a49 0x5e10 0x437f 0x4b4e 0x2f45 0x216e 0x5cb7 0x7130
0x2a3f 0x60e4 0x4dc9 0x0ef0 0x0f52 0x1bb9 0x6211 0x7a56
0x226d 0x4ea7 0x6f36 0x3692 0x38bf 0x0c62 0x05eb 0x4c55
0x60f4 0x728c 0x3b6f 0x2037 0x7f69 0x0936 0x651a 0x4ceb
0x6218 0x79f3 0x383f 0x18d9 0x4f05 0x5c82 0x2912 0x6f17
0x6856 0x5938 0x1007 0x61ab 0x3e7f 0x57c2 0x542f 0x4f62
0x7454 0x2eac 0x7739 0x42d4 0x2f90 0x435a 0x2e52 0x2064
0x637c 0x66ad 0x2c90 0x0bad 0x759c 0x0029 0x0986 0x7126
0x1ca7 0x1605 0x386a 0x27f5 0x1380 0x6d75 0x24c3 0x0f8e
0x2b7a 0x1418 0x1fd1 0x7dc1 0x2d8e 0x43af 0x2267 0x7da3
0x4e3d 0x1338 0x50db 0x454d 0x764d 0x40a3 0x42e6 0x262b
0x2d2e 0x1aea 0x2e17 0x173d 0x3a6e 0x71bf 0x25f9 0x0a5d
0x7c57 0x0fbe 0x46ce 0x4939 0x6b17 0x37bb 0x3e91 0x76db>;
onfi,nand-timing-mode = <0x1f>;
nand-on-flash-bbt;
boot0@0 {
label = "boot0";
reg = /bits/ 64 <0x0 0x200000>;
nand-ecc-mode = "hw_syndrome";
nand-rnd-mode = "hw";
};
test@200000 {
label = "test";
reg = /bits/ 64 <0x200000 0x600000>;
nand-ecc-mode = "hw_syndrome";
nand-rnd-mode = "hw";
};
uboot@800000 {
label = "uboot";
reg = /bits/ 64 <0x800000 0x200000>;
nand-ecc-mode = "hw";
nand-rnd-mode = "hw";
};
boot@0a00000 {
label = "boot";
reg = /bits/ 64 <0x0a00000 0x2000000>;
nand-ecc-mode = "hw";
nand-rnd-mode = "hw";
};
rootfs@0x02a00000 {
label = "rootfs";
reg = /bits/ 64 <0x02a00000 0xed600000>;
nand-ecc-mode = "hw";
nand-rnd-mode = "hw";
};
};
};
Starting kernel ...
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.13.0-rc3-g26c5ceb-dirty (gcc version 6.3.1 20170109 (Linaro GCC 6.3-2017
[ 0.000000] CPU: ARMv7 Processor [410fc074] revision 4 (ARMv7), cr=10c5387d
[ 0.000000] CPU: div instructions available: patching division code
[ 1.234372] nand: device found, Manufacturer ID: 0x2c, Chip ID: 0x44
[ 1.240801] nand: Micron MT29F32G08CBADA3W
[ 1.244897] nand: 4096 MiB, MLC, erase size: 2048 KiB, page size: 8192, OOB size: 744
[ 1.264020] Bad block table not found for chip 0
[ 1.278608] Bad block table not found for chip 0
[ 1.283237] Scanning device for bad blocks
[ 1.307904] Bad eraseblock 21 at 0x000002a00000
[ 1.313368] Bad eraseblock 22 at 0x000002c00000
...
[ 12.581254] Bad eraseblock 2044 at 0x0000ff800000
[ 12.587820] Bad eraseblock 2046 at 0x0000ffc00000
[ 12.593470] Bad eraseblock 2047 at 0x0000ffe00000
[ 12.598269] nand_bbt: error while erasing BBT block -5
[ 12.604362] nand_bbt: error -30 while marking block 2045 bad
[ 12.610031] No space left to write bad block table
[ 12.614816] nand_bbt: error while writing bad block table -28
[ 12.620591] sunxi_nand 1c03000.nand: nand_scan_tail failed: -28
[ 12.626504] sunxi_nand 1c03000.nand: failed to init nand chips
[ 12.632486] sunxi_nand: probe of 1c03000.nand failed with error -28
[ 12.639744] libphy: Fixed MDIO Bus: probed
[root@alarm ~]# ls /dev/mtd*
ls: cannot access '/dev/mtd*': No such file or directory
then I coment in sun7i-a20-cubietruck.dts
//nand-on-flash-bbt;
and coment in /drivers/mtd/nand/nand_base.c
in nand_erase_nand(..) function
/*
instr->state = MTD_ERASE_FAILED;
goto erase_exit;
*/
Starting kernel ...
[ 12.491595] Bad eraseblock 2047 at 0x0000ffe00000
[ 12.502590] 5 ofpart partitions found on MTD device 1c03000.nand
[ 12.508661] Creating 5 MTD partitions on "1c03000.nand":
[ 12.513984] 0x000000000000-0x000000200000 : "boot0"
[ 12.519434] 0x000000200000-0x000000800000 : "test"
[ 12.524601] 0x000000800000-0x000000a00000 : "uboot"
[ 12.529924] 0x000000a00000-0x000002a00000 : "boot"
[ 12.535097] 0x000002a00000-0x0000f0000000 : "rootfs"
[ 12.544322] libphy: Fixed MDIO Bus: probed
[root@alarm ~]# mtdinfo -a
mtd0
Name: boot0
Type: mlc-nand
Eraseblock size: 2097152 bytes, 2.0 MiB
Amount of eraseblocks: 1 (2097152 bytes, 2.0 MiB)
Minimum input/output unit size: 8192 bytes
Sub-page size: 8192 bytes
OOB size: 744 bytes
Character device major/minor: 90:0
Bad blocks are allowed: true
Device is writable: true
mtd1
Name: test
Type: mlc-nand
Eraseblock size: 2097152 bytes, 2.0 MiB
Amount of eraseblocks: 3 (6291456 bytes, 6.0 MiB)
Minimum input/output unit size: 8192 bytes
Sub-page size: 8192 bytes
OOB size: 744 bytes
Character device major/minor: 90:2
Bad blocks are allowed: true
Device is writable: true
mtd2
Name: uboot
Type: mlc-nand
Eraseblock size: 2097152 bytes, 2.0 MiB
Amount of eraseblocks: 1 (2097152 bytes, 2.0 MiB)
Minimum input/output unit size: 8192 bytes
Sub-page size: 8192 bytes
OOB size: 744 bytes
Character device major/minor: 90:4
Bad blocks are allowed: true
Device is writable: true
mtd3
Name: boot
Type: mlc-nand
Eraseblock size: 2097152 bytes, 2.0 MiB
Amount of eraseblocks: 16 (33554432 bytes, 32.0 MiB)
Minimum input/output unit size: 8192 bytes
Sub-page size: 8192 bytes
OOB size: 744 bytes
Character device major/minor: 90:6
Bad blocks are allowed: true
Device is writable: true
mtd4
Name: rootfs
Type: mlc-nand
Eraseblock size: 2097152 bytes, 2.0 MiB
Amount of eraseblocks: 1899 (3982491648 bytes, 3.7 GiB)
Minimum input/output unit size: 8192 bytes
Sub-page size: 8192 bytes
OOB size: 744 bytes
Character device major/minor: 90:8
Bad blocks are allowed: true
Device is writable: true
[root@alarm ~]# mtdinfo -a -u
Count of MTD devices: 5
Present MTD devices: mtd0, mtd1, mtd2, mtd3, mtd4
Sysfs interface supported: yes
mtd0
Name: boot0
Type: mlc-nand
Eraseblock size: 2097152 bytes, 2.0 MiB
Amount of eraseblocks: 1 (2097152 bytes, 2.0 MiB)
Minimum input/output unit size: 8192 bytes
Sub-page size: 8192 bytes
OOB size: 744 bytes
Character device major/minor: 90:0
Bad blocks are allowed: true
Device is writable: true
Default UBI VID header offset: 8192
Default UBI data offset: 16384
Default UBI LEB size: 2080768 bytes, 2.0 MiB
Maximum UBI volumes count: 128
mtd1
Name: test
Type: mlc-nand
Eraseblock size: 2097152 bytes, 2.0 MiB
Amount of eraseblocks: 3 (6291456 bytes, 6.0 MiB)
Minimum input/output unit size: 8192 bytes
Sub-page size: 8192 bytes
OOB size: 744 bytes
Character device major/minor: 90:2
Bad blocks are allowed: true
Device is writable: true
Default UBI VID header offset: 8192
Default UBI data offset: 16384
Default UBI LEB size: 2080768 bytes, 2.0 MiB
Maximum UBI volumes count: 128
mtd2
Name: uboot
Type: mlc-nand
Eraseblock size: 2097152 bytes, 2.0 MiB
Amount of eraseblocks: 1 (2097152 bytes, 2.0 MiB)
Minimum input/output unit size: 8192 bytes
Sub-page size: 8192 bytes
OOB size: 744 bytes
Character device major/minor: 90:4
Bad blocks are allowed: true
Device is writable: true
Default UBI VID header offset: 8192
Default UBI data offset: 16384
Default UBI LEB size: 2080768 bytes, 2.0 MiB
Maximum UBI volumes count: 128
mtd3
Name: boot
Type: mlc-nand
Eraseblock size: 2097152 bytes, 2.0 MiB
Amount of eraseblocks: 16 (33554432 bytes, 32.0 MiB)
Minimum input/output unit size: 8192 bytes
Sub-page size: 8192 bytes
OOB size: 744 bytes
Character device major/minor: 90:6
Bad blocks are allowed: true
Device is writable: true
Default UBI VID header offset: 8192
Default UBI data offset: 16384
Default UBI LEB size: 2080768 bytes, 2.0 MiB
Maximum UBI volumes count: 128
mtd4
Name: rootfs
Type: mlc-nand
Eraseblock size: 2097152 bytes, 2.0 MiB
Amount of eraseblocks: 1899 (3982491648 bytes, 3.7 GiB)
Minimum input/output unit size: 8192 bytes
Sub-page size: 8192 bytes
OOB size: 744 bytes
Character device major/minor: 90:8
Bad blocks are allowed: true
Device is writable: true
Default UBI VID header offset: 8192
Default UBI data offset: 16384
Default UBI LEB size: 2080768 bytes, 2.0 MiB
Maximum UBI volumes count: 128
[root@alarm ~]# flash_erase /dev/mtd3 0 0
Erasing 2048 Kibyte @ 0 -- 167944 % complete libmtd: error!: MEMERASE64 ioctl failed for eraseblock 0 (mtd3)
error 5 (Input/output error)
flash_erase: error!: /dev/mtd3: MTD Erase failure
error 5 (Input/output error)
Erasing 2048 Kibyte @ b6faecb000000006 -- 167944 % complete libmtd: error!: MEMERASE64 ioctl failed for eraseblock 1 (m)
error 5 (Input/output error)
flash_erase: error!: /dev/mtd3: MTD Erase failure
error 5 (Input/output error)
Erasing 2048 Kibyte @ b6faecb00000000c -- 167944 % complete libmtd: error!: MEMERASE64 ioctl failed for eraseblock 2 (m)
error 5 (Input/output error)
flash_erase: error!: /dev/mtd3: MTD Erase failure
error 5 (Input/output error)
...
ubiformat and dd leads to the same error.
Please tell me what am I doing wrong?
Maybe the NAND is faulty?
Sincerely, Denis Romanenko
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.