Re: I Failed to execute AARCH64 Linux kernel on the QEMU

2024-01-31 Thread Peter Maydell
On Wed, 31 Jan 2024 at 12:12, Minjun Hong  wrote:
>
> Hello.
>
> I'm trying to execute AARCH64 Linux kernel on the QEMU.
>
> But,there was an error and the error log is:
>>
>> rom: requested regions overlap (rom bootloader. free=0x422c0a00, 
>> addr=0x4000)
>> qemu-system-aarch64: rom check and register reset failed
>
>
>  And my development environment is:
>>
>> host: x86_64 Ubuntu 18.04
>> linux kernel source version: v5.19
>> busybox version(for initramfs): 1_36_stable

You don't say what QEMU version you're using.

If it's the version from Ubuntu 18.04, that is now really
quite old, so I would start by trying a newer QEMU.

You should also use a newer Ubuntu, because (a) 18.04
is no longer supported as a build platform for current
QEMU and (b) 18.04 fell out of security support last year,
so you're already overdue to migrate away from it.

If nothing else, a newer QEMU has improved that particular
error message so it gives better detail about exactly
what binary blobs are overlapping and causing the problem.

thanks
-- PMM



I Failed to execute AARCH64 Linux kernel on the QEMU

2024-01-31 Thread Minjun Hong
Hello.

I'm trying to execute AARCH64 Linux kernel on the QEMU.

But,there was an error and the error log is:

> rom: requested regions overlap (rom bootloader. free=0x422c0a00, 
> addr=0x4000)
> qemu-system-aarch64: rom check and register reset failed
>
>
 And my development environment is:

> host: x86_64 Ubuntu 18.04
> linux kernel source version: v5.19
> busybox version(for initramfs): 1_36_stable
>
>
 I cannot find what I should check first. I mean, I'm lost. So, I need help.

What I did to achieve my goal is as following:

1. Linux kernel build for AARCH64

- apply defconfig

> make ARCH=arm64 defconfig -j$(nproc) CROSS_COMPILE=aarch64-linux-gnu-
>
> -  set 'CONFIG_BLK_DEV_RAM' config by using menuconfig to use RAM disk
- build kernel

> make ARCH=arm64 -j$(nproc) CROSS_COMPILE=aarch64-linux-gnu-
>
>
2.  Build 'busybox' to make initramfs.gz
- apply defconfig

> make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- defconfig
>
> -  set 'CONFIG_STATIC' config by using menuconfig to build the libraries
as static library form.
- build busybox

> make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j$(nproc)
>

 - install busybox

> make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- install
>

- make initramfs.gz

> cd _install
> mkdir -p dev etc/init.d home/root lib mnt proc root sys tmp usr/lib var
> cp -v /usr/aarch64-linux-gnu/lib/* ./lib/
>
> cat > etc/init.d/rcS << EOF
> #!/bin/sh
> mount -t proc none /proc
> mount -t sysfs none /sys
> /sbin/mdev -s
> [ ! -h /etc/mtab ]  && ln -s /proc/mounts /etc/mtab
> [ ! -f /etc/resolv.conf ] && cat /proc/net/pnp > /etc/resolv.conf
> EOF
>
> chmod +x etc/init.d/rcS
> find . | cpio -o --format=newc > ../initramfs
> cd ..
> gzip -vc initramfs > initramfs.gz
>
> - install qemu

> sudo apt install qemu-system-arm qemu-efi-aarch64
>
>
-  execute qemu

> qemu-system-aarch64 \

-machine virt \

-cpu cortex-a57 \

-smp 4 \

-m 2048 \

-kernel arch/arm64/boot/Image \

-initrd busybox/initramfs.gz \

-append "rdinit=/sbin/init root=/dev/ram rootfstype=ramfs rw nokaslr" \

-nographic
>

 If you have any idea about this problem, please help me. Thanks!