20160810_jeffrey - silenceuncrio/diary GitHub Wiki

Index

  • 0915 - review
  • 0920 - Bad Linux ARM zImage magic
  • 1000 - 修改 mx6ul_14x14_evk.h - ${loadaddr} - ${fdt_addr}
  • 1010 - boot 改小 - 從 4m 改成 2m
  • 1020 - 把 0x200000 大小 的 boot 搞出來
  • 1315 - mtdinfo 怎麼用
  • 1320 - nanddump 怎麼用
  • 1530 - 研究 燒錄機 - ALL-100P
  • 1625 - PHT 表示 燒錄機 是 FLASH-100

0915

review

0920

昨天原本是想利用 U-Boot 的 tftpput 慢慢把 NAND Flash 裡可以開機的 3MB 大的 image 慢慢 put 出來

光前面的 1MB 的 dbbd 部分就讓我卡關了

後來想從 Linux 開機時發現開不了機

U-Boot 2015.04-imx_v2015.04_3.14.52_1.1.0_ga+g6cf684a (Aug 09 2016 - 18:16:32)

CPU:   Freescale i.MX6UL rev1.1 at 396 MHz
CPU:   Temperature 42 C
Reset cause: POR
Board: MX6UL 14x14 EVK
I2C:   ready
DRAM:  512 MiB
force_idle_bus: sda=0 scl=0 sda.gp=0x1d scl.gp=0x1c
NAND:  128 MiB
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   FEC1
Error: FEC1 address not set.

Normal Boot
Hit any key to stop autoboot:  0

NAND read: device 0 offset 0x4000000, size 0x800000
 8388608 bytes read: OK

NAND read: device 0 offset 0x5000000, size 0x100000
 1048576 bytes read: OK
Bad Linux ARM zImage magic!
=>

這是因為 bootargsmtpartsboot16m 改成 4m

bootcmd${loadaddr}${fdt_addr} 沒做出相對應的修改的原因

#define CONFIG_EXTRA_ENV_SETTINGS \
	"bootargs=console=ttymxc0,115200 ubi.mtd=3 "  \
		"root=ubi0:rootfs rootfstype=ubifs "		     \
		CONFIG_BOOTARGS_CMA_SIZE \
		"mtdparts=gpmi-nand:4m(boot),16m(kernel),16m(dtb),-(rootfs)\0"\
	"bootcmd=nand read ${loadaddr} 0x4000000 0x800000;"\
		"nand read ${fdt_addr} 0x5000000 0x100000;"\
		"bootz ${loadaddr} - ${fdt_addr}\0"

要怎麼修改呢?

看一下 MfgTool 的 log

...
Creating 4 MTD partitions on "gpmi-nand":
0x000000000000-0x000000400000 : "boot"
0x000000400000-0x000001400000 : "kernel"
0x000001400000-0x000002400000 : "dtb"
0x000002400000-0x000008000000 : "rootfs"

這是依據 mtdparts=gpmi-nand:4m(boot),16m(kernel),16m(dtb),-(rootfs) 做出來的

所以 kerner 從 0x400000 開始 dtb 從 0x1400000 開始

1000

修改 mx6ul_14x14_evk.h

#define CONFIG_EXTRA_ENV_SETTINGS \
	"bootargs=console=ttymxc0,115200 ubi.mtd=3 "  \
		"root=ubi0:rootfs rootfstype=ubifs "		     \
		CONFIG_BOOTARGS_CMA_SIZE \
		"mtdparts=gpmi-nand:4m(boot),16m(kernel),16m(dtb),-(rootfs)\0"\
	"bootcmd=nand read ${loadaddr} 0x400000 0x800000;"\
		"nand read ${fdt_addr} 0x1400000 0x100000;"\
		"bootz ${loadaddr} - ${fdt_addr}\0"

開機成功

1010

繼續把 boot 改小一點 - 從 4m 改成 2m

#define CONFIG_EXTRA_ENV_SETTINGS \
	"bootargs=console=ttymxc0,115200 ubi.mtd=3 "  \
		"root=ubi0:rootfs rootfstype=ubifs "		     \
		CONFIG_BOOTARGS_CMA_SIZE \
		"mtdparts=gpmi-nand:2m(boot),16m(kernel),16m(dtb),-(rootfs)\0"\
	"bootcmd=nand read ${loadaddr} 0x200000 0x800000;"\
		"nand read ${fdt_addr} 0x1200000 0x100000;"\
		"bootz ${loadaddr} - ${fdt_addr}\0"

開起來了

...
Creating 4 MTD partitions on "gpmi-nand":
0x000000000000-0x000000200000 : "boot"
0x000000200000-0x000001200000 : "kernel"
0x000001200000-0x000002200000 : "dtb"
0x000002200000-0x000008000000 : "rootfs"
gpmi-nand 1806000.gpmi-nand: driver registered.
...

1020

可以著手進行看怎麼把這 0x200000 大小的 boot 搞出來 - 0x000000000000-0x000000200000 : "boot"

1315

先看 mtdinfonanddump 要怎麼用

mtdinfo

root@imx6ulevk:~# mtdinfo -h
mtdinfo version 1.5.1 - a tool to print MTD information.

Usage: mtdinfo <MTD node file path> [--map | -M] [--ubi-info | -u]
       mtdinfo --all [--ubi-info | -u]
       mtdinfo [--help | --version]

Options:
-u, --ubi-info                  print what would UBI layout be if it was put
                                on this MTD device
-M, --map                       print eraseblock map
-a, --all                       print information about all MTD devices
                                Note: `--all' may give less info per device
                                than, e.g., `mtdinfo /dev/mtdX'
-h, --help                      print help message
-V, --version                   print program version

Examples:
  mtdinfo /dev/mtd0             print information MTD device /dev/mtd0
  mtdinfo /dev/mtd0 -u          print information MTD device /dev/mtd0
                                and include UBI layout information
  mtdinfo -a                    print information about all MTD devices

直接用 mtdinfo

root@imx6ulevk:~# mtdinfo
Count of MTD devices:           4
Present MTD devices:            mtd0, mtd1, mtd2, mtd3
Sysfs interface supported:      yes

mtdinfo /dev/mtd0

root@imx6ulevk:~# mtdinfo /dev/mtd0
mtd0
Name:                           boot
Type:                           nand
Eraseblock size:                131072 bytes, 128.0 KiB
Amount of eraseblocks:          16 (2097152 bytes, 2.0 MiB)
Minimum input/output unit size: 2048 bytes
Sub-page size:                  2048 bytes
OOB size:                       64 bytes
Character device major/minor:   90:0
Bad blocks are allowed:         true
Device is writable:             true

1320

nanddump

root@imx6ulevk:~# nanddump -h
Usage: nanddump [OPTIONS] MTD-device
Dumps the contents of a nand mtd partition.

-h         --help               Display this help and exit
           --version            Output version information and exit
           --bb=METHOD          Choose bad block handling method (see below).
-a         --forcebinary        Force printing of binary data to tty
-c         --canonicalprint     Print canonical Hex+ASCII dump
-f file    --file=file          Dump to file
-l length  --length=length      Length
-n         --noecc              Read without error correction
           --omitoob            Omit OOB data (default)
-o         --oob                Dump OOB data
-p         --prettyprint        Print nice (hexdump)
-q         --quiet              Don't display progress and status messages
-s addr    --startaddress=addr  Start address

--bb=METHOD, where METHOD can be `padbad', `dumpbad', or `skipbad':
    padbad:  dump flash data, substituting 0xFF for any bad blocks
    dumpbad: dump flash data, including any bad blocks
    skipbad: dump good data, completely skipping any bad blocks (default)

nanddump /dev/mtd0

root@imx6ulevk:~# nanddump /dev/mtd0
ECC failed: 0
ECC corrected: 0
Number of bad blocks: 0
Number of bbt blocks: 0
Not printing binary garbage to tty. Use '-a'
or '--forcebinary' to override.

nanddump -a /dev/mtd0

root@imx6ulevk:~# nanddump -a /dev/mtd0
ECC failed: 3
ECC corrected: 0
Number of bad blocks: 0
Number of bbt blocks: 0
Block size 131072, page size 2048, OOB size 64
Dumping data starting at 0x00000000 and ending at 0x00200000...
ECC: 1 uncorrectable bitflip(s) at offset 0x00000000
?FCB P@
禘4??6脅P6)t05
                  漙斑  %Qa0礓漹瀛?g詖 鎧-$黃/s括
鱴kO    薆髲6?Q,j?     MlLtn?
...
^C

印個不停... 直到我按 Control + c

1530

目前人在隔壁研究一下我們自己的 燒錄機

1625

PHT 表示我搞錯燒錄機了

應該是 FLASH-100 才對

直接拿一台回來玩玩看

有點歷史了

利用 VirtualBox 裝個 WinXP 來安裝該燒錄機的軟體

為了燒錄 MX30LF1G18AC 還要下載啥 IC 列表支援

PHT 表示去隔壁的電腦複製檔案比較快

明天再說吧