Ubuntu16.04配置根文件系统

交叉编译器:gcc-linaro4.9.4
编译器路径:/usr/local/arm/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/bin
nfs挂载路径:/home/arjun/linux/nfs/ubunturootfs
客户端地址:192.168.8.60
服务器地址:192.168.8.57
硬件主芯片:imx6ull    存储:EMMC
 

 

下载index/ubuntu-base/releases-16.04.5

ubuntu-base-16.04.5-base-armhf.tar.gz

解压


 tar -xzxf ubuntu-base-16.04.5-base-armhf.tar.gz 


安装qemu工具


 apt-get install  qemu-user-static


拷贝qemu-user-static


cp /usr/bin/qemu-arm-static  ./usr/bin/

 

设置软件源 拷贝主机DSN配置文件


 cp /etc/resolv.conf  ./etc/resolv.conf 


添加软件源   位置/home/arjun/linux/nfs/ubuntu_rootfs/etc/apt
vim sources.list

deb http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial main multiverse restricted universe
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-backports main multiverse restricted universe
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-proposed main multiverse restricted universe
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-security main multiverse restricted universe
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-updates main multiverse restricted universe
deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial main multiverse restricted universe
deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-backports main multiverse restricted universe
deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-proposed main multiverse restricted universe
deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-security main multiverse restricted universe
deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-updates main multiverse restricted universe

主机挂载根文件系统


mount.sh

  #!/bin/bash
  echo "MOUNTING"
  mount -t proc /proc /home/arjun/linux/nfs/ubuntu_rootfs/proc
  mount -t sysfs /sys /home/arjun/linux/nfs/ubuntu_rootfs/sys
  mount -o bind /dev /home/arjun/linux/nfs/ubuntu_rootfs/dev
  mount -o bind /dev/pts /home/arjun/linux/nfs/ubuntu_rootfs/dev/pts
  chroot /home/arjun/linux/nfs/ubuntu_rootfs

umount.sh


 #!/bin/bash
 echo "UNMOUNTING"
 umount  /home/arjun/linux/nfs/ubunturootfs/proc
 umount  /home/arjun/linux/nfs/ubunturootfs/sys
 umount  /home/arjun/linux/nfs/ubunturootfs/dev
 umount  /dev/pts /home/arjun/linux/nfs/ubuntu_rootfs/dev/pts
 

挂载
./mount.sh


apt update   
apt install vim
apt install kmod
apt install net-tools
apt install ethtool
apt install ifupdown
apt install language-pack-en-base
apt install rsyslog
apt install htop
apt install iputils-ping

 

设置本机名称和IP地址


echo "arjun_imx6ull">/etc/hostname
echo "127.0.0.1 loaclhost">>/etc/hosts
echo "127.0.0.1 arjun_imx6ull">>/etc/hosts

 

启动uboot修改bootargs参数

bootargs=console=tty1 console=ttymxc0,115200 root=/dev/nfs rw nfsroot=192.168.8.57:/home/arjun/linux/nfs/ubuntu_rootfs  ip=192.168.8.60:192.168.8.57:192.168.8.1:255.255.255.0::eth0:off


  
   

ubuntu 挂载 出现错误


Starting /etc/rc.local Compatibility...
[  OK  ] Started /etc/rc.local Compatibility.
[  OK  ] Started Getty on tty4.
[  OK  ] Started Getty on tty5.
[  OK  ] Started Getty on tty2.
[  OK  ] Started Getty on tty0.
[  OK  ] Started Getty on tty1.
[  OK  ] Started Getty on tty3.
[  OK  ] Started Getty on tty6.
[ TIME ] Timed out waiting for device dev-ttymxc0.device.
[DEPEND] Dependency failed for Serial Getty on ttymxc0.
[  OK  ] Reached target Login Prompts.
[  OK  ] Reached target Multi-User System.
[  OK  ] Reached target Graphical Interface.
         Starting Update UTMP about System Runlevel Changes...
[  OK  ] Started Update UTMP about System Runlevel Changes.

显示ttymxc0有问题


添加文件/etc/init/ttymxc0.config


start on stopped rc RUNLEVEL=[2345] and container CONTAINER=lxc
stop on runlevel[!2345]
respawn
exec /sbin/getty -L 115200 ttymxc0 vt100


再执行                

ln -s /lib/systemd/system/[email protected] /etc/systemd/system/getty.target.wants/[email protected]

 

重启开发板

你可能感兴趣的:(linux)