接着前一篇博文。
在上一篇博文中我们用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. flask基础之session原理详解(十)

    前言 flask_session是flask框架实现session功能的一个插件,用来替代flask自带的session实现机制,flask默认的session信息保存在cookie中,不够安全和灵活 ...

  2. VMware下centos桥接模式静态ip配置

    声明:本文转载自http://blog.csdn.net/ltr15036900300/article/details/48828207,非原创. 一.配置虚拟机centos网络 备份网络文件 [ro ...

  3. 过滤掉文本中的javascript标签代码

    2014年1月21日 11:51:19 php代码: $content = preg_replace('#<\s*[script].*>#', '', $a);//有些攻击可以在scrip ...

  4. COM和.NET的互操作

    组件对象模型的基本知识         基于构件的软件开发日益流行,这里我吧自己在学校时整理的关于COM的一些东西献给大家,供初学者参考.一.组件(COM),是微软公司为了计算机工业的软件生产更加符合 ...

  5. 前端如何在h5页面调用微信支付?

    在微信服务号开发的时候经常会遇到微信支付的功能实现,通过实际经验自己总结了一下,前端在H5页面调起微信支付有两种办法,一是利用内置对象,二是通过引用微信的js sdk,亲测都能支付成功,从写法上来看用 ...

  6. 《Photoshop智能手机APP界面设计》学习笔记-转

    第一章 APP用户界面基础 1.1 手机UI设计相关基本概念 1.1.1 什么是UI设计 UI(User's Interface)即用户界面,它不仅仅是美化界面,还需要研究用户,让界面变得更友好.简洁 ...

  7. 网站目录下多出的 core 文件

    1.core 文件简介 在一个程序崩溃时,一般会在指定目录下生成一个core文件.core文件仅仅是一个内存映象(同时加上调试信息),主要是用来调试的.也就是说这种文件是程序意外中断时候生成的 deb ...

  8. transition动画

    http://rainleaves.com/demo/transition/transition.html

  9. Codeforces 405E Graph Cutting

    Graph Cutting 不会写.. dfs的过程中把回边丢到它的祖先中去, 回溯的时候两两配对.感觉好神奇啊. #include<bits/stdc++.h> #define LL l ...

  10. spark streaming的容错:防止数据丢失

    官方这么说的 [Since Spark 1.2] Configuring write ahead logs - Since Spark 1.2, we have introduced write ah ...