marvell 开发板Ubuntu镜像制作及配置步骤
http://wiki.macchiatobin.net/tiki-index.php?page=Boot+from+removable+storage+-+Ubuntu
marvell開發板的燒寫步驟比較復雜。
?
板子上沒有flash,默認SD卡啟動,需要將SD卡制成啟動盤。
第一步制作rootfs,以Ubuntu為例:
首先下載Ubuntu鏡像:
?
mcbin@buildserver:~$ mkdir ubuntu mcbin@buildserver:~$ cd ubuntu mcbin@buildserver:~/ubuntu$ wget http://cdimage.ubuntu.com/releases/16.04.2/release/ubuntu-16.04.2-server-arm64.iso掛載image
?
?
mcbin@buildserver:~/ubuntu$ mkdir temp mcbin@buildserver:~/ubuntu$ sudo mount -o loop ubuntu-16.04.2-server-arm64.iso temp/ mcbin@buildserver:~/ubuntu$ ls temp/install/ filesystem.manifest filesystem.squashfs hwe-initrd.gz hwe-vmlinuz netboot filesystem.size filesystem.squashfs.gpg hwe-netboot initrd.gz vmlinuz 恢復(不知怎么翻譯unsquash)文件系統到/rootfs mcbin@buildserver:~/ubuntu$ sudo unsquashfs -d rootfs/ temp/install/filesystem.squashfs mcbin@buildserver:~/ubuntu$ ls rootfs/ bin boot dev etc home lib media mnt opt proc root run sbin srv sys tmp usr var修改passwd,使得免密碼登錄:
?
?
mcbin@buildserver:~/ubuntu/rootfs/etc$ cat passwd root::0:0:root:/root:/bin/bash daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin bin:x:2:2:bin:/bin:/usr/sbin/nologin [truncated output]打包rootfs:
?
?
mcbin@buildserver:~/ubuntu$ sudo tar -cjvf rootfs.tar.bz2 -C rootfs/ .?
?
?
?
第二步編譯源碼:
建文件夾
?
mcbin@buildserver:~$ mkdir -p kernel/4.4.8 mcbin@buildserver:~$ cd kernel/4.4.8/下載源碼:
?
?
mcbin@buildserver:~/kernel/4.4.8$ git clone https://github.com/MarvellEmbeddedProcessors/linux-marvell .記得不要漏掉最后的點。
?
切換分支:
?
mcbin@buildserver:~/kernel/4.4.8$ git checkout linux-4.4.8-armada-17.02-macchiatobin Checking out files: 100% (44078/44078), done. Branch linux-4.4.8-armada-17.02-macchiatobin set up to track remote branch linux-4.4.8-armada-17.02-macchiatobin from origin. Switched to a new branch 'linux-4.4.8-armada-17.02-macchiatobin'設置環境變量:
?
?
mcbin@buildserver:~/kernel/4.4.8$ export ARCH=arm64 mcbin@buildserver:~/kernel/4.4.8$ export CROSS_COMPILE=aarch64-linux-gnu-創建config文件,確保你的系統中有arm的交叉編譯器,沒有的話請安裝:aarch64-Linux-gnu-gcc,最好用apt-get安裝。
?
開始編譯:
?
mcbin@buildserver:~/kernel/4.4.8$ make -j4?
如果你的交叉編譯器有問題會導致編譯出錯。
查看結果:
?
mcbin@buildserver:~/kernel/4.4.8$ ls arch/arm64/boot dts Image Image.gz install.sh Makefile如果有上述文件則說明編譯成功。
?
將SD卡插入pc,pc須安裝有Linux環境,我的是在virtualbox中安裝的Ubuntu。在終端中輸入:lsblk來外設,
?
?
mcbin@buildserver:~$ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 238.5G 0 disk ├─sda1 8:1 0 230.6G 0 part / ├─sda2 8:2 0 1K 0 part └─sda5 8:5 0 7.9G 0 part [SWAP] sdb 8:16 0 3.7T 0 disk └─sdb1 8:17 0 3.7T 0 part /media/disk1 sdc 8:32 0 238.5G 0 disk └─sdc1 8:33 0 238.5G 0 part /media/disk2 sde 8:64 1 7.4G 0 disk └─sde1 8:65 1 7.4G 0 part顯然SD卡是sde,含有sde1一個分區。接下來格式化分區:
?
?
mcbin@buildserver:~$ sudo mkfs.ext4 /dev/sde1 mke2fs 1.42.13 (17-May-2015) /dev/sde1 contains a vfat file system Proceed anyway? (y,n) y Creating filesystem with 1939456 4k blocks and 485760 inodes (truncated output)將格式化后的sde1掛載到/mnt
?
?
mcbin@buildserver:~$ sudo mount /dev/sde1 /mnt/解壓rootfs到SD卡,
?
?
mcbin@buildserver:~$ cd /mnt/ mcbin@buildserver:/mnt$ sudo tar -xvf ~/ubuntu/rootfs.tar.bz2?
?
mcbin@buildserver:/mnt$ ls bin boot dev etc home lib lost+found media mnt opt proc root run sbin srv sys tmp usr var?
將編譯好的image和依賴文件放到SD卡:
?
mcbin@buildserver:/mnt$ sudo cp ~/kernel/4.4.8/arch/arm64/boot/Image boot/ mcbin@buildserver:/mnt$ sudo cp ~/kernel/4.4.8/arch/arm64/boot/dts/marvell/armada-8040-mcbin.dtb boot/ mcbin@buildserver:/mnt$ ls boot armada-8040-mcbin.dtb Image卸載SD卡:
?
?
mcbin@buildserver:/mnt$ cd mcbin@buildserver:~$ sudo umount /mnt最后一步,啟動設置:
?
將SD卡插入marvell板子,將marvell板子連接pc,打開pc端的上位機,我用的是 mobaxterm,打開相應的串口,設置波特率115200,此時將marvell板接上電源,上位機將顯示啟動信息,這時必須要不停地按鍵使其停止在設置段。
?
Hit any key to stop autoboot: 0 Marvell>> Marvell>>接下來就按照說明一步步操作:
?
?
Marvell>> mmc dev 1 switch to partitions #0, OK mmc1 is current device Marvell>> ext4ls mmc 1:1 / <DIR> 4096 . <DIR> 4096 .. <DIR> 16384 lost+found <DIR> 4096 home <DIR> 4096 opt <DIR> 4096 srv <DIR> 4096 lib <DIR> 4096 media <DIR> 4096 etc <DIR> 4096 proc <DIR> 4096 run <DIR> 4096 bin <DIR> 4096 usr <DIR> 4096 sbin <DIR> 4096 var <DIR> 4096 sys <DIR> 4096 root <DIR> 4096 tmp <DIR> 4096 mnt <DIR> 4096 dev <DIR> 4096 boot Marvell>> ext4ls mmc 1:1 /boot <DIR> 4096 . <DIR> 4096 ..12687360 Image33736 armada-8040-mcbin.dtb Marvell>> setenv image_name boot/Image Marvell>> setenv fdt_name boot/armada-8040-mcbin.dtb Marvell>> setenv bootmmc 'mmc dev 1; ext4load mmc 1:1 $kernel_addr $image_name;ext4load mmc 1:1 $fdt_addr $fdt_name;setenv bootargs $console root=/dev/mmcblk1p1 rw rootwait; booti $kernel_addr - $fdt_addr' Marvell>> saveenv Marvell>> setenv bootcmd 'run bootmmc' Marvell>> saveenv Marvell>> run bootmmc至此設置成功:登錄root即可。
?
?
localhost login: root Welcome to Ubuntu 16.04.2 LTS (GNU/Linux 4.4.8-armada-17.02.2-g4126e30 aarch64)* Documentation: https://help.ubuntu.com* Management: https://landscape.canonical.com* Support: https://ubuntu.com/advantageThe programs included with the Ubuntu system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright.Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law.root@localhost:~#?
?
?
總結
以上是生活随笔為你收集整理的marvell 开发板Ubuntu镜像制作及配置步骤的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: matlab计算π,如何计算π的值(MA
- 下一篇: 计算机技术在x中的应用浅论,浅议网络技术