Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1p7xQl-0005kr-8z for mharc-grub-devel@gnu.org; Wed, 21 Dec 2022 06:38:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7xQj-0005kQ-GH for grub-devel@gnu.org; Wed, 21 Dec 2022 06:38:37 -0500 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p7xQh-0005HC-Lk for grub-devel@gnu.org; Wed, 21 Dec 2022 06:38:37 -0500 Received: by mail-pj1-x102f.google.com with SMTP id x3so1115636pjv.4 for ; Wed, 21 Dec 2022 03:38:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=mdJC50F+2+XPLFTFcJuh6TAHKnJmH600K2YFkWYRUaU=; b=KZP5o7S7enqnS76HNs2OCwBlsYH5Wd16KLiHLb2uWcvd4UP4CAuA8gE009xOqEZIIP usL2JTTXSQHxQQZ9lGLVfxOv7vu4P2iPAA97sf9lJcgbLBGGiwD7okKnUpBUQe6LgEQD VAj+ny/2KuiUM7Ojqowx/OR9IPM05+lFs6P5eDsfBw+Jn5kuciALaJKVPqjK7jXKXj+i kG8Din63xsrwT4RMRFw2ZC+XX6rvvS2cvparFWA2EpA4ClVo1TwDzgFaL0EHTGtNRICX gEbVcC2TO/tnCgQh0D8wt8SC9EGhhKckb2QMsmfvPGUERyOx4gl4BQFC0e4oz2a274Ow 9LTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=mdJC50F+2+XPLFTFcJuh6TAHKnJmH600K2YFkWYRUaU=; b=50Y4/gOOYdawYenOwwvkIFZL4HHPBaD4f/vv8I2GgGBTbvt+ejU5JAbXpXpO/Z4t+5 6DSHG548fLRqgqDpBm6CT9pLSFgaVp7eCZ7ECasdazOtx8cTx2s5fyvOYDBMIE3EU8/f YN9lh5IxpLTQWnbXwqoD/HwdvRf39cOnW4djsYFuE2GBGdxiF/glg41D0fuzzLD1Sy9k QKQZk09aeMKtbk3QEx303MthnOVCkFRXIgC1ane1q5BZ3qzGJpfb2l24HVrX2IN0V8oy cPFzPb4FxbT0FfQrgINI7ovIEUiL87a9RVOHFJQFM4tWygBfj9PkaC4SSSu1E6aE09Yj +oTw== X-Gm-Message-State: AFqh2kqOHN2n3E2X2JdtDFvNnS1bVKgHvaLgNIsj/BbejFBVT2tlyMfg kBG+NezR5tGrz/h0oBbl88w= X-Google-Smtp-Source: AMrXdXuiUFju6PzVI60CaBkEMotjlxze6+pGZJWdgedeBIdge+T8xD8KBAGIIqo3goTVM6TWh774Qw== X-Received: by 2002:a05:6a21:e28b:b0:b2:4b74:1f85 with SMTP id bz11-20020a056a21e28b00b000b24b741f85mr2449279pzc.16.1671622713905; Wed, 21 Dec 2022 03:38:33 -0800 (PST) Received: from [0.0.0.0] (ec2-13-113-80-70.ap-northeast-1.compute.amazonaws.com. [13.113.80.70]) by smtp.gmail.com with ESMTPSA id x68-20020a626347000000b00574ee8cfdabsm10624083pfb.148.2022.12.21.03.38.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 21 Dec 2022 03:38:33 -0800 (PST) Message-ID: <48f3e768-9bbb-b556-b47e-40752621dd35@gmail.com> Date: Wed, 21 Dec 2022 19:38:28 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [RFC PATCH] kern/dl: Add module version check Content-Language: en-US To: Thomas Schmitt , grub-devel@gnu.org Cc: pete@akeo.ie, rharwood@redhat.com, development@efficientek.com, dkiper@net-space.pl References: <8490b57e-87e6-58ce-4d7a-c99ebf899b84@gmail.com> <15103386399840557260@scdbackup.webframe.org> From: Zhang Boyang In-Reply-To: <15103386399840557260@scdbackup.webframe.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=2607:f8b0:4864:20::102f; envelope-from=zhangboyang.id@gmail.com; helo=mail-pj1-x102f.google.com X-Spam_score_int: -32 X-Spam_score: -3.3 X-Spam_bar: --- X-Spam_report: (-3.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, NICE_REPLY_A=-1.161, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2022 11:38:37 -0000 Hi, On 2022/12/21 17:43, Thomas Schmitt wrote: > Hi, > > Pete Batard wrote: >>> unlike what is the case for UEFI, one can not expect >>> to be able to pick all the GRUB core files needed to convert a GRUB >>> based ISO bootable media to a GRUB based USB bootable media [...] >>> Typically, one of the >>> missing files will be a 'core.img' that can work for USB BIOS boot of a >>> MBR partitioned FAT or NTFS media, and that even a GRUB based ISOHybrid >>> image will not readily provide. > > Zhang Boyang wrote: >> The situation is, for BIOS boot, there is no grub core file in ISO >> because it's written to sectors instead of files? Did I understand >> correctly? > > I think it is rather about the fact that GRUB equipped hybrid ISOs boot > on legacy BIOS from USB stick via the MBR code (~440 byte) to the > El Torito boot image, which is in charge for booting from optical media. > In grub-mkrescue ISOs it is called > /boot/grub/i386-pc/eltorito.img > The MBR code is taken by grub-mkrescue.c from the file "boot_hybrid.img" > in source_dirs[GRUB_INSTALL_PLATFORM_I386_PC]. > > So no core.img is needed and the filesystem module set can be sparse, > because the filesystem type is known from which GRUB will read its further > software. > > Thanks for explaining! So I think the best solution for Rufus is to overwrite distro's .mod files with its owns (if mismatched modules is a problem). > Pete Batard wrote: >>> Rufus usually recommends to write such images in what it calls >>> "ISO mode" (shorthand for "ISO extraction mode") with the ISO content >>> extracted to a FAT or NTFS file system and with a GRUB core.img >>> bootloader > > Maybe one should not only put a copy of the EFI boot image's /EFI/BOOT > tree into grub-mkrescue ISOs but also an outdoor pack with the GRUB > equipment that is needed to make bootable a USB stick with FAT or NTFS. > (The filesystem modules are included in Pete Batard's proposal for the > /EFI/BOOT tree. But the disk MBR image and core.img are not.) > > > Zhang Boyang wrote: >> test whether that commit (052e6068be62) breaks Rufus >> (e.g. Rufus with latest git GRUB, to boot Debian ISO). > > Debian ISOs still boot on legacy BIOS via ISOLINUX. > Archlinux, Ubuntu, Fedora, and others meanwhile use GRUB in their ISOs for > both, legacy BIOS and EFI. > Oh, yes, Debian seems using isolinux instead of grub.... So please use Ubuntu ISOs for testing, which uses grub in BIOS mode. By the way, I also tried Arch Linux, it also uses isolinux (but it has a theme looks like grub). I did reversed tests (i.e. old GRUB core + new GRUB modules) just now: 1) I used Rufus 3.21 and ubuntu-22.04.1-desktop-amd64.iso (which uses GRUB 2.06) to create a USB stick. To simulate mismatched modules, I overwrited "\boot\grub\i386-pc\relocator.mod" (on USB stick) with my latest git build. Then that USB stick failed to boot in BIOS mode, showing "452: out of range pointer: 0x100010" error. 2) I tested supergrub2-2.06s1-beta2-multiarch-CD.iso with latest Arch Linux (BIOS mode, grub 2:2.06.r403.g7259d55ff-1). It doesn't have problems booting Arch Linux because it has $prefix properly set to its own GRUB path in CDROM, so it is using its own modules. If I manually run "set prefix=(hd0,msdos1)/boot/grub", it will failed to boot, showing "error: symbol `grub_debug_malloc' not found." By the way, I googled "452: out of range pointer" and there seems a lot of them. Probably the root cause of many of them is mismatched modules, so I think giving a clear message to user should be helpful (if similar things happens in future). Best Regards, Zhang Boyang > I think that in any case an ISO made by grub-mkrescue should be tested. > Maybe a distro developer is here who uses it for making a full fledged > installation ISO or a live ISO. > > > Have a nice day :) > > Thomas >