mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00:00
[syslinux] improve support for Syslinux based Slax ISOs
* For some weird reason appending the base directory to the root syslinux.cfg we create does not appear to work with Slax. So we now always patch ldlinux.sys to include the base directory. * Also add an exception to move the /slax/boot/EFI directory to /EFI. * It should be noted that, as of slax-64bit-slackware-15.0.3.iso, the Slax UEFI Syslinux bootloaders appear to be broken (since creating a media without using Rufus at all per the Slax documentation does *not* produce a USB drive that was bootable in UEFI mode on 2 of the machines I tried). * Also clean up some iso.c code and fix some unreachable code in ntfssect.c. * Closes #2336. * Closes #2338.
This commit is contained in:
parent
45a5f22d43
commit
0bd38abd4e
5 changed files with 44 additions and 24 deletions
13
src/iso.c
13
src/iso.c
|
@ -1308,6 +1308,19 @@ out:
|
|||
// bootmgr might need to be uncompressed: https://github.com/pbatard/rufus/issues/1381
|
||||
RunCommand("compact /u bootmgr* efi/boot/*.efi", dest_dir, TRUE);
|
||||
}
|
||||
// Exception for Slax Syslinux UEFI bootloaders...
|
||||
// ...that don't appear to work anyway as of slax-64bit-slackware-15.0.3.iso
|
||||
static_sprintf(path, "%s\\slax\\boot\\EFI", dest_dir);
|
||||
if (PathFileExistsA(path)) {
|
||||
char dst_path[16];
|
||||
static_sprintf(dst_path, "%s\\EFI", dest_dir);
|
||||
if (!PathFileExistsA(dst_path)) {
|
||||
if (MoveFileA(path, dst_path))
|
||||
uprintf("Moved: %s → %s", path, dst_path);
|
||||
else
|
||||
uprintf("Could not move %s → %s", path, dst_path, WindowsErrorString());
|
||||
}
|
||||
}
|
||||
update_md5sum();
|
||||
if (archive_path != NULL) {
|
||||
uprintf("● Adding files from %s", archive_path);
|
||||
|
|
10
src/rufus.rc
10
src/rufus.rc
|
@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
|||
IDD_DIALOG DIALOGEX 12, 12, 232, 326
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
EXSTYLE WS_EX_ACCEPTFILES
|
||||
CAPTION "Rufus 4.3.2085"
|
||||
CAPTION "Rufus 4.3.2086"
|
||||
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
|
||||
BEGIN
|
||||
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
|
||||
|
@ -392,8 +392,8 @@ END
|
|||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 4,3,2085,0
|
||||
PRODUCTVERSION 4,3,2085,0
|
||||
FILEVERSION 4,3,2086,0
|
||||
PRODUCTVERSION 4,3,2086,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
|
@ -411,13 +411,13 @@ BEGIN
|
|||
VALUE "Comments", "https://rufus.ie"
|
||||
VALUE "CompanyName", "Akeo Consulting"
|
||||
VALUE "FileDescription", "Rufus"
|
||||
VALUE "FileVersion", "4.3.2085"
|
||||
VALUE "FileVersion", "4.3.2086"
|
||||
VALUE "InternalName", "Rufus"
|
||||
VALUE "LegalCopyright", "© 2011-2023 Pete Batard (GPL v3)"
|
||||
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
|
||||
VALUE "OriginalFilename", "rufus-4.3.exe"
|
||||
VALUE "ProductName", "Rufus"
|
||||
VALUE "ProductVersion", "4.3.2085"
|
||||
VALUE "ProductVersion", "4.3.2086"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* Copyright 2003 Lars Munch Christensen - All Rights Reserved
|
||||
* Copyright 1998-2008 H. Peter Anvin - All Rights Reserved
|
||||
* Copyright 2012-2021 Pete Batard
|
||||
* Copyright 2012-2023 Pete Batard
|
||||
*
|
||||
* Based on the Linux installer program for SYSLINUX by H. Peter Anvin
|
||||
*
|
||||
|
@ -111,7 +111,7 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter, int file_system)
|
|||
libfat_sector_t *sectors = NULL;
|
||||
int ldlinux_sectors;
|
||||
uint32_t ldlinux_cluster;
|
||||
int i, nsectors, sl_fs_stype;
|
||||
int i, w, nsectors, sl_fs_stype;
|
||||
BOOL use_v5 = (boot_type == BT_SYSLINUX_V6) || ((boot_type == BT_IMAGE) && (SL_MAJOR(img_report.sl_version) >= 5));
|
||||
|
||||
PrintInfoDebug(0, MSG_234, (boot_type == BT_IMAGE) ? img_report.sl_version_str : embedded_sl_version_str[use_v5?1:0]);
|
||||
|
@ -287,8 +287,14 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter, int file_system)
|
|||
goto out;
|
||||
}
|
||||
|
||||
/* Patch ldlinux.sys and the boot sector */
|
||||
if (syslinux_patch(sectors, nsectors, 0, 0, NULL, NULL) < 0) {
|
||||
/* Set the base directory and patch ldlinux.sys and the boot sector */
|
||||
for (i = (int)strlen(img_report.cfg_path); (i > 0) && (img_report.cfg_path[i] != '/'); i--);
|
||||
if (i > 0)
|
||||
img_report.cfg_path[i] = 0;
|
||||
w = syslinux_patch(sectors, nsectors, 0, 0, img_report.cfg_path, NULL);
|
||||
if (i > 0)
|
||||
img_report.cfg_path[i] = '/';
|
||||
if (w < 0) {
|
||||
uprintf("Could not patch Syslinux files.");
|
||||
uprintf("WARNING: This could be caused by your firewall having modified downloaded content, such as 'ldlinux.sys'...");
|
||||
goto out;
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "syslinux.h"
|
||||
#include "syslxint.h"
|
||||
|
||||
extern void uprintf(const char* format, ...);
|
||||
|
||||
/*
|
||||
* Generate sector extents
|
||||
|
@ -161,8 +162,8 @@ int syslinux_patch(const sector_t *sectp, int nsectors,
|
|||
#if 0
|
||||
if (nsect > nptrs) {
|
||||
/* Not necessarily an error in this case, but a general problem */
|
||||
fprintf(stderr, "Insufficient extent space, build error!\n");
|
||||
exit(1);
|
||||
uprintf("syslinux_patch: Insufficient extent space, build error!\n");
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -178,8 +179,8 @@ int syslinux_patch(const sector_t *sectp, int nsectors,
|
|||
if (subdir) {
|
||||
int sublen = strlen(subdir) + 1;
|
||||
if (get_16_sl(&epa->dirlen) < sublen) {
|
||||
fprintf(stderr, "Subdirectory path too long... aborting install!\n");
|
||||
exit(1);
|
||||
uprintf("syslinux_patch: Subdirectory path too long... aborting install!");
|
||||
return -1;
|
||||
}
|
||||
memcpy_to_sl(slptr(boot_image, &epa->diroffset), subdir, sublen);
|
||||
}
|
||||
|
@ -188,8 +189,8 @@ int syslinux_patch(const sector_t *sectp, int nsectors,
|
|||
if (subvol) {
|
||||
int sublen = strlen(subvol) + 1;
|
||||
if (get_16_sl(&epa->subvollen) < sublen) {
|
||||
fprintf(stderr, "Subvol name too long... aborting install!\n");
|
||||
exit(1);
|
||||
uprintf("syslinux_patch: Subvol name too long... aborting install!");
|
||||
return -1;
|
||||
}
|
||||
memcpy_to_sl(slptr(boot_image, &epa->subvoloffset), subvol, sublen);
|
||||
}
|
||||
|
|
|
@ -126,10 +126,10 @@ static DWORD NtfsSectGetVolumeHandle(
|
|||
M_ERR("Unable to open volume handle!");
|
||||
goto err_handle;
|
||||
}
|
||||
CloseHandle(VolumeInfo->Handle);
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
|
||||
CloseHandle(VolumeInfo->Handle);
|
||||
err_handle:
|
||||
|
||||
return rc;
|
||||
|
|
Loading…
Reference in a new issue