mirror of https://github.com/armbian/build.git
qemu-uboot-arm64/qemu-uboot-x86: split more x86/arm64 differences, add some docs, bump to u-boot 23.04 +update-patches; add arm64 bootscript
This commit is contained in:
parent
5ad3caefee
commit
d9f2ec3255
|
@ -4,5 +4,56 @@ declare -g BOARDFAMILY="uefi-arm64"
|
|||
declare -g KERNEL_TARGET="current,edge"
|
||||
|
||||
declare -g UEFI_GRUB="skip" # Skip GRUB for this board
|
||||
declare -g SERIALCON="ttyS0"
|
||||
declare -g SERIALCON="ttyAMA0"
|
||||
declare -g QEMU_UBOOT_BOOTCONFIG="qemu_arm64_defconfig"
|
||||
|
||||
# qemu'ed uboot on arm64 can do extlinux.
|
||||
# declare -g SRC_EXTLINUX="yes"
|
||||
# declare -g SRC_CMDLINE="loglevel=7 console=ttyAMA0" # Those boards are serial-debug only; 'root=LABEL=armbi_root' ?
|
||||
# enable_extension "u-boot-menu" # this generates the extlinux.conf
|
||||
|
||||
function post_family_config__force_uboot_bin_and_use_uboot_menu_extlinux_arm64() {
|
||||
declare -g UBOOT_TARGET_MAP="all;;u-boot.bin"
|
||||
|
||||
# lets try with a bootscript. kernel does not start under extlinux...
|
||||
declare -g BOOTSCRIPT="boot-qemu-arm64.cmd:boot.cmd"
|
||||
}
|
||||
|
||||
# Export the u-boot.rom file next to the disk image, so it can be used as qemu's firmware via the -bios option.
|
||||
function pre_umount_final_image__export_uboot_rom() {
|
||||
: "${version:?version is not set}"
|
||||
local uboot_name="linux-u-boot-${BRANCH}-${BOARD}_${REVISION}_${ARCH}"
|
||||
display_alert "Exporting u-boot.bin" "${uboot_name} - ${version}.u-boot.bin" "debug"
|
||||
run_host_command_logged cp -pv "${MOUNT}/usr/lib/${uboot_name}/u-boot.bin" "${DESTIMG}/${version}.u-boot.bin"
|
||||
}
|
||||
|
||||
function board_docs__qemu-uboot-arm64() {
|
||||
: "${version:?version is not set}"
|
||||
|
||||
cat <<- DOCS
|
||||
## Running on qemu, via command line
|
||||
|
||||
\`\`\`bash
|
||||
# nvme stuff
|
||||
qemu-system-aarch64 -m 2048 -machine virt -nographic -cpu cortex-a57 \\
|
||||
-bios ${version}.u-boot.bin \\
|
||||
-drive if=none,file=${version}.img.qcow2,id=armbian \\
|
||||
-device nvme,drive=armbian,serial=serialnumber
|
||||
|
||||
# virtio, network
|
||||
# try with -accel kvm on supported neoverse systems
|
||||
qemu-system-aarch64 -m 2048 -machine virt -nographic -cpu cortex-a72 \\
|
||||
-bios ${version}.u-boot.bin -nic user,model=virtio-net-pci \\
|
||||
-drive if=none,media=disk,id=drive0,file=${version}.img.qcow2,discard=unmap,detect-zeroes=unmap \\
|
||||
-device virtio-blk-pci,drive=drive0,bootindex=0
|
||||
|
||||
\`\`\`
|
||||
|
||||
@TODO, see docs below.
|
||||
|
||||
## Docs
|
||||
|
||||
- https://u-boot.readthedocs.io/en/latest/board/emulation/qemu-arm.html
|
||||
- https://u-boot.readthedocs.io/en/latest/develop/devicetree/dt_qemu.html
|
||||
DOCS
|
||||
}
|
||||
|
|
|
@ -8,4 +8,49 @@ declare -g SERIALCON="ttyS0"
|
|||
|
||||
# u-boot's "x86_64" is incomplete; use the 32-bit version.
|
||||
declare -g QEMU_UBOOT_BOOTCONFIG="qemu-x86_defconfig"
|
||||
declare -g INITRD_ARCH='x86' # not really needed, but just in case
|
||||
declare -g INITRD_ARCH='x86' # input for mkimage, needed for extlinux
|
||||
|
||||
## qemu'ed uboot on x86 can do extlinux?
|
||||
#declare -g SRC_EXTLINUX="yes"
|
||||
#declare -g SRC_CMDLINE="loglevel=7 console=ttyS0" # Those boards are serial-debug only; 'root=LABEL=armbi_root' ?
|
||||
#enable_extension "u-boot-menu" # this generates the extlinux.conf
|
||||
|
||||
function post_family_config__force_uboot_rom_build_x86() {
|
||||
declare -g UBOOT_TARGET_MAP="all;;u-boot.rom" # Can't find the target that produces 'u-boot.rom', so for now 'make all'
|
||||
|
||||
# x86 requires a bootscript, since it's a bzImage and non-mkimage'd initrd; extlinux chokes.
|
||||
declare -g BOOTSCRIPT="boot-qemu-x86.cmd:boot.cmd"
|
||||
}
|
||||
|
||||
# Export the u-boot.rom file next to the disk image, so it can be used as qemu's firmware via the -bios option.
|
||||
function pre_umount_final_image__export_uboot_rom() {
|
||||
: "${version:?version is not set}"
|
||||
local uboot_name="linux-u-boot-${BRANCH}-${BOARD}_${REVISION}_${ARCH}"
|
||||
display_alert "Exporting u-boot.rom" "${uboot_name} - ${version}.u-boot.rom" "debug"
|
||||
run_host_command_logged cp -pv "${MOUNT}/usr/lib/${uboot_name}/u-boot.rom" "${DESTIMG}/${version}.u-boot.rom"
|
||||
}
|
||||
|
||||
function board_docs__qemu-uboot-x86() {
|
||||
: "${version:?version is not set}"
|
||||
cat <<- DOCS
|
||||
## Upstream docs
|
||||
|
||||
- https://u-boot.readthedocs.io/en/latest/arch/x86.html
|
||||
- https://u-boot.readthedocs.io/en/latest/board/emulation/qemu-x86.html
|
||||
|
||||
## Running on qemu, via command line
|
||||
|
||||
### On Linux (x86), with KVM acceleration
|
||||
|
||||
\`\`\`bash
|
||||
qemu-system-x86_64 -accel kvm -machine q35,vmport=off -smp 8 -nographic -bios ${version}.u-boot.rom -m 2048 -nic user,model=virtio-net-pci -device virtio-blk-pci,drive=drive0,bootindex=0 -drive if=none,media=disk,id=drive0,file=${version}.img.qcow2,discard=unmap,detect-zeroes=unmap
|
||||
\`\`\`
|
||||
|
||||
### On Mac (x86)
|
||||
|
||||
\`\`\`bash
|
||||
# -accel hvf does not work for me, u-boot hangs. this makes it unpractical on macos (monterey). probably also works under darwin/arm64, it's emulated anyway.
|
||||
qemu-system-x86_64 -machine q35,vmport=off -smp 8 -nographic -bios ${version}.u-boot.rom -m 2048 -nic user,model=virtio-net-pci -device virtio-blk-pci,drive=drive0,bootindex=0 -drive if=none,media=disk,id=drive0,file=${version}.img.qcow2,discard=unmap,detect-zeroes=unmap
|
||||
\`\`\`
|
||||
DOCS
|
||||
}
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
# do the virtio dance
|
||||
${devtype} scan
|
||||
${devtype} info
|
||||
ls ${devtype} ${devnum}:${distro_bootpart} /boot
|
||||
|
||||
# higher load address; the default causes the initrd to be overwritten when the bzImage is unpacked....
|
||||
#setenv ramdisk_addr_r 0x8000000
|
||||
echo "KERNEL LOAD ADDRESS: kernel_addr_r : ${kernel_addr_r}"
|
||||
echo "INITRD LOAD ADDRESS: ramdisk_addr_r: ${ramdisk_addr_r}"
|
||||
echo "FDT LOAD ADDRESS : fdt_addr : ${fdt_addr}"
|
||||
|
||||
# /vmlinuz and /initrd.img are standard Debian symlinks to the "latest installed kernel"
|
||||
load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} /vmlinuz
|
||||
# Attention, this is uInitrd for uboot/ARM; there's a symlink put there by Armbian hooks
|
||||
load ${devtype} ${devnum}:${distro_bootpart} ${ramdisk_addr_r} ${prefix}uInitrd
|
||||
|
||||
# boot params
|
||||
# @TODO: armbianEnv.txt, etc.
|
||||
setenv bootargs root=LABEL=armbi_root ro console=ttyAMA0
|
||||
|
||||
booti ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr}
|
|
@ -1,18 +1,20 @@
|
|||
# do the virtio dance
|
||||
${devtype} scan
|
||||
${devtype} info
|
||||
ls virtio ${devnum}:${distro_bootpart} /boot
|
||||
ls ${devtype} ${devnum}:${distro_bootpart} /boot
|
||||
|
||||
# higher load address; the default causes the initrd to be overwritten when the bzImage is unpacked....
|
||||
setenv ramdisk_addr_r 0x8000000
|
||||
echo KERNEL LOAD ADDRESS: kernel_addr_r: ${kernel_addr_r}
|
||||
echo INITRD LOAD ADDRESS: ramdisk_addr_r: ${ramdisk_addr_r}
|
||||
|
||||
load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} /boot/vmlinuz
|
||||
# /vmlinuz and /initrd.img are standard Debian symlinks to the "latest installed kernel"
|
||||
load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} /vmlinuz
|
||||
# Attention, this is the raw initrd.img, NOT uInitrd for uboot/ARM
|
||||
load ${devtype} ${devnum}:${distro_bootpart} ${ramdisk_addr_r} /boot/initrd.img
|
||||
load ${devtype} ${devnum}:${distro_bootpart} ${ramdisk_addr_r} /initrd.img
|
||||
|
||||
# boot params
|
||||
# @TODO: armbianEnv.txt, etc.
|
||||
setenv bootargs root=LABEL=armbi_root ro console=ttyS0
|
||||
|
||||
# zboot knows how to handle bzImage...
|
||||
|
|
|
@ -51,11 +51,11 @@ if [[ "${QEMU_UBOOT_BOOTCONFIG}" != "" ]]; then
|
|||
# Used in the qemu-uboot-x86 and qemu-uboot-arm64 "boards".
|
||||
display_alert "Using UEFI as base for qemu-uboot-${LINUXFAMILY}" "Using BOOTCONFIG: ${QEMU_UBOOT_BOOTCONFIG}" "debug"
|
||||
declare -g ATF_COMPILE="no"
|
||||
declare -g BOOTSCRIPT="boot-qemu-${LINUXFAMILY}.cmd:boot.cmd"
|
||||
|
||||
declare -g BOOTDIR="qemu-uboot-${LINUXFAMILY}"
|
||||
declare -g BOOTBRANCH='tag:v2023.01'
|
||||
declare -g BOOTBRANCH='tag:v2023.04'
|
||||
declare -g BOOTSOURCE='https://github.com/u-boot/u-boot' # Gotta set this again, it is unset by grub extension
|
||||
declare -g UBOOT_TARGET_MAP="all;;u-boot.rom" # Can't find the target that produces 'u-boot.rom', so for now 'make all'
|
||||
|
||||
declare -g BOOTCONFIG="${QEMU_UBOOT_BOOTCONFIG}"
|
||||
add_packages_to_image spice-vdagent qemu-guest-agent # Nice-to-have packages for running under qemu
|
||||
|
||||
|
@ -73,9 +73,4 @@ if [[ "${QEMU_UBOOT_BOOTCONFIG}" != "" ]]; then
|
|||
echo "Not writing uboot for qemu-uboot-xxxx platform"
|
||||
}
|
||||
|
||||
function pre_umount_final_image__export_uboot_rom() {
|
||||
local uboot_name="${CHOSEN_UBOOT}_${REVISION}_${ARCH}"
|
||||
display_alert "Exporting u-boot.rom" "${uboot_name} - ${version}.u-boot.rom" "debug"
|
||||
run_host_command_logged cp -pv "${MOUNT}/usr/lib/${uboot_name}/u-boot.rom" "${DESTIMG}/${version}.u-boot.rom" || true
|
||||
}
|
||||
fi
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
Subject: [PATCH] hack_x86_ramdisk_addr_and_boot_virtio_first
|
||||
---
|
||||
Index: include/configs/qemu-x86.h
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
diff --git a/include/configs/qemu-x86.h b/include/configs/qemu-x86.h
|
||||
--- a/include/configs/qemu-x86.h (revision 4debc57a3da6c3f4d3f89a637e99206f4cea0a96)
|
||||
+++ b/include/configs/qemu-x86.h (date 1669899370752)
|
||||
--- a/include/configs/qemu-x86.h (revision fd4ed6b7e83ec3aea9a2ce21baea8ca9676f40dd)
|
||||
+++ b/include/configs/qemu-x86.h (revision 8cbd5f0763ba2558020392dfcaddfcd5270e9aca)
|
||||
@@ -13,10 +13,9 @@
|
||||
#include <linux/sizes.h>
|
||||
|
||||
|
@ -24,19 +26,19 @@ Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
|||
<+>UTF-8
|
||||
===================================================================
|
||||
diff --git a/include/configs/x86-common.h b/include/configs/x86-common.h
|
||||
--- a/include/configs/x86-common.h (revision 4debc57a3da6c3f4d3f89a637e99206f4cea0a96)
|
||||
+++ b/include/configs/x86-common.h (date 1669899456091)
|
||||
@@ -50,7 +50,7 @@
|
||||
--- a/include/configs/x86-common.h (revision fd4ed6b7e83ec3aea9a2ce21baea8ca9676f40dd)
|
||||
+++ b/include/configs/x86-common.h (revision 8cbd5f0763ba2558020392dfcaddfcd5270e9aca)
|
||||
@@ -25,7 +25,7 @@
|
||||
*/
|
||||
|
||||
/* Default environment */
|
||||
#define CONFIG_ROOTPATH "/opt/nfsroot"
|
||||
#define CONFIG_HOSTNAME "x86"
|
||||
-#define CONFIG_RAMDISK_ADDR 0x4000000
|
||||
+#define CONFIG_RAMDISK_ADDR 0x8000000
|
||||
-#define CFG_RAMDISK_ADDR 0x4000000
|
||||
+#define CFG_RAMDISK_ADDR 0x8000000
|
||||
#if defined(CONFIG_GENERATE_ACPI_TABLE) || defined(CONFIG_EFI_STUB)
|
||||
#define CONFIG_OTHBOOTARGS "othbootargs=\0"
|
||||
#define CFG_OTHBOOTARGS "othbootargs=\0"
|
||||
#else
|
||||
@@ -77,7 +77,7 @@
|
||||
CONFIG_OTHBOOTARGS \
|
||||
@@ -52,7 +52,7 @@
|
||||
CFG_OTHBOOTARGS \
|
||||
"scriptaddr=0x7000000\0" \
|
||||
"kernel_addr_r=0x1000000\0" \
|
||||
- "ramdisk_addr_r=0x4000000\0" \
|
||||
|
|
|
@ -1,5 +1,13 @@
|
|||
--- a/configs/qemu-x86_defconfig 2022-12-01 12:44:02.389010874 +0000
|
||||
+++ b/configs/qemu-x86_defconfig 2022-12-01 12:52:35.218984706 +0000
|
||||
Subject: [PATCH] use_q35_dts_for_qemu-x86_defconfig
|
||||
---
|
||||
Index: configs/qemu-x86_defconfig
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
diff --git a/configs/qemu-x86_defconfig b/configs/qemu-x86_defconfig
|
||||
--- a/configs/qemu-x86_defconfig (revision 8cbd5f0763ba2558020392dfcaddfcd5270e9aca)
|
||||
+++ b/configs/qemu-x86_defconfig (revision a7508f38ea82842d4067d33643a6dae399bb0121)
|
||||
@@ -4,7 +4,7 @@
|
||||
CONFIG_NR_DRAM_BANKS=8
|
||||
CONFIG_ENV_SIZE=0x40000
|
||||
|
@ -9,14 +17,15 @@
|
|||
CONFIG_SMP=y
|
||||
CONFIG_GENERATE_PIRQ_TABLE=y
|
||||
CONFIG_GENERATE_MP_TABLE=y
|
||||
@@ -50,11 +50,13 @@
|
||||
@@ -51,6 +51,7 @@
|
||||
CONFIG_SYS_64BIT_LBA=y
|
||||
CONFIG_CPU=y
|
||||
CONFIG_NVME_PCI=y
|
||||
+CONFIG_DM_RNG=y
|
||||
CONFIG_SYS_NS16550_PORT_MAPPED=y
|
||||
CONFIG_SPI=y
|
||||
CONFIG_USB_KEYBOARD=y
|
||||
CONFIG_FRAMEBUFFER_SET_VESA_MODE=y
|
||||
@@ -58,5 +59,6 @@
|
||||
CONFIG_FRAMEBUFFER_VESA_MODE_USER=y
|
||||
CONFIG_FRAMEBUFFER_VESA_MODE=0x144
|
||||
CONFIG_CONSOLE_SCROLL_LINES=5
|
||||
|
|
Loading…
Reference in New Issue