Memory Technology Devices – UBI
Memory Technology Devices – UBIFS
Memory Technology Devices – NAND
FreeBSD
NAND Flash Framework Introduction, experimental
Own try…
# file /tmp/nandimg_.JeCb7JOv/common.fs /tmp/nandimg_.JeCb7JOv/common.fs: UBIfs image, sequence number 8, length 4096, CRC 0x151054e7 # mount -t ubifs /tmp/nandimg_.JeCb7JOv/common.fs /mnt/common mount: unknown filesystem type 'ubifs'
Should work, but…
Where are the sources for mtd/nand/nandsim kernel module?
UBI / UBIFS on NANDSIM simulator
Simulate NAND MTD Device
Extract and rebuild a UBI image (on Ubuntu)
$ mkdir /mnt/ubi $ modprobe mtdblock $ modprobe ubi $ modprobe nandsim \ first_id_byte=0x20 \ second_id_byte=0xaa \ third_id_byte=0x00 \ fourth_id_byte=0x15 $ cat /proc/mtddev $ ls -l /dev/mtd* $ dd if=ubi.img of=/dev/mtdblock[COLOR=red]0[/COLOR] bs=2048 $ ubiattach /dev/ubi_ctrl -m 0 $ ls -l /dev/ubi* $ mount -t ubifs ubi0_0 /mnt/ubi
$ mkfs.ubifs -m 2048 -e 129024 -c 2047 -r /mnt/ubi ubifs.img $ nano ubi.ini [ubifs]mode=ubi image=ubifs.img vol_id=0 vol_size=200MiB vol_type=dynamic vol_name=rootfs vol_flags=autoresize $ ubinize -o ubi.img -p 131072 -m 2048 -s 512 ubi.ini
Compile kernel module
Fedore – Building Only Kernel Modules
How to: Compile Linux kernel modules
“FATAL: Module not found error” using modprobe
Building nandsim for Fedora
$ yum install mtd-utils $ yum install kernel-devel $ mkdir -p ~/src/nand $ cd ~/src/nand $ fetch <URL>/nandsim.c $ vi Makefile <= (as in Fedora: Building Only Kernel Modules) $ make make -C /lib/modules/3.11.10-301.fc20.x86_64/build M=/home/andreas/src/nand modules make[1]: Entering directory `/usr/src/kernels/3.11.10-301.fc20.x86_64' CC [M] /home/andreas/src/nand/nandsim.o /home/andreas/src/nand/nandsim.c: In function ‘alloc_device’: /home/andreas/src/nand/nandsim.c:581:25: error: ‘FMODE_CAN_READ’ undeclared (first use in this function) if (!(cfile->f_mode & FMODE_CAN_READ)) { ^ /home/andreas/src/nand/nandsim.c:581:25: note: each undeclared identifier is reported only once for each function it appears in /home/andreas/src/nand/nandsim.c:586:25: error: ‘FMODE_CAN_WRITE’ undeclared (first use in this function) if (!(cfile->f_mode & FMODE_CAN_WRITE)) { ^ make[2]: *** [/home/andreas/src/nand/nandsim.o] Error 1 make[1]: *** [_module_/home/andreas/src/nand] Error 2 make[1]: Leaving directory `/usr/src/kernels/3.11.10-301.fc20.x86_64' make: *** [default] Error 2 $ uname -a Linux nch-w-andreasb.advaoptical.com 3.11.10-301.fc20.x86_64 [...] $ grep -r FMODE_CAN_READ /usr/src/kernels/3.11.10-301.fc20.x86_64/ <empty> $ grep -r FMODE_CAN_READ /usr/src/kernels/3.19.8-100.fc20.x86_64 /usr/src/kernels/3.19.8-100.fc20.x86_64/include/linux/fs.h:#define FMODE_CAN_READ ((__force fmode_t)0x20000) $ rpm -qa kernel kernel-3.19.8-100.fc20.x86_64 kernel-3.11.10-301.fc20.x86_64 $ grub2-mkconfig -o /boot/grub2/grub.cfg $ grub2-install /dev/sda <Reboot> $ yum remove kernel-3.11.10-301.fc20.x86_64 $ yum remove kernel-devel-3.11.10-301.fc20.x86_64