Skip to content

Commit

Permalink
Merge pull request #26 from coolsnowwolf/master
Browse files Browse the repository at this point in the history
20240115 日常更新 更新版本号
  • Loading branch information
xayane authored Jan 15, 2024
2 parents 95ea230 + 4ad82ac commit 5f9cc44
Show file tree
Hide file tree
Showing 234 changed files with 35,997 additions and 496 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# 欢迎来到 Lean 的 LEDE 源码仓库

为国产龙芯 LOONGSON SoC loongarch64 架构添加支持

I18N: [English](README_EN.md) | [简体中文](README.md) | [日本語](README_JA.md)

## 官方讨论群
Expand Down
11 changes: 6 additions & 5 deletions config/Config-images.in
Original file line number Diff line number Diff line change
Expand Up @@ -198,15 +198,15 @@ menu "Target Images"
default ""

config GRUB_IMAGES
bool "Build GRUB images (Linux x86 or x86_64 host only)"
bool "Build GRUB images"
depends on TARGET_x86
depends on TARGET_ROOTFS_EXT4FS || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS
select PACKAGE_grub2
default n

config GRUB_EFI_IMAGES
bool "Build GRUB EFI images (Linux x86 or x86_64 host only)"
depends on TARGET_x86 || TARGET_armvirt
bool "Build GRUB EFI images"
depends on TARGET_x86 || TARGET_armvirt || TARGET_loongarch64
depends on TARGET_ROOTFS_EXT4FS || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS
select PACKAGE_grub2 if TARGET_x86
select PACKAGE_grub2-efi if TARGET_x86
Expand Down Expand Up @@ -276,7 +276,7 @@ menu "Target Images"

config VMDK_IMAGES
bool "Build VMware image files (VMDK)"
depends on TARGET_x86 || TARGET_armvirt
depends on TARGET_x86 || TARGET_armvirt || TARGET_loongarch64
depends on GRUB_IMAGES || GRUB_EFI_IMAGES
default y
select PACKAGE_kmod-e1000
Expand All @@ -289,7 +289,7 @@ menu "Target Images"

config TARGET_IMAGES_GZIP
bool "GZip images"
depends on TARGET_ROOTFS_EXT4FS || TARGET_x86 || TARGET_armvirt || TARGET_malta
depends on TARGET_ROOTFS_EXT4FS || TARGET_x86 || TARGET_armvirt || TARGET_loongarch64 || TARGET_malta
default y

comment "Image Options"
Expand All @@ -308,6 +308,7 @@ menu "Target Images"
config TARGET_ROOTFS_PARTSIZE
int "Root filesystem partition size (in MiB)"
depends on USES_ROOTFS_PART || TARGET_ROOTFS_EXT4FS
default 232 if TARGET_loongarch64
default 400 if TARGET_x86
default 160
help
Expand Down
4 changes: 2 additions & 2 deletions include/kernel-5.15
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
LINUX_VERSION-5.15 = .145
LINUX_KERNEL_HASH-5.15.145 = b2a49d87605f3a9491581150315e22337c1afb599efc1e2737481be3a2d6d620
LINUX_VERSION-5.15 = .146
LINUX_KERNEL_HASH-5.15.146 = 5a807a5fa2a80ada957d8079681dfb5cc196ec26f43244d1c8a4fd7af592d192
4 changes: 2 additions & 2 deletions include/kernel-5.4
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
LINUX_VERSION-5.4 = .265
LINUX_KERNEL_HASH-5.4.265 = 4dae99e49f466d4689e128ec023754908147159d7462019a83c7da1f25df9b15
LINUX_VERSION-5.4 = .266
LINUX_KERNEL_HASH-5.4.266 = da072f7e6fe719c01e517cac1fa9988b2f5fa87d62a8501b7dc16d3b62b2acb6
2 changes: 2 additions & 0 deletions include/kernel-6.6
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
LINUX_VERSION-6.6 = .10
LINUX_KERNEL_HASH-6.6.10 = 9ee627e4c109aec7fca3eda5898e81d201af2c7eb2f7d9d7d94c1f0e1205546c
2 changes: 2 additions & 0 deletions include/kernel.mk
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ else ifneq (,$(findstring $(ARCH) , arceb ))
LINUX_KARCH := arc
else ifneq (,$(findstring $(ARCH) , armeb ))
LINUX_KARCH := arm
else ifneq (,$(findstring $(ARCH) , loongarch64 ))
LINUX_KARCH := loongarch
else ifneq (,$(findstring $(ARCH) , mipsel mips64 mips64el ))
LINUX_KARCH := mips
else ifneq (,$(findstring $(ARCH) , powerpc64 ))
Expand Down
30 changes: 30 additions & 0 deletions include/site/loongarch64
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/sh
. $TOPDIR/include/site/linux
ac_cv_c_littleendian=${ac_cv_c_littleendian=yes}
ac_cv_c_bigendian=${ac_cv_c_bigendian=no}

ac_cv_sizeof___int64=0
ac_cv_sizeof_char=1
ac_cv_sizeof_int=4
ac_cv_sizeof_int16_t=2
ac_cv_sizeof_int32_t=4
ac_cv_sizeof_int64_t=8
ac_cv_sizeof_long_int=8
ac_cv_sizeof_long_long=8
ac_cv_sizeof_long=8
ac_cv_sizeof_off_t=8
ac_cv_sizeof_short_int=2
ac_cv_sizeof_short=2
ac_cv_sizeof_size_t=8
ac_cv_sizeof_ssize_t=8
ac_cv_sizeof_u_int16_t=2
ac_cv_sizeof_u_int32_t=4
ac_cv_sizeof_u_int64_t=8
ac_cv_sizeof_uint16_t=2
ac_cv_sizeof_uint32_t=4
ac_cv_sizeof_uint64_t=8
ac_cv_sizeof_unsigned_int=4
ac_cv_sizeof_unsigned_long=8
ac_cv_sizeof_unsigned_long_long=8
ac_cv_sizeof_unsigned_short=2
ac_cv_sizeof_void_p=8
5 changes: 5 additions & 0 deletions include/target.mk
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,11 @@ ifeq ($(DUMP),1)
CPU_TYPE ?= riscv64
CPU_CFLAGS_riscv64:=-mabi=lp64d -march=rv64imafdc
endif
ifeq ($(ARCH),loongarch64)
CPU_TYPE ?= generic
CPU_CFLAGS := -O2 -pipe
CPU_CFLAGS_generic:=-march=loongarch64
endif
ifneq ($(CPU_TYPE),)
ifndef CPU_CFLAGS_$(CPU_TYPE)
$(warning CPU_TYPE "$(CPU_TYPE)" doesn't correspond to a known type)
Expand Down
36 changes: 27 additions & 9 deletions package/boot/grub2/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk

PKG_NAME:=grub
PKG_VERSION:=2.06
PKG_RELEASE:=$(AUTORELEASE)
PKG_VERSION:=2.12
PKG_RELEASE:=6

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=@GNU/grub
PKG_HASH:=b79ea44af91b93d17cd3fe80bdae6ed43770678a9a5ae192ccea803ebb657ee1
PKG_HASH:=f3c97391f7c4eaa677a78e090c7e97e6dc47b16f655f04683ebd37bef7fe0faa

PKG_LICENSE:=GPL-3.0-or-later
PKG_CPE_ID:=cpe:/a:gnu:grub2
Expand All @@ -25,6 +25,7 @@ ifneq ($(BUILD_VARIANT),none)
endif

PKG_FLAGS:=nonshared
PKG_BUILD_FLAGS:=no-gc-sections no-lto no-mold

include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/package.mk
Expand All @@ -40,7 +41,8 @@ endef

Package/grub2=$(call Package/grub2/Default,x86,pc)
Package/grub2-efi=$(call Package/grub2/Default,x86,efi)
Package/grub2-efi-arm=$(call Package/grub2/Default,armvirt,efi)
Package/grub2-efi-arm=$(call Package/grub2/Default,armsr,efi)
Package/grub2-efi-loongarch64=$(call Package/grub2/Default,loongarch64,efi)

define Package/grub2-editenv
CATEGORY:=Utilities
Expand Down Expand Up @@ -127,14 +129,14 @@ define Package/grub2/install
-O i386-pc \
-c $(PKG_BUILD_DIR)/grub-early.cfg \
-o $(STAGING_DIR_IMAGE)/grub2/gpt-core.img \
at_keyboard biosdisk boot chain configfile fat linux ls part_gpt reboot search serial vga
at_keyboard biosdisk boot chain configfile fat linux ls part_gpt reboot search serial test vga
$(STAGING_DIR_HOST)/bin/grub-mkimage \
-d $(PKG_BUILD_DIR)/grub-core \
-p /boot/grub \
-O i386-pc \
-c ./files/grub-early.cfg \
-o $(STAGING_DIR_IMAGE)/grub2/generic-core.img \
at_keyboard biosdisk boot chain configfile ext2 linux ls part_msdos reboot search serial vga
at_keyboard biosdisk boot chain configfile ext2 linux ls part_msdos reboot search serial test vga
$(STAGING_DIR_HOST)/bin/grub-mkimage \
-d $(PKG_BUILD_DIR)/grub-core \
-p /boot/grub \
Expand All @@ -159,7 +161,7 @@ define Package/grub2-efi/install
-O $(CONFIG_ARCH)-efi \
-c $(PKG_BUILD_DIR)/grub-early.cfg \
-o $(STAGING_DIR_IMAGE)/grub2/boot$(if $(CONFIG_x86_64),x64,ia32).efi \
at_keyboard boot chain configfile fat linux ls part_gpt reboot serial efi_gop efi_uga
at_keyboard boot chain configfile fat linux ls part_gpt reboot serial test efi_gop efi_uga
$(STAGING_DIR_HOST)/bin/grub-mkimage \
-d $(PKG_BUILD_DIR)/grub-core \
-p /boot/grub \
Expand All @@ -178,14 +180,29 @@ define Package/grub2-efi-arm/install
-O arm$(if $(CONFIG_aarch64),64,)-efi \
-c $(PKG_BUILD_DIR)/grub-early.cfg \
-o $(STAGING_DIR_IMAGE)/grub2/boot$(if $(CONFIG_aarch64),aa64,arm).efi \
boot chain configfile fat linux ls part_gpt reboot search search_fs_uuid search_label serial efi_gop lsefi minicmd
boot chain configfile fat linux ls part_gpt part_msdos reboot search \
search_fs_uuid search_label serial efi_gop lsefi minicmd ext2
$(STAGING_DIR_HOST)/bin/grub-mkimage \
-d $(PKG_BUILD_DIR)/grub-core \
-p /boot/grub \
-O arm$(if $(CONFIG_aarch64),64,)-efi \
-c ./files/grub-early.cfg \
-o $(STAGING_DIR_IMAGE)/grub2/iso-bootaa$(if $(CONFIG_aarch64),aa64,arm).efi \
boot chain configfile fat iso9660 linux ls lsefi minicmd part_msdos part_gpt reboot serial test efi_gop
boot chain configfile fat iso9660 linux ls lsefi minicmd part_msdos part_gpt \
reboot serial test efi_gop
endef

define Package/grub2-efi-loongarch64/install
$(INSTALL_DIR) $(STAGING_DIR_IMAGE)/grub2
cp ./files/grub-early-gpt.cfg $(PKG_BUILD_DIR)/grub-early.cfg
$(STAGING_DIR_HOST)/bin/grub-mkimage \
-d $(PKG_BUILD_DIR)/grub-core \
-p /boot/grub \
-O loongarch64-efi \
-c $(PKG_BUILD_DIR)/grub-early.cfg \
-o $(STAGING_DIR_IMAGE)/grub2/bootloongarch64.efi \
boot chain configfile fat linux ls lsefi minicmd part_gpt part_msdos reboot search \
search_fs_uuid search_label serial efi_gop all_video gfxterm ext2
endef


Expand All @@ -203,5 +220,6 @@ $(eval $(call HostBuild))
$(eval $(call BuildPackage,grub2))
$(eval $(call BuildPackage,grub2-efi))
$(eval $(call BuildPackage,grub2-efi-arm))
$(eval $(call BuildPackage,grub2-efi-loongarch64))
$(eval $(call BuildPackage,grub2-editenv))
$(eval $(call BuildPackage,grub2-bios-setup))
2 changes: 1 addition & 1 deletion package/boot/grub2/files/grub-early-gpt.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
search --set=root --label kernel
configfile ($root)/boot/grub/grub.cfg
configfile ($root)/efi/openwrt/grub.cfg
36 changes: 36 additions & 0 deletions package/boot/grub2/patches/001-add-missing-extra_deps-list.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
From 4d4dae6a52b1749642261a15f5dcc1e3d4150b36 Mon Sep 17 00:00:00 2001
From: Julien Olivain <ju.o@free.fr>
Date: Fri, 22 Dec 2023 19:02:53 +0100
Subject: [PATCH] Add missing grub-core/extra_deps.lst file in release tarball

A file is missing in the grub-2.12 release tarballs (both .gz and .xz).
See [1]. The issue was reported in [2] and fixed upstream in [3].

This patch adds the missing file, on top of the release tarball. This
patch won't apply on upstream git, since the file is present in the
source repository. Since the issue is fixed upstream in [3], it is
expected upcoming releases tarballs will include the file.

The file content was fetched from the upstream git repo:
https://git.savannah.gnu.org/gitweb/?p=grub.git;a=blob_plain;f=grub-core/extra_deps.lst;hb=refs/tags/grub-2.12

[1] https://ftp.gnu.org/gnu/grub/grub-2.12.tar.xz
[2] https://lists.gnu.org/archive/html/grub-devel/2023-12/msg00054.html
[3] https://git.savannah.gnu.org/gitweb/?p=grub.git;a=commit;h=b835601c7639ed1890f2d3db91900a8506011a8e

Signed-off-by: Julien Olivain <ju.o@free.fr>
Upstream: Fixed by: https://git.savannah.gnu.org/gitweb/?p=grub.git;a=commit;h=b835601c7639ed1890f2d3db91900a8506011a8e
---
grub-core/extra_deps.lst | 1 +
1 file changed, 1 insertion(+)
create mode 100644 grub-core/extra_deps.lst

diff --git a/grub-core/extra_deps.lst b/grub-core/extra_deps.lst
new file mode 100644
index 0000000..f44ad6a
--- /dev/null
+++ b/grub-core/extra_deps.lst
@@ -0,0 +1 @@
+depends bli part_gpt
--
2.43.0
13 changes: 9 additions & 4 deletions package/devel/binutils/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=binutils
PKG_VERSION:=2.38
PKG_VERSION:=2.40
PKG_RELEASE:=1

PKG_SOURCE_URL:=@GNU/binutils
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_VERSION:=$(PKG_VERSION)
PKG_HASH:=e316477a914f567eccc34d5d29785b8b0f5a10208d36bbacedcc39048ecfe024
PKG_HASH:=0f8a4c272d7f17f369ded10a4aca28b8e304828e95526da482b0ccc4dfc9d8e1

PKG_FIXUP:=patch-libtool
PKG_LIBTOOL_PATHS:=. gas bfd opcodes gprof binutils ld libiberty gold intl
PKG_LIBTOOL_PATHS:=. gas bfd opcodes gprof gprofng binutils ld libiberty gold intl libctf libsframe
PKG_REMOVE_FILES:=libtool.m4
PKG_INSTALL:=1

Expand Down Expand Up @@ -87,7 +87,11 @@ CONFIGURE_ARGS += \
--enable-shared \
--enable-install-libiberty \
--enable-install-libbfd \
--enable-install-libctf
--enable-install-libctf \
--with-system-zlib \
--without-zstd \
--without-msgpack \
--disable-gprofng

define Build/Install
$(call Build/Install/Default)
Expand All @@ -105,6 +109,7 @@ endef
define Package/libbfd/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libbfd*.so* $(1)/usr/lib/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libsframe*.so* $(1)/usr/lib/
endef

define Package/libctf/install
Expand Down
88 changes: 88 additions & 0 deletions package/devel/binutils/patches/001-replace-attribute_const.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
Fix this compile error:
----------------------
./../common/cpuid.c:27:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__get_cpuid'
27 | __get_cpuid (unsigned int op ATTRIBUTE_UNUSED, unsigned int *eax,
| ^~~~~~~~~~~
----------------------

and this error:
----------------------
unwind.c: In function '__collector_ext_return_address':
unwind.c:236:34: error: '__u64' undeclared (first use in this function)
236 | context->uc_mcontext.sp = (__u64) __builtin_frame_address(0); \
| ^~~~~
unwind.c:490:3: note: in expansion of macro 'FILL_CONTEXT'
490 | FILL_CONTEXT ((&context));

----------------------
--- a/gprofng/common/cpuid.c
+++ b/gprofng/common/cpuid.c
@@ -23,7 +23,7 @@
#elif defined(__aarch64__)
#define ATTRIBUTE_UNUSED __attribute__((unused))

-static inline uint_t __attribute_const__
+static inline uint_t __attribute__((__const__))
__get_cpuid (unsigned int op ATTRIBUTE_UNUSED, unsigned int *eax,
unsigned int *ebx ATTRIBUTE_UNUSED,
unsigned int *ecx ATTRIBUTE_UNUSED, unsigned int *edx ATTRIBUTE_UNUSED)
--- a/gprofng/libcollector/unwind.c
+++ b/gprofng/libcollector/unwind.c
@@ -233,7 +233,7 @@ memory_error_func (int status ATTRIBUTE_
#elif ARCH(Aarch64)
#define FILL_CONTEXT(context) \
{ CALL_UTIL (getcontext) (context); \
- context->uc_mcontext.sp = (__u64) __builtin_frame_address(0); \
+ context->uc_mcontext.sp = (uint64_t) __builtin_frame_address(0); \
}

#endif /* ARCH() */
@@ -4579,11 +4579,11 @@ stack_unwind (char *buf, int size, void
if (buf && bptr && eptr && context && size + mode > 0)
getByteInstruction ((unsigned char *) eptr);
int ind = 0;
- __u64 *lbuf = (void *) buf;
- int lsize = size / sizeof (__u64);
- __u64 pc = context->uc_mcontext.pc;
- __u64 sp = context->uc_mcontext.sp;
- __u64 stack_base;
+ uint64_t *lbuf = (void *) buf;
+ int lsize = size / sizeof (uint64_t);
+ uint64_t pc = context->uc_mcontext.pc;
+ uint64_t sp = context->uc_mcontext.sp;
+ uint64_t stack_base;
unsigned long tbgn = 0;
unsigned long tend = 0;

@@ -4594,7 +4594,7 @@ stack_unwind (char *buf, int size, void
{
stack_base = sp + 0x100000;
if (stack_base < sp) // overflow
- stack_base = (__u64) -1;
+ stack_base = (uint64_t) -1;
}
DprintfT (SP_DUMP_UNWIND,
"unwind.c:%d stack_unwind %2d pc=0x%llx sp=0x%llx stack_base=0x%llx\n",
@@ -4625,17 +4625,17 @@ stack_unwind (char *buf, int size, void
__LINE__, (unsigned long) sp);
break;
}
- pc = ((__u64 *) sp)[1];
- __u64 old_sp = sp;
- sp = ((__u64 *) sp)[0];
+ pc = ((uint64_t *) sp)[1];
+ uint64_t old_sp = sp;
+ sp = ((uint64_t *) sp)[0];
if (sp < old_sp)
break;
}
if (ind >= lsize)
{
ind = lsize - 1;
- lbuf[ind++] = (__u64) SP_TRUNC_STACK_MARKER;
+ lbuf[ind++] = (uint64_t) SP_TRUNC_STACK_MARKER;
}
- return ind * sizeof (__u64);
+ return ind * sizeof (uint64_t);
}
#endif /* ARCH() */
Loading

0 comments on commit 5f9cc44

Please sign in to comment.