设为首页收藏本站
查看: 435|回复: 0

【米尔瑞萨RZ/G2L开发板-创新应用】+ ubuntu文件系统移植

[复制链接]

3

主题

1

回帖

47

积分

新手上路

积分
47
wakojosin 发表于 2023-9-4 00:12:23 | 显示全部楼层 |阅读模式
本帖最后由 wakojosin 于 2023-9-4 20:08 编辑

工具


开发环境:WSL2 - ubuntu 18.04
ubuntu文件系统地址:https://mirrors.tuna.tsinghua.ed ... 5-base-arm64.tar.gz
软件工具:MYD-YG2LX_SDUpdate.tar.bz2,teraterm-4.104.exe

准备
安装teraterm-4.104.exe;

ubuntu主机安装qemu-user-static;
解压MYD-YG2LX_SDUpdate.tar.bz2到~/work/myir;
解压ubuntu-base-20.04.5-base-arm64.tar.gz到~/work/myir/ubuntu_root
复制qemu-aarch64-static到~/work/myir/ubuntu_root/user/bin
创建脚本~/work/myir/mount_rootfs.sh,内容如下:

  1. #!/bin/bash
  2. mnt() {
  3.         echo "MOUNTING"
  4.         sudo mount -t proc /proc ${2}proc
  5.         sudo mount -t sysfs /sys ${2}sys
  6.         sudo mount -o bind /dev ${2}dev
  7.         sudo mount -o bind /dev/pts ${2}dev/pts
  8.         sudo chroot ${2}
  9. }
  10. umnt() {
  11.         echo "UNMOUNTING"
  12.         sudo umount ${2}proc
  13.         sudo umount ${2}sys
  14.         sudo umount ${2}dev/pts
  15.         sudo umount ${2}dev
  16. }
  17. if [ "$1" == "-m" ] && [ -n "$2" ] ;
  18. then
  19.         mnt $1 $2
  20. elif [ "$1" == "-u" ] && [ -n "$2" ];
  21. then
  22.         umnt $1 $2
  23. else
  24.         echo ""
  25.         echo "Either 1'st, 2'nd or both parameters were missing"
  26.         echo ""
  27.         echo "1'st parameter can be one of these: -m(mount) OR -u(umount)"
  28.         echo "2'nd parameter is the full path of rootfs directory(with trailing '/')"
  29.         echo ""
  30.         echo "For example: ch-mount -m /media/sdcard/"
  31.         echo ""
  32.         echo 1st parameter : ${1}
  33.         echo 1nd parameter : ${2}
  34. fi
复制代码
配置软件源,我用的清华的


复制DNS配置
sudo cp /etc/resolv.conf ubuntu_root/etc/resolv.conf

开干
运行脚本sudo bash mount_rootfs.sh -m ubuntu_root/进行文件系统挂载,如果出现错误,好像类似Exec format error,重装qemu-user-static然后重新复制一遍就行

给文件系统安装软件:
  1. apt update

  2. apt install net-tools
  3. apt install ethtool
  4. apt install ifupdown
  5. apt install vim
  6. apt install iputils-ping
  7. apt install language-pack-en-base
  8. apt install sudo
  9. apt install systemd

  10. #应该差不多了,不行等运行起来再补
  11. #需要桌面环境的安装ubuntu-desktop
复制代码


根据需求创建新用户

配置网卡
vi /etc/network/interfaces
  1. # interfaces(5) file used by ifup(8) and ifdown(8)
  2. # Include files from /etc/network/interfaces.d:
  3. auto lo
  4. iface lo inet loopback

  5. auto eth0
  6. iface eth0 inet dhcp

  7. auto eth1
  8. iface eth1 inet dhcp
复制代码

DNS配置
vi /etc/systemd/resolved.conf
  1. [Resolve]
  2. DNS=223.5.5.5 223.6.6.6
复制代码


配置DHCP
vi /etc/dhcp/dhclient.conf,找到timeout,改为10,时间短点启动快点
  1. #send dhcp-client-identifier 1:0:a0:24:ab:fb:9c;
  2. #send dhcp-lease-time 3600;
  3. #supersede domain-name "fugue.com home.vix.com";
  4. #prepend domain-name-servers 127.0.0.1;
  5. #require subnet-mask, domain-name-servers;
  6. timeout 10;
  7. #retry 60;
  8. #reboot 10;
  9. #select-timeout 5;
  10. #initial-interval 2;
  11. #script "/sbin/dhclient-script";
  12. #media "-link0 -link1 -link2", "link0 link1";
  13. #reject 192.33.137.209;
复制代码


配置终端,这部分我是在开发板中进行,通过原始的EMMC中的系统,对SD卡的系统进行配置,直接拷贝emmc中的/lib/systemd/system/serial-getty@.service到SD卡对于的位置
然后通过chroot挂载SD卡文件系统创建两个软连接:
  1. /etc/systemd/system/getty.target.wants/:
  2. lrwxrwxrwx 1 root root 34 Sep  3  2023 getty@tty1.service -> /lib/systemd/system/getty@.service
  3. lrwxrwxrwx 1 root root 41 Jan  1 08:44 serial-getty@ttySC0.service -> /lib/systemd/system/serial-getty@.service
复制代码


到此应该是配置完成了,通过exit推出,sudo bash mount_rootfs.sh -u ubuntu_root/卸载文件系统

然后复制文件系统,进行镜像创建:
rm -rf MYD-YG2LX_SDUpdate/renesas-sd/rootfs/*
cp -a ubuntu_root/* MYD-YG2LX_SDUpdate/renesas-sd/rootfs/

根据《MYD-YG2LX_Linux软件开发指南.pdf 4.3.制作SD卡烧录器》进行SD卡系统进行的创建,《4.2.windows下烧录系统》进行SD卡镜像烧写

展示



安装了个gcc


镜像分享
镜像是按步骤操作的,未烧录到板子上验证(我使用的系统是在板子上配置的),有问题留言反馈谢谢。

链接:https://pan.baidu.com/s/1S7ZfiWkZav4W2YJcpVSqtg
提取码:ea8v




回复

使用道具 举报

您需要登录后才可以回帖 登录

本版积分规则

Archiver|手机版|小黑屋|米尔科技论坛   

GMT+8, 2024-5-13 07:40 , Processed in 0.089481 second(s), 19 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表