Linux系統平臺上有許多開源的系統構建框架,這些框架方便了開發者進行嵌入式系統的構建和定制化開發,目前比較常見的有Buildroot, Yocto, OpenEmbedded等等。 本文檔并不包含Linux BSP系統相關基礎知識的介紹,將直接使用米爾發布的myir-image-full提供的的BSP。如需了解BSP文件的制作請查看《Remi Pi_Linux軟件開發指南》。 Remi Pi使用的Ubuntu系統基于ubuntu-base-22.04-base-arm64.tar.gz版本制作(下載地址如下),在此版本基礎上添加了豐富的系統資源和其他軟件資源。 注意:米爾提供的ubuntu系統的登錄名為:root 密碼為:123456
基于ubuntu base系統在開發過程中所需的一些軟硬件環境,包括必要的開發主機環境,必備的軟件工具,代碼和資料的獲取等,具體的準備工作下面將進行詳細介紹。 本節將介紹如何搭建適用于瑞薩Remi Pi平臺的開發環境,該平臺使用的RZ/G系列處理器是多核異構的處理器,RZ/G2L擁有兩個2個ARM Cortex A53。通過閱讀本章節,您將了解相關硬件工具,軟件開發調試工具的安裝和使用。并能快速的搭建相關開發環境,為后面的開發和調試做準備。 一般選擇在安裝Fedora, openSUSE, Debian, Ubuntu, RHEL或者 CentOS等Linux發行版的本地主機上進行,這里推薦的是Ubuntu22.04 64bit桌面版系統,后續開發也是以此系統為例進行介紹。 3. Ubuntu 22.04 文件系統移植 ubuntu-base 是Ubuntu官方構建的ubuntu最小文件系統,包含debain軟件包管理器,基礎包大小通常只有幾十兆,其背后有整個ubuntu軟件源支持,ubuntu軟件一般穩定性比較好,基于ubuntu-base按需安裝Linux軟件,深度可定制等,常用于嵌入式rootfs構建。 3.2. 獲取源碼 3.2.1. 通過wget獲取源碼
3.3. 準備chroot環境 (如果主機沒有安裝qemu-user-static工具包,可輸入以下命令安裝工具包) - PC@system1:~$ sudo apt install qemu-user-static
復制代碼
3.3.2. 制作掛載腳本 3.4. 安裝包文件 首先使用ch-mount.sh將ubuntu文件系統掛載。 - PC@system1:~$ ./ch-mount.sh -m ./rootfs/
- MOUNTING
- root@system1:/#
- root@system1:/# ls
- bin dev home media opt root sbin sys usr
- boot etc lib mnt proc run srv tmp var
復制代碼
3.4.2. 基礎包安裝 添加log,用戶調試ubuntu系統的調試 - root@system1:/# touch /var/log/rsyslog
- root@system1:/# chown syslog:adm /var/log/rsyslog
- root@system1:/# chmod 666 /var/log/rsyslog
- root@system1:/# systemctl unmask rsyslog
- root@system1:/# systemctl enable rsyslog
復制代碼
3.4.3. 桌面系統的安裝 瀏覽器和音頻安裝 - root@system1:/# sudo apt install epiphany-browser
- root@system1:/# sudo apt install xine-ui
復制代碼
設置root密碼: 123456 - root@system1:/# passwd root
- Enter new UNIX password:
- Retype new UNIX password:
- passwd: password updated successfully
復制代碼
一定要執行下面的指令,不然會sudo報錯sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set - root@system1:/# chown root:root /usr/bin/sudo
- root@system1:/# chmod 4755 /usr/bin/sudo
復制代碼
創建一個用戶名為:myir 密碼為:123456 - root@system1:/# adduser myir
- perl: warning: Setting locale failed.
- perl: warning: Please check that your locale settings:
- LANGUAGE = (unset),
- LC_ALL = (unset),
- LC_TIME = "zh_CN.UTF-8",
- LC_IDENTIFICATION = "zh_CN.UTF-8",
- LC_TELEPHONE = "zh_CN.UTF-8",
- LC_NUMERIC = "zh_CN.UTF-8",
- LC_ADDRESS = "zh_CN.UTF-8",
- LC_NAME = "zh_CN.UTF-8",
- LC_MONETARY = "zh_CN.UTF-8",
- LC_PAPER = "zh_CN.UTF-8",
- LC_MEASUREMENT = "zh_CN.UTF-8",
- LANG = "zh_CN.UTF-8"
- are supported and installed on your system.
- perl: warning: Falling back to the standard locale ("C").
- Adding user `myir' ...
- Adding new group `myir' (1000) ...
- Adding new user `myir' (1000) with group `myir' ...
- Creating home directory `/home/myir' ...
- Copying files from `/etc/skel' ...
- Enter new UNIX password:
- Retype new UNIX password:
- passwd: password updated successfully
- Changing the user information for myir
- Enter the new value, or press ENTER for the default
- Full Name []: cy
- Room Number []: 604
- Work Phone []:
- Home Phone []:
- Other []:
- Is the information correct? [Y/n] y
復制代碼
設置權限 - sudo vi /etc/sudoers
- root ALL=(ALL:ALL) ALL
- myir(根據自己添加的用戶來添加) ALL=(ALL:ALL) ALL
復制代碼
- root@system1:/# export LC_ALL=C
復制代碼
設置hosts和主機名稱,添加127.0.0.1 myir - root@system1:/# vi /etc/hosts
復制代碼
修改passwd文件 - root@system1:/# vi /etc/passwd
- 找到這一行:_apt:x:100:65534::/nonexistent:/usr/sbin/nologin
- 修改為:_apt:x:0:65534::/nonexistent:/usr/sbin/nologin
復制代碼
配置網卡接口,添加如下內容 - root@system1:/# vi /etc/network/interfaces
- auto eth0
- iface eth0 inet dhcp
復制代碼
以上步驟操作完成后即可卸載系統。直接在系統中輸入exit退出系統,并使用命令來卸載 - root@system1:/# exit
- exit
- PC@system1:~$
- PC@system1:~$ ./ch-mount.sh -u ubuntu-rootfs/
- UNMOUNTING
復制代碼
3.5.1. 制作ext4格式文件 請用戶根據實際情況來決定大小,這里以3.3G大小舉例制作。 - PC@system1:~$ mkfs.ext4 ubuntu22.04.ext4
復制代碼
將ubuntu-rootfs目錄中的內容復制到掛載的文件系統中,然后卸載。 - PC@system1:~$ sudo cp -avrf ubuntu-rootfs/* temp
- PC@system1:~$ sudo umount temp
復制代碼
先將下載資源的03_Tools/myir tools目錄下的RemiPi_SDUpdate.tar.bz2解壓到虛擬機中(用戶請根據自己實際情況解壓) - PC@system1:~$ tar -xf RemiPi_SDUpdate.tar.bz2
- PC@system1:~$ cd RemiPi_SDUpdate/renesas-sd
- PC@system1:~/RemiPi_SDUpdate/renesas-sd$ ls
- image README.md rzg2_bsp_scripts fat16 output rootfs
復制代碼
修改Manifest文件 - PC@system1:~/RemiPi_SDUpdate/renesas-sd/rootfs/home/root/g2l_images$ cat Manifest
- bl2file="bl2_bp-myir-remi-1g_pmic.bin"
- fipfile="fip-myir-remi-1g_pmic.bin"
- imagefile="Image"
- dtbfile="*.dtb"
- rootfsfile="ubuntu22.04.ext4"
- ledname="162"
復制代碼
最后進入到下面目錄,執行制作鏡像的腳本即可。 - PC@system1:~/RemiPi_SDUpdate/renesas-sd$ cd rzg2_bsp_scripts/image_creator/
- PC@system1: ~/RemiPi_SDUpdate/renesas-sd/rzg2_bsp_scripts/image_creator$ ./create_image.sh myir_config.ini
復制代碼
4. 認識LXDE LXDE是一個輕量級和快速的桌面環境。它被設計為用戶友好和占用資源少,同時保持資源使用率低。LXDE使用更少的內存和CPU來盡可能地展現功能豐富的桌面環境。與其它的桌面環境不同,LXDE努力成為模塊化的桌面環境,所以每個組件可以獨立使用。這使得移植LXDE不同分布和平臺更容易。 除了這些核心組件外,LXDE還有其他一些輔助工具,如LXAppearance(用于更改主題和圖標)、LXTask(任務管理器)等。 4.2. 啟動LXDE 登錄成功后,由于默認背景是黑色的,可以點擊鼠標右鍵后選擇Desktop Preferences->Appearance->Wallpaper(/usr/share/lxde/wallpapers/lxde_blue.jpg)來選擇背景圖片,如圖4-2: 圖4-2:lxde背景圖片修改 圖4-3:lxde背景圖片
|