Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can not start from qemu, kernel hang. #1

Open
jason--liu opened this issue Apr 6, 2023 · 8 comments
Open

can not start from qemu, kernel hang. #1

jason--liu opened this issue Apr 6, 2023 · 8 comments

Comments

@jason--liu
Copy link

jason--liu commented Apr 6, 2023

qemu-system-aarch64 -nographic -bios u-boot.bin -cpu cortex-a53 -machine type=virt -smp 4 -m 2G -machine virtualization=true -drive if=none,file=virtio-sd.img,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 -device virtio-net-device,netdev=net0 -netdev user,id=net0,hostfwd=tcp:127.0.0.1:5555-:22

U-Boot 2023.04-rc5-00013-g86169cdcb0-dirty (Apr 03 2023 - 17:50:07 +0800)

DRAM: 2 GiB
Core: 51 devices, 14 uclasses, devicetree: board
Flash: 64 MiB
Loading Environment from Flash... *** Warning - bad CRC, using default environment

In: pl011@9000000
Out: pl011@9000000
Err: pl011@9000000
Net: eth0: virtio-net#30
Hit any key to stop autoboot: 0
=> fatload virtio 0:1 0x40000000 kernel.bin;fatload virtio 0:1 0x44000000 ramdisk.bin;fatload virtio 0:1 0x43e00000 qemu-arm64.dtb;booti 0x40000000 - 0x43e00000
221200 bytes read in 2 ms (105.5 MiB/s)
712704 bytes read in 2 ms (339.8 MiB/s)
4700 bytes read in 1 ms (4.5 MiB/s)
Flattened Device Tree blob at 43e00000
Booting using the fdt blob at 0x43e00000
Working FDT set to 43e00000
Using Device Tree in place at 0000000043e00000, end 0000000043e0425b
Working FDT set to 43e00000

Starting kernel ...

"Synchronous Abort" handler, esr 0x02000000
elr: ffffffff8010e0a4 lr : 0000000000002ca8 (reloc)
elr: 00000000400000a4 lr : 00000000bfef4ca8
x0 : 0000000000300000 x1 : 000000000000000f
x2 : 0000000000000000 x3 : 0000000000000000
x4 : 0000000040000000 x5 : 0000000000000001
x6 : 0000000000000008 x7 : 0000000000000000
x8 : 00000000beefe850 x9 : 0000000000000002
x10: 000000000a200023 x11: 0000000000000002
x12: 0000000000000002 x13: 00000000bfffffff
x14: 00000000c0000000 x15: 00000000bfef3700
x16: 00000000c0000000 x17: 0000000000000000
x18: 00000000beeb1db0 x19: 00000000bffe3988
x20: 0000000000000000 x21: 0000000000000000
x22: 0000000000000003 x23: 00000000beed12f8
x24: 0000000000000003 x25: 00000000beed12f8
x26: 0000000000000001 x27: 0000000043e00000
x28: 00000000beed1320 x29: 00000000bedb1970

Code: d5033fdf f100075f 540002c1 d28001e1 (d518cca1)
Resetting CPU ...

@lemin9538 please help check this problem, thanks.

@lemin9538
Copy link
Contributor

u-boot用个低版本的试试?感觉uboot有些东西没有设置好。

@jason--liu
Copy link
Author

jason--liu commented Apr 10, 2023

用了一个和README里面接近的版本,现象一样的。

qemu-system-aarch64 -nographic -bios u-boot.bin -cpu cortex-a53 -machine type=virt -smp 4 -m 2G -machine virtualization=true -drive if=none,file=virtio-sd.img,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 -device virtio-net-device,netdev=net0 -netdev user,id=net0,hostfwd=tcp:127.0.0.1:5555-:22

U-Boot 2019.07 (Apr 10 2023 - 14:08:43 +0800)

DRAM: 2 GiB
Flash: 128 MiB
*** Warning - bad CRC, using default environment

In: pl011@9000000
Out: pl011@9000000
Err: pl011@9000000
Net:
Warning: virtio-net#30 using MAC address from ROM
eth0: virtio-net#30
Hit any key to stop autoboot: 0
=> fatload virtio 0:1 0x40000000 kernel.bin;fatload virtio 0:1 0x44000000 ramdisk.bin;fatload virtio 0:1 0x43e00000 qemu-arm64.dtb;booti 0x40000000 - 0x43e00000
221200 bytes read in 2 ms (105.5 MiB/s)
712704 bytes read in 0 ms
4700 bytes read in 0 ms
Flattened Device Tree blob at 43e00000
Booting using the fdt blob at 0x43e00000
Loading Device Tree to 00000000bedfc000, end 00000000bee0025b ... OK

Starting kernel ...

"Synchronous Abort" handler, esr 0x02000000
elr: ffffffff800bd0a4 lr : 0000000000002344 (reloc)
elr: 00000000400000a4 lr : 00000000bff45344
x0 : 0000000000300000 x1 : 000000000000000f
x2 : 0000000000000000 x3 : 0000000000000000
x4 : 0000000040000000 x5 : 0000000000000001
x6 : 0000000000000008 x7 : 0000000000000000
x8 : 00000000bef31000 x9 : 0000000000000002
x10: 000000000a200023 x11: 0000000000000002
x12: 0000000000000002 x13: 0000000000000fbc
x14: 00000000bee018dc x15: 00000000bff44a60
x16: 0000000000000000 x17: 0000000000000000
x18: 00000000bef02de8 x19: 00000000bffd5d78
x20: 0000000000000000 x21: 0000000000000000
x22: 0000000000000003 x23: 00000000bef06da8
x24: 00000000bffc2d00 x25: 0000000000000000
x26: 0000000000000001 x27: 00000000bedfc000
x28: 0000000000000400 x29: 00000000bee019d0

Resetting CPU ...

resetting ...

@lemin9538
Copy link
Contributor

lemin9538 commented Apr 10, 2023

文档中的这个patch 打了吗?

diff --git a/common/image-fdt.c b/common/image-fdt.c
index eb552ca207..987817546d 100644
--- a/common/image-fdt.c
+++ b/common/image-fdt.c
@@ -175,6 +175,8 @@ int boot_relocate_fdt(struct lmb *lmb, char **of_flat_tree, ulong *of_size)
        if (fdt_high) {
                void *desired_addr = (void *)simple_strtoul(fdt_high, NULL, 16);
 
+               desired_addr = (void *)-1;
+
                if (((ulong) desired_addr) == ~0UL) {
                        /* All ones means use fdt in place */
                        of_start = fdt_blob;

@jason--liu
Copy link
Author

打上了的。
image

@lemin9538
Copy link
Contributor

221200 bytes read in 2 ms (105.5 MiB/s)
712704 bytes read in 0 ms
4700 bytes read in 0 ms
Flattened Device Tree blob at 43e00000
Booting using the fdt blob at 0x43e00000
Loading Device Tree to 00000000bedfc000, end 00000000bee0025b ... OK

从你这个log显示 没打上。你再检查下uboot编译。

@jason--liu
Copy link
Author

jason--liu commented Apr 11, 2023

重新clean后再编译,device tree 的地址看起来对了,但还是出现了同步异常。

qemu-system-aarch64 -nographic -bios u-boot.bin -cpu cortex-a53 -machine type=virt -smp 4 -m 2G -machine virtualization=true -drive if=none,file=virtio-sd.img,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 -device virtio-net-device,netdev=net0 -netdev user,id=net0,hostfwd=tcp:127.0.0.1:5555-:22

U-Boot 2019.07-dirty (Apr 11 2023 - 15:27:58 +0800)

DRAM: 2 GiB
Flash: 128 MiB
*** Warning - bad CRC, using default environment

In: pl011@9000000
Out: pl011@9000000
Err: pl011@9000000
Net:
Warning: virtio-net#30 using MAC address from ROM
eth0: virtio-net#30
Hit any key to stop autoboot: 0
=> fatload virtio 0:1 0x40000000 kernel.bin;fatload virtio 0:1 0x44000000 ramdisk.bin;fatload virtio 0:1 0x43e00000 qemu-arm64.dtb;booti 0x40000000 - 0x43e00000
=> fatload virtio 0:1 0x40000000 kernel.bin;fatload virtio 0:1 0x44000000 ramdisk.bin;fatload virtio 0:1 0x43e00000 qemu-arm64.
221200 bytes read in 2 ms (105.5 MiB/s)
712704 bytes read in 3 ms (226.6 MiB/s)
4700 bytes read in 1 ms (4.5 MiB/s)
Flattened Device Tree blob at 43e00000
Booting using the fdt blob at 0x43e00000
Using Device Tree in place at 0000000043e00000, end 0000000043e0425b

Starting kernel ...

"Synchronous Abort" handler, esr 0x02000000
elr: ffffffff800bd0a4 lr : 0000000000002344 (reloc)
elr: 00000000400000a4 lr : 00000000bff45344
x0 : 0000000000300000 x1 : 000000000000000f
x2 : 0000000000000000 x3 : 0000000000000000
x4 : 0000000040000000 x5 : 0000000000000001
x6 : 0000000000000008 x7 : 0000000000000000
x8 : 00000000bef31000 x9 : 0000000000000002
x10: 000000000a200023 x11: 0000000000000002
x12: 0000000000000002 x13: 0000000000000fbc
x14: 00000000bee018dc x15: 00000000bff44a60
x16: 0000000000000000 x17: 0000000000000000
x18: 00000000bef02de8 x19: 00000000bffd5cf8
x20: 0000000000000000 x21: 0000000000000000
x22: 0000000000000003 x23: 00000000bef06da8
x24: 00000000bffc2c90 x25: 0000000000000000
x26: 0000000000000001 x27: 0000000043e00000
x28: 0000000000000400 x29: 00000000bee019d0

Resetting CPU ...

resetting ...

U-Boot 2019.07-dirty (Apr 11 2023 - 15:27:58 +0800)

DRAM: 2 GiB
Flash: 128 MiB
*** Warning - bad CRC, using default environment

In: pl011@9000000
Out: pl011@9000000
Err: pl011@9000000
Net:
Warning: virtio-net#30 using MAC address from ROM
eth0: virtio-net#30
Hit any key to stop autoboot: 0
=> QEMU: Terminated

@lemin9538
Copy link
Contributor

那奇怪了,我在我这边跑下来是没有问题的。

@luanxg
Copy link

luanxg commented Oct 24, 2023

我也出现了上面崩溃的问题,最后通过修改qemu启动命令解决了

qemu-system-aarch64 -nographic -bios u-boot/u-boot.bin -cpu cortex-a53 -machine virt -smp 4 -m 2G -M virtualization=on,gic-version=3 -drive if=none,file=virtio-sd.img,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants