Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

add LoongArch64 support for grub #1

Closed
wants to merge 39 commits into from
Closed

add LoongArch64 support for grub #1

wants to merge 39 commits into from

Conversation

zwaizwai
Copy link

No description provided.

@yetist yetist requested review from a team, yetist, hudsonzuo, Angie-JA-Dou, wqfree, sdlaqz and tong2357 and removed request for a team, yetist, hudsonzuo, Angie-JA-Dou, wqfree, sdlaqz and tong2357 May 28, 2021 10:19
@xen0n
Copy link
Contributor

xen0n commented May 28, 2021

这个有点长,我需要看3到4天时间,预定一个 review 坑位

@@ -0,0 +1,26 @@
diff --git a/build-aux/config.guess b/build-aux/config.guess
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个文件方便测试用的,应该在最终提交中去掉。

@@ -98,4 +98,5 @@ bootstrap_post_import_hook () {

bootstrap_epilogue () {
mv INSTALL.grub INSTALL
patch -p1 -i "grub-core/lib/gnulib-patches/loongarch.patch"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

只为测试使用,正式提交中应去掉。

grub-core/lib/loongarch64/efi/loongarch64.c Outdated Show resolved Hide resolved
include/grub/loongarch64/time.h Show resolved Hide resolved
util/grub-mkimagexx.c Outdated Show resolved Hide resolved
util/grub-mkimagexx.c Outdated Show resolved Hide resolved
@yetist
Copy link
Contributor

yetist commented Jun 29, 2021

@loongarch64/dev-team 请大家有空review一下grub,谢谢。

include/grub/loongarch64/memory.h Outdated Show resolved Hide resolved
grub-core/loader/loongarch64/linux.c Outdated Show resolved Hide resolved
grub-core/loader/loongarch64/linux.c Outdated Show resolved Hide resolved
grub-core/kern/loongarch64/efi/init.c Show resolved Hide resolved
grub-core/lib/loongarch64/efi/loongarch64.c Outdated Show resolved Hide resolved
grub-core/lib/loongarch64/efi/loongarch64.c Outdated Show resolved Hide resolved
#include <grub/symbol.h>

FUNCTION (grub_arch_sync_caches)
jirl $zero,$ra,0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

新的推上游的工具链都支持 jr $ra,不用写原始指令了,读起来顺一点

include/grub/elf.h Outdated Show resolved Hide resolved
include/grub/efi/pe32.h Outdated Show resolved Hide resolved
grub-core/lib/loongarch64/relocator.c Outdated Show resolved Hide resolved
static void
write_jump (int regn, void **target)
{
grub_uint32_t andi=0x4c000000;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. #define
  2. 0x4c000000 不是 jirl 吗?为啥写 andi

util/grub-mkimagexx.c Outdated Show resolved Hide resolved
util/grub-mkimagexx.c Outdated Show resolved Hide resolved
util/grub-mkimagexx.c Outdated Show resolved Hide resolved
@@ -1969,12 +2192,18 @@ make_reloc_section (Elf_Ehdr *e, struct grub_mkimage_layout *layout,
if ((grub_target_to_host32 (s->sh_type) == SHT_REL) ||
(grub_target_to_host32 (s->sh_type) == SHT_RELA))
{
Elf_Rel *r;
Elf_Rela *r;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这边是重构了以前已有的代码?建议拆提交。上游不会允许一整个大提交同时做这么多事情

util/grub-mkimagexx.c Outdated Show resolved Hide resolved
conf/Makefile.common Outdated Show resolved Hide resolved
@@ -1133,6 +1139,9 @@ main (int argc, char *argv[])
case GRUB_INSTALL_PLATFORM_RISCV64_EFI:
efi_file = "BOOTRISCV64.EFI";
break;
case GRUB_INSTALL_PLATFORM_LOONGARCH64_EFI:
efi_file = "BOOTLOONGARCH64.EFI";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

目前无论 CLFS 或者 Loongnix 提供的可用系统镜像中,这个文件都叫 BOOTLOONGARCH.EFI,可能在 UEFI 上游标准正式添加 LA 支持之前,这边要改成和真机默认行为一样?

@yetist yetist changed the base branch from la64/master to master December 20, 2021 06:26
@yetist yetist changed the base branch from master to la64/master December 20, 2021 06:26
@xen0n
Copy link
Contributor

xen0n commented Dec 20, 2021

commit e8c9f07 这是之前传言了一阵子的删除旧固件兼容性的提交吗?

Signed-off-by: Yang Qiming <yangqiming@loongson.cn>
@xen0n
Copy link
Contributor

xen0n commented May 18, 2023

Closing as the port is merged upstream; see #5 #6.

@xen0n xen0n closed this May 18, 2023
yetist pushed a commit that referenced this pull request Jul 4, 2023
Currently bootstrap complains in the following way when
patching gnulib files:

  patching file argp-help.c
  Hunk #1 succeeded at 52 (offset 1 line).
  Hunk #2 succeeded at 1548 (offset 115 lines).
  patching file mbswidth.c
  patching file mbswidth.h
  Hunk #1 succeeded at 40 (offset -5 lines).

Let's fix it by amending line numbers in the patch.

Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
Reviewed-by: Alec Brown <alec.r.brown@oracle.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants