Ltib Common Commands 1

Source: Internet
Author: User

And then write a little bit of Ltib's common command parameters, although it feels that the compiler kernel and file system process has a certain understanding, but to its command parameters used is not much, can be said to be not very understanding, some of the following, I hope that useful:


first, a more useful command parameter is help, a person forget the command parameters are very common, not to mention the first familiar with the tool. The following command line can be used to view the Help for the LTIB command:
$./ltib--help # # This equates to./ltib-h
when compiling the kernel and filesystem, we sometimes forget which packages we chose to compile, and we can use the following command to see all the available packages in the current installation mode, and whether they are selected for compilation into the project:
$./ltib-m listpkgs # # This command is displayed according to the configuration of the Ltib
To view the selected compiled packages in the configuration, such as kernel version packages, System kits:
$./ltib-m listpkgs | grep ' y '
If you want to see the information generated by the compilation process and save it for later viewing, you can use the following command
$./ltib--preconfig config/platform/mpc8349itx/defconfig-min-fs-our-final--batch 2>&1 | Tee Ltib_log.txt
# # Save the information generated by the compilation process and error messages are saved to the Ltib_log.txt file
LTIB provides a shell pattern that directly provides the cross-compilation toolchain pattern We currently configure, and the following command allows us to enter the LTIB shell environment
$./ltib-m Shell # # After completion will be prompted to enter the shell mode prompt ' ltib> '
# # Enter Exit to exit Shell mode
# # The following command can see what this is for, I give the command directly, it is the result of this command, no longer explain
ltib> GCC--version
POWERPC-LINUX-UCLIBC-GCC (GCC) 3.4.3
Copyright (C) 2004 Free Software Foundation, Inc.
This was free software; See the source for copying conditions. There is NO
Warranty Not even to merchantability or FITNESS for A particular PURPOSE.
Ltib>
Sometimes we want to look at some of the package of source code, such as kernel, uboot and so on these see the beneficial health of the program source code, how to do? Another situation is that the source of the various configuration files, such as memory map allocation, also need to look at the source file, its command format is $./ltib-m prep-p <program_package_name>
# # Below this Part I was operating under the large folder, and the path is written relative to/usr/local/mpc8349/large/, not the MyTest folder
# # For example we want to see the MPC8349ITX Development Board vsc7385 memory allocation, or find VSC7385 driver module section, need to see Uboot, kernel source code, the following command to get the kernel source code
$./ltib-m Prep-p Kernel
# # After decompression of the kernel source is located in rpm/build/linux-2.6.13/
# # One of the vsc7485 drivers is rpm/build/linux-2.6.13/drivers/net/gianfar_phy.c
# # The following operation must be done under the original large folder, why do you do this? Think for yourself. The following command can get Uboot source code
$./ltib-m prep-p U-boot
# # extracted after the Uboot source is located in rpm/build/u-boot-1.1.3
# # One of the important files about MPC8349MITX board configuration information is/include/configs/mpc8349itx.h
# # In this file above you can see the VSC7385 memory allocation base address information (#define CFG_VSC7385_BASE 0xf8000000)
# # No Uboot command, you can see the source code to help understand.
Note: Above this command operation I chose in the/usr/local/mpc8349/large folder, is because to get some program source code, first it has to compile.
The above describes a Ltib compile kernel and file system more useful way, when you are more familiar with the Ltib workflow, you can fully configure the cross-compilation tool chain, kernel and file system, and then compile, you can use the following command line
$./ltib--configure
There are three ways to regenerate all of the kernel and RFS images:
# # Method One: Directly call the configuration file compilation, if the configuration file is not updated, and the compiled target image does not change, will not be compiled. If there are any changes, the compilation will be performed
$./ltib--preconfig config/platform/mpc8349itx/defconfig-min-fs-our-final--batch
# # Method Two: Same as method one, but forced recompilation
$./ltib--preconfig config/platform/mpc8349itx/defconfig-min-fs-our-final--batch-f
# # Method Three: Clear all compiled packages and reconfigure the build image
$./ltib-m Distclean # # Clear Ltib project files
$./ltib--configure # # re-configure compilation
If we are not satisfied with the Ltib configuration file, want to be familiar with the configuration of Ltib configuration, or the related work done, or even look at it is not pleasing to the eye, can take this operation, the Ltib completely uninstalled,
# # First executes the command:
$./ltib-m Distclean # # This operation will completely erase all current LTIB project files
# # This command is not easy to use unless you are more familiar with the LTIB compilation configuration process
# # Then do the following as root (note: This operation will uninstall all public files)
# rm-rf/opt/freescale/pkgs
# Rm-rf/opt/freescale/ltib
# RM <install_path> # # Execute the parent directory of the file Ltib
# # Another more violent approach is to run the RM command as root to remove all
Next write the external kernel module compilation, if we have a folder test (located under the main directory/home/liuby/), the folder contains the program source code files test.c and makefile, the contents of these two files are appended to the end of this paragraph.
# # First we get the kernel source code, and then compile, why do so, I do not understand ~ ~ ~, some wonder, and then solve
$./ltib-m Prep-p Kernel
$./ltib-m scbuild-p Kernel # # Compiled image is Rpm/build/linux/arch/ppc/boot/images/uimage
# # Copy the Test folder to the kernel's driver folder
$ cp-a ~/test rpm/build/linux/drivers/
# # VI Modify the makefile under the driver folder
$ VI Rpm/build/linux/drivers/makefile
# # can be modeled after the contents of the Makefile Add the following line at the end
Ojb-m + = test/# # then save exit
# # Modify the test.c and makefile under the test folder to make sure it is correct.
# # The following command goes into the shell environment of Ltib, then goes to the test directory and compiles
$./ltib-m Shell
Ltib> CD rpm/build/linux/drivers/test/
Ltib> make V=1 ARCH=PPC
# # # Rpm/build/linux/drivers/test/test.ko is what we want module, download to the board with Insmod Test.ko to execute the module (rmmod Test.ko is unloading module)
++++++++++++++++ below for test.c program content ++++++++++++++++++
#include <linux/init.h>
#include <linux/module.h>
#include <asm/mpc83xx.h>
Module_license ("Dual BSD/GPL");
static int hello_init (void)
{
PRINTK (Kern_alert "Hello, world\n");
PRINTK (Kern_alert "IMMR virtual Address:%x\n", Virt_immrbar);
PRINTK (Kern_alert "Immrbar:%08lx\n", * (unsigned long*) (Virt_immrbar + 0x00000));
PRINTK (Kern_alert "SPRIDR:%08lx\n", * (unsigned long*) (Virt_immrbar + 0x00108));
return 0;
}
static void Hello_exit (void)
{
PRINTK (Kern_alert "Goodbye, cruel world\n");
}
Module_init (Hello_init);
Module_exit (Hello_exit);
++++++++++++++++ above for test.c program content ++++++++++++++++++
+++++++++++++++ below for Makefile program content +++++++++++++++++
Ifneq ($ (kernelrelease),)
Obj-m: = TEST.O
Else
Kdir: =. /..
PWD: = $ (shell pwd)
Default
$ (make)-C $ (Kdir) m=$ (PWD)
endif
+++++++++++++++ above for Makefile program content +++++++++++++++++
# # Similarly we can compile the VLAN configuration module

Ltib Common Commands 1

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.