接着前一篇博文。
在上一篇博文中我们用NFS挂载根文件系统的方式启动了系统,接下来我们把移植了Python3的根文件系统固化到NandFlash中,但是由于linux-4.9目前不支持Yaffs2文件系统,所以我们用Jiffs2文件系统。
下面我们分为几部分:
1、移植mtd-utils工具
2、固化根文件系统到NandFlash中
3、支持Telnet
 

平台

硬件:TQ2440  64MB内存 256MB NandFlash
bootloader:U-Boot 2015.04
kernel:linux-4.9
Python: Python-3.6.0
工具链:arm-none-linux-gnueabi-gcc  4.8.3
 

正文

一、移植mtd-utils工具

mtd-utils提供了大量的用于操作Flash的工具,这里需要首先下载编译一些依赖包。
下面是编译脚本:
 #!/bin/bash

 export CC=arm-linux-gcc

 ../configure --prefix=`pwd` \
--shared

然后编译make && make install

  • lzo-2.10
编译脚本:
 #!/bin/bash

 ../configure --host=arm-linux \
CC="arm-linux-gcc" \
--prefix=`pwd`

然后编译make && make install

  • e2fsprogs-1.43.4
编译:
 #!/bin/bash

 ../configure --host=arm-linux \
CC="arm-linux-gcc" \
--prefix=`pwd`

编译 make && make install

  • mtd-utils
编译:
 ( pengdl@ubuntu | ~/Study/tq2440/MTD_UTILS/mtd-utils-v2 | Remote:True )
$./autogen.sh ( pengdl@ubuntu | ~/Study/tq2440/MTD_UTILS/mtd-utils-v2 | Remote:True Ret: @ :: )
$cd build_tq2440/ ( pengdl@ubuntu | ~/Study/tq2440/MTD_UTILS/mtd-utils-v2/build_tq2440 | Remote:True )
$./mk.sh

编译脚本:

 #!/bin/bash

 export CC=arm-linux-gcc
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/home/pengdl/Study/tq2440/MTD_UTILS/e2fsprogs-1.43./build_tq2440/lib/uuid ../configure --host=arm-linux \
--prefix=`pwd` \
LDFLAGS="-L/home/pengdl/Study/tq2440/MTD_UTILS/zlib-1.2.11/build_tq2440/lib \
-L/home/pengdl/Study/tq2440/MTD_UTILS/lzo-2.10/build_tq2440/lib \
-L/home/pengdl/Study/tq2440/MTD_UTILS/e2fsprogs-1.43./build_tq2440/lib" \
CPPFLAGS="-I/home/pengdl/Study/tq2440/MTD_UTILS/zlib-1.2.11/build_tq2440/include \
-I/home/pengdl/Study/tq2440/MTD_UTILS/lzo-2.10/build_tq2440/include \
-I/home/pengdl/Study/tq2440/MTD_UTILS/e2fsprogs-1.43./build_tq2440/include" make -j4
make install

在sbin下面会生成我们需要的工具, 这里我们只要flash_eraseall和flash_erase两个工具, 将这两个工具拷贝到根文件系统的/bin下面。

二、固化根文件系统到NandFlash

先把前一篇博文中生成的rootfs目录进行压缩:
sudo tar -czf rootfs.tar.gz rootfs

然后将rootfs.tar.gz拷贝到根文件系统下面,然后启动系统,烧写系统:

 flash_eraseall  /dev/mtd5
mount -t jffs2 /dev/mtdblock5 /mnt
tar -xf rootfs.tar.gz /mnt
cd /mnt
mv rootfs/* .
rm -r rootfs

然后修改uboot的bootargs参数:

noinitrd root=/dev/mtdblock5 rw rootfstype=jffs2 console=ttySAC0,115200n init=/linuxrc

三、支持telnet

四、开机log

 U-Boot 2015.04-g5095150 (Dec   - ::)

 CPUID:
FCLK: MHz
HCLK: MHz
PCLK: MHz
I2C: ready
DRAM: MiB
WARNING: Caches not enabled
Flash: Bytes
NAND: MiB
In: serial
Out: serial
Err: serial
Net: dm9000
Hit any key to stop autoboot: NAND read: device offset 0x300000, size 0x500000
bytes read: OK NAND read: device offset 0x800000, size 0x100000
bytes read: OK
## Booting kernel from Legacy Image at ...
Image Name: Linux-4.9.+
Created: -- :: UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: Bytes = 3.3 MiB
Load Address:
Entry Point:
Verifying Checksum ... OK
## Flattened Device Tree blob at
Booting using the fdt blob at 0x32000000
Loading Kernel Image ... OK
Loading Device Tree to 33aa6000, end 33aaa62c ... OK Starting kernel ... Uncompressing Linux... done, booting the kernel.
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.9.+ (pengdl@ubuntu) (gcc version 4.8. (prerelease) (Sourcery CodeBench Lite 2014.05-) ) # Wed Apr :: PDT
[ 0.000000] CPU: ARM920T [] revision (ARMv4T), cr=c000717f
[ 0.000000] CPU: VIVT data cache, VIVT instruction cache
[ 0.000000] OF: fdt:Machine model: TQ2440
[ 0.000000] Memory policy: Data cache writeback
[ 0.000000] DT missing boot CPU MPIDR[:], fall back to default cpu_logical_map
[ 0.000000] Built zonelists in Zone order, mobility grouping on. Total pages:
[ 0.000000] Kernel command line: noinitrd root=/dev/mtdblock5 rw rootfstype=jffs2 console=ttySAC0,115200n init=/linuxrc
[ 0.000000] PID hash table entries: (order: -, bytes)
[ 0.000000] Dentry cache hash table entries: (order: , bytes)
[ 0.000000] Inode-cache hash table entries: (order: , bytes)
[ 0.000000] Memory: 57900K/65536K available (4729K kernel code, 234K rwdata, 1376K rodata, 204K init, 262K bss, 7636K reserved, 0K cma-reserved)
[ 0.000000] Virtual kernel memory layout:
[ 0.000000] vector : 0xffff0000 - 0xffff1000 ( kB)
[ 0.000000] fixmap : 0xffc00000 - 0xfff00000 ( kB)
[ 0.000000] vmalloc : 0xc4800000 - 0xff800000 ( MB)
[ 0.000000] lowmem : 0xc0000000 - 0xc4000000 ( MB)
[ 0.000000] modules : 0xbf000000 - 0xc0000000 ( MB)
[ 0.000000] .text : 0xc0008000 - 0xc04a67f0 ( kB)
[ 0.000000] .init : 0xc0627000 - 0xc065a000 ( kB)
[ 0.000000] .data : 0xc065a000 - 0xc0694840 ( kB)
[ 0.000000] .bss : 0xc0694840 - 0xc06d60a8 ( kB)
[ 0.000000] SLUB: HWalign=, Order=-, MinObjects=, CPUs=, Nodes=
[ 0.000000] NR_IRQS:
[ 0.000000] irq: clearing pending status
[ 0.000000] _get_rate: could not find clock xti
[ 0.000128] sched_clock: bits at 1000kHz, resolution 1000ns, wraps every 32767500ns
[ 0.000262] clocksource: samsung_clocksource_timer: mask: 0xffff max_cycles: 0xffff, max_idle_ns: ns
[ 0.001283] Console: colour dummy device 80x30
[ 0.001485] Calibrating delay loop... 199.47 BogoMIPS (lpj=)
[ 0.035125] pid_max: default: minimum:
[ 0.035715] Mount-cache hash table entries: (order: , bytes)
[ 0.035803] Mountpoint-cache hash table entries: (order: , bytes)
[ 0.039125] CPU: Testing write buffer coherency: ok
[ 0.041713] Setting up static identity map for 0x30008200 - 0x30008258
[ 0.067192] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: ns
[ 0.067812] pinctrl core: initialized pinctrl subsystem
[ 0.071047] NET: Registered protocol family
[ 0.074165] DMA: preallocated KiB pool for atomic coherent allocations
[ 0.096405] cpuidle: using governor ladder
[ 0.097029] No ATAGs?
[ 0.355694] SCSI subsystem initialized
[ 0.357161] usbcore: registered new interface driver usbfs
[ 0.357830] usbcore: registered new interface driver hub
[ 0.358518] usbcore: registered new device driver usb
[ 0.362268] Advanced Linux Sound Architecture Driver Initialized.
[ 0.393373] clocksource: Switched to clocksource samsung_clocksource_timer
[ 0.460629] NET: Registered protocol family
[ 0.464553] TCP established hash table entries: (order: , bytes)
[ 0.464669] TCP bind hash table entries: (order: , bytes)
[ 0.464723] TCP: Hash tables configured (established bind )
[ 0.465667] UDP hash table entries: (order: , bytes)
[ 0.465778] UDP-Lite hash table entries: (order: , bytes)
[ 0.466911] NET: Registered protocol family
[ 0.545633] RPC: Registered named UNIX socket transport module.
[ 0.545741] RPC: Registered udp transport module.
[ 0.545757] RPC: Registered tcp transport module.
[ 0.545773] RPC: Registered tcp NFSv4. backchannel transport module.
[ 0.553953] futex hash table entries: (order: -, bytes)
[ 0.562980] workingset: timestamp_bits= max_order= bucket_order=
[ 0.697643] NFS: Registering the id_resolver key type
[ 0.697875] Key type id_resolver registered
[ 0.697912] Key type id_legacy registered
[ 0.697998] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[ 0.698281] jffs2: version 2.2. (NAND) © - Red Hat, Inc.
[ 0.707965] romfs: ROMFS MTD (C) Red Hat, Inc.
[ 0.728928] io scheduler noop registered
[ 0.729037] io scheduler deadline registered
[ 0.731029] io scheduler cfq registered (default)
[ 0.945571] .serial: ttySAC0 at MMIO 0x50000000 (irq = , base_baud = ) is a S3C2440
[ 1.303277] random: fast init done
[ 1.537741] console [ttySAC0] enabled
[ 1.693858] brd: module loaded
[ 1.698712] s3c24xx-nand 4e000000.nand: Tacls=, 10ns Twrph0= 30ns, Twrph1= 10ns
[ 1.701109] s3c24xx-nand 4e000000.nand: NAND ECC disabled
[ 1.706441] nand: device found, Manufacturer ID: 0xec, Chip ID: 0xda
[ 1.712658] nand: Samsung NAND 256MiB ,3V -bit
[ 1.717150] nand: MiB, SLC, erase size: KiB, page size: , OOB size:
[ 1.724707] nand: NAND_ECC_NONE selected by board driver. This is not recommended!
[ 1.732301] Scanning device for bad blocks
[ 1.761552] Bad eraseblock at 0x000002d80000
[ 1.761944] Bad eraseblock at 0x000002e20000
[ 1.774618] Bad eraseblock at 0x0000045c0000
[ 1.810576] Bad eraseblock at 0x00000a160000
[ 1.835265] Bad eraseblock at 0x00000e000000
[ 1.835424] Bad eraseblock at 0x00000e020000
[ 1.851744] Creating MTD partitions on "tq2440-0":
[ 1.851909] 0x000000000000-0x000000100000 : "SPL"
[ 1.860632] ftl_cs: FTL header not found.
[ 1.867840] 0x000000100000-0x000000200000 : "U-BOOT"
[ 1.876060] ftl_cs: FTL header not found.
[ 1.881673] 0x000000200000-0x000000300000 : "PARAMS"
[ 1.887146] ftl_cs: FTL header not found.
[ 1.895758] 0x000000300000-0x000000800000 : "KERNEL"
[ 1.904875] ftl_cs: FTL header not found.
[ 1.910723] 0x000000800000-0x000000900000 : "DTB"
[ 1.916009] ftl_cs: FTL header not found.
[ 1.925445] 0x000000900000-0x000010000000 : "ROOTFS"
[ 1.937184] ftl_cs: FTL header not found.
[ 1.949791] eth0: dm9000e at c4932000,c4934004 IRQ MAC: ::de:ad:be:ef (platform data)
[ 1.953206] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 1.959146] ohci-s3c2410: OHCI S3C2410 driver
[ 1.966554] s3c2410-ohci .usb_ohci: OHCI Host Controller
[ 1.969213] s3c2410-ohci .usb_ohci: new USB bus registered, assigned bus number
[ 1.978389] s3c2410-ohci .usb_ohci: irq , io mem 0x49000000
[ 2.049314] hub -:1.0: USB hub found
[ 2.051489] hub -:1.0: ports detected
[ 2.057806] usbcore: registered new interface driver usb-storage
[ 2.060801] mousedev: PS/ mouse device common for all mice
[ 2.066162] s3c-rtc .rtc: rtc disabled, re-enabling
[ 2.070382] rtc rtc0: alarm rollover not handled
[ 2.073906] rtc rtc0: invalid alarm value: -- ::
[ 2.080535] s3c-rtc .rtc: rtc core: registered s3c as rtc0
[ 2.086568] i2c /dev entries driver
[ 2.093037] s3c2410-wdt .watchdog: watchdog inactive, reset disabled, irq disabled
[ 2.099750] sdhci: Secure Digital Host Controller Interface driver
[ 2.103179] sdhci: Copyright(c) Pierre Ossman
[ 2.110337] hidraw: raw HID events driver (C) Jiri Kosina
[ 2.122224] usbcore: registered new interface driver usbhid
[ 2.122350] usbhid: USB HID core driver
[ 2.131286] NET: Registered protocol family
[ 2.132068] Key type dns_resolver registered
[ 2.197106] s3c-rtc .rtc: setting system clock to -- :: UTC ()
[ 2.201017] ALSA device list:
[ 2.203000] No soundcards found.
[ 8.385039] VFS: Mounted root (jffs2 filesystem) on device :.
[ 8.386953] Freeing unused kernel memory: 204K (c0627000 - c065a000)
[ 8.392017] This architecture does not have kernel memory protection.
[ 11.614549] dm9000 .ethernet eth0: link up, 100Mbps, full-duplex, lpa 0xCDE1 Please press Enter to activate this console.
[root@tq2440 ]#
[root@tq2440 ]# mount
/dev/root on / type jffs2 (rw,relatime)
proc on /proc type proc (rw,relatime)
tmpfs on /tmp type tmpfs (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
tmpfs on /dev type tmpfs (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
devpts on /dev/pts type devpts (rw,relatime,mode=,ptmxmode=)
[root@tq2440 ]# cat /proc/mtd
dev: size erasesize name
mtd0: "SPL"
mtd1: "U-BOOT"
mtd2: "PARAMS"
mtd3: "KERNEL"
mtd4: "DTB"
mtd5: 0f700000 "ROOTFS"
[root@tq2440 ]#
完。

移植Python3到TQ2440(二)的更多相关文章

  1. 移植Python3到TQ2440(一)

    平台 硬件:TQ2440  64MB内存 256MB NandFlash bootloader:U-Boot 2015.04 kernel:linux-4.9 Python: Python-3.6.0 ...

  2. 移植Python2到TQ2440

    环境 Python:2.7.13 开发板: TQ2440 工具链: arm-none-linux-gnueabi-gcc 4.8.3 概述 前面已经把Python3移植到TQ2440上面的,现在我们移 ...

  3. windows使用python3.4生成二维码

    1.首先下载qrcode库 使用pip命令: pip install qrcode python3.x以上的版本默认是安装好pip的,如果出现无法找到pip指令的信息的话,则需要首先安装pip. 2. ...

  4. UCOS2_STM32F1移植详细过程(二)

    Ⅰ.概述 打开上一篇文章新建的工程,是提取的ST标准库里面源代码文件和UCOS工程包源代码文件.下载过的朋友可能会知道,直接编译那个工程会有大片的错误和警告,原因在于那个工程是没有经过修改源代码的工程 ...

  5. python3 基础语法(二)

    一.python3的基本数据类型: 和其他语言一样都包含了以下数据类型: 类型 含义 实例 INT 整型(integer) 1 FLOAT 浮点型 1.1 BOOL 布尔值 TRUE/FALSE ST ...

  6. Python3安装(二)

    因为Python是跨平台的,它可以运行在Windows.Mac和各种Linux/Unix系统上.在Windows上写Python程序,放到Linux上也是能够运行的. 要开始学习Python编程,首先 ...

  7. 【Mac + Appium + Python3.6学习(二)】之Android自动化测试,appium-desktop配置和简易自动化测试脚本

    上一篇文章介绍安装appium测试环境,这一片研究介绍如何测试Android自动化. 上一篇地址:<[Mac + Appium学习(一)]之安装Appium环境> 这一篇参考:<Ma ...

  8. python3编程技巧二——如何在列表、字典、集合 中根据条件筛选数据

    一.列表筛选数据 # coding=utf-8 from random import randint # 创建随机列表 l = [randint(-10, 10) for i in range(10) ...

  9. 从零开始之uboot、移植uboot2017.01(二、从入口分析流程)

    原创: To_run_away 从零开始学linux 本节的开始之前,先看一下uboot的链接脚本. 一.链接脚本 /* * Copyright (c) 2004-2008 Texas Instrum ...

随机推荐

  1. 【干货】Linux内存数据的获取与转存 直捣密码

    知识源:Unit 2: Linux/Unix Acquisition 2.1 Linux/Unix Acquistion Memory Acquisition 中的实验demo部分  小白注意,这是网 ...

  2. shell脚本练习【转】

    1.写一个脚本,判断当前系统上所有用户的shell是否为可登录shell(即用户的shell不是/sbin/nologin):分别这两类用户的个数:通过字符串比较来实现: #脚本内容 [root@ce ...

  3. C/C++杂记:深入理解数据成员指针、函数成员指针

    1. 数据成员指针 对于普通指针变量来说,其值是它所指向的地址,0表示空指针. 而对于数据成员指针变量来说,其值是数据成员所在地址相对于对象起始地址的偏移值,空指针用-1表示.例: 代码示例: str ...

  4. LR开发接口脚本

    char token_id,tenant_id;    web_add_header("Accept","application/json");    web_ ...

  5. (windows下)安装mysql

    一.先从mysql的官网上下载对应版本的mysql zip包(适用于windows下的) 二.解压zip包放到自定义的文件夹下(我放的是e盘,路径为E:\mysql-5.6.40-winx64) 三. ...

  6. PYTHON-range和xrange区别

    range会根据输入,生成一个list. xrange功能类似,但生成的不是一个list,而是一个迭代器,每次调用是返回一个数字.这样比较节省内存.

  7. redis 命令远程批量删除keys

    1.首先在电脑上装上 redis 客户端; https://www.cnblogs.com/feijl/p/6879929.html 2.安装成功后,进入 redis-cli 客户端目录; 连接 re ...

  8. <转> 解决异常:IllegalStateException: Fragment <ThisFragment> is not currently in the FragmentManager

    上午敲代码时出现这个问题,简单记录一下解决办法,有时间详细描述一下深层原因. 问题出现在这: @Override public void onSaveInstanceState(Bundle outS ...

  9. poj 2253 一条路径中的最大边 再找出最小的

    题目大意,有两只青蛙,分别在两个石头上,青蛙A想要到青蛙B那儿去,他可以直接跳到B的石头上,也可以跳到其他石头上,再从其他石头跳到B那儿,求青蛙从A到B的所有路径中最小的Frog Distance,我 ...

  10. 【转】HTML5 API——无刷新更新地址 history.pushState/replaceState 方法

    (window.location)在通过JavaScript更改以后,浏览器都会通过刷新来到达你更改后的URL(location的意思就是位 置..) 而在JavaScript MVC开始流行之后,通 ...