向U盘写入Armbian的镜像文件或者使用armbian-config 中的boot from spi 自动安装系统usb到分区中
root@orangepipc2:~# sudo find /boot/dtb/ -name "*overlay*"
/boot/dtb/allwinner/overlay
/boot/dtb/allwinner/overlay/README.sun50i-a64-overlays
/boot/dtb/allwinner/overlay/README.sun50i-h5-overlays
root@orangepipc2:~# nano /boot/dtb/allwinner/overlay/README.sun50i-h5-overlays
GNU nano 3.2 /boot/dtb/allwinner/overlay/README.sun50i-h5-overlays
SPI 1 pins (MOSI, MISO, SCK, CS): PA15, PA16, PA14, PA13
Parameters:
param_spidev_spi_bus (int)
SPI bus to activate SPIdev support on
Required
Supported values: 0, 1
param_spidev_spi_cs (int)
SPI chip select number
Optional
Default: 0
Supported values: 0, 1
Using chip select 1 requires using "spi-add-cs1" overlay
param_spidev_max_freq (int)
Maximum SPIdev frequency
Optional
root@orangepipc2:~# nano /boot/armbianEnv.txt
GNU nano 3.2 /boot/armbianEnv.txt
verbosity=1
bootlogo=false
console=both
disp_mode=1920x1080p60
overlay_prefix=sun50i-h5
rootdev=/dev/mmcblk0p1
rootfstype=ext4
overlays=spi-spidev
param_spinor_spi_bus=1
param_spidev_spi_bus=0
usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u
root@orangepipc2:~# reboot
[ 794.209485] reboot: Restarting system
U-Boot SPL 2020.04-armbian (Sep 02 2020 - 10:18:39 +0200)
DRAM: 1024 MiB
Trying to boot from MMC1
NOTICE: BL31: v2.3(debug):d35403f-dirty
NOTICE: BL31: Built : 10:18:35, Sep 2 2020
NOTICE: BL31: Detected Allwinner H5 SoC (1718)
NOTICE: BL31: Found U-Boot DTB at 0x40913f0, model: Xunlong Orange Pi PC 2
INFO: ARM GICv2 driver initialized
INFO: Configuring SPC Controller
NOTICE: PMIC: Assuming H5 reference regulator design
INFO: BL31: Platform setup done
INFO: BL31: Initializing runtime services
INFO: BL31: cortex_a53: CPU workaround for 855873 was applied
WARNING: BL31: cortex_a53: CPU workaround for 1530924 was missing!
NOTICE: PSCI: System suspend is unavailable
INFO: BL31: Preparing for EL3 exit to normal world
INFO: Entry point address = 0x4a000000
INFO: SPSR = 0x3c9
U-Boot 2020.04-armbian (Sep 02 2020 - 10:18:39 +0200) Allwinner Technology
CPU: Allwinner H5 (SUN50I)
Model: Xunlong Orange Pi PC 2
DRAM: 1 GiB
MMC: mmc@1c0f000: 0
Loading Environment from FAT... Unable to use mmc 0:1... In: serial@1c28000
Out: serial@1c28000
Err: serial@1c28000
Allwinner mUSB OTG (Peripheral)
Net: phy interface7
eth0: ethernet@1c30000
Warning: usb_ether using MAC address from ROM
, eth1: usb_ether
starting USB...
Bus usb@1c1a000: USB EHCI 1.00
Bus usb@1c1a400: USB OHCI 1.0
Bus usb@1c1b000: USB EHCI 1.00
Bus usb@1c1b400: USB OHCI 1.0
Bus usb@1c1c000: USB EHCI 1.00
Bus usb@1c1c400: USB OHCI 1.0
Bus usb@1c1d000: USB EHCI 1.00
Bus usb@1c1d400: USB OHCI 1.0
scanning bus usb@1c1a000 for devices... 1 USB Device(s) found
scanning bus usb@1c1a400 for devices... 1 USB Device(s) found
scanning bus usb@1c1b000 for devices... 1 USB Device(s) found
scanning bus usb@1c1b400 for devices... 1 USB Device(s) found
scanning bus usb@1c1c000 for devices... 2 USB Device(s) found
scanning bus usb@1c1c400 for devices... 1 USB Device(s) found
scanning bus usb@1c1d000 for devices... 1 USB Device(s) found
scanning bus usb@1c1d400 for devices... 1 USB Device(s) found
scanning usb for storage devices... 1 Storage Device(s) found
Autoboot in 1 seconds, press
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
Found U-Boot script /boot/boot.scr
3173 bytes read in 4 ms (774.4 KiB/s)
## Executing script at 4fc00000
U-boot loaded from SD
Boot script loaded from mmc
242 bytes read in 4 ms (58.6 KiB/s)
31829 bytes read in 9 ms (3.4 MiB/s)
788 bytes read in 9 ms (85 KiB/s)
Applying kernel provided DT overlay sun50i-h5-spi-spidev.dtbo
4191 bytes read in 8 ms (510.7 KiB/s)
Applying kernel provided DT fixup script (sun50i-h5-fixup.scr)
## Executing script at 45000000
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
10294834 bytes read in 494 ms (19.9 MiB/s)
21168136 bytes read in 1011 ms (20 MiB/s)
## Loading init Ramdisk from Legacy Image at 4fe00000 ...
Image Name: uInitrd
Image Type: AArch64 Linux RAMDisk Image (gzip compressed)
Data Size: 10294770 Bytes = 9.8 MiB
Load Address: 00000000
Entry Point: 00000000
Verifying Checksum ... OK
## Flattened Device Tree blob at 4fa00000
Booting using the fdt blob at 0x4fa00000
Loading Ramdisk to 4962e000, end 49fff5f2 ... OK
Loading Device Tree to 00000000495bd000, end 000000004962dfff ... OK
Starting kernel ...
Armbian 20.08.1 Buster ttyS0
orangepipc2 login: root
Password:
Last login: Wed Oct 7 11:10:19 CST 2020 on ttyS0
___ ____ _ ____ ____ ____
/ _ \| _ \(_) | _ \ / ___|___ \
| | | | |_) | | | |_) | | __) |
| |_| | __/| | | __/| |___ / __/
\___/|_| |_| |_| \____|_____|
Welcome to Armbian 20.08.1 Buster with Linux 5.8.5-sunxi64
System load: 0.66 0.16 0.05 Up time: 0 min
Memory usage: 10 % of 985MB IP: 172.16.3.157
CPU temp: 31°C
Usage of /: 10% of 15G
[ General system configuration (beta): armbian-config ]
root@orangepipc2:~# modprobe spidev
root@orangepipc2:~# ls -l /usr/lib/linux-u-boot-current-orangepipc2_20.08.1_arm64/
total 680
-rw-rw-r-- 1 root root 32768 Sep 2 16:18 sunxi-spl.bin
-rwx------ 1 root root 661728 Sep 2 16:18 u-boot.itb
root@orangepipc2:~# dd if=/dev/zero count=2048 bs=1K | tr '\000' '\377' > spi.img
2048+0 records in
2048+0 records out
2097152 bytes (2.1 MB, 2.0 MiB) copied, 0.0642 s, 32.7 MB/s
root@orangepipc2:~# dd if=/usr/lib/linux-u-boot-current-orangepipc2_20.08.1_arm64/sunxi-spl.bin of=spi.img bs=1k conv=notrunc
32+0 records in
32+0 records out
32768 bytes (33 kB, 32 KiB) copied, 0.00462494 s, 7.1 MB/s
root@orangepipc2:~# dd if=/usr/lib/linux-u-boot-current-orangepipc2_20.08.1_arm64/u-boot.itb of=spi.img bs=1 seek=32768 conv=notrunc
661728+0 records in
661728+0 records out
661728 bytes (662 kB, 646 KiB) copied, 3.87539 s, 171 kB/s
root@orangepipc2:~# flashrom -p linux_spi:dev=/dev/spidev0.0 -c MX25L1605 -w spi.img
flashrom on Linux 5.8.5-sunxi64 (aarch64)
flashrom is free software, get the source code at https://flashrom.org
Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
Found Macronix flash chip "MX25L1605" (2048 kB, SPI) on linux_spi.
Reading old flash chip contents... done.
Erasing and writing flash chip... Erase/write done.
Verifying flash... VERIFIED.
root@orangepipc2:~# shutdown -h now
[ 572.680826] reboot: Power down
U-Boot SPL 2020.04-armbian (Sep 02 2020 - 10:18:39 +0200)
DRAM: 1024 MiB
Trying to boot from sunxi SPI
NOTICE: BL31: v2.3(debug):d35403f-dirty
NOTICE: BL31: Built : 10:18:35, Sep 2 2020
NOTICE: BL31: Detected Allwinner H5 SoC (1718)
NOTICE: BL31: Found U-Boot DTB at 0x40913f0, model: Xunlong Orange Pi PC 2
INFO: ARM GICv2 driver initialized
INFO: Configuring SPC Controller
NOTICE: PMIC: Assuming H5 reference regulator design
INFO: BL31: Platform setup done
INFO: BL31: Initializing runtime services
INFO: BL31: cortex_a53: CPU workaround for 855873 was applied
WARNING: BL31: cortex_a53: CPU workaround for 1530924 was missing!
NOTICE: PSCI: System suspend is unavailable
INFO: BL31: Preparing for EL3 exit to normal world
INFO: Entry point address = 0x4a000000
INFO: SPSR = 0x3c9
U-Boot 2020.04-armbian (Sep 02 2020 - 10:18:39 +0200) Allwinner Technology
CPU: Allwinner H5 (SUN50I)
Model: Xunlong Orange Pi PC 2
DRAM: 1 GiB
MMC: mmc@1c0f000: 0
Loading Environment from FAT... MMC: no card present
In: serial@1c28000
Out: serial@1c28000
Err: serial@1c28000
Allwinner mUSB OTG (Peripheral)
Net: phy interface7
eth0: ethernet@1c30000
Warning: usb_ether using MAC address from ROM
, eth1: usb_ether
starting USB...
Bus usb@1c1a000: USB EHCI 1.00
Bus usb@1c1a400: USB OHCI 1.0
Bus usb@1c1b000: USB EHCI 1.00
Bus usb@1c1b400: USB OHCI 1.0
Bus usb@1c1c000: USB EHCI 1.00
Bus usb@1c1c400: USB OHCI 1.0
Bus usb@1c1d000: USB EHCI 1.00
Bus usb@1c1d400: USB OHCI 1.0
scanning bus usb@1c1a000 for devices... 1 USB Device(s) found
scanning bus usb@1c1a400 for devices... 1 USB Device(s) found
scanning bus usb@1c1b000 for devices... 1 USB Device(s) found
scanning bus usb@1c1b400 for devices... 1 USB Device(s) found
scanning bus usb@1c1c000 for devices... 2 USB Device(s) found
scanning bus usb@1c1c400 for devices... 1 USB Device(s) found
scanning bus usb@1c1d000 for devices... 1 USB Device(s) found
scanning bus usb@1c1d400 for devices... 1 USB Device(s) found
scanning usb for storage devices... 1 Storage Device(s) found
Autoboot in 1 seconds, press
MMC: no card present
Device 0: Vendor: GALAX KA Rev: 0117 Prod: 1D0128A
Type: Hard Disk
Capacity: 122104.3 MB = 119.2 GB (250069680 x 512)
... is now current device
Scanning usb 0:1...
Found U-Boot script /boot/boot.scr
3173 bytes read in 1 ms (3 MiB/s)
## Executing script at 4fc00000
U-boot loaded from SPI
Boot script loaded from usb
246 bytes read in 1 ms (240.2 KiB/s)
31829 bytes read in 3 ms (10.1 MiB/s)
788 bytes read in 3 ms (255.9 KiB/s)
Applying kernel provided DT overlay sun50i-h5-spi-spidev.dtbo
4191 bytes read in 3 ms (1.3 MiB/s)
Applying kernel provided DT fixup script (sun50i-h5-fixup.scr)
## Executing script at 45000000
10294834 bytes read in 224 ms (43.8 MiB/s)
21168136 bytes read in 458 ms (44.1 MiB/s)
## Loading init Ramdisk from Legacy Image at 4fe00000 ...
Image Name: uInitrd
Image Type: AArch64 Linux RAMDisk Image (gzip compressed)
Data Size: 10294770 Bytes = 9.8 MiB
Load Address: 00000000
Entry Point: 00000000
Verifying Checksum ... OK
## Flattened Device Tree blob at 4fa00000
Booting using the fdt blob at 0x4fa00000
Loading Ramdisk to 4962e000, end 49fff5f2 ... OK
Loading Device Tree to 00000000495bd000, end 000000004962dfff ... OK
Starting kernel ...
Armbian 20.08.1 Buster ttyS0
orangepipc2 login: root
Password:
Last login: Sat Sep 26 22:20:08 CST 2020 on ttyS0
___ ____ _ ____ ____ ____
/ _ \| _ \(_) | _ \ / ___|___ \
| | | | |_) | | | |_) | | __) |
| |_| | __/| | | __/| |___ / __/
\___/|_| |_| |_| \____|_____|
Welcome to Armbian 20.08.1 Buster with Linux 5.8.5-sunxi64
System load: 0.68 0.16 0.05 Up time: 0 min
Memory usage: 10 % of 985MB IP: 172.16.3.157
CPU temp: 29°C
Usage of /: 19% of 7.9G
root@orangepipc2:~# df -h
Filesystem Size Used Avail Use% Mounted on
udev 423M 0 423M 0% /dev
tmpfs 99M 3.0M 96M 3% /run
/dev/sda1 7.9G 1.4G 6.1G 19% /
tmpfs 493M 0 493M 0% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 493M 0 493M 0% /sys/fs/cgroup
tmpfs 493M 4.0K 493M 1% /tmp
/dev/zram0 49M 1.5M 44M 4% /var/log
tmpfs 99M 0 99M 0% /run/user/0
root@orangepipc2:~#
最终使用的命令为:
dd if=/usr/lib/linux-u-boot-current-orangepipc2_20.08.1_arm64/sunxi-spl.bin of=spi.img bs=1k conv=notrunc
dd if=/usr/lib/linux-u-boot-current-orangepipc2_20.08.1_arm64/u-boot.itb of=spi.img bs=1 seek=32768 conv=notrunc
flashrom -p linux_spi:dev=/dev/spidev0.0 -c MX25L1605 -w spi.img
注意:本文归作者所有,未经作者允许,不得转载