接着前一篇博文。
在上一篇博文中我们用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. Regular Expression Matching & Wildcard Matching

    Regular Expression Matching Implement regular expression matching with support for '.' and '*'. '.' ...

  2. 关于 VS 2010 和 VS 2013 的警告 LNK4042

    由于我最近调整了一下 Jimi 的文件结构,导致出现了一个 LNK4042 的 warning,我并没有很重视,这个 warning 导致出现了一些错误. 我调试了几个小时,一开始并没有想到是这个 w ...

  3. Windows下安装Python及Eclipse中配置PyDev插件

    最近开始接触Python,鉴于之前安装Java的教训,决定这次边安装Python,边写下历程,供日后反复使用. 在Python官网http://www.python.org/下载Python版本,鉴于 ...

  4. hadoop-2.7.2-HA安装笔记

    配置方案如图   NN DN ZK ZKFC JN RM NM(任务管理器) HMaster Region Server Node1 1 1 1 1 1 Node2 1 1 1 1 1 1 1 Nod ...

  5. LeetCode(24): 两两交换链表中的节点

    Medium! 题目描述: 给定一个链表,两两交换其中相邻的节点,并返回交换后的链表. 示例: 给定 1->2->3->4, 你应该返回 2->1->4->3. 说 ...

  6. mysql添加远程访问权限

    GRANT 权限列表 ON 数据库.表 TO 用户账号 @ 用户ip IDENTIFIED BY 用户密码 授权命令; 权限列表:允许用户执行的操作权限. 包含select,insert,update ...

  7. MongoDB 进阶模式设计

    原文链接:http://www.mongoing.com/mongodb-advanced-pattern-design 12月12日上午,TJ在开源中国的年终盛典会上分享了文档模型设计的进阶技巧,就 ...

  8. 193 Valid Phone Numbers

    Given a text file file.txt that contains list of phone numbers (one per line), write a one liner bas ...

  9. Storm介绍及核心组件和编程模型

    离线计算 离线计算:批量获取数据.批量传输数据.周期性批量计算数据.数据展示 代表技术:Sqoop批量导入数据.HDFS批量存储数据.MapReduce批量计算数据.Hive批量计算数据.azkaba ...

  10. 001 SpringMVC的helloWorld程序

    一:helloworld程序 1.结构目录 2.添加lib包 3.在web.xml中配置DispatchServlet 这个就是主servlet. <?xml version="1.0 ...