Embedded Linux Development with i.MX6ULL: Environment Setup and Basic Concepts
System Configuration and Fundamental Concepts
Hardware and Virtual Machine Setup
For embedded Linux development, the setup involves a development board, a Windows machine, and a virtual environment.
There are three network adapter modes for virtual machines:
- VMnet1 (Host-Only): Enables communication between VMs and the host, but prevents internet access.
- VMnet8 (NAT): Allows internal communication and provides internet access via the host, but external access to the VM is blocked.
- VMnet0 (Bridged): Treats the VM as a physical device on the network, allowing full access and connectivity.
To connect the development board with the virtual machine, configure the VM in bridged mode and assign both devices the same subnet IP address:
Ubuntu IP: 192.168.5.11
Development Board IP: 192.168.5.9
Both devices must also be connected to the same router via Ethernet cable.
Serial Communication
The development board requires a USB-to-serial converter chip to enable serial communication.
Cross-Compilation Toolchain
A cross-compilation toolchain is essential for building software for the target architecture.
Linux Environment Variables
Environment variables link paths to system resources, simplifying command execution by replacing long paths with varible names.
Core Linux Commends
Common commands for system management include:
df -h: Disk usage overviewtoporps: Process monitoringkill -9: Force process terminationfree: Memory statusecho: Output textwhereis: Locate filestouch,cat: File creation and viewingunzip,tar: Archive handlingchmod: Permission control (read=4, write=2, execute=1)grep: Text search within files
Archiving and Compression
TAR
tar -zcvf test.tar.gz ./test: Compress directory using gziptar -cvf test.tar ./test: Create uncompressed tar archivetar -cjf test.tar.bz2 ./test: Compress with bzip2tar -czf test.tar.Z ./test: Compress with compress
Decompression:
tar -xzvf test.tar.gz: Extract gzip-compressed archivetar -xvf test.tar: Extract standard tar archivetar -vxjf test.tar.bz2: Extract bzip2 archive
ZIP
zip -r mydata.zip mydata: Compress directoryunzip mydata.zip: Extract zip file
GZ
gzip 1.txt: Compress single file (not directories)gzip -d 1.txt.gz: Decompress gz file
GREP
grep "example" demo.txt: Search for pattern in filegrep -r "Hello" /opt/: Recursively search directory
Kernel Compilation Essentials
Key configuration files for kernel compilation:
.config: Generated configuration used during builddefconfig: Default configuration file; used when.configis missing
The path for defconfig files on the system:
/home/xzj/Desktop/linux-imx-rel_imx_4.1.15_2.1.0_ga/arch/arm/configs
Kconfig: Provides options for menuconfig interface
Device Tree and Kernel Image
Device trees (.dts) define hardware details like memory layout and clock configurations. These are compiled into .dtb files.
Kernel images (.bin) contain core OS components and data structures necessary for runtime resource management.
The build process generates an image which is compressed into zImage format.
Development Environment Setup
Installing Cross-Compilation Toolchain
Copy the toolchain to /usr/local/arm/ and update the environment:
sudo vi /etc/profile
export PATH=$PATH:/usr/local/arm/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/bin
Install required libraries:
sudo apt-get install lsb-core lib32stdc++6
Verify installation:
arm-linux-gnueabihf-gcc -v
gcc -v
Remote Access Using VSCode
On the VM:
-
Install SSH server:
sudo apt-get install ssh -
Start SSH service:
sudo service ssh start -
Install network tools:
sudo apt-get install net-tools -
Check IP address:
ifconfig -
In VSCode, install the Remote SSH extension and connect using the VM's IP address.
Ensure the SSH config file includes the username at the end:
Host vm-ip
HostName <IP_ADDRESS>
User <USERNAME>