1、將當前用戶加入sudo
使用root用戶,輸入visudo命令打開sudo配置文件,找到下面這一行,并在下面新增黑色部分,其中username是要添加的用戶名。
root ALL=(ALL) ALL
username ALL=(ALL) ALL
2、開機自動加載共享文件夾
使用sudo vim /etc/fstab,在fstab最后添加如下一行,將所有共享文件夾mount進hgfs目錄下面:(使用vmware-hgfsclient命令可以查看到所有的共享文件夾名稱)
.host:/ /mnt/hgfs fuse.vmhgfs-fuse allow_other,defaults 0 0
注意:要在主機與虛擬機中設置共享文件夾,需要安裝VMware Tools工具,自動掛載點是“/mnt/hgfs”。(1)進入VMware菜單欄中的虛擬機設置選項——共享文件夾設置中添加主機中用來給客戶機共享的目錄。(2)啟動虛擬機,啟動終端,執行“vmware-hgfsclient”命令可以顯示所有啟用的共享文件夾名稱(顯示的是添加共享目錄時設置的共享名稱)。如果沒有結果,則虛擬機設置中添加的共享文件夾沒有啟用。重新進入設置啟用即可,不用重啟虛擬機。(3)用root權限執行如下命令將共享文件夾掛載到Linux中:
a. 4.0之前的Linux內核:
sudo mount -t vmhgfs .host:/ /mnt/hgfs#將所有共享文件夾掛載到/mnt/hgfs
sudo mount -t vmhgfs .host:/share /mnt/hgfs/share#將名稱為share的共享掛載到/mnt/hgfs/share下
b. 4.0及更高版本的Linux內核:
sudo vmhgfs-fuse .host:/ /mnt/hgfs -o subtype=vmhgfs-fuse,allow_other #將所有共享文件夾掛載到/mnt/hgfs
sudo vmhgfs-fuse .host:/share /mnt/hgfs/share -o subtype=vmhgfs-fuse,allow_other #將名稱為share的共享掛載到/mnt/hgfs/share下
可以用“vmhgfs-fuse -h”查看命令幫助。掛載點可以自己設置,不一定要放在默認目錄。
3.安裝petalinux
安裝依賴包
sudo yum install gawk make wget tar bzip2 gzip python unzip perl patch diffutils diffstat git cpp gcc gcc-c++ glibc-devel texinfo chrpath socat perl-Data-Dumper perl-Text-ParseWords perl-Thread-Queue python34-pip xz which SDL-devel xterm autoconf libtool zlib-devel automake glib2-devel zlib ncurses-devel openssl-devel dos2unix flex bison glibc.i686 screen pax glibc-devel.i686 compat-libstdc+-33.i686 libstdc+.i686
安裝tftp server
sudo yum install xinetd tftp tftp-server
配置tftp server
[root@localhost ~]# cat /etc/xinetd.d/tftp
# default: off
# description: The tftp server serves files using the trivial file transfer \
# protocol. The tftp protocol is often used to boot diskless \
# workstations, download configuration files to network-aware printers, \
# and to start the installation process for some operating systems.
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /var/lib/tftpboot -c # 注意這行,如果允許上傳,一定要加上參數 -c
disable = no # 這行默認為yes,改成no,允許
per_source = 11
cps = 100 2
flags = IPv4
}
重啟服務:
systemctl restart xinetd
創建安裝目錄并安裝
sudo mkdir -p /opt/pkg/petalinux/2018.3
sudo chmod 755 /opt/pkg/petalinux
sudo chown -R synopsys:synopsys 2018.3
./petalinux-v2018.3-final-installer.run /opt/pkg/petalinux/2018.3
4. 添加petalinux初始化腳本
使用vim /.bashrc命令,在/.bashrc中添加如下一行:
source /opt/pkg/petalinux/2018.3/settings.sh