{"id":1734,"date":"2025-10-20T03:36:04","date_gmt":"2025-10-20T03:36:04","guid":{"rendered":"http:\/\/www.recologypower.com:9080\/?p=1734"},"modified":"2025-10-20T05:51:32","modified_gmt":"2025-10-20T05:51:32","slug":"%e3%80%90linux%e3%80%91%e7%bc%96%e8%af%91%e9%80%82%e7%94%a8%e4%ba%8enor-flash%e7%9a%84linux%e6%96%87%e4%bb%b6%e7%b3%bb%e7%bb%9f","status":"publish","type":"post","link":"http:\/\/www.recologypower.com:9080\/?p=1734","title":{"rendered":"\u3010Linux\u3011\u7f16\u8bd1\u9002\u7528\u4e8eNOR Flash\u7684Linux\u6587\u4ef6\u7cfb\u7edf"},"content":{"rendered":"\n<p>\u5728\u5d4c\u5165\u5f0f\u7cfb\u7edf\u4e2d\uff0c\u4f7f\u7528NOR Flash\u4f5c\u4e3a\u5b58\u50a8\u4ecb\u8d28\u65f6\uff0c\u901a\u5e38\u9700\u8981\u9009\u62e9\u5408\u9002\u7684\u6587\u4ef6\u7cfb\u7edf\u5e76\u8fdb\u884c\u76f8\u5173\u914d\u7f6e\u548c\u7f16\u8bd1\u3002\u4ee5\u4e0b\u662f\u5b9e\u73b0\u8fd9\u4e00\u76ee\u6807\u7684\u6b65\u9aa4\u3002<\/p>\n\n\n\n<p>1. \u51c6\u5907\u5de5\u4f5c<\/p>\n\n\n\n<ul>\n<li><strong>\u83b7\u53d6\u5de5\u5177\u94fe<\/strong>\uff1a\u5b89\u88c5\u4ea4\u53c9\u7f16\u8bd1\u5de5\u5177\uff0c\u5982&nbsp;<em>gcc-linaro<\/em>&nbsp;\u548c\u8bbe\u5907\u6811\u7f16\u8bd1\u5668&nbsp;<em>dtc<\/em>\u3002<\/li>\n\n\n\n<li><strong>\u4e0b\u8f7d\u6e90\u7801<\/strong>\uff1a U-Boot \u6e90\u7801\uff1aLichee-Pi U-Boot\u3002 Linux \u5185\u6838\u6e90\u7801\uff1aLichee-Pi Linux\u3002<\/li>\n<\/ul>\n\n\n\n<p>2. \u914d\u7f6e\u548c\u7f16\u8bd1U-Boot<\/p>\n\n\n\n<ul>\n<li><strong>\u914d\u7f6e\u652f\u6301NOR Flash<\/strong>\uff1a<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>make ARCH=arm menuconfig<\/code><\/pre>\n\n\n\n<ul>\n<li>   <strong>\u8bbe\u7f6e\u9ed8\u8ba4\u542f\u52a8\u53c2\u6570<\/strong>\uff1a \u4fee\u6539\u00a0<em>include\/configs\/sun8i.h<\/em>\u00a0\u6587\u4ef6\uff0c\u6dfb\u52a0\u5982\u4e0b\u5185\u5bb9\uff1a<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>#define CONFIG_BOOTCOMMAND \"sf probe 0; sf read 0x41800000 0x100000 0x10000; sf read 0x41000000 0x110000 0x400000; bootz 0x41000000 - 0x41800000\"\r\n#define CONFIG_BOOTARGS \"console=ttyS0,115200 root=\/dev\/mtdblock3 rootfstype=jffs2 rw\"<\/code><\/pre>\n\n\n\n<ul>\n<li><strong>\u7f16\u8bd1U-Boot<\/strong>\uff1a<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j4<\/code><\/pre>\n\n\n\n<p>3. \u914d\u7f6e\u548c\u7f16\u8bd1Linux\u5185\u6838<\/p>\n\n\n\n<ul>\n<li><strong>\u914d\u7f6e\u5185\u6838\u9009\u9879<\/strong>\uff1a&nbsp;<em>make ARCH=arm menuconfig&nbsp;<\/em>\u542f\u7528 Device Drivers -&gt; Memory Technology Device (MTD) support\u3002 \u542f\u7528 File systems -&gt; Miscellaneous filesystems -&gt; JFFS2 support\u3002<\/li>\n<\/ul>\n\n\n\n<ul>\n<li><strong>\u4fee\u6539\u8bbe\u5907\u6811\u6587\u4ef6<\/strong>\uff1a \u5728\u8bbe\u5907\u6811\u6587\u4ef6\uff08\u5982&nbsp;<em>sun8i-v3s-licheepi-zero.dts<\/em>\uff09\u4e2d\u6dfb\u52a0SPI Flash\u8282\u70b9\uff1a<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>&amp;spi0 {\r\n   status = \"okay\";\r\n   flash@0 {\r\n       compatible = \"jedec,spi-nor\";\r\n       reg = &lt;0x0>;\r\n       spi-max-frequency = &lt;50000000>;\r\n   };\r\n};<\/code><\/pre>\n\n\n\n<ul>\n<li><strong>\u7f16\u8bd1\u5185\u6838\u548c\u8bbe\u5907\u6811<\/strong>\uff1a<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j4\r\nmake ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- dtbs<\/code><\/pre>\n\n\n\n<p>4. \u5236\u4f5cJFFS2\u6587\u4ef6\u7cfb\u7edf\u955c\u50cf<\/p>\n\n\n\n<ul>\n<li>\u5b89\u88c5\u5de5\u5177\uff1a<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt-get install mtd-utils<\/code><\/pre>\n\n\n\n<ul>\n<li>\u5236\u4f5c\u955c\u50cf\uff1a<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>mkfs.jffs2 -s 0x100 -e 0x10000 -p 0xAF0000 -d rootfs\/ -o jffs2.img<\/code><\/pre>\n\n\n\n<p>5. \u6253\u5305\u955c\u50cf<\/p>\n\n\n\n<ul>\n<li>\u5c06U-Boot\u3001\u5185\u6838\u3001\u8bbe\u5907\u6811\u548c\u6587\u4ef6\u7cfb\u7edf\u6253\u5305\u4e3a\u4e00\u4e2a\u955c\u50cf\uff1a<\/li>\n<\/ul>\n\n\n\n<p>dd if=\/dev\/zero of=flashimg.bin bs=1M count=16<br>dd if=u-boot-sunxi-with-spl.bin of=flashimg.bin bs=1K conv=notrunc<br>dd if=sun8i-v3s-licheepi-zero.dtb of=flashimg.bin bs=1K seek=1024 conv=notrunc<br>dd if=zImage of=flashimg.bin bs=1K seek=1088 conv=notrunc<br>dd if=jffs2.img of=flashimg.bin bs=1K seek=5184 conv=notrunc<\/p>\n\n\n\n<p>6. \u70e7\u5f55\u955c\u50cf\u5230NOR Flash<\/p>\n\n\n\n<ul>\n<li>\u4f7f\u7528\u00a0<em>sunxi-fel<\/em>\u00a0\u5de5\u5177\u70e7\u5f55\u955c\u50cf\uff1a<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo sunxi-fel -p spiflash-write 0 flashimg.bin<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"slide-text-bg2\">\n<h3>\u5728\u5d4c\u5165\u5f0f\u7cfb\u7edf\u4e2d\uff0c\u4f7f\u7528NOR Flash\u4f5c<\/h3>\n<\/div>\n<div class=\"flex-btn-div\"><a href=\"http:\/\/www.recologypower.com:9080\/?p=1734\" class=\"btn1 flex-btn\">\u9605\u8bfb\u66f4\u591a<\/a><\/div>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[110],"tags":[],"_links":{"self":[{"href":"http:\/\/www.recologypower.com:9080\/index.php?rest_route=\/wp\/v2\/posts\/1734"}],"collection":[{"href":"http:\/\/www.recologypower.com:9080\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.recologypower.com:9080\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.recologypower.com:9080\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.recologypower.com:9080\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1734"}],"version-history":[{"count":2,"href":"http:\/\/www.recologypower.com:9080\/index.php?rest_route=\/wp\/v2\/posts\/1734\/revisions"}],"predecessor-version":[{"id":1737,"href":"http:\/\/www.recologypower.com:9080\/index.php?rest_route=\/wp\/v2\/posts\/1734\/revisions\/1737"}],"wp:attachment":[{"href":"http:\/\/www.recologypower.com:9080\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1734"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.recologypower.com:9080\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1734"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.recologypower.com:9080\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1734"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}