Jump to content
Electronics-Lab.com Community

Building and Configuring Debian File System on iMX6ULL Platform


Forlinx

Recommended Posts

Note: Operate under the root user by default.

1. Qemu and Debootstrap Installation

Since a Debian file system is built on Ubuntu, these two tools can be installed directly using the apt-get command. The commands are as follows:

sudo apt-get install binfmt-support qemu qemu-user-static debootstrap

2. Extracting Debian File System

Use the debootstrap command to extract the file system. Execute the following command to retrieve the file system from the Debian mirror:

mkdir /home/forlinx/debian
sudo debootstrap --arch=armhf --foreign buster root https://mirrors.tuna.tsinghua.edu.cn/debian/

Explanation of command parameters:

arch:Specify CPU architecture

buster:Debian version (currently 10)

foreign:Use when initializing unpacking in a different architecture than the host

root:The folder where the file system is stored

https: // mirrors.tuna.tsinghua.edu.cn / debian /:Download source

Extraction may take around 10 minutes. Please be patient. Successful extraction reveals the Linux directory tree. If extraction fails, try multiple attempts or switch networks.

3. Perfecting the File System

Since the operation is conducted on an X86 virtual machine, QEMU needs to be used to simulate an ARM environment to improve the file system.

a.To copy qemu-arm-static into the newly built base system, use the following command:

cd root
sudo cp /usr/bin/qemu-arm-static usr/bin
cd ..

b.Initialize the file system.

Execute the following command:

sudo DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true LC_ALL=C
LANGUAGE=C 
LANG=C chroot root debootstrap/debootstrap --second-stage

c.Use the chroot root command to initialize file system

chroot root

d.Use the command to create the following

echo "proc /proc proc defaults 0 0" >> etc/fstab
mkdir -p usr/share/man/man1/
mknod dev/console c 5 1

e.To update the download sources, use the command vi /etc/apt/sources.list to open the source.list file and replace the contents with the following:

deb http://mirrors.ustc.edu.cn/debian stable main contrib non-free
#deb-src http://mirrors.ustc.edu.cn/debian stable main contrib non-free
deb http://mirrors.ustc.edu.cn/debian stable-updates main contrib non-free
#deb-src http://mirrors.ustc.edu.cn/debian stable-updates main contrib non-free
#deb http://mirrors.ustc.edu.cn/debian stable-proposed-updates main contrib non-free
#deb-src http://mirrors.ustc.edu.cn/debian stable-proposed-updates main contrib non-free

Then save and exit. Use the command apt-get update to update the source. If updating the download source reports an error,use the date command to modify the system time to solve the problem.

f.Use the command apt-get install vim to install some necessary software

apt-get install vim
apt-get install sudo
apt-get install dpkg
apt-get install bzip2
apt-get install net-tools
apt-get install ntpdate

g.Create a new user with the command adduser forlinx, then enter the password

adduser forlinx

h.Set the root password, use the command passwd root, and set the password to forlinx.

passwd root

i.To set up Ethernet, enter the following command:

vi /etc/network/interfaces

As follows:

#/etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
#The loopback interface
auto lo
iface lo inet loopback
#Wireless interfaces
iface wlan0 inet dhcp
wireless_mode managed
wireless_essid any
wpa-driver wext
wpa-conf /etc/wpa_supplicant.conf
iface atml0 inet dhcp
#Wired or wireless interfaces
auto eth0
#iface eth0 inet dhcp
#iface eth1 inet dhcp
iface eth0 inet static
address 192.168.0.232
netmask 255.255.255.0
gateway 192.168.0.1
broadcast 192.168.0.255
auto eth1
iface eth1 inet static
address 192.168.1.232
netmask 255.255.255.0
gateway 192.168.1.1
broadcast 192.168.1.255
#Ethernet/RNDIS gadget (g_ether)
#... or on host side, usbnet and random hwaddr
iface usb0 inet static
address 192.168.7.2
netmask 255.255.255.0
network 192.168.7.0
gateway 192.168.7.1
#Bluetooth networking
iface bnep0 inet dhcp

Add a network reboot

cd etc/rc5.d/
vi /etc/rc5.d/S02net_restart.sh

As follows:

#!/bin/bash
echo "network restarting!"
/etc/init.d/networking restart
echo "network restart complete!"

j.Modify host name

vi /etc/hostname

Modify to: Debian

k.Modify the system time zone

cp /usr/share/zoneinfo/Hongkong /etc/localtime
ntpdate ntp.aliyun.com

Take East Zone 8 as an example, other time zone files are also included under this path.

l.Since 6ull is weak, skip installing the desktop and go straight to using the exit

m.Just exit the qemu environment

exit

4. Package the file system

Go to the debian filesystem directory and use the command tar - cjf rootfs.tar.bz2. / * to package it.

5. Burn-in verification

Place the packaged file system into the burner, while keeping the other images as they are and only replacing the file system. Then proceed with the burn-in test.

6. Debian command

a.Check Debian version

cat /etc/issue

b.Install wget

apt-get install wget

Solve ERROR: The certificate of ‘packages.microsoft.com’ is not trusted. Report error,then add -- no - check - certificate after the command.

Appendix: Installation Method for .net on Linux

1. Download the .net compressed package from the official website

https://dotnet.microsoft.com/en-us/download/dotnet/6.0

2. Enter the /home/root directory

cd /home/root

3. Install script settings

vi install.sh

The script is as follows:

#!/bin/sh
DOTNET_FILE=dotnet-sdk-6.0.402-linux-arm.tar.gz
export DOTNET_ROOT=$(pwd)/.dotnet
mkdir -p "$DOTNET_ROOT" && tar zxf "$DOTNET_FILE" -C "$DOTNET_ROOT"
export PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools

DOTNET_FILE is the name of the downloaded zip file.

4. Execute the installation

chmod u+x install.sh
./install.sh

5. Modify environment variables

vi /etc/profile

As follows:

export DOTNET_ROOT=$HOME/.dotnet
export PATH=$PATH:$HOME/.dotnet:$HOME/.dotnet/tools

6. Test

Enter the following command:

dotnet new console -o sample1
cd sample1
dotnet run

The following output should be seen:

Hello World!
Link to comment
Share on other sites


Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
  • Create New...