From ada9a1650ad197d9337f7562331143c6bcd92dc6 Mon Sep 17 00:00:00 2001 From: David P Date: Jan 20 2024 22:12:40 +0000 Subject: addpkg: libre/linux-libre-rt 6.6.5.16.realtime1-1 Signed-off-by: David P. --- diff --git a/libre/linux-libre-rt/0001-ARM-atags-add-support-for-Marvell-s-u-boot.patch b/libre/linux-libre-rt/0001-ARM-atags-add-support-for-Marvell-s-u-boot.patch new file mode 100644 index 0000000..d4c3cf0 --- /dev/null +++ b/libre/linux-libre-rt/0001-ARM-atags-add-support-for-Marvell-s-u-boot.patch @@ -0,0 +1,51 @@ +From 4533007cef1bd1da546752b372234b9bb9548214 Mon Sep 17 00:00:00 2001 +From: Willy Tarreau +Date: Sun, 2 Dec 2012 19:59:28 +0100 +Subject: [PATCH 1/7] ARM: atags: add support for Marvell's u-boot + +Marvell uses a specific atag in its u-boot which includes among other +information the MAC addresses for up to 4 network interfaces. + +Signed-off-by: Willy Tarreau +--- + arch/arm/include/uapi/asm/setup.h | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +diff --git a/arch/arm/include/uapi/asm/setup.h b/arch/arm/include/uapi/asm/setup.h +index 25ceda63b284..83578c54975b 100644 +--- a/arch/arm/include/uapi/asm/setup.h ++++ b/arch/arm/include/uapi/asm/setup.h +@@ -144,6 +144,18 @@ struct tag_memclk { + __u32 fmemclk; + }; + ++/* Marvell uboot parameters */ ++#define ATAG_MV_UBOOT 0x41000403 ++struct tag_mv_uboot { ++ __u32 uboot_version; ++ __u32 tclk; ++ __u32 sysclk; ++ __u32 isUsbHost; ++ __u8 macAddr[4][6]; ++ __u16 mtu[4]; ++ __u32 nand_ecc; ++}; ++ + struct tag { + struct tag_header hdr; + union { +@@ -166,6 +178,11 @@ struct tag { + * DC21285 specific + */ + struct tag_memclk memclk; ++ ++ /* ++ * Marvell specific ++ */ ++ struct tag_mv_uboot mv_uboot; + } u; + }; + +-- +2.37.0 + diff --git a/libre/linux-libre-rt/0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch b/libre/linux-libre-rt/0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch new file mode 100644 index 0000000..f4a913a --- /dev/null +++ b/libre/linux-libre-rt/0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch @@ -0,0 +1,154 @@ +From 1ab962c7265f1be59e7071292d1d19e0a7b6ac72 Mon Sep 17 00:00:00 2001 +From: "Jan Alexander Steffens (heftig)" +Date: Mon, 16 Sep 2019 04:53:20 +0200 +Subject: [PATCH 1/5] ZEN: Add sysctl and CONFIG to disallow unprivileged + CLONE_NEWUSER + +Our default behavior continues to match the vanilla kernel. +--- + include/linux/user_namespace.h | 4 ++++ + init/Kconfig | 16 ++++++++++++++++ + kernel/fork.c | 14 ++++++++++++++ + kernel/sysctl.c | 12 ++++++++++++ + kernel/user_namespace.c | 7 +++++++ + 5 files changed, 53 insertions(+) + +diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h +index 45f09bec02c4..87b20e2ee274 100644 +--- a/include/linux/user_namespace.h ++++ b/include/linux/user_namespace.h +@@ -148,6 +148,8 @@ static inline void set_userns_rlimit_max(struct user_namespace *ns, + + #ifdef CONFIG_USER_NS + ++extern int unprivileged_userns_clone; ++ + static inline struct user_namespace *get_user_ns(struct user_namespace *ns) + { + if (ns) +@@ -181,6 +183,8 @@ extern bool current_in_userns(const struct user_namespace *target_ns); + struct ns_common *ns_get_owner(struct ns_common *ns); + #else + ++#define unprivileged_userns_clone 0 ++ + static inline struct user_namespace *get_user_ns(struct user_namespace *ns) + { + return &init_user_ns; +diff --git a/init/Kconfig b/init/Kconfig +index 6d35728b94b2..0562c8ca7b30 100644 +--- a/init/Kconfig ++++ b/init/Kconfig +@@ -1226,6 +1226,22 @@ config USER_NS + + If unsure, say N. + ++config USER_NS_UNPRIVILEGED ++ bool "Allow unprivileged users to create namespaces" ++ default y ++ depends on USER_NS ++ help ++ When disabled, unprivileged users will not be able to create ++ new namespaces. Allowing users to create their own namespaces ++ has been part of several recent local privilege escalation ++ exploits, so if you need user namespaces but are ++ paranoid^Wsecurity-conscious you want to disable this. ++ ++ This setting can be overridden at runtime via the ++ kernel.unprivileged_userns_clone sysctl. ++ ++ If unsure, say Y. ++ + config PID_NS + bool "PID Namespaces" + default y +diff --git a/kernel/fork.c b/kernel/fork.c +index 177ce7438db6..6ecece1407fc 100644 +--- a/kernel/fork.c ++++ b/kernel/fork.c +@@ -100,6 +100,10 @@ + #include + #include + ++#ifdef CONFIG_USER_NS ++#include ++#endif ++ + #include + #include + #include +@@ -2260,6 +2264,10 @@ __latent_entropy struct task_struct *copy_process( + if ((clone_flags & (CLONE_NEWUSER|CLONE_FS)) == (CLONE_NEWUSER|CLONE_FS)) + return ERR_PTR(-EINVAL); + ++ if ((clone_flags & CLONE_NEWUSER) && !unprivileged_userns_clone) ++ if (!capable(CAP_SYS_ADMIN)) ++ return ERR_PTR(-EPERM); ++ + /* + * Thread groups must share signals as well, and detached threads + * can only be started up within the thread group. +@@ -3413,6 +3421,12 @@ int ksys_unshare(unsigned long unshare_flags) + if (unshare_flags & CLONE_NEWNS) + unshare_flags |= CLONE_FS; + ++ if ((unshare_flags & CLONE_NEWUSER) && !unprivileged_userns_clone) { ++ err = -EPERM; ++ if (!capable(CAP_SYS_ADMIN)) ++ goto bad_unshare_out; ++ } ++ + err = check_unshare_flags(unshare_flags); + if (err) + goto bad_unshare_out; +diff --git a/kernel/sysctl.c b/kernel/sysctl.c +index 354a2d294f52..5bc5605e7cdb 100644 +--- a/kernel/sysctl.c ++++ b/kernel/sysctl.c +@@ -80,6 +80,9 @@ + #ifdef CONFIG_RT_MUTEXES + #include + #endif ++#ifdef CONFIG_USER_NS ++#include ++#endif + + /* shared constants to be used in various sysctls */ + const int sysctl_vals[] = { 0, 1, 2, 3, 4, 100, 200, 1000, 3000, INT_MAX, 65535, -1 }; +@@ -1623,6 +1626,15 @@ static struct ctl_table kern_table[] = { + .mode = 0644, + .proc_handler = proc_dointvec, + }, ++#ifdef CONFIG_USER_NS ++ { ++ .procname = "unprivileged_userns_clone", ++ .data = &unprivileged_userns_clone, ++ .maxlen = sizeof(int), ++ .mode = 0644, ++ .proc_handler = proc_dointvec, ++ }, ++#endif + #ifdef CONFIG_PROC_SYSCTL + { + .procname = "tainted", +diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c +index 1d8e47bed3f1..fec01d016a35 100644 +--- a/kernel/user_namespace.c ++++ b/kernel/user_namespace.c +@@ -22,6 +22,13 @@ + #include + #include + ++/* sysctl */ ++#ifdef CONFIG_USER_NS_UNPRIVILEGED ++int unprivileged_userns_clone = 1; ++#else ++int unprivileged_userns_clone; ++#endif ++ + static struct kmem_cache *user_ns_cachep __read_mostly; + static DEFINE_MUTEX(userns_state_mutex); + +-- +2.43.0 + diff --git a/libre/linux-libre-rt/0001-usb-serial-gadget-no-TTY-hangup-on-USB-disconnect-WI.patch b/libre/linux-libre-rt/0001-usb-serial-gadget-no-TTY-hangup-on-USB-disconnect-WI.patch new file mode 100644 index 0000000..e9de435 --- /dev/null +++ b/libre/linux-libre-rt/0001-usb-serial-gadget-no-TTY-hangup-on-USB-disconnect-WI.patch @@ -0,0 +1,39 @@ +From 716120e8010a7f400c6bed7384000e95e1465c94 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ky=C3=B6sti=20M=C3=A4lkki?= +Date: Mon, 26 Aug 2013 19:19:44 +0300 +Subject: [PATCH 1/2] usb serial gadget: no TTY hangup on USB disconnect [WIP] +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +We may want to maintain the TTY over USB disconnects. + +This is useful when we have a terminal console to a host which +power-cycles or for other reasons resets the USB host controller. + +Signed-off-by: Kyösti Mälkki +--- + drivers/usb/gadget/function/u_serial.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/drivers/usb/gadget/function/u_serial.c b/drivers/usb/gadget/function/u_serial.c +index b369292..d156a28 100644 +--- a/drivers/usb/gadget/function/u_serial.c ++++ b/drivers/usb/gadget/function/u_serial.c +@@ -1258,8 +1258,13 @@ void gserial_disconnect(struct gserial *gser) + gser->ioport = NULL; + if (port->port.count > 0 || port->openclose) { + wake_up_interruptible(&port->drain_wait); ++#if 0 + if (port->port.tty) + tty_hangup(port->port.tty); ++#else ++ if (port->port.tty) ++ stop_tty(port->port.tty); ++#endif + } + spin_unlock_irqrestore(&port->port_lock, flags); + +-- +1.8.1.1 + diff --git a/libre/linux-libre-rt/0002-ARM-atags-fdt-retrieve-MAC-addresses-from-Marvell-bo.patch b/libre/linux-libre-rt/0002-ARM-atags-fdt-retrieve-MAC-addresses-from-Marvell-bo.patch new file mode 100644 index 0000000..758c050 --- /dev/null +++ b/libre/linux-libre-rt/0002-ARM-atags-fdt-retrieve-MAC-addresses-from-Marvell-bo.patch @@ -0,0 +1,38 @@ +From b2f96ec9b408c8bbec437c3d3b54c0b748fca85a Mon Sep 17 00:00:00 2001 +From: Willy Tarreau +Date: Sun, 2 Dec 2012 19:56:58 +0100 +Subject: [PATCH 2/7] ARM: atags/fdt: retrieve MAC addresses from Marvell boot + loader + +The atags are parsed and if a Marvell atag is found, up to 4 MAC +addresses are extracted there and assigned to node aliases eth0..3 +with the name "mac-address". + +This was tested on my Mirabox and the two NICs had their correct +address set. + +Signed-off-by: Willy Tarreau +--- + arch/arm/boot/compressed/atags_to_fdt.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/arch/arm/boot/compressed/atags_to_fdt.c b/arch/arm/boot/compressed/atags_to_fdt.c +index 1feb6b0f7a1f..5e5cb3094b6a 100644 +--- a/arch/arm/boot/compressed/atags_to_fdt.c ++++ b/arch/arm/boot/compressed/atags_to_fdt.c +@@ -205,6 +205,12 @@ int atags_to_fdt(void *atag_list, void *fdt, int total_space) + hex_str(serno, atag->u.serialnr.high); + hex_str(serno+8, atag->u.serialnr.low); + setprop_string(fdt, "/", "serial-number", serno); ++ } else if (atag->hdr.tag == ATAG_MV_UBOOT) { ++ /* This ATAG provides up to 4 MAC addresses */ ++ setprop(fdt, "eth0", "mac-address", atag->u.mv_uboot.macAddr[0], 6); ++ setprop(fdt, "eth1", "mac-address", atag->u.mv_uboot.macAddr[1], 6); ++ setprop(fdt, "eth2", "mac-address", atag->u.mv_uboot.macAddr[2], 6); ++ setprop(fdt, "eth3", "mac-address", atag->u.mv_uboot.macAddr[3], 6); + } + } + +-- +2.37.0 + diff --git a/libre/linux-libre-rt/0002-drivers-firmware-skip-simpledrm-if-nvidia-drm.modese.patch b/libre/linux-libre-rt/0002-drivers-firmware-skip-simpledrm-if-nvidia-drm.modese.patch new file mode 100644 index 0000000..f8a56fb --- /dev/null +++ b/libre/linux-libre-rt/0002-drivers-firmware-skip-simpledrm-if-nvidia-drm.modese.patch @@ -0,0 +1,89 @@ +From ed37397be7fb48e57536a4e2ffe983569611a4cc Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Thu, 19 May 2022 14:40:07 +0200 +Subject: [PATCH 2/5] drivers/firmware: skip simpledrm if nvidia-drm.modeset=1 + is set + +The Nvidia proprietary driver has some bugs that leads to issues if used +with the simpledrm driver. The most noticeable is that does not register +an emulated fbdev device. + +It just relies on a fbdev to be registered by another driver, that could +be that could be attached to the framebuffer console. On UEFI machines, +this is the efifb driver. + +This means that disabling the efifb driver will cause virtual consoles to +not be present in the system when using the Nvidia driver. Legacy BIOS is +not affected just because fbcon is not used there, but instead vgacon. + +Unless a VGA mode is specified using the vga= kernel command line option, +in that case the vesafb driver is used instead and its fbdev attached to +the fbcon. + +This is a problem because with CONFIG_SYSFB_SIMPLEFB=y, the sysfb platform +code attempts to register a "simple-framebuffer" platform device (that is +matched against simpledrm) and only registers either an "efi-framebuffer" +or "vesa-framebuffer" if this fails to be registered due the video modes +not being compatible. + +The Nvidia driver relying on another driver to register the fbdev is quite +fragile, since it can't really assume those will stick around. For example +there are patches posted to remove the EFI and VESA platform devices once +a real DRM or fbdev driver probes. + +But in any case, moving to a simpledrm + emulated fbdev only breaks this +assumption and causes users to not have VT if the Nvidia driver is used. + +So to prevent this, let's add a workaround and make the sysfb to skip the +"simple-framebuffer" registration when nvidia-drm.modeset=1 option is set. + +This is quite horrible, but honestly I can't think of any other approach. + +For this to work, the CONFIG_FB_EFI and CONFIG_FB_VESA config options must +be enabled besides CONFIG_DRM_SIMPLEDRM. + +Signed-off-by: Javier Martinez Canillas +Cherry-picked-for: https://bugs.archlinux.org/task/73720 +--- + drivers/firmware/sysfb.c | 18 +++++++++++++++++- + 1 file changed, 17 insertions(+), 1 deletion(-) + +diff --git a/drivers/firmware/sysfb.c b/drivers/firmware/sysfb.c +index 82fcfd29bc4d..17b7e096b682 100644 +--- a/drivers/firmware/sysfb.c ++++ b/drivers/firmware/sysfb.c +@@ -34,6 +34,22 @@ + #include + #include + ++static int skip_simpledrm; ++ ++static int __init simpledrm_disable(char *opt) ++{ ++ if (!opt) ++ return -EINVAL; ++ ++ get_option(&opt, &skip_simpledrm); ++ ++ if (skip_simpledrm) ++ pr_info("The simpledrm driver will not be probed\n"); ++ ++ return 0; ++} ++early_param("nvidia-drm.modeset", simpledrm_disable); ++ + static struct platform_device *pd; + static DEFINE_MUTEX(disable_lock); + static bool disabled; +@@ -85,7 +101,7 @@ static __init int sysfb_init(void) + + /* try to create a simple-framebuffer device */ + compatible = sysfb_parse_mode(si, &mode); +- if (compatible) { ++ if (compatible && !skip_simpledrm) { + pd = sysfb_create_simplefb(si, &mode); + if (!IS_ERR(pd)) + goto unlock_mutex; +-- +2.43.0 + diff --git a/libre/linux-libre-rt/0002-fix-Atmel-maXTouch-touchscreen-support.patch b/libre/linux-libre-rt/0002-fix-Atmel-maXTouch-touchscreen-support.patch new file mode 100644 index 0000000..5ad26fc --- /dev/null +++ b/libre/linux-libre-rt/0002-fix-Atmel-maXTouch-touchscreen-support.patch @@ -0,0 +1,37 @@ +From ab8cc1b2dc1b716d5c08f72dacbe1eded269f304 Mon Sep 17 00:00:00 2001 +From: André Silva +Date: Tue, 22 Mar 2016 17:58:59 -0300 +Subject: [PATCH 2/2] fix Atmel maXTouch touchscreen support + +The Atmel maXTouch touchscreen works with Linux-libre 3.13-gnu, +but not with the current longterm and mainline kernels in +Parabola. + +Now it needs to load nonfree firmware in mxt_initialize(), +which is in drivers/input/touchscreen/atmel_mxt_ts.c, and the +atmel_mxt_ts driver fails to work. + +This driver works if changing reject_firmware_nowait to +request_firmware_nowait in atmel_mxt_ts.c. This line is +requesting the file named MXT_CFG_NAME, and it's a config file, +not the firmware blob. + +Signed-off-by: André Silva +Signed-off-by: mytbk +--- + drivers/input/touchscreen/atmel_mxt_ts.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c +index 726a83e..d818834 100644 +--- a/drivers/input/touchscreen/atmel_mxt_ts.c ++++ b/drivers/input/touchscreen/atmel_mxt_ts.c +@@ -1989,7 +1989,7 @@ static int mxt_initialize(struct mxt_data *data) + if (error) + goto err_free_object_table; + +- error = reject_firmware_nowait(THIS_MODULE, true, MXT_CFG_NAME, ++ error = request_firmware_nowait(THIS_MODULE, true, MXT_CFG_NAME, + &client->dev, GFP_KERNEL, data, + mxt_config_cb); + if (error) { diff --git a/libre/linux-libre-rt/0003-HID-amd_sfh-Check-that-sensors-are-enabled-before-se.patch b/libre/linux-libre-rt/0003-HID-amd_sfh-Check-that-sensors-are-enabled-before-se.patch new file mode 100644 index 0000000..61656b6 --- /dev/null +++ b/libre/linux-libre-rt/0003-HID-amd_sfh-Check-that-sensors-are-enabled-before-se.patch @@ -0,0 +1,63 @@ +From 32e4bc1b86e21f941767b2faf48446145ca30d44 Mon Sep 17 00:00:00 2001 +From: Mario Limonciello +Date: Tue, 20 Jun 2023 15:01:17 -0500 +Subject: [PATCH 3/5] HID: amd_sfh: Check that sensors are enabled before + set/get report + +A crash was reported in amd-sfh related to hid core initialization +before SFH initialization has run. + +``` + amdtp_hid_request+0x36/0x50 [amd_sfh +2e3095779aada9fdb1764f08ca578ccb14e41fe4] + sensor_hub_get_feature+0xad/0x170 [hid_sensor_hub +d6157999c9d260a1bfa6f27d4a0dc2c3e2c5654e] + hid_sensor_parse_common_attributes+0x217/0x310 [hid_sensor_iio_common +07a7935272aa9c7a28193b574580b3e953a64ec4] + hid_gyro_3d_probe+0x7f/0x2e0 [hid_sensor_gyro_3d +9f2eb51294a1f0c0315b365f335617cbaef01eab] + platform_probe+0x44/0xa0 + really_probe+0x19e/0x3e0 +``` + +Ensure that sensors have been set up before calling into +amd_sfh_get_report() or amd_sfh_set_report(). + +Cc: stable@vger.kernel.org +Cc: Linux regression tracking (Thorsten Leemhuis) +Fixes: 7bcfdab3f0c6 ("HID: amd_sfh: if no sensors are enabled, clean up") +Reported-by: Haochen Tong +Link: https://lore.kernel.org/all/3250319.ancTxkQ2z5@zen/T/ +Signed-off-by: Mario Limonciello +Cherry-picked-for: https://gitlab.archlinux.org/archlinux/packaging/packages/linux/-/issues/7 +--- + drivers/hid/amd-sfh-hid/amd_sfh_client.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_client.c b/drivers/hid/amd-sfh-hid/amd_sfh_client.c +index bdb578e0899f..0f1d6778051f 100644 +--- a/drivers/hid/amd-sfh-hid/amd_sfh_client.c ++++ b/drivers/hid/amd-sfh-hid/amd_sfh_client.c +@@ -25,6 +25,9 @@ void amd_sfh_set_report(struct hid_device *hid, int report_id, + struct amdtp_cl_data *cli_data = hid_data->cli_data; + int i; + ++ if (!cli_data->is_any_sensor_enabled) ++ return; ++ + for (i = 0; i < cli_data->num_hid_devices; i++) { + if (cli_data->hid_sensor_hubs[i] == hid) { + cli_data->cur_hid_dev = i; +@@ -41,6 +44,9 @@ int amd_sfh_get_report(struct hid_device *hid, int report_id, int report_type) + struct request_list *req_list = &cli_data->req_list; + int i; + ++ if (!cli_data->is_any_sensor_enabled) ++ return -ENODEV; ++ + for (i = 0; i < cli_data->num_hid_devices; i++) { + if (cli_data->hid_sensor_hubs[i] == hid) { + struct request_list *new = kzalloc(sizeof(*new), GFP_KERNEL); +-- +2.43.0 + diff --git a/libre/linux-libre-rt/0003-fix-mvsdio-eMMC-timing.patch b/libre/linux-libre-rt/0003-fix-mvsdio-eMMC-timing.patch new file mode 100644 index 0000000..a447eaa --- /dev/null +++ b/libre/linux-libre-rt/0003-fix-mvsdio-eMMC-timing.patch @@ -0,0 +1,38 @@ +From 5b76d7e549a6f65f881ef832cb39ae6a4ad34119 Mon Sep 17 00:00:00 2001 +From: Kevin Mihelich +Date: Fri, 5 Sep 2014 15:43:56 -0600 +Subject: [PATCH 3/7] fix mvsdio eMMC timing + +These changes from Globalscale change the MMC timing to allow the eMMC versions +of the Mirabox and SMILE Plug to work. + +Signed-off-by: Kevin Mihelich +--- + drivers/mmc/host/mvsdio.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/mmc/host/mvsdio.c b/drivers/mmc/host/mvsdio.c +index 629efbe639c4..c507c064736c 100644 +--- a/drivers/mmc/host/mvsdio.c ++++ b/drivers/mmc/host/mvsdio.c +@@ -90,7 +90,7 @@ static int mvsd_setup_data(struct mvsd_host *host, struct mmc_data *data) + tmout_index = fls(tmout - 1) - 12; + if (tmout_index < 0) + tmout_index = 0; +- if (tmout_index > MVSD_HOST_CTRL_TMOUT_MAX) ++// if (tmout_index > MVSD_HOST_CTRL_TMOUT_MAX) //by steven, try to setup the timeout to maximum value + tmout_index = MVSD_HOST_CTRL_TMOUT_MAX; + + dev_dbg(host->dev, "data %s at 0x%08x: blocks=%d blksz=%d tmout=%u (%d)\n", +@@ -613,6 +613,8 @@ static void mvsd_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) + u32 m = DIV_ROUND_UP(host->base_clock, ios->clock) - 1; + if (m > MVSD_BASE_DIV_MAX) + m = MVSD_BASE_DIV_MAX; ++ if(ios->clock==50000000 ) //by steven ++ m=1; + mvsd_write(MVSD_CLK_DIV, m); + host->clock = ios->clock; + host->ns_per_clk = 1000000000 / (host->base_clock / (m+1)); +-- +2.37.0 + diff --git a/libre/linux-libre-rt/0004-Revert-wifi-cfg80211-fix-CQM-for-non-range-use.patch b/libre/linux-libre-rt/0004-Revert-wifi-cfg80211-fix-CQM-for-non-range-use.patch new file mode 100644 index 0000000..5ae067c --- /dev/null +++ b/libre/linux-libre-rt/0004-Revert-wifi-cfg80211-fix-CQM-for-non-range-use.patch @@ -0,0 +1,140 @@ +From cd906594e5fdf1065975f2a89ce45c066c9f02a3 Mon Sep 17 00:00:00 2001 +From: Greg Kroah-Hartman +Date: Mon, 11 Dec 2023 10:16:15 +0100 +Subject: [PATCH 4/5] Revert "wifi: cfg80211: fix CQM for non-range use" +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This reverts commit 4a7e92551618f3737b305f62451353ee05662f57 which is +commit 7e7efdda6adb385fbdfd6f819d76bc68c923c394 upstream. + +It needed to have commit 076fc8775daf ("wifi: cfg80211: remove wdev +mutex") applied to properly work, otherwise regressions happen. + +Link: https://lore.kernel.org/r/e374bb16-5b13-44cc-b11a-2f4eefb1ecf5@manjaro.org +Link: https://lore.kernel.org/r/87sf4belmm.fsf@turtle.gmx.de +Link: https://lore.kernel.org/r/20231210213930.61378-1-leo@leolam.fr +Reported-by: Léo Lam +Reported-by: Sven Joachim +Reported-by: Philip Müller +Cc: Johannes Berg +Signed-off-by: Greg Kroah-Hartman +Cherry-picked-for: https://gitlab.archlinux.org/archlinux/packaging/packages/linux/-/issues/17 +--- + net/wireless/core.h | 1 - + net/wireless/nl80211.c | 50 ++++++++++++++++-------------------------- + 2 files changed, 19 insertions(+), 32 deletions(-) + +diff --git a/net/wireless/core.h b/net/wireless/core.h +index f0a3a2317638..e536c0b615a0 100644 +--- a/net/wireless/core.h ++++ b/net/wireless/core.h +@@ -299,7 +299,6 @@ struct cfg80211_cqm_config { + u32 rssi_hyst; + s32 last_rssi_event_value; + enum nl80211_cqm_rssi_threshold_event last_rssi_event_type; +- bool use_range_api; + int n_rssi_thresholds; + s32 rssi_thresholds[] __counted_by(n_rssi_thresholds); + }; +diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c +index 6a82dd876f27..931a03f4549c 100644 +--- a/net/wireless/nl80211.c ++++ b/net/wireless/nl80211.c +@@ -12824,6 +12824,10 @@ static int cfg80211_cqm_rssi_update(struct cfg80211_registered_device *rdev, + int i, n, low_index; + int err; + ++ /* RSSI reporting disabled? */ ++ if (!cqm_config) ++ return rdev_set_cqm_rssi_range_config(rdev, dev, 0, 0); ++ + /* + * Obtain current RSSI value if possible, if not and no RSSI threshold + * event has been received yet, we should receive an event after a +@@ -12898,6 +12902,18 @@ static int nl80211_set_cqm_rssi(struct genl_info *info, + wdev->iftype != NL80211_IFTYPE_P2P_CLIENT) + return -EOPNOTSUPP; + ++ if (n_thresholds <= 1 && rdev->ops->set_cqm_rssi_config) { ++ if (n_thresholds == 0 || thresholds[0] == 0) /* Disabling */ ++ return rdev_set_cqm_rssi_config(rdev, dev, 0, 0); ++ ++ return rdev_set_cqm_rssi_config(rdev, dev, ++ thresholds[0], hysteresis); ++ } ++ ++ if (!wiphy_ext_feature_isset(&rdev->wiphy, ++ NL80211_EXT_FEATURE_CQM_RSSI_LIST)) ++ return -EOPNOTSUPP; ++ + if (n_thresholds == 1 && thresholds[0] == 0) /* Disabling */ + n_thresholds = 0; + +@@ -12905,20 +12921,6 @@ static int nl80211_set_cqm_rssi(struct genl_info *info, + old = rcu_dereference_protected(wdev->cqm_config, + lockdep_is_held(&wdev->mtx)); + +- /* if already disabled just succeed */ +- if (!n_thresholds && !old) +- return 0; +- +- if (n_thresholds > 1) { +- if (!wiphy_ext_feature_isset(&rdev->wiphy, +- NL80211_EXT_FEATURE_CQM_RSSI_LIST) || +- !rdev->ops->set_cqm_rssi_range_config) +- return -EOPNOTSUPP; +- } else { +- if (!rdev->ops->set_cqm_rssi_config) +- return -EOPNOTSUPP; +- } +- + if (n_thresholds) { + cqm_config = kzalloc(struct_size(cqm_config, rssi_thresholds, + n_thresholds), +@@ -12933,26 +12935,13 @@ static int nl80211_set_cqm_rssi(struct genl_info *info, + memcpy(cqm_config->rssi_thresholds, thresholds, + flex_array_size(cqm_config, rssi_thresholds, + n_thresholds)); +- cqm_config->use_range_api = n_thresholds > 1 || +- !rdev->ops->set_cqm_rssi_config; + + rcu_assign_pointer(wdev->cqm_config, cqm_config); +- +- if (cqm_config->use_range_api) +- err = cfg80211_cqm_rssi_update(rdev, dev, cqm_config); +- else +- err = rdev_set_cqm_rssi_config(rdev, dev, +- thresholds[0], +- hysteresis); + } else { + RCU_INIT_POINTER(wdev->cqm_config, NULL); +- /* if enabled as range also disable via range */ +- if (old->use_range_api) +- err = rdev_set_cqm_rssi_range_config(rdev, dev, 0, 0); +- else +- err = rdev_set_cqm_rssi_config(rdev, dev, 0, 0); + } + ++ err = cfg80211_cqm_rssi_update(rdev, dev, cqm_config); + if (err) { + rcu_assign_pointer(wdev->cqm_config, old); + kfree_rcu(cqm_config, rcu_head); +@@ -19142,11 +19131,10 @@ void cfg80211_cqm_rssi_notify_work(struct wiphy *wiphy, struct wiphy_work *work) + wdev_lock(wdev); + cqm_config = rcu_dereference_protected(wdev->cqm_config, + lockdep_is_held(&wdev->mtx)); +- if (!cqm_config) ++ if (!wdev->cqm_config) + goto unlock; + +- if (cqm_config->use_range_api) +- cfg80211_cqm_rssi_update(rdev, wdev->netdev, cqm_config); ++ cfg80211_cqm_rssi_update(rdev, wdev->netdev, cqm_config); + + rssi_level = cqm_config->last_rssi_event_value; + rssi_event = cqm_config->last_rssi_event_type; +-- +2.43.0 + diff --git a/libre/linux-libre-rt/0004-net-smsc95xx-Allow-mac-address-to-be-set-as-a-parame.patch b/libre/linux-libre-rt/0004-net-smsc95xx-Allow-mac-address-to-be-set-as-a-parame.patch new file mode 100644 index 0000000..b487155 --- /dev/null +++ b/libre/linux-libre-rt/0004-net-smsc95xx-Allow-mac-address-to-be-set-as-a-parame.patch @@ -0,0 +1,95 @@ +From 824cc151d839ce92269200119f9148013755adb8 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Tue, 18 Feb 2014 01:43:50 -0300 +Subject: [PATCH 4/7] net/smsc95xx: Allow mac address to be set as a parameter + +--- + drivers/net/usb/smsc95xx.c | 56 ++++++++++++++++++++++++++++++++++++++ + 1 file changed, 56 insertions(+) + +diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c +index bfb58c91db04..29b7c4cb90f1 100644 +--- a/drivers/net/usb/smsc95xx.c ++++ b/drivers/net/usb/smsc95xx.c +@@ -54,6 +54,7 @@ + #define SUSPEND_SUSPEND3 (0x08) + #define SUSPEND_ALLMODES (SUSPEND_SUSPEND0 | SUSPEND_SUSPEND1 | \ + SUSPEND_SUSPEND2 | SUSPEND_SUSPEND3) ++#define MAC_ADDR_LEN (6) + + #define SMSC95XX_NR_IRQS (1) /* raise to 12 for GPIOs */ + #define PHY_HWIRQ (SMSC95XX_NR_IRQS - 1) +@@ -78,6 +79,10 @@ static bool turbo_mode = true; + module_param(turbo_mode, bool, 0644); + MODULE_PARM_DESC(turbo_mode, "Enable multiple frames per Rx transaction"); + ++static char *macaddr = ":"; ++module_param(macaddr, charp, 0); ++MODULE_PARM_DESC(macaddr, "MAC address"); ++ + static int __must_check smsc95xx_read_reg(struct usbnet *dev, u32 index, + u32 *data) + { +@@ -761,8 +766,59 @@ static int smsc95xx_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd) + return phy_mii_ioctl(netdev->phydev, rq, cmd); + } + ++/* Check the macaddr module parameter for a MAC address */ ++static int smsc95xx_is_macaddr_param(struct usbnet *dev, u8 *dev_mac) ++{ ++ int i, j, got_num, num; ++ u8 mtbl[MAC_ADDR_LEN]; ++ ++ if (macaddr[0] == ':') ++ return 0; ++ ++ i = 0; ++ j = 0; ++ num = 0; ++ got_num = 0; ++ while (j < MAC_ADDR_LEN) { ++ if (macaddr[i] && macaddr[i] != ':') { ++ got_num++; ++ if ('0' <= macaddr[i] && macaddr[i] <= '9') ++ num = num * 16 + macaddr[i] - '0'; ++ else if ('A' <= macaddr[i] && macaddr[i] <= 'F') ++ num = num * 16 + 10 + macaddr[i] - 'A'; ++ else if ('a' <= macaddr[i] && macaddr[i] <= 'f') ++ num = num * 16 + 10 + macaddr[i] - 'a'; ++ else ++ break; ++ i++; ++ } else if (got_num == 2) { ++ mtbl[j++] = (u8) num; ++ num = 0; ++ got_num = 0; ++ i++; ++ } else { ++ break; ++ } ++ } ++ ++ if (j == MAC_ADDR_LEN) { ++ netif_dbg(dev, ifup, dev->net, "Overriding MAC address with: " ++ "%02x:%02x:%02x:%02x:%02x:%02x\n", mtbl[0], mtbl[1], mtbl[2], ++ mtbl[3], mtbl[4], mtbl[5]); ++ for (i = 0; i < MAC_ADDR_LEN; i++) ++ dev_mac[i] = mtbl[i]; ++ return 1; ++ } else { ++ return 0; ++ } ++} ++ + static void smsc95xx_init_mac_address(struct usbnet *dev) + { ++ /* Check module parameters */ ++ if (smsc95xx_is_macaddr_param(dev, dev->net->dev_addr)) ++ return; ++ + u8 addr[ETH_ALEN]; + + /* maybe the boot loader passed the MAC address in devicetree */ +-- +2.37.0 + diff --git a/libre/linux-libre-rt/0005-Set-distribution-specific-version.patch b/libre/linux-libre-rt/0005-Set-distribution-specific-version.patch new file mode 100644 index 0000000..3bea6e3 --- /dev/null +++ b/libre/linux-libre-rt/0005-Set-distribution-specific-version.patch @@ -0,0 +1,38 @@ +From 556a05b87c58b0e7dafa3107d7534dfcbdcf00ee Mon Sep 17 00:00:00 2001 +From: David Runge +Date: Sun, 18 Jun 2023 10:28:50 +0200 +Subject: [PATCH 5/5] Set distribution specific version + +Remove upstream's localversion file and instead append our distribution +specific identifier using `EXTRAVERSION`. + +Signed-off-by: David Runge +--- + Makefile | 2 +- + localversion-rt | 1 - + 2 files changed, 1 insertion(+), 2 deletions(-) + delete mode 100644 localversion-rt + +diff --git a/Makefile b/Makefile +index ee4e504a3e78..a8ac0fdc967d 100644 +--- a/Makefile ++++ b/Makefile +@@ -2,7 +2,7 @@ + VERSION = 6 + PATCHLEVEL = 6 + SUBLEVEL = 5 +-EXTRAVERSION = ++EXTRAVERSION = .16.realtime1 + NAME = Hurr durr I'ma ninja sloth + + # *DOCUMENTATION* +diff --git a/localversion-rt b/localversion-rt +deleted file mode 100644 +index 1199ebade17b..000000000000 +--- a/localversion-rt ++++ /dev/null +@@ -1 +0,0 @@ +--rt16 +-- +2.43.0 + diff --git a/libre/linux-libre-rt/PKGBUILD b/libre/linux-libre-rt/PKGBUILD new file mode 100644 index 0000000..2c4ee16 --- /dev/null +++ b/libre/linux-libre-rt/PKGBUILD @@ -0,0 +1,512 @@ +# Maintainer: David P. + +# Based on linux-rt package + +_replacesarchkernel=('linux%') # '%' gets replaced with kernel suffix +_replacesoldkernels=() # '%' gets replaced with kernel suffix +_replacesoldmodules=() # '%' gets replaced with kernel suffix + +pkgbase=linux-libre-rt +_kver=6.6.5 +_rtver=16 +pkgver=$_kver.$_rtver.realtime1 +pkgrel=1 +pkgdesc='Linux-libre RT' +url='https://linux-libre.fsfla.org/' +arch=(i686 x86_64 armv7h) +makedepends=( + bc + cpio + gettext + libelf + pahole + perl + python + tar + xz + + # htmldocs + graphviz + imagemagick + python-sphinx + texlive-latexextra +) +options=('!strip') +_srcname=linux-6.6 +source=( + "https://cdn.kernel.org/pub/linux/kernel/projects/rt/${_srcname##*-}/older/patch-$_kver-rt$_rtver.patch"{.xz,.sign} + "https://linux-libre.fsfla.org/pub/linux-libre/releases/${_srcname##*-}-gnu/linux-libre-${_srcname##*-}-gnu.tar.xz"{,.sign} + "https://linux-libre.fsfla.org/pub/linux-libre/releases/$_kver-gnu/patch-${_srcname##*-}-gnu-$_kver-gnu.xz"{,.sign} + "https://repo.parabola.nu/other/linux-libre/logos/logo_linux_"{clut224.ppm,vga16.ppm,mono.pbm}{,.sig} + config.i686 config.x86_64 config.armv7h # the main kernel config files + linux-armv7h.preset # armv7h preset file for mkinitcpio ramdisk + + # maintain the TTY over USB disconnects + # http://www.coreboot.org/EHCI_Gadget_Debug + 0001-usb-serial-gadget-no-TTY-hangup-on-USB-disconnect-WI.patch + # fix Atmel maXTouch touchscreen support + # https://labs.parabola.nu/issues/877 + # http://www.fsfla.org/pipermail/linux-libre/2015-November/003202.html + 0002-fix-Atmel-maXTouch-touchscreen-support.patch + # Arch Linux patches + # https://gitlab.archlinux.org/archlinux/packaging/upstream/linux-rt + 0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch + 0002-drivers-firmware-skip-simpledrm-if-nvidia-drm.modese.patch + 0003-HID-amd_sfh-Check-that-sensors-are-enabled-before-se.patch + 0004-Revert-wifi-cfg80211-fix-CQM-for-non-range-use.patch + 0005-Set-distribution-specific-version.patch +) +source_i686=( + # avoid using zstd compression in ultra mode (exhausts virtual memory) + no-ultra-zstd.patch +) +source_armv7h=( + # Arch Linux ARM patches + 0001-ARM-atags-add-support-for-Marvell-s-u-boot.patch + 0002-ARM-atags-fdt-retrieve-MAC-addresses-from-Marvell-bo.patch + 0003-fix-mvsdio-eMMC-timing.patch + 0004-net-smsc95xx-Allow-mac-address-to-be-set-as-a-parame.patch + #0005-set-default-cubietruck-led-triggers.patch + #0006-exynos4412-odroid-set-higher-minimum-buck2-regulator.patch + #0007-USB-Armory-MkII-support.patch +) +validpgpkeys=( + 474402C8C582DAFBE389C427BCB7CF877E7D47A7 # Alexandre Oliva + 6DB9C4B4F0D8C0DC432CF6E4227CA7C556B2BA78 # David P. + 64254695FFF0AA4466CC19E67B96E8162A8CF5D1 # Sebastian Andrzej Siewior +) +sha256sums=('08c112c9365ee852763c0bb73d6ae5dfd0a2091275fcfe298a137515e5a8c74b' + 'SKIP' + 'd71785bdb694fefaa4f183e5dd2ffc453c179db6f9427cc37e1ed046f0073ccf' + 'SKIP' + '23bb9ff3579fa125486fbcf1cc1eda8d3d9e87238ea152c8a12f740b5c9d00de' + 'SKIP' + 'bfd4a7f61febe63c880534dcb7c31c5b932dde6acf991810b41a939a93535494' + 'SKIP' + '6de8a8319271809ffdb072b68d53d155eef12438e6d04ff06a5a4db82c34fa8a' + 'SKIP' + '13bd7a8d9ed6b6bc971e4cd162262c5a20448a83796af39ce394d827b0e5de74' + 'SKIP' + 'e3eb78843cd229c84c4e225a5bf7b79395a5917f745c977c064449b9c7ee05e8' + 'db0a4f014c072efdbda4ade6ac47cab2a3c75a4821b2bb18c2c55f21dd33d541' + 'd5a8adaa3c3cbc7143ae25ebb7eb207e55f6273312496f73085139d7c2ebfdfc' + 'ca1708abbd2f8960c278722dc81a7c635973d92872386ad9e2fff10b86836e98' + '0376bd5efa31d4e2a9d52558777cebd9f0941df8e1adab916c868bf0c05f2fc3' + '351fd96be8cd5ebd0435c0a8a978673fc023e3b1026085e67f86d815b2285e25' + '9be2358b18d9715f8d525edeec5ec011ad7d6e8d7b5360cfcd0854912ad7f47e' + '68a4845043f442d65ea87992b96bca9997bf3eca2644611c65ef62eb6e889ed7' + '412fc11fd909e7b22daecf7a5f3df13e2a6e681e814e83e57cb624402d33c31c' + 'fbcadedb198711a3ea838db17d582efb455a4dab644f4d6552375f35112b368c' + '02b32a95dd171c76f0246368cc68b837ac36aff307f6323659f5136fe018ff5f') +sha256sums_i686=('d32270be5fd9c3e3ba50f3aef33f6cfcb85be0c8216f03b777287cc621fdff28') +sha256sums_armv7h=('ef4661a32234fe12bda28e698400c78c11491387df83ee554c53afb4dba244da' + 'd3a4b7c7a3d3b4d69369b85630eef33b21cfbcffc23adbdc3cfa837610912287' + '2bce52fa4ae4d34ca171d3aa100302a920c231275fc3ba9141af8b2f68cf67d1' + '12d5706b00d2939b92130a4dc41d060f5e1fea75424b902ebceca72e427dc3b9') +b2sums=('eea23d87f4e42c6b67fd02b17c3f7adfad84294d559a0df661e64c339ca5d6f9c50bfa985755da1a83812d03d3db882cac1767e433e7878eb39fe4482280dd70' + 'SKIP' + 'e3e753fed07258f34e2e44e1acd4be0c22a3c58a3ae4856b518a4f99358f5bf6e8f38e41f422d9a434b33b0d7ee972e93ac7d37c9734949d6db263afe4c4f47c' + 'SKIP' + 'c845ccf80eed695bbb9efab5d13742c04f102348617ee784929fc04530b46e374ee17e44985012b1a5472ea8de4b8a47f79d5f1863885b13901d901e46b2fee2' + 'SKIP' + '73fee2ae5cb1ffd3e6584e56da86a8b1ff6c713aae54d77c0dab113890fc673dc5f300eb9ed93fb367b045ece8fa80304ff277fe61665eccf7b7ce24f0c045eb' + 'SKIP' + 'd02a1153a4285b32c774dca4560fe37907ccf30b8e487a681b717ed95ae9bed5988875c0a118938e5885ae9d2857e53a6f216b732b6fa3368e3c5fe08c86382c' + 'SKIP' + '580911af9431c066bbc072fd22d5e2ef65f12d8358cec5ff5a4f1b7deebb86cef6b5c1ad631f42350af72c51d44d2093c71f761234fb224a8b9dbb3b64b8201d' + 'SKIP' + 'b130326fbe2481955ec240af39bcd89c8c20e10c86fe869c8455c8c47957d3ba232267cd42183b5261c82d010589f84b5d7a71f653d3b2b99654c04a8856ecca' + '20adf14ffbc1cfeb3893d95c63b30143cf8b001543f0b9a8367b3cc8e520f6cfcc6c30d0fb83a4214e76728aa0ffe0488bae373791668bfcaf8e18f7462e6374' + '40e9266a1802002a0eb3e30ee82409a46f70eb6fd6bb2e1f5c44e21483db058a4b94b1a09ffe41ea7d0ce341d2c0ebe33db226ee341df01fdf056675e6d034a6' + 'af69176b1117b94e56b043e97b0bd5873a2974a6a2fd52b102d0ffdca440ff68cfb241d6c4d4ef453cc8c220c236b739bad232e53fd500ce7672fa6e5ba87383' + 'c2214154c36900e311531bfe68184f31639f5c50fed23bc3803a7f18439b7ff258552a39f02fed0ea92f10744e17a6c55cef0ef1a98187f978fe480fb3dddc14' + '0c7ceba7cd90087db3296610a07886f337910bad265a32c052d3a703e6eb8e53f355ab9948d72d366408d968d8ee7435084dd89bef5ed0b69355fd884c2cd468' + 'a54310fda8f1bc0dc68aa2b90c1d64086e61d74171224d784c658a00ce3aa464c4e3398482dd2f4ee21069a8854f1315b7101dd41f3d6a94d5b2b4c0e0ad63dc' + '5050a1cbf5ddb45df001554eaa8c8aa65ce9d75af4220c8b74cb515f4ce0201468eea7840bfaf8dbda7c05bfdfa5df5b7ab498416cd890c8d18ecc3a375c0b42' + '65df2e904af1f839125d00758022be03838b32b1f48585ff9726f5deb01422542b902deac2cbe9f48ac242b7a1056440109f199b9a9698f5746ebb6874133538' + '88109f36e8e535a0232625ecb446f5b05f1698f495ed4c405397077fdb80cd584c0417bf0a3403fe6aa89be7ed9f8f972822fba6ac5a35b4f77f2aa92b732932' + 'e13ed69f4e5e090acbd3ad618fcba69ce14fd7b4f7949653d15d5e305511b2b47d12bf02904860e2af20fc453632d249550f5eea765bf969fdf668871b7d3ca2') +b2sums_i686=('165ab9dd8cedeaae5327accc1581c19cf0be55f923b03feb889cad3351b74c7c4cd3d3c206938e5152bfe1d947513dea8f630f8f5544099ec13d16d254725c40') +b2sums_armv7h=('73ecc5862c6b4aef7b163c1992004273fbf791b82c75a8602e3def311f682f2b866124c0bfde90d03c7c76bb8b5853bdb9daad6ee2ab0908f4145cda476b8286' + '15f7b70b5d153e9336006aba873a78f94d91b8df5e1939041f12e678bb9cfbdda2e362001068a07c044ce606cf0d4d2e625002df9c569c914f7ac248d4d3e8ad' + '6219cec826bc543000ab87cf35dcc713f0635519cf79e75888b213a5e2d1f728e59e70df7fd842dda6e40494bf9cafa9f87368cb75b338c5a157a0adcf583512' + '66d6cff292962c4c8bbea62b2240c4c53c0c514f9e99864be9244cb846c505e1bedd800ca1347b80883543035d20573b06796e5bacbace6e829880695ffca781') + +_replacesarchkernel=("${_replacesarchkernel[@]/\%/${pkgbase#linux-libre}}") +_replacesoldkernels=("${_replacesoldkernels[@]/\%/${pkgbase#linux-libre}}") +_replacesoldmodules=("${_replacesoldmodules[@]/\%/${pkgbase#linux-libre}}") + +case "$CARCH" in + i686|x86_64) KARCH=x86;; + armv7h) KARCH=arm;; +esac + +export KBUILD_BUILD_HOST=parabola +export KBUILD_BUILD_USER=$pkgbase +export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})" + +prepare() { + cd $_srcname + + if [ "${_srcname##*-}" != "$_kver" ]; then + echo "Applying upstream patch..." + patch -Np1 < "../patch-${_srcname##*-}-gnu-$_kver-gnu" + fi + + echo "Adding freedo as boot logo..." + install -m644 -t drivers/video/logo \ + ../logo_linux_{clut224.ppm,vga16.ppm,mono.pbm} + + echo "Setting version..." + echo "-$pkgrel" > localversion.10-pkgrel + echo "${pkgbase#linux-libre}" > localversion.20-pkgname + + sed '/^EXTRAVERSION =/s/= .*/=/' -i Makefile + + local source=("${source[@]}") + case "$CARCH" in + "armv7h") + source+=("${source_armv7h[@]}") ;; + "i686") + source+=("${source_i686[@]}") ;; + esac + + local src + for src in "${source[@]}"; do + src="${src%%::*}" + src="${src##*/}" + # allow to pick up the RT patch + src="${src//patch.xz/patch}" + [[ $src = *.patch ]] || continue + echo "Applying patch $src..." + patch -Np1 < "../$src" + done + + echo "Setting config..." + cp ../config.$CARCH .config + make olddefconfig + diff -u ../config.$CARCH .config || : + + make -s kernelrelease > version + echo "Prepared $pkgbase version $( $@ + + quiet_cmd_zstd22 = ZSTD22 $@ +- cmd_zstd22 = cat $(real-prereqs) | $(ZSTD) -22 --ultra > $@ ++ cmd_zstd22 = cat $(real-prereqs) | $(ZSTD) -19 > $@ + + quiet_cmd_zstd22_with_size = ZSTD22 $@ +- cmd_zstd22_with_size = { cat $(real-prereqs) | $(ZSTD) -22 --ultra; $(size_append); } > $@ ++ cmd_zstd22_with_size = { cat $(real-prereqs) | $(ZSTD) -19; $(size_append); } > $@ + + # ASM offsets