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

[Firmware Bug]: Kernel image misaligned at boot, please fix your bootloader! #46

Open
paulmenzel opened this issue Feb 18, 2021 · 3 comments

Comments

@paulmenzel
Copy link
Contributor

The boot log of #45 shows the error below:

[    0.000000] [Firmware Bug]: Kernel image misaligned at boot, please fix your bootloader!

@chenglin-tsai, do you know, if that is present also Linux 5.6?

@chenglin-tsai
Copy link
Contributor

chenglin-tsai commented Feb 18, 2021

The boot log of #45 shows the error below:

[    0.000000] [Firmware Bug]: Kernel image misaligned at boot, please fix your bootloader!

@chenglin-tsai, do you know, if that is present also Linux 5.6?

Hi Paul,

Based on the test log on kernel 5.6.16 before. I didn't see such a warning message.

Test log on kernel 5.6.16:
dentOS_tn4810m_check_swp8_fiber_connection_and_all_other_ports_ok_01272020.log

I saw there is a solution for this warning here: raspberrypi/firmware#1415
Not sure whether this is the right solution.

@paulmenzel
Copy link
Contributor Author

Sorry, I should have checked first. Linux commit dd4bc60765 (arm64: warn on incorrect placement of the kernel by the bootloader) added that warning in Linux 5.8, so it couldn’t have been shown by Linux 5.6.

I saw there is a solution for this warning here: raspberrypi/firmware#1415

Do you mean adding kernel_address=0x200000? Unfortunately, I didn’t find a commit, where it’s visible in what file it’s done. I guess U-Boot?

@chenglin-tsai
Copy link
Contributor

chenglin-tsai commented Feb 18, 2021

Sorry, I should have checked first. Linux commit dd4bc60765 (arm64: warn on incorrect placement of the kernel by the bootloader) added that warning in Linux 5.8, so it couldn’t have been shown by Linux 5.6.

I saw there is a solution for this warning here: raspberrypi/firmware#1415

Do you mean adding kernel_address=0x200000? Unfortunately, I didn’t find a commit, where it’s visible in what file it’s done. I guess U-Boot?

Good news. We could change the kernel load address to 0x200000 in 'tools/flat-image-tree.py' to solve this issue. But I am not sure whether it will cause other side effects. Wait for confirmed.

        elif arch == 'arm64':
            self.load = "<0x200000>"
            self.entry = "<0x200000>"

src: https://github.com/dentproject/dentOS/blob/main/tools/flat-image-tree.py

Test log:
dentOS_tn48m_fix_arm64_kernel_load_address_to_0x20000_2021_0218.log

2021/02/19 updates:

 In arch/arm64/include/asm/boot.h:
/*
 * arm64 requires the kernel image to placed at a 2 MB aligned base address
 */
#define MIN_KIMG_ALIGN		SZ_2M

In arch/arm64/kernel/setup.c:
if (!efi_enabled(EFI_BOOT) && ((u64)_text % MIN_KIMG_ALIGN) != 0)
    pr_warn(FW_BUG "Kernel image misaligned at boot, please fix your bootloader!");

I think any kernel load address that mod by SZ_2M equals to zero can pass the check.
https://elixir.bootlin.com/linux/v5.10.4/source/arch/arm64/include/asm/boot.h
https://elixir.bootlin.com/linux/v5.10.4/source/arch/arm64/kernel/setup.c

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

2 participants