Build a basic embedded Linux root file system

Source: Internet
Author: User
Tags openssl parent directory

Configuring TFTP
Steps to configure the TFTP service:
1. Install related software package: TFTPD (server side), TFTP (client), xinetd sudo apt-get install tftpd tftp xinetd
2. Setting up the configuration file
Create a configuration file under/etc/xinetd.d/tftp sudo vi tftp
Enter the following in the file:
Service TFTP
{
Socket_type = Dgram
protocol = UDP
Wait = yes
user = root
Server =/USR/SBIN/IN.TFTPD
Server_args =-s/tftpboot
Disable = no
Per_source = 11
CPS = 100 2
Flags = IPV4
}
Save exit
3. Set up TFTP service file directory (upload file and download file location), and change its permissions
sudo mkdir/tftpboot
sudo chmod 777/tftpboot-r
4. Restart the service
sudo/etc/init.d/xinetd restart
Now that the TFTP service has been installed, you can test it below. (Suppose there is a test file in the current directory test.txt)
$tftp 127.0.0.1
Tftp> put Test.txt
Sent 1018 bytes in 0.0 seconds
Tftp> Get Test.txt
Received 1018 bytes in 0.1 seconds
Tftp> quit
$

With the put command, the Test.txt file in the current directory can be uploaded to its service file directory via TFTP. At this point, the Test.txt file appears below the/tftpboot. With the Get command, you can download the Test.txt file from/tftpboot. This verifies the correctness of the TFTP service configuration. When the file is uploaded and downloaded, it can be exited by the QUIT command.

It is generally successful to configure the TFTP service in strict accordance with the above steps. If no get or put is present, check to see if the firewall is off.

Installing the Configure Server for NFS

The steps to install and configure NFS services under Ubuntu are as follows:
1. Install NFS
There is no NFS server installed by default on Ubuntu, so we first install the NFS server side:
$sudo Apt-get Install Nfs-kernel-server
In some documents, it is also necessary to use Apt-get to manually install client Nfs-common for NFS, as well as Port mapper Portmap, but this is unnecessary because apt will automatically install them for us when installing Nfs-kernel-server.

2, Configuration/etc/exports
NFS allows mount directories and permissions to be defined in file/etc/exports. For example, we want to share the Rootfs directory under the root directory, then we need to add the following line at the end of the/etc/exports file:/rootfs (Rw,sync,no_root_squash)
Where:/rootfs is the directory to be shared, * represents allow all network segment access, RW is read and write permissions, sync is data synchronization to write memory and hard disk, No_root_squash is the NFS client share directory user permissions, if the client is using root users, The client has root privileges for that shared directory.
Other common parameters for NFS are:
RO read-only access
RW read-Write access sync all data is written to share on request
Async NFS can respond to requests before writing data
Secure NFS is sent over a secured TCP/IP port below 1024
Insecure NFS is sent over 1024 ports
Wdelay If multiple users are writing to the NFS directory, the group is written to (default)
No_wdelay if more than one user wants to write to the NFS directory, it is written immediately and does not require this setting when using Async.
Hide does not share its subdirectories in the NFS shared directory
No_hide subdirectories for shared NFS directories
Subtree_check if you share a subdirectory such as/usr/bin, Force NFS to check the permissions of the parent directory (default)
No_subtree_check and above, do not check parent directory permissions
All_squash shared file UID and GID mapping anonymous user anonymous, suitable for common directories.
No_all_squash preserve the UID and GID of shared files (default)
Root_squash all requests from the root user are mapped to the same permissions as the anonymous user (default)
No_root_squas Root user has full administrative access to the root directory
Anonuid=xxx specifying the UID of an anonymous user in an NFS server/etc/passwd file
Anongid=xxx specify GID for anonymous users in NFS server/etc/passwd files

3. Restart Service
$sudo/etc/init.d/portmap Restart
$sudo/etc/init.d/nfs-kernel-server Restart

4. Test NFS
You can now run the following command to display the shared directory:
$showmount-E
Alternatively, you can use the following command to mount it on a local disk, for example, to mount the/rootfs under/mnt:
$ sudo mount-t NFS localhost:/rootfs/mnt
You can run the DF command to see if the mount succeeds. After viewing, you can uninstall using the following command:
$ sudo umount/mnt


QT4 porting to s3c2410 platform
1. Development platform: Ubuntu 8.10, Cross compiler version 3.4.5 (ARM-LINUX-GCC), qt-embedded-linux-
Opensource-src-4.4.3.tar.gz.
2. Target platform: s3c2410,320*240 touch screen, linux-2.6.26.5,u-boot-1.3.4
3. The migration steps are as follows:
(1) First configure the Linux kernel, support LCD driver, then light up your screen, and support framebuffer, the specific kernel configuration is as follows:
Device Drivers---> Graphics support---> Support for Frame
Buffer Devices--->
s3c2410 LCD
Framebuffer support
Of course there are some details involved.
(2) If you want to support a USB mouse and USB keyboard, simply configure the kernel to:
Device Drivers---> HID Devices---> USB Human Interface
Device (full HID) support
(3) Compile the kernel for testing.
(4) The following work on the basis of the beginning of the transplant QT4. First download the source code:
Put in a directory of your ordinary users, such as/home/xxx/qt4_port, unzip.
(5) Enter the extracted directory.
(6) Then is the key configuration, QT4 is configured to support a certain feature, such as OpenSSL and so on. Then according to your own needs of the corresponding configuration can be, here refer to the site of an article, as follows:
./configure \
-prefix/home/yoyoili/qt4_port/qt/build \
Specifies the directory that is installed, consistent with the directory running on the Development Board
-release-shared \
-fast \
-PCH \
-no-qt3support \
-qt-sql-sqlite \
-NO-LIBTIFF-NO-LIBMNG \
-qt-libjpeg \
-qt-zlib \
-qt-libpng \
-qt-freetype \
-NO-OPENSSL \
-nomake Examples-nomake Demos-nomake Tools\
-optimized-qmake \
-no-phonon \
-no-nis \
-NO-OPENGL \
-no-cups \
-no-xcursor-no-xfixes-no-xrandr-no-xrender-no-xkb-no-sm\
-no-xinerama-no-xshape \
-no-separate-debug-info \
-xplatform qws/linux-arm-g++ \
-embedded arm \
-depths 16 \
-NO-QVFB \
-QT-GFX-LINUXFB \
-no-gfx-qvfb-no-kbd-qvfb-no-mouse-qvfb\
-QT-KBD-USB \
-confirm-license \
-no-armfpa
There is no way to implement a touch screen calibration, if the touchscreen is supported, plus one:
Qt-mouse-tslib.
If this process involves a lot of problems, generally your system is missing some library problems, my Ubuntu 8.10 corresponding libraries are installed relatively complete, no errors, if you are Fedroa, only need to fully install.
(7) then makes && make install, compile and install, if good, will be in your installation directory, that is,/home/xxx/qt4_port/qt/build has the corresponding directory: bin include Lib Mk Specs Plugins Translations, we can look inside the content. Here we are concerned about a lib, is the library file, after the cross-compiled program on the board after running up all need these libraries. Cp/home/xxx/qt4_port/qt/build/lib/libqt* the required library to/home/xxx/w/rootfs/home/qt/build/lib, and of course some libraries you don't need to copy. Note: Here/home/xxx/w/rootfs is the target NFS mount point
(8) then copy the Wen Quan Shu, which shows the Chinese, for example: cp/home/xxx/qt4_port/qt/build/lib/fonts/wenquanyi_160_75.qpf/home/xxx/w/rootfs/home/qt/ Build/fonts (the previous path is to compile and install the future directory, this font is the directory of lib/fonts below, of course, we are the development of the board root file system directory)
(9) Testing, we use the source code to carry out the program to test, such as in the source of example there are many, just qmake && make on it, and then copy the executable file on the development Board with the root file system.
(10) Set the corresponding environment variables, this environment variable is used for the Development Board, not to your PC! Specific as follows:
Export Qtdir=/home/qt/build
Export ld_library_path= $QTDIR/lib: $LD _library_path//(otherwise the library could not be found)
Export path= $QTDIR/bin: $PATH
Export qt_qws_fontdir=/home/qt/build/fonts//(otherwise the font cannot be displayed)
Of course if you have a touch screen with the relevant settings, you also need to add here!
(11) To run our program:
./TEST-QWS-FN/HOME/QT/BUILD/FONTS/WENQUANYI_160_75.QPF
Then you have a display on the screen.
(12) You can then plug in your USB mouse on the development Board to operate the little QT program.
(13) If you want to play the keyboard:
Set your CONSOLE=TTY0 can operate your development board, you can play the command, then the parameters of this console is specified in two ways, one can be passed through u-boot, here such as: Setenv Bootargs Root=/dev/nfs Nfsroot=192.168.1.110:/home/yoyoili/source/rootfs ip=192.168.1.120 INIT=/LINUXRC Console=tty0,
The other is through the kernel, you only need to configure the kernel either: the following:
Boot Options---> (root=/dev/nfs nfsroot=192.168.1.2:/home/yoyoili/source/rootfs ip=192.168.1.3 init=/linuxrc Cons OLE=TTY0)!
(14) Here are some of the problems that may arise:
1. When compiling your QT program there will be a collect error, should be connected to the QT4 library is not the arm cross-compiler tool compiled, the two connections are conflicting. Remove the connection to the Qt4 library in the File.pro and add a line of config-= qt to remove it.
2. If this problem occurs:/lib/libqtcore.so:undefined reference to ' Clock_gettim solution is to add a lfags after-LRT in makefile.
3. Some people use the cross compiler is used ARM-SOFTFLOAT-LINUX-GNU-GCC, so in make compile always hint ARM-LINUX-GCC can't find, solve this problem many ways, one way is to re-create your cross compiler, Modify the Arm-softfloat.dat (as if it is this) to change the inside target to Arm-linux, another way is to modify the QT4 source mkspecs/qws/linux-arm-g++ Modify the Qmake.config directory to change the ARM-LINUX-GCC to ARM-SOFTFLOAT-LINUX-GCC, and then make the line.
4. Of course you can use a lot of tools to compile your program, such as Qtcreator,kdevelop

More wonderful Linux video tutorials at 51CTO Academy: http://edu.51cto.com/course/courseList/id-48.html

Build a basic embedded Linux root file system

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.