• 009-BSP学习笔记-在开发板上移植UBUNTU


    一、下载ubuntu-base(ubuntu-rootfs)

    http://cdimage.ubuntu.com/ubuntu-base/releases/
    在PC上解压

    cd /home/zuozhongkai/linux/nfs //进入到 nfs 目录下
    mkdir ubuntu_rootfs //创建名为“ubuntu_rootfs”目录
    sudo tar -vzxf ubuntu-base-16.04.5-base-armhf.tar.gz
    
    • 1
    • 2
    • 3

    二、ubuntu文件系统配置

    1、安装qemu

    PC下载安装qemu并拷贝到ubuntu-base

    sudo apt-get install qemu-user-static
    cd /home/zuozhongkai/linux/nfs/ubuntu_rootfs //进入到 ubuntu_rootfs 目录下
    sudo cp /usr/bin/qemu-arm-static ./usr/bin/ //拷贝 qemu-arm-static
    
    • 1
    • 2
    • 3
    2、设置软件源

    将 Ubuntu 主机下的 DNS 配置文件/etc/resolv.conf 拷贝到根文件系统中,命令如下:

    cd /home/zuozhongkai/linux/nfs/ubuntu_rootfs //进入到 ubuntu_rootfs 目录下
    sudo cp /etc/resolv.conf ./etc/resolv.conf //拷贝 resolv.conf
    
    • 1
    • 2

    打开根文件系统中的 ubuntu_rootfs/etc/apt/sources.list 文件,在此文件最后面添加软件源

    3、在主机(PC)挂载并配置根文件系统(注意该节均在主机PC下运行)

    mount.sh

    1 #!/bin/bash
    2 echo "MOUNTING"
    3 sudo mount -t proc /proc
    	/home/zuozhongkai/linux/nfs/ubuntu_rootfs/proc
    4 sudo mount -t sysfs /sys
    	/home/zuozhongkai/linux/nfs/ubuntu_rootfs/sys
    5 sudo mount -o bind /dev /home/zuozhongkai/linux/nfs/ubuntu_rootfs/dev
    6 sudo mount -o bind /dev/pts
    	/home/zuozhongkai/linux/nfs/ubuntu_rootfs/dev/pts
    7 sudo chroot /home/zuozhongkai/linux/nfs/ubuntu_rootfs
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10

    unmount.sh

    1 #!/bin/bash
    2 echo "UNMOUNTING"
    3 sudo umount /home/zuozhongkai/linux/nfs/ubuntu_rootfs/proc
    4 sudo umount /home/zuozhongkai/linux/nfs/ubuntu_rootfs/sys
    5 sudo umount /home/zuozhongkai/linux/nfs/ubuntu_rootfs/dev/pts
    6 sudo umount /home/zuozhongkai/linux/nfs/ubuntu_rootfs/dev
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    常用命令、软件安装

    apt update
    apt install sudo
    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
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11

    设置基本参数和环境

    passwd root
    echo "alientek_imx6ul" > /etc/hostname
    echo "127.0.0.1 localhost" >> /etc/hosts
    echo "127.0.0.1 alientek_imx6ul" >> /etc/hosts
    ln -s /lib/systemd/system/getty@.service/etc/systemd/system/getty.target.wants/getty@ttymxc0.service
    //ALPHA开发板使用的UART1对应的串口设备文件为ttymxc0,我们需要添加一个名为getty@ttymxc0.service的链接,链接到 getty@.service 服务上
    exit//退出根文件系统
    ./unmount.sh
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

    三、安装测试

    1、nfs挂载测试
    setenv bootargs ‘console=tty1 console=ttymxc0,115200 root=/dev/nfs nfsroot=192.168.1.253:/home/zuozhongkai/linux/nfs/ubuntu_rootfs rw ip=192.168.1.251:192.168.1.253:192.168.1.1:255.255.255.0::eth0:off’
    saveenv //保存环境变量
    
    • 1
    • 2

    重启即可

    2、烧录
    //PC上打包文件系统
    cd ubuntu_rootfs //进入到 ubuntu 根文件系统
    tar -vcjf ubuntu_rootfs.tar.bz2 * //打包根文件系统
    
    • 1
    • 2
    • 3

    见系统烧写方式章节(后续整理)

  • 相关阅读:
    PyCharm控制台中英文显示切换
    物理不可克隆功能 (PUF)介绍
    最新综述 | 图数据挖掘中的算法公平性
    kafka配合ElasticStack技术栈的搭配使用
    RabbitMQ原理(二):SpringAMQP编程
    MyBatis-Plus介绍与项目起步讲解
    Qt应用开发(基础篇)——按钮基类 QAbstractButton
    前端RSA加解密(支持超长分段)
    把所有的Linux命令制作成一张电脑壁纸,消耗了20红牛终于成了
    工程机械比例阀电流采集方案
  • 原文地址:https://blog.csdn.net/qq_38292379/article/details/128083766