[PATCH] Mandatory install device check for PowerPC

2024-05-27 Thread Avnish Chouhan
This patch adds a check on install_device while installing grub for PowerPC.
If install_device is not mentioned in grub2-install, the error will be thrown.
Running grub2-install on PowerPC without the install_device may 
result in boot corruption.

Signed-off-by: Avnish Chouhan 
---
 util/grub-install.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/util/grub-install.c b/util/grub-install.c
index 5babc7a..192d2a8 100644
--- a/util/grub-install.c
+++ b/util/grub-install.c
@@ -970,6 +970,8 @@ main (int argc, char *argv[])
 case GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275:
   if (install_device)
is_prep = 1;
+  else
+grub_util_error ("%s", _("install device isn't specified"));
   break;
 case GRUB_INSTALL_PLATFORM_MIPS_ARC:
 case GRUB_INSTALL_PLATFORM_MIPSEL_ARC:
-- 
2.39.3


___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] Mandatory install device check for PowerPC

2024-05-27 Thread Vladimir 'phcoder' Serbinenko
Le lun. 27 mai 2024, 16:38, Avnish Chouhan  a écrit :

> This patch adds a check on install_device while installing grub for
> PowerPC.
> If install_device is not mentioned in grub2-install, the error will be
> thrown.
> Running grub2-install on PowerPC without the install_device may
> result in boot corruption.
>
This breaks PowerMac booting which doesn't have install device.

>
> Signed-off-by: Avnish Chouhan 
> ---
>  util/grub-install.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/util/grub-install.c b/util/grub-install.c
> index 5babc7a..192d2a8 100644
> --- a/util/grub-install.c
> +++ b/util/grub-install.c
> @@ -970,6 +970,8 @@ main (int argc, char *argv[])
>  case GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275:
>if (install_device)
> is_prep = 1;
> +  else
> +grub_util_error ("%s", _("install device isn't specified"));
>break;
>  case GRUB_INSTALL_PLATFORM_MIPS_ARC:
>  case GRUB_INSTALL_PLATFORM_MIPSEL_ARC:
> --
> 2.39.3
>
>
> ___
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] Mandatory install device check for PowerPC

2024-05-27 Thread Michal Suchánek
Hello,

On Mon, May 27, 2024 at 07:07:19PM +0530, Avnish Chouhan wrote:
> This patch adds a check on install_device while installing grub for PowerPC.
> If install_device is not mentioned in grub2-install, the error will be thrown.
> Running grub2-install on PowerPC without the install_device may 
> result in boot corruption.
> 
> Signed-off-by: Avnish Chouhan 
> ---
>  util/grub-install.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/util/grub-install.c b/util/grub-install.c
> index 5babc7a..192d2a8 100644
> --- a/util/grub-install.c
> +++ b/util/grub-install.c
> @@ -970,6 +970,8 @@ main (int argc, char *argv[])
>  case GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275:
>if (install_device)
>   is_prep = 1;
> +  else
> +grub_util_error ("%s", _("install device isn't specified"));
>break;

As far as I understand this is fine for us (support for pSeries and
powernv platform).

However, this is not acceptable for upstream. Upstream also supports
Apple hardawre, and there the grub binary is installed as a file on the
filesystem rather than copied to a device.

Or to put it differently, there is the PReP sub-platform of
GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275 and currently the code does not
detect that is running on such platform (eg. by examining the device
tree) but rather it infers is_prep solely based on user input (the
device to install to) and in absence of the user input non-PReP platform
is assumed, leading to bootlist corruption when no boot device is given
on a PReP platform.

To fix this the logic should be inverted: Set is_prep should be set
based on what system is detected, and require an install device for
PReP platform.

Thanks

Michal

>  case GRUB_INSTALL_PLATFORM_MIPS_ARC:
>  case GRUB_INSTALL_PLATFORM_MIPSEL_ARC:
> -- 
> 2.39.3
> 

___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


[PATCH] PRELIMINARY framebuffer rotation patch

2024-05-27 Thread Kyle Bader
>From 79d5934af355f360a78438e0132b788a0f626ec9 Mon Sep 17 00:00:00 2001
From: kbader94 
Date: Sun, 26 May 2024 13:17:45 -0600
Subject: [PATCH] PRELIMINARY framebuffer rotation patch

This patch contains the minimum changes required to implement framebuffer
orientation rotation.

More and more frequently GNU/linux users are using nonstandard display
orientations, such as portrait orientations. While linux supports rotating
the framebuffer on startup via the fbcon=rotate: paramater, this
parameter has no effect on GRUB, and GRUB has no alternative parameters to
set the framebuffer rotation. This feature has previously been proposed,
with an attempted patch here:
https://lists.gnu.org/archive/html/grub-devel/2010-02/msg00158.html.

This patch implements a basic framebuffer rotation by:
   *  adding a rotation env_var
   *  modifying the dirty function to support 2d dirty regions, with
accompanying changes to doublebuf_pageflipping_update_screen and
doublebuf_blit_update_screen, and associated init functions.
   *  modifying mode_info to contain orignal_width and origina_height
   *  modifying the blitting function to transform coordinates to account
for rotation
   *  modifying the fbfill function as above
   *  modifying the scroll function as above
   *  modifying individual drivers(bochs.c) to use the original_sizes
instead of the width and height

grub-core/video/fb/video_fb.c - dirty changes:

   The current implementation of the dirty function only tracks changes to
the y coordinates. This means updating even a small 2d region such as a
single 16*16 character requires updating the entire *16
pixels. This patch revises the dirty methods to operate on 2d regions. This
means the doublebuf functions responsible for updating the screen,
doublebuf_blit_update_screen and doublebuf_pageflipping_update_screen, also
have to be changed so they make multiple copies, one for each row of pixels
to be updated, instead of a single copy for the entire contigous block of
pixels contained in the framebuffer.

include/grub/video.h mode_info - changes

   We need to differentiate the physical framebuffer size from the render
area size, which is done by adding original_height and orignal_width
members to mode_info. Additionally, the rotation for the framebuffer will
be spefied by setting the new rotation member contained within mode_info

grub-core/video/fb/fbutil.c - add trans_x and trans_y helper functions

   These functions are used by the fbblit and fbfill functions to transform
coordinates prior to drawing.

grub-core/video/fb/fbblit.c - check target rotation and transform
appropriately

   As an initial proof of concept only the slow blitting operation is
implemented, however the same logic can easily be applied to other blitting
operations and color formats.

grub-core/video/bochs.c - video driver changes requires

   Some video drivers may need changes to account for the fact that
mode_info.width and height may not reflect the actual width and height of
the screen and/or framebuffer. The only driver I've implemented and tested
these changes on is the bochs.c driver.

Further work required

   This patch is not final and is presented as a proof of concept, for your
consideration and feedback. It works in qemu, however other drivers besides
bochs.c have yet to be implemented. Additionally other blitting formats can
be made to support rotations with optimized blitters, currently only the
generic blitter is supported.

Setting the rotation

   The rotation can be set by setting the rotation env var to 0, 90, or 270
by either entering the command set rotation=, or placing the
command in the grub.cfg file.

 Changes to be committed:
modified:   grub-core/video/bochs.c
modified:   grub-core/video/fb/fbblit.c
modified:   grub-core/video/fb/fbfill.c
modified:   grub-core/video/fb/fbutil.c
modified:   grub-core/video/fb/video_fb.c
modified:   include/grub/fbutil.h
modified:   include/grub/video.h
---
 grub-core/video/bochs.c   |   4 +-
 grub-core/video/fb/fbblit.c   |  63 +--
 grub-core/video/fb/fbfill.c   |  29 +++-
 grub-core/video/fb/fbutil.c   |  56 +++
 grub-core/video/fb/video_fb.c | 307 +-
 include/grub/fbutil.h |   9 +
 include/grub/video.h  |  20 ++-
 7 files changed, 350 insertions(+), 138 deletions(-)

diff --git a/grub-core/video/bochs.c b/grub-core/video/bochs.c
index edc651697..5937d7486 100644
--- a/grub-core/video/bochs.c
+++ b/grub-core/video/bochs.c
@@ -172,7 +172,7 @@ grub_video_bochs_video_fini (void)
 static grub_err_t
 doublebuf_pageflipping_set_page (int page)
 {
-  int start = framebuffer.mode_info.height * page;
+  int start = framebuffer.mode_info.original_height * page;

   vbe_write (start, BOCHS_VBE_Y_OFFSET);
   return GRUB_ERR_NONE;
@@ -323,6 +323,8 @@ grub_video_bochs_setup (unsigned int width, unsigned
int height,
   /* Fill mode info details.  */
   framebuffer.mode_info.width = width;
   framebuffer.mode_info.height = height;
+  fra

Re: [PATCH v3 5/5] keccak: Disable acceleration with SSE asm

2024-05-27 Thread Gary Lin via Grub-devel
On Fri, May 24, 2024 at 08:30:06PM +0300, Vladimir Serbinenko wrote:
> ---
>  .../lib/libgcrypt-patches/02_keccak_sse.diff  | 19 +++
>  1 file changed, 19 insertions(+)
>  create mode 100644 grub-core/lib/libgcrypt-patches/02_keccak_sse.diff
> 
> diff --git a/grub-core/lib/libgcrypt-patches/02_keccak_sse.diff 
> b/grub-core/lib/libgcrypt-patches/02_keccak_sse.diff
> new file mode 100644
> index 0..980ebb2b7
> --- /dev/null
> +++ b/grub-core/lib/libgcrypt-patches/02_keccak_sse.diff
> @@ -0,0 +1,19 @@
> +commit b0cf06271da5fe20360953a53a47c69da89669cd
> +Author: Vladimir Serbinenko 
> +Date:   Sun Apr 7 06:33:11 2024 +0300
> +
> +keccak: Disable acceleration with SSE asm
> +
> +diff --git a/grub-core/lib/libgcrypt/cipher/keccak.c 
> b/grub-core/lib/libgcrypt/cipher/keccak.c
Since this patch file is applied after importing libgcrypt to libgcrypt-grub,
the target file has to be libgcrypt-grub/cipher/keccak.c.

Gary Lin

> +index 11e64b3e7..8b570263b 100644
> +--- a/grub-core/lib/libgcrypt/cipher/keccak.c
>  b/grub-core/lib/libgcrypt/cipher/keccak.c
> +@@ -251,7 +251,7 @@ keccak_absorb_lane32bi(u32 *lane, u32 x0, u32 x1)
> + /* Construct generic 64-bit implementation. */
> + #ifdef USE_64BIT
> + 
> +-#if __GNUC__ >= 4 && defined(__x86_64__)
> ++#if __GNUC__ >= 4 && defined(__x86_64__) && 0
> + 
> + static inline void absorb_lanes64_8(u64 *dst, const byte *in)
> + {
> -- 
> 2.39.2
> 
> 
> ___
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel

___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel