Ubuntu10.04 build the Scratchbox cross compiling environment
Source: Internet
Author: User
Olive color: Command RED: modify or add content purple: Option 1 Selected, Scratchbox Introduction Small. ThebasicideaofScratchboxis olive color: Command RED: modify or add content purple: selected options
I. Scratchbox introduction Scratchbox is a configuration and compilation environment for building Linux software and entire Linux distributions. the basic idea of Scratchbox is to offer developers an environment that works and looks like the target environment before the target environment is available.
2. Install Scratchbox1. Add the software source lingd @ Ubuntu :~ $ Sudo vi/etc/apt/sources. list/etc/apt/sources. list Add the following content at the end: deb http://scratchbox.org/debian/ stable main
2. Update the software source lingd @ ubuntu :~ $ Sudo apt-get update
3. Install the package lingd @ ubuntu :~ $ Sudo apt-get install scratchbox-core scratchbox-libs scratchbox-devkit-qemulingd @ ubuntu :~ $ Sudo apt-get install scratchbox-devkit-debian scratchbox-devkit-perl scratchbox-toolchain-cs2007q3-glibc2.5-arm7
Note: The following scratchbox-core must be installed: scratchbox environment, common tools and local compilers. scratchbox-libs: Required databases for scratchbox-core, devkits, and toolchains. scratchbox-devkit-qemu: the ARM Instruction Set Simulator of scratchbox. scratchbox provides two Simulation Methods: qemu and sbrsh. to use qemu simulation, you must install the scratchbox-devkit-cputransp package, but now the scratchbox-devkit-cputransp package has been replaced by scratchbox-devkit-qemu. The following are optional scratchbox-devkit-debian: Environment and tools used for Debian package development. scratchbox-devkit-perl: an additional perl module. scratchbox-toolchain-cs2007q3-glibc2.5-arm7: Cross-compilation toolkit, you can also select another cross-compilation toolkit scratchbox-devkit-doctools: Document generation tool. this package is large and I have not installed it.
3. Disable VDSOVDSOs (Virtual Dynamically-linked Shared Objects Virtual dynamic sharing object) are a way to export kernel space routines to user space applications, using standard mechanic for linking and loading (I. e. standard ELF format ).
Disable Ubuntu 10.04's VDSO function lingd @ ubuntu :~ $ Sudo vi/etc/sysctl. conf edit/etc/sysctl. conf and add the following two lines at the end: vm. vdso_enabled = 0vm. mmap_min_addr = 4096
Run lingd @ ubuntu :~ $ Sudo sysctl-pvm. vdso_enabled = 0vm. mmap_min_addr = 4096.
To take effect for a long time, edit/etc/rc. local and add sysctl-p before the last line (exit 0 ).
4. Add scratchbox users 1. Add users to scratchbox lingd @ ubuntu :~ $ Sudo/scratchbox/sbin/sbox_adduser lingd [sudo] password for lingd: Add user lingd to group 'sbox '? [Yes/no] (yes): yes is Adding the user "lingd" to "sbox" group... Adding user lingd to group sbox. Scratchbox user account for user lingd added2. check whether the user lingd is in the sbox group. lingd @ ubuntu :~ $ Groupslingd adm dialout cdrom plugdev lpadmin admin sambashare sbox if the sbox group is not displayed, log out and log on again. Otherwise, lingd @ ubuntu will appear in/scratchbox/login :~ $/Scratchbox/loginbash:/scratchbox/login: insufficient Permissions
5. Configure scratchbox1. enter the scratchbox environment lingd @ ubuntu :~ $/Scratchbox/login or scratchbox
You dont have active target in scratchbox chroot. Please create one by running "sb-menu" before continuing
Welcome to Scratchbox, the cross-compilation toolkit!
Use 'SB-menu 'to change your compilation target. See/scratchbox/doc/for documentation.
[Sbox-NO-TARGET: ~] >
2. Configure the compilation TARGET [sbox-NO-TARGET: ~] > Sb-menu displays the interactive configuration menu. Select create targetSetup Setup a target and create a new target. Create a new target --> input target name: arm select compiler (compiler) cs2007q3-glibc2.5-arm7 cross select devkits (Development auxiliary tool), be sure to select qemu, after selecting devkits based on your needs, select DONE Done selecting as the simulator and qemu-armqemu-arm-sb Emulation Do you wish extract a rootsetting on the target? --> NoDo you wish install files to the target? --> Yes: select the file you want to install by default (or press a space to select the file you want to install) --> OKDo you wish to select the target --> yes, the sb-menu will exit. Reference 4 illustrates the scratchbox configuration process
6. Compile and Test 1. HelloWorld has some sample code in/scratchbox/packages. HelloWorld is one of them. Because you do not have sufficient permissions in/scratchbox/packages, you can only copy hello. c to the user's main directory and then compile [sbox-arm: ~]. > Cp/scratchbox/packages/hello. c hello. c [sbox-arm: ~] > Gcc hello. c-o hello [sbox-arm: ~] > Lshello hello. c test file type: [sbox-arm: ~] > File hellohello: ELF 32-bit LSB executable, ARM, version 1 (SYSV), for GNU/Linux 2.6.14, dynamically linked (uses shared libs ), not stripped: the operating platform of the executable file hello is ARM.
2. Run HelloWorld on the PC (in the scratchbox environment) [sbox-arm: ~] >. The result displayed on/hello world is actually the result of running the program on the qemu simulator. When selecting qemu to configure the simulator in Selected devkits (Auxiliary development tool, be sure to select qemu-arm-XX (I chose qemu-arm-sb); otherwise, run. /hello: [sbox-arm: ~] >./Hello Error-8 while loading./hello
3. Run the HelloWorldhello file on the arm Development Board and download it to the current directory of the Development Board. Run: chmod a + x hello./hello to view the program running result on the Development Board.
7. Explanation of the solution to scratchbox is not properly set up when logging on to Scratchbox: If Scratchbox was installed from Debian or RPM packages, the/etc/init. d/scratchbox-core init script was installed and Scratchbox shoshould start automatically when the system is rebooted. however, if you installed Scratchbox from tarbils then rebooting your machine will clear away all the mounts and binfmt_misc registrations that Scratchb Ox requires to work. to get your Scratchbox working again after reboot, you have to run the following command as root: #/scratchbox/sbin/sbox_ctl start: Install scratchbox as tar, after the pc is restarted, the mounts and binfmt_misc information required by scratchbox to work normally will be cleared. Therefore, before starting scratchbox or/scratchbox/login for the first time, you must run the "/scratchbox/sbin/sbox_ctl start" command lingd @ ubuntu :~ $ ScratchboxERROR: Scratchbox is not properly set up! Lingd @ ubuntu :~ $ Sudo/scratchbox/sbin/sbox_ctl start [sudo] password for lingd: Starting Scratchbox: binfmt_misc, mount. lingd @ ubuntu :~ $ Scratchbox
Welcome to Scratchbox, the cross-compilation toolkit!
Use 'SB-menu 'to change your compilation target. See/scratchbox/doc/for documentation.
[Sbox-arm: ~] >
However, I installed it through the deb package./scratchbox/sbin/sbox_ctl start cannot solve my problem. I guess it is caused by abnormal shutdown of the Virtual Machine Vmware. Reinstall scratchbox: lingd @ ubuntu :~ $ Sudo apt-get -- no-download -- reinstall install scratchbox-core scratchbox-libs scratchbox-devkit-qemuscratchbox again!
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.