openSUSE:在您的 ARM 板上使用 openSUSE

跳转到:导航搜索

在您的ARM板上安装openSUSE

预构建的ARM板映像可用

点击您的开发板并按照说明操作。

如果您的开发板没有预构建的映像,请下载下面的根文件系统(aarch64 rootfs 或 armv7 rootfs)。

Geeko-white.png
Tumbleweed aarch64
http://download.opensuse.org/ports/aarch64/tumbleweed/appliances/
Geeko-white.png
Tumbleweed armv7
http://download.opensuse.org/ports/armv7hl/tumbleweed/appliances/
Geeko-white.png
Leap 15.2 aarch64
http://download.opensuse.org/ports/aarch64/distribution/leap/15.2/appliances/
Geeko-white.png
Leap 15.2 armv7
http://download.opensuse.org/ports/armv7hl/distribution/leap/15.2/appliances/

如果您使用的开发板 openSUSE 不提供 U-Boot 和内核,则请制作自己的 SD 卡以进行启动,并包含第一个引导加载程序(厂商特定)、U-Boot(为您的开发板配置)和内核(为您的开发板配置)。

root password for the openSUSE prebuilt images is linux

构建上游内核或u-boot

openSUSE 提供 ARM 交叉编译器。以下是构建内核的一些示例(注意:32位 defconfig 通常不包含 EFI 支持,而您需要它来启动,因此您需要调整配置)

zypper in cross-arm-gcc7 cross-aarch64-gcc7
make ARCH=arm CROSS_COMPILE=arm-suse-linux-gnueabi- O=/scratch/arm-kernel sunxi_defconfig
make ARCH=arm CROSS_COMPILE=arm-suse-linux-gnueabi- O=/scratch/arm-kernel -j16
make ARCH=arm64 CROSS_COMPILE=aarch64-suse-linux- O=/scratch/arm64-kernel defconfig
make ARCH=arm64 CROSS_COMPILE=aarch64-suse-linux- O=/scratch/arm64-kernel -j16

从网络启动

首先,按照上述说明下载 JeOS rootfs 并安装归档文件。

$ mkdir rootfs
$ sudo tar xJf openSUSE-*-ARM-*.tar.xz -C rootfs

为 ARM 二进制文件设置 QEMU 翻译

# zypper in qemu-linux-user
# qemu-binfmt-conf.sh

准备环境

# mount --bind /proc rootfs/proc
# mount --bind /sys rootfs/sys
# mount --bind /dev rootfs/dev
# cp /etc/resolv.conf rootfs/etc/
# cp /usr/bin/qemu-arm* rootfs/usr/bin
# chroot rootfs

如果将其用于 aarch64 系统,请改为复制 /usr/bin/qemu-aarch64*。

您现在可以像在 ARM 板上一样运行命令,例如

# zypper in grub2-efi
# grub2-mknetdir  --net-directory=/srv/tftpboot --subdir=/boot/grub2-armv7
# zypper up
# zypper in tftpboot-installation-openSUSE-Tumbleweed-armv7hl
# zypper in -d u-boot-orangepizero
# zypper in dtb-sun8i

使用 grub2-mknetdir 时带上 --subdir 参数,以便您可以为每个架构编写单独的 grub.cfg。您需要为每个架构加载不同的内核二进制文件。

完成后,输入

# exit

您将回到之前的 文件系统。

并且不要忘记卸载 procsysdev

# umount rootfs/proc
# umount rootfs/sys
# umount rootfs/dev

您可以使用带有特定于供应商的工具的 u-boot 二进制文件来在您的开发板上安装/启动 u-boot。

您可以使用创建的 tftpboot 目录作为网络启动安装源。

您现在应该有一个 rootfs/srv/tftpboot/boot/grub2-something/ 包含 arm-efiarm64-efi 子目录。

编辑其中的 grub2.cfg 以包含类似以下内容

menuentry 'Tumbleweed Install' {
echo Loading linux
linux (tftp)openSUSE-Tumbleweed-armv7l/boot/armv7l/linux instsys=tftp://<your tftp server>/openSUSE-Tumbleweed-armv7l/boot/armv7l/root install=http://download.opensuse.org/ports/armv7hl/tumbleweed/repo/oss/ console=ttyS0,115200 loglevel=6 earlyprintk=serial
echo Loading initrd
initrd (tftp)openSUSE-Tumbleweed-armv7l/boot/armv7l/initrd
echo booting
boot
}

menuentry 'Tumbleweed Rescue' {
echo Loading linux
linux (tftp)openSUSE-Tumbleweed-armv7l/boot/armv7l/linux instsys=tftp://<your tftp server>/openSUSE-Tumbleweed-armv7l/boot/armv7l/root rescue=http://download.opensuse.org/ports/armv7hl/tumbleweed/repo/oss/ console=ttyS0,115200 loglevel=6 earlyprintk=serial
echo Loading initrd
initrd (tftp)openSUSE-Tumbleweed-armv7l/boot/armv7l/initrd
echo booting
boot
}

您也可以使用类似以下内容

set arch=armv7hl
set kernelarch=armv7l
source /boot/grub2/grub.cfg

并将上述示例中的 armv7larmv7hl 替换为 $kernelarch$arch 以获得所有架构的菜单。

将此 grub 目录移动到您机器上的 /srv/tftpboot 并安装 dhcptftp 服务器。还为您的发行版创建一个目录,并将 install.tar 中的文件放入其中。示例

mv rootfs/srv/tftpboot/boot /srv/tftpboot

或者如果您已经有用于不同平台的 grub

mv rootfs/srv/tftpboot/boot/grub2-* /srv/tftpboot/boot/

从 rootfs 移动 tftpboot 映像数据

mv rootfs/usr/share/tftpboot-installation/openSUSE-Tumbleweed-armv7l /srv/tftpboot

u-boot 在 tftp 服务器上的 /dtb 中寻找设备树。提供当前设备树很有用,因为 u-boot 中附带的设备树通常滞后于内核中的设备树。

mkdir /srv/tftpboot/dtb/
cp -v roofs.armv7/boot/dtb-*/*.dtb
cp sun8i-h2-plus-orangepi-zero.dtb /srv/tftpboot/dtb/

现在,如果您将 dhcp 服务器配置为发送 boot/grub2-armv7/arm-efi/core.efi,您的开发板应该会启动您刚刚写入的 grub2.cfg 文件。如果默认启动脚本未从网络加载 grub,您可以使用以下启动命令

dhcp ${kernel_addr_r} && tftpboot ${fdt_addr_r} dtb/${fdtfile} && bootefi ${kernel_addr_r} ${fdt_addr_r}

如果您想将相同的 dhcp 配置用于多个平台,您将需要通过开发板发送的 DHCP 选项来区分平台。对于 u-boot,armv7 dhcp 发现包如下所示

  Client-Ethernet-Address 02:42:49:9c:98:f8 (oui Unknown)
  Vendor-rfc1048 Extensions
    Magic Cookie 0x63825363
    DHCP-Message Option 53, length 1: Discover
    MSZ Option 57, length 2: 576
    ARCH Option 93, length 2: 21
    NDI Option 94, length 3: 1.0.0
    Vendor-Class Option 60, length 12: "U-Boot.armv7"
    Parameter-Request Option 55, length 5: 
      Subnet-Mask, Default-Gateway, Domain-Name-Server, Hostname
      RP

这对应于 32 位 u-boot 配置

CONFIG_BOOTP_PXE_CLIENTARCH=0x15 (21)
CONFIG_BOOTP_VCI_STRING="U-Boot.armv7"

对于 Raspberry Pi 3b+ 64 位 u-boot,您将得到

CONFIG_BOOTP_PXE_CLIENTARCH=0x16 (22)
CONFIG_BOOTP_VCI_STRING="U-Boot.armv8"

对于 Pi Zero (armv6),您将得到

CONFIG_BOOTP_PXE_CLIENTARCH=0x15 (21)
CONFIG_BOOTP_VCI_STRING="U-Boot.arm"

dnsmasq 示例

dhcp-vendorclass=set:armv6,U-Boot.arm
dhcp-vendorclass=set:armv7,U-Boot.armv7
dhcp-vendorclass=set:arm64,U-Boot.armv8
dhcp-boot=tag:armv6,boot/grub2-armv6/arm-efi/core.efi,tftpserver,10.11.12.13
dhcp-boot=tag:armv7,boot/grub2-armv7/arm-efi/core.efi,tftpserver,10.11.12.13
dhcp-boot=tag:arm64,boot/grub2-arm64/arm64-efi/core.efi,tftpserver,10.11.12.13

参见