Linux and FL2440 the various problems and tricks encountered during use

Source: Internet
Author: User
Tags diff diff patch

Original link: http://www.cnblogs.com/NickQ/p/8900474.html

# # Various problems and tips for using Linux and FL2440
    • Questions about porting the Linux root file system
  1. When porting and using the file system in the minimum kernel, remember to configure and save The U-boot related parameters, which will cause the Linux kernel to not find the file system to die.
    When the file system is JFFS2, the bootcmd and Bootargs parameters are set:

    set bootcmd ‘nand read 30008000 100000 400000; bootm 30008000‘set bootargs ‘console=tty0 console=ttyS0,115200 root=/dev/mtdblock2 rootfstype=jffs2 init=/linuxrc mem=64M rw noinitrd loglevel=7‘save

    Parameter explanation:

    The parameters of the Bootargs are resolved as follows:
    CONSOLE=TTY0 specifies that the kernel control terminal is the LCD, the kernel initiates the information output to the LCD; console=ttys0,115200 specifies that the kernel control terminal is also the first serial port, using a baud rate of 115200, so that the kernel boot information is printed to the first serial port;
    ROOT=/DEV/MTDBLOCK2 specifies that the root file system is stored on the Mtdblock2, which should be consistent with the U-boot burn location, the Linux kernel partition, and the Linux kernel fails to start if the root file system is not found;
    ROOTFSTYPE=JFFS2 specifies that the root file system type is JFFS2, and if the parameter is incorrect, the kernel fails to start;
    INIT=/LINUXRC specifies that the INIT process executes/LINUXRC this program, and he will parse and execute commands under/etc/inittab;
    Mem=64m U-boot tells the Linux kernel to have 64M of memory;
    RW root file system is mounted in read-write format;
    NOINITRD did not use INITRD;
    Loglevel=7 defines the print level of the kernel PRINTK to 7, that is, all information is printed through the console;

    When the file system is UBIFS, the bootcmd and Bootargs parameters are set:

    set bootcmd ‘nand read 30008000 100000 400000; bootm 30008000‘set bootargs ‘console=tty0 console=ttyS0,115200 ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs mem=64M noinitrd rw loglevel=7‘

    Parameter explanation:

    The parameters of the Bootargs are resolved as follows:
    CONSOLE=TTY0 specifies that the kernel control terminal is the LCD, the kernel initiates the information output to the LCD; console=ttys0,115200 specifies that the kernel control terminal is also the first serial port, using a baud rate of 115200, so that the kernel boot information is printed to the first serial port;
    ubi.mtd=2 specifies that the UBI volume is established on MTD2, and that the value should be guaranteed with the U-boot burn location, the Linux kernel partition
    The Linux kernel fails to start because the root file system cannot be found;
    ROOT=UBI0:ROOTFS Specifies the location of the root file system: In the process of making ubifs, when we process the file system image through the Ubinize command, the vol_id in its configuration file is specified as 0,vol_name;
    ROOTFSTYPE=JFFS2 specifies that the root file system type is JFFS2, and if the parameter is incorrect, the kernel fails to start;
    INIT=/LINUXRC specifies that the INIT process executes/LINUXRC this program, and he will parse and execute commands under/etc/inittab;
    Mem=64m U-boot tells the Linux kernel to have 64M of memory;
    RW root file system is mounted in read-write format;
    NOINITRD did not use INITRD;
    Loglevel=7 defines the print level of the kernel PRINTK to 7, that is, all information is printed through the console;

  2. When using make menuconfig, be sure to configure the environment to VT100 mode. (Only virtual machines can be configured and the CRT may not be configured.)
    No will cause some of the input boxes to not be backspace.

    Switch to VT100:[[email protected] linux-3.0]$ export TERM=vt100
    Switch to Linux:[[email protected] linux-3.0]$ export TERM=linux

    • Production and use of patches
    1. Generate Patch diff command

Simply put, the diff function is used to compare the two files, and then record, that is, the so-called diff patch. Syntax format: diff "Options" source file (folder) destination file (folder), is to give the source file (clip) patch, make it into the destination file (folder), the term is "upgrade."

diff -Nrua [fromdir] [todir] > file 制作补丁命令

参数解释:-r 是一个递归选项,设置了这个选项,diff会将两个不同版本源代码目录中的所有对应文件全部都进行一次比较,包括子目录文件。-N 选项确保补丁文件将正确地处理已经创建或删除文件的情况。-u 选项以统一格式创建补丁文件,这种格式比缺省格式更紧凑些。     -a 将所有文件当做文本文件来处理-b 忽略空格造成的不同-B 忽略空行造成的不同-q 只报告什么地方不同,不报告具体的不同信息-H 利用试探法加速对大文件的搜索-i 忽略大小写的变化-l 用pr 对输出进行分页-s 两个文件相同时才报告-v 在标准输出上输出版本信息并退出
    1. Using Patches

      Patch Command

      Simply put, patch is the use of diff-made patches to achieve the source file (clip) and destination file (clip) conversion. This means that you can have the source file (clip) ――> destination file (clip), or the destination file (clip) ――> source file (clip).

      patch -p0 [fromdir] < file.patch 打补丁命令

      Parameter explanation:
      -P0 option to find the destination file (clip) from the current directory
      -P1 option to ignore the first level of the directory, starting from the current directory to find.
      (The-PN option indicates the number of n-tier directories canceled)

      If you use the parameter-p0, it means to find a folder called old from the current directory, and under it look for the pcitable file under modules to perform the patch operation.
      If you use parameter-p1, it means ignoring the first-level directory (that is, old), looking for the Modules folder from the current directory, and looking for pcitable under it. This assumes that the current directory must be the directory where the modules is located. The diff patch file can be anywhere, as long as the path of the diff patch file is indicated. Of course, you can use a relative path, or you can use an absolute path. But I'm generally used to using relative paths.

      The-e option indicates that if an empty file is found, delete it.
      The-r option indicates that the "new" file and the "old" file in the patch file are now switched over (in effect, the new version is patched to make it the old version)

    • Linux Common methods
    1. Transfer files in virtual machines

      Install a software called Lrzsz (SZ/RZ).
      sudo yum install lrzsz
      Using the Sz/rz and secure CRT to pass files to each other

    2. Linux sshd boot from

      Chkconfig command

Adding sshd to the system service
chkconfig sshd on

You can view the operating level status of Sshd:
[[email protected] ~]# chkconfig --list sshd sshd 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭

Chkconfig View the Startup items using the command:
chkconfig --list

Chkconfig Close the Startup Key command:
chkconfig autostart.shoff

Chkconfig Delete the startup Item command:
chkconfig --del autostart.sh

    1. environment variable interpretation of environment variables: (Reference link: 76757934)
    2. /etc/environment–> is the first file that the system reads at logon to set environment variables for all processes. Instead of executing the commands in this file when using this file, the system assigns the key to value according to the code of the Key=value mode, so if you want to define the PATH environment variable in the file, simply add a line like path= $PATH:/xxx/bin code. (This file is configured for path only, and it does not execute the commands in this file as stated above.) The above is also read the word, I do not understand the simple assignment but do not perform, but generally do not operate the file).

    3. /etc/profile–> is the second file that is executed when the system logs on, and can be used to set environment variables for all users of the system. (Note that it is global, but because of its execution, it is easy to be overwritten by the following configuration files, the most typical is that we add ARM-LINUX-GCC path to path, will be overwritten by later ~/.profile).

    4. ~/.profile–> is the profile file that corresponds to the currently logged-on user and is used to customize the current user's personal work environment. (Individual user and root user) (but only if ~/.bash_profile and ~/.bash_login do not exist, the ~/.profile will be read, but the two files are not normally present).

    5. ~/.bashrc–> is the bash initialization file that corresponds to the currently logged-on user, which is executed once each time the user opens the shell.

    • ##### PS1: Set the shell prompt
      export PS1=‘[\[email protected]\A \w]\$ ‘
      can refer to: 50455361

    • ##### PATH: Determines which directories the shell will look for in order to find commands or programs
      export PATH=$PATH:./

    1. Modify the time zone and synchronize with Internet timevi /etc/sysconfig/clock
      ```
      Zone= "Asia/shanghai"
      Utc=false
      Arc=false

' Date setting: Date-s 2018/04/13 time setting: Date-s 16:04:00 '

```
To view hardware time (BIOS): Hwclock command

Parameter explanation:
-R: View the existing BIOS time, default to-R parameter.
-W: Writes the current Linux system time to the BIOS.

' sync BIOS clock, force system time to write Cmos:clock-w '

Synchronize with Internet time
```
Vi/etc/rc.d/rc.local
/usr/sbin/ntpdate-u 192.168.0.2 192.168.0.3 192.168.0.4;
/sbin/hwclock-w

```

    • FL2440 Burning
    1. Burn process Commands
      //用 J_link 烧录bootstraphspeed 12000loadbin D:\Linux_share\bootstrap-s3c2440.bin 0setpc 0g//用 J_link 烧录u-boothloadbin D:\Linux_share\u-boot-s3c2440.bin 0x33f80000setpc 0x33f80000g//擦除整块Flash并设置IPnand scrubyset ipaddr 192.168.110.2;set serverip 192.168.110.1;save//下载烧录U-boottftp 30008000 u-boot-s3c2440.bin;nand erase 0 100000;nand write 30008000 0 60000//下载烧录linuxromtftp 30008000 linuxrom-s3c2440.bin;nand erase 100000 1000000;nand write 30008000 100000 F00000//下载烧录rootfs-ubifstftp 30800000 rootfs-ubifs.bin;nand erase 1000000 4000000;nand write 30800000 1000000 3000000

Linux and FL2440 the various problems and tricks encountered during use

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.