From: srs5694 Date: Mon, 26 Oct 2015 01:01:56 +0000 (-0400) Subject: Merge commit '66d7ba273b64a6dd5987c32b5c3bc849b9fa9f16' X-Git-Url: https://code.delx.au/refind/commitdiff_plain/1e45a07f1a4521411ccd61dffe00e7ceebd38824?hp=66d7ba273b64a6dd5987c32b5c3bc849b9fa9f16 Merge commit '66d7ba273b64a6dd5987c32b5c3bc849b9fa9f16' --- diff --git a/CREDITS.txt b/CREDITS.txt index 887e892..53011ad 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -75,21 +75,21 @@ Icons and graphics: ------------------- * I replaced many of the original rEFIt icons with icons taken from the - Oxygen Icons project, either from the Oxygen Refit package on its page - (http://deviantdark.deviantart.com/art/Oxygen-Refit-70199755) or from the - oxygen-icons version 4.7.4 package on my Gentoo Linux development system. - These icons are released under the LGPLv3 or GPLv3. If I'm reading the - pages correctly, the original creator was David Vignoni (aka - "deviantdark" on the deviantart site). + Oxygen Icons project, originally from the Oxygen Refit package on its + page (http://deviantdark.deviantart.com/art/Oxygen-Refit-70199755) or + from the oxygen-icons version 4.7.4 package on my Gentoo Linux + development system. As of version 0.9.3, I refreshed these icons with + versions from Ubuntu's oxygen-icon-theme 4.13.0-0ubuntu1 package. These + icons are released under the GPLv3. If I'm reading the pages correctly, + the original creator was David Vignoni (aka "deviantdark" on the + deviantart site). * Erik Kemperman provided the rEFInd icon, which is a combination of the common refresh/reload icon and the search/find icon. -* The keys icon for MOK keys management comes from the - kdeartwork-iconthemes-4.8.5 package on Gentoo. - -* The memtest icon (tool_memtest.icns) was originally memory.png from - the Gentoo kdeartwork-iconthemes-4.10.5 icons package. +* The memtest icon (tool_memtest.icns) was originally memory.png from the + Gentoo kdeartwork-iconthemes-4.10.5 icons package, and was subsequently + updated from the Ubuntu kdeartwork 4:15.08.1-0ubuntu1 package. * The gummiboot icon is taken from the gummiboot Web page (http://freedesktop.org/wiki/Software/gummiboot) and scaled down diff --git a/EfiLib/gnuefi-helper.c b/EfiLib/gnuefi-helper.c index 2c344b1..d4f269d 100644 --- a/EfiLib/gnuefi-helper.c +++ b/EfiLib/gnuefi-helper.c @@ -2,11 +2,16 @@ * EfiLib/gnuefi-helper.c * GNU-EFI support functions * - * Copyright (c) 2014 Roderick W. Smith - * With extensive borrowing from other sources (mostly Tianocore) + * Borrowed from the TianoCore EDK II, with modifications by Rod Smith * - * This software is licensed under the terms of the GNU GPLv3, - * a copy of which should come with this file. + * Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.
+ * This program and the accompanying materials + * are licensed and made available under the terms and conditions of the BSD License + * which accompanies this distribution. The full text of the license may be found at + * http://opensource.org/licenses/bsd-license.php + * + * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. * */ @@ -307,4 +312,4 @@ GetNextDevicePathInstance ( } return ReturnValue; -} \ No newline at end of file +} diff --git a/EfiLib/gnuefi-helper.h b/EfiLib/gnuefi-helper.h index 2a2fe07..694988a 100644 --- a/EfiLib/gnuefi-helper.h +++ b/EfiLib/gnuefi-helper.h @@ -1,12 +1,17 @@ /* - * EfiLib/gnuefi.h + * EfiLib/gnuefi-helper.h * Header file for GNU-EFI support in legacy boot code * - * Copyright (c) 2014 Roderick W. Smith - * With extensive borrowing from other sources (mostly Tianocore) + * Borrowed from the TianoCore EDK II, with modifications by Rod Smith * - * This software is licensed under the terms of the GNU GPLv3, - * a copy of which should come with this file. + * Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.
+ * This program and the accompanying materials + * are licensed and made available under the terms and conditions of the BSD License + * which accompanies this distribution. The full text of the license may be found at + * http://opensource.org/licenses/bsd-license.php + * + * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. * */ /* diff --git a/debian/control b/debian/control index 344ebdb..7820838 100644 --- a/debian/control +++ b/debian/control @@ -6,7 +6,7 @@ Standards-Version: 3.9.5 Build-Depends: debhelper (>= 9), gnu-efi Package: refind -Architecture: any +Architecture: i386, amd64 Depends: ${misc:Depends}, efibootmgr, openssl, sbsigntool, util-linux, parted Description: boot manager for EFI-based computers A graphical boot manager for EFI- and UEFI-based computers, such as all diff --git a/debian/copyright b/debian/copyright index 1ceeff4..a8c0f36 100644 --- a/debian/copyright +++ b/debian/copyright @@ -25,10 +25,195 @@ Upstream Authors: Apple, Inc. Copyright: - Copyright 2012 Roderick W. Smith - Copyright 2006 Christoph Pfisterer -License: +This package builds two EFI application programs and several drivers. +Documentation and icons are also included. + +* The main rEFInd binary (refind_x64.efi or refind_ia32.efi) uses source + code with various licenses, all of which are compatible with the GPL-3, + which is the overarching license. +* The gptsync binary uses source files that all use the BSD 2-clause + license. +* Drivers all rely on a BSD 2-clause base. Beyond that, things diverge: + * The HFS+ and ISO-9660 drivers use GPL-2 source files + * The Btrfs driver uses GPL-2+ and GPL-3+ source files + * The ext2fs, ext4fs, ReiserFS, and NTFS drivers all use GPL-2+ + source files. +* The documentation is licensed under the FDL 1.3 + +File-by-file details are described below. + +Files Used to Create Main rEFInd Binary +--------------------------------------- + +Files: refind/* + libeg/image.c + libeg/screen.c +Copyright: 2006-2010 Christoph Pfisterer + 2012-2015 Roderick W. Smith +License: BSD 3-clause & GPL-3+ + +Files: refind/icns.c + libeg/* +Copyright: 2006-2007 Christoph Pfisterer +License BSD 3-clause + +Files: refind/gpt.[ch] + libeg/lodepng_xtra.c +Copyright: 2014-2015 Roderick W. Smith +License: GPL-3+ + +Files: refind/crc32.[ch] +Copyright: 1986 Gary S. Brown +License: "You may use this program, or code or tables extracted from it, as + desired without restriction." + +Files: refind/driver_support.[ch] +Copyright: 2006-2011 Intel Corporation +License: BSD 2-clause + +Files: refind/line_edit.[ch] +Copyright: 2012 Harald Hoyer + 2012-2013 Kay Sievers +License: LGPL-2.1+ + +Files: EfiLib/* +Copyright: 2004-2011 Intel Corp. +License: BSD 2-clause + +Files: libeg/lodepng.c +Copyright: 2005-2013 Lode Vandevenne +License: zlib + +Files: mok/* +Copyright: 2012 James Bottomley +License: LGPL-2.1 + +Files: mok/mok.[ch] +Copyright: 2012 Red Hat, Inc. + 2009-2012 Intel Corporation +License: BSD 2-clause + +Files: include/* +Copyright: 2006-2010 Intel Corporation +License: BSD 2-clause + +Files: include/syslinux_mbr.h +Copyright: 2003-2004 H. Peter Anvin +License: Expat + +Files: include/RemovableMedia.h +Copyright: 2005 Apple Computer, Inc. +License: See comments in file + +Files Used to Create gptsync Binary +----------------------------------- + +Files: gptsync/* +Copyright: 2006 Christoph Pfisterer +License: BSD 2-clause + +Files: gptsync/gptsync.c +Copyright: 2006 Christoph Pfisterer + 2013 Roderick W. Smith +License: BSD 2-clause + +Base Filesystem Driver Files +---------------------------- + +Files: filesystems/fsw_core.[ch] + filesystems/fsw_efi.[ch] + filesystems/fsw_efi_lib.c + filesystems/fsw_efi_base.h + filesystems/fsw_lib.c +Copyright: 2006 Christoph Pfisterer +License: BSD 3-clause + +Files: filesystems/fsw_efi_edk2_base.h +Copyright: 2012 Stefan Agner +License BSD 3-clause + +Files Used by ext2fs, ext4fs, ReiserFS, NTFS Filesystem Drivers +(Used in addition to Base Filesystem Driver Files) +--------------------------------------------------------------- + +Files: filesystems/fsw_ext2.[ch] + filesystems/fsw_ext2_disk.h + filesystems/fsw_reiserfs.[ch] + filesystems/fsw_reiserfs_disk.h +Copyright: 2006 Christoph Pfisterer +License: GPL-2+ + +Files: filesystems/fsw_ext4.c +Copyright: 2012 Stefan Agner +License: GPL-2+ + +Files: filesystems/fsw_ext4.h +Copyright: 2006 Christoph Pfisterer + 2012 Stefan Agner +License: GPL-2+ + +Files: filesystems/fsw_ext4_disk.h +Copyright: 2006 Christoph Pfisterer + 2012 Stefan Agner + 1991-2012 by various Linux kernel contributors +License: GPL-2+ + +Files: filesystems/fsw_ntfs.c +Copyright: Samuel Liao +License: GPL-2+ + +Files Used by Btrfs Filesystem Driver +(Used in addition to Base Filesystem Driver Files) +-------------------------------------------------- + +Files: filesystems/crc32c.c + filesystems/gzio.c +Copyright: 2008 Free Software Foundation, Inc. +License: GPL-3+ + +Files: filesystems/fsw_btrfs.c +Copyright: 2010 Free Software Foundation, Inc. + 2013 Tencent, Inc. (Samuel Liao) +License: GPL-3+ + +Files: filesystems/minilzo.[ch] +Copyright: 1996-2011 Markus Franz Xaver Johannes Oberhumer +License: GPL-2+ + +Files: filesystems/scandisk.c +Copyright: 2013 Tencent, Inc. (Samuel Liao) +License: GPL-3+ + +Files Used by HFS+ & ISO-9660 Filesystem Drivers +(Used in addition to Base Filesystem Driver Files) +-------------------------------------------------- + +Files: filesystems/fsw_hfs.[ch] +Copyright: 2010 Oracle Corporation +License: GPL-2 + +Files: filesystems/fsw_iso9660.[ch] +Copyright: 2006 Christoph Pfisterer + 2010 Oracle Corporation +License: BSD 3-clause & GPL-2 + +Files Used to Build iPXE (not built by default) +----------------------------------------------- + +Files: net/* +Copyright: 2009 Michael Brown +License: GPL-2+ + +Documentation +------------- + +Files: docs/* +Copyright: 2012-2015 Roderick W. Smith +License: FDL 1.3 + + +License: GPL-3 This package is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/filesystems/crc32c.c b/filesystems/crc32c.c index 343fd21..ec10d25 100644 --- a/filesystems/crc32c.c +++ b/filesystems/crc32c.c @@ -2,6 +2,23 @@ * this file take from grub 2.0 * for btrfs UEFI driver */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2008 Free Software Foundation, Inc. + * + * GRUB is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GRUB is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GRUB. If not, see . + */ static uint32_t crc32c_table [256]; diff --git a/filesystems/fsw_ntfs.c b/filesystems/fsw_ntfs.c index 86db271..2fda530 100644 --- a/filesystems/fsw_ntfs.c +++ b/filesystems/fsw_ntfs.c @@ -1,7 +1,7 @@ /** * \file fsw_ntfs.c * ntfs file system driver code. - * by Samuel Liao + * Copyright (C) 2015 by Samuel Liao */ /*- diff --git a/filesystems/scandisk.c b/filesystems/scandisk.c index 6ae5cf8..d8b862a 100644 --- a/filesystems/scandisk.c +++ b/filesystems/scandisk.c @@ -5,6 +5,21 @@ * * Copyright (c) 2013 Tencent, Inc. */ +/* + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #include "fsw_efi.h" #ifdef __MAKEWITH_GNUEFI #include "edk2/DriverBinding.h" diff --git a/icons/func_exit.png b/icons/func_exit.png index 2038cfc..9ae1f1f 100644 Binary files a/icons/func_exit.png and b/icons/func_exit.png differ diff --git a/icons/func_firmware.png b/icons/func_firmware.png index f418082..4ac82ce 100644 Binary files a/icons/func_firmware.png and b/icons/func_firmware.png differ diff --git a/icons/tool_memtest.png b/icons/tool_memtest.png index c85bf9e..d1f80ea 100644 Binary files a/icons/tool_memtest.png and b/icons/tool_memtest.png differ diff --git a/icons/tool_mok_tool.png b/icons/tool_mok_tool.png index 976ed77..fbb1dfc 100644 Binary files a/icons/tool_mok_tool.png and b/icons/tool_mok_tool.png differ diff --git a/icons/tool_netboot.png b/icons/tool_netboot.png index a5070ef..3df117a 100644 Binary files a/icons/tool_netboot.png and b/icons/tool_netboot.png differ diff --git a/icons/tool_part.png b/icons/tool_part.png index c4ade3b..71ec791 100644 Binary files a/icons/tool_part.png and b/icons/tool_part.png differ diff --git a/icons/vol_net.png b/icons/vol_net.png index 614d53c..a9a9d2e 100644 Binary files a/icons/vol_net.png and b/icons/vol_net.png differ diff --git a/icons/vol_optical.png b/icons/vol_optical.png index 05507ea..6b533af 100644 Binary files a/icons/vol_optical.png and b/icons/vol_optical.png differ diff --git a/libeg/image.c b/libeg/image.c index 614d312..124c997 100644 --- a/libeg/image.c +++ b/libeg/image.c @@ -35,11 +35,24 @@ */ /* * Modifications copyright (c) 2012-2015 Roderick W. Smith - * + * * Modifications distributed under the terms of the GNU General Public - * License (GPL) version 3 (GPLv3), a copy of which must be distributed - * with this source code or binaries made from it. - * + * License (GPL) version 3 (GPLv3), or (at your option) any later version. + * + */ +/* + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ #include "libegint.h" diff --git a/libeg/lodepng_xtra.c b/libeg/lodepng_xtra.c index 2116012..343fbff 100644 --- a/libeg/lodepng_xtra.c +++ b/libeg/lodepng_xtra.c @@ -2,11 +2,26 @@ * Additional functions to support LodePNG for use in rEFInd * * copyright (c) 2013 by by Roderick W. Smith, and distributed - * under the terms of the GNU GPL v3. + * under the terms of the GNU GPL v3, or (at your option) any + * later version. * * See http://lodev.org/lodepng/ for the original LodePNG. * */ +/* + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #include "global.h" #include "../refind/screen.h" @@ -110,4 +125,4 @@ EG_IMAGE * egDecodePNG(IN UINT8 *FileData, IN UINTN FileDataLength, IN UINTN Ico lodepng_free(PixelData); return NewImage; -} // EG_IMAGE * egDecodePNG() \ No newline at end of file +} // EG_IMAGE * egDecodePNG() diff --git a/libeg/screen.c b/libeg/screen.c index cdf1506..61df93b 100644 --- a/libeg/screen.c +++ b/libeg/screen.c @@ -37,10 +37,23 @@ * Modifications copyright (c) 2012-2014 Roderick W. Smith * * Modifications distributed under the terms of the GNU General Public - * License (GPL) version 3 (GPLv3), a copy of which must be distributed - * with this source code or binaries made from it. + * License (GPL) version 3 (GPLv3), or (at your option) any later version. * */ +/* + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #include "libegint.h" #include "../refind/screen.h" diff --git a/mok/COPYING b/mok/COPYING index 804e589..e2aa3e6 100644 --- a/mok/COPYING +++ b/mok/COPYING @@ -1,7 +1,9 @@ Below file was part of the efitools package by James Bottomley, from which -most of the source files in this directory were taken. The mok.c and mok.h -files, however, are based on Matthew J. Garrett's shim program; see the -copyright notices in those files for details.... +most of the source files in this directory were taken. The files in this +directory originated in the "lib" directory of the efitools package, and so +fall under the LGPLv2.1. The mok.c and mok.h files, however, are based on +Matthew J. Garrett's shim program; see the copyright notices in those files +for details.... ------------------------------------------------------------------------ diff --git a/refind.conf-sample b/refind.conf-sample index 32ccc59..abab655 100644 --- a/refind.conf-sample +++ b/refind.conf-sample @@ -424,35 +424,35 @@ timeout 20 # of an initial RAM disk. Note uses of Linux-style forward slashes. # Also note that a leading slash is optional in file specifications. menuentry Linux { - icon EFI/refind/icons/os_linux.png - volume 904404F8-B481-440C-A1E3-11A5A954E601 - loader bzImage-3.3.0-rc7 - initrd initrd-3.3.0.img - options "ro root=UUID=5f96cafa-e0a7-4057-b18f-fa709db5b837" - disabled + icon EFI/refind/icons/os_linux.png + volume 904404F8-B481-440C-A1E3-11A5A954E601 + loader bzImage-3.3.0-rc7 + initrd initrd-3.3.0.img + options "ro root=UUID=5f96cafa-e0a7-4057-b18f-fa709db5b837" + disabled } # A sample entry for loading Ubuntu using its standard name for # its GRUB 2 boot loader. Note uses of Linux-style forward slashes menuentry Ubuntu { - loader /EFI/ubuntu/grubx64.efi - icon /EFI/refind/icons/os_linux.png - disabled + loader /EFI/ubuntu/grubx64.efi + icon /EFI/refind/icons/os_linux.png + disabled } # A minimal ELILO entry, which probably offers nothing that # auto-detection can't accomplish. menuentry "ELILO" { - loader \EFI\elilo\elilo.efi - disabled + loader \EFI\elilo\elilo.efi + disabled } # Like the ELILO entry, this one offers nothing that auto-detection # can't do; but you might use it if you want to disable auto-detection # but still boot Windows.... menuentry "Windows 7" { - loader \EFI\Microsoft\Boot\bootmgfw.efi - disabled + loader \EFI\Microsoft\Boot\bootmgfw.efi + disabled } # EFI shells are programs just like boot loaders, and can be @@ -461,10 +461,10 @@ menuentry "Windows 7" { # could initialize hardware and then launch an OS, or it could # do something entirely different. menuentry "Windows via shell script" { - icon \EFI\refind\icons\os_win.png - loader \EFI\tools\shell.efi - options "fs0:\EFI\tools\launch_windows.nsh" - disabled + icon \EFI\refind\icons\os_win.png + loader \EFI\tools\shell.efi + options "fs0:\EFI\tools\launch_windows.nsh" + disabled } # Mac OS is normally detected and run automatically; however, @@ -474,8 +474,8 @@ menuentry "Windows via shell script" { # certainly need to change the "volume" line for this example # to work. menuentry "My Mac OS X" { - icon \EFI\refind\icons\os_mac.png - volume "OS X boot" - loader \System\Library\CoreServices\boot.efi - disabled + icon \EFI\refind\icons\os_mac.png + volume "OS X boot" + loader \System\Library\CoreServices\boot.efi + disabled } diff --git a/refind/Make.tiano b/refind/Make.tiano index f8f60ff..4cc1783 100644 --- a/refind/Make.tiano +++ b/refind/Make.tiano @@ -35,7 +35,7 @@ ALL_EFILIBS = $(EFILIB)/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevel # /usr/local/UDK2010/MyWorkSpace/Build/MdeModule/RELEASE_GCC46/X64/MdeModulePkg/Core/Dxe/DxeMain/OUTPUT/DxeMain/DxeMain.obj -SOURCE_NAMES = config driver_support icns lib main menu screen gpt crc32 legacy AutoGen +SOURCE_NAMES = config line_edit driver_support icns lib main menu screen gpt crc32 legacy AutoGen OBJS = $(SOURCE_NAMES:=.obj) all: $(BUILDME) diff --git a/refind/Makefile b/refind/Makefile index 402e33d..fe5c247 100644 --- a/refind/Makefile +++ b/refind/Makefile @@ -25,8 +25,8 @@ LOCAL_CPPFLAGS = -I$(SRCDIR) -I$(SRCDIR)/../include -I$(SRCDIR)/../libeg -I$(SR LOCAL_LDFLAGS = -L$(SRCDIR)/../libeg/ -L$(SRCDIR)/../mok/ -L$(SRCDIR)/../EfiLib/ LOCAL_LIBS = -leg -lmok -lEfiLib -OBJS = main.o config.o menu.o screen.o icns.o gpt.o crc32.o lib.o driver_support.o legacy.o -#OBJS = main.o config.o menu.o screen.o icns.o lib.o mok.o driver_support.o variables.o sha256.o pecoff.o simple_file.o security_policy.o guid.o +OBJS = main.o line_edit.o config.o menu.o screen.o icns.o gpt.o crc32.o lib.o driver_support.o legacy.o +#OBJS = main.o line_edit.o config.o menu.o screen.o icns.o lib.o mok.o driver_support.o variables.o sha256.o pecoff.o simple_file.o security_policy.o guid.o all: $(TARGET) diff --git a/refind/config.c b/refind/config.c index afededb..194dcb8 100644 --- a/refind/config.c +++ b/refind/config.c @@ -38,10 +38,23 @@ * Modifications copyright (c) 2012-2015 Roderick W. Smith * * Modifications distributed under the terms of the GNU General Public - * License (GPL) version 3 (GPLv3), a copy of which must be distributed - * with this source code or binaries made from it. + * License (GPL) version 3 (GPLv3) or (at your option) any later version. * */ +/* + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . +*/ #include "global.h" #include "lib.h" diff --git a/refind/gpt.c b/refind/gpt.c index cc6c70b..6ce2ba0 100644 --- a/refind/gpt.c +++ b/refind/gpt.c @@ -5,11 +5,19 @@ * Copyright (c) 2014-2015 Roderick W. Smith * All rights reserved. * - * This program is distributed under the terms of the GNU General Public - * License (GPL) version 3 (GPLv3), a copy of which must be distributed - * with this source code or binaries made from it. + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. * - */ + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . +*/ #include "gpt.h" #include "lib.h" diff --git a/refind/legacy.c b/refind/legacy.c index 10dfc5e..3f1ccc7 100644 --- a/refind/legacy.c +++ b/refind/legacy.c @@ -37,10 +37,23 @@ * Modifications copyright (c) 2012-2015 Roderick W. Smith * * Modifications distributed under the terms of the GNU General Public - * License (GPL) version 3 (GPLv3), a copy of which must be distributed - * with this source code or binaries made from it. + * License (GPL) version 3 (GPLv3), or (at your option) any later version. * */ +/* + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . +*/ #include "global.h" #include "icns.h" diff --git a/refind/lib.c b/refind/lib.c index 961e89d..33af394 100644 --- a/refind/lib.c +++ b/refind/lib.c @@ -37,10 +37,23 @@ * Modifications copyright (c) 2012-2015 Roderick W. Smith * * Modifications distributed under the terms of the GNU General Public - * License (GPL) version 3 (GPLv3), a copy of which must be distributed - * with this source code or binaries made from it. + * License (GPL) version 3 (GPLv3), or (at your option) any later version. * */ +/* + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #include "global.h" #include "lib.h" diff --git a/refind/line_edit.c b/refind/line_edit.c new file mode 100644 index 0000000..8bb9fb4 --- /dev/null +++ b/refind/line_edit.c @@ -0,0 +1,217 @@ +// Line-editing functions borrowed from gummiboot (cursor_left(), +// cursor_right(), & line_edit()). + +/* + * Simple UEFI boot loader which executes configured EFI images, where the + * default entry is selected by a configured pattern (glob) or an on-screen + * menu. + * + * All gummiboot code is LGPL not GPL, to stay out of politics and to give + * the freedom of copying code from programs to possible future libraries. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * Copyright (C) 2012-2013 Kay Sievers + * Copyright (C) 2012 Harald Hoyer + * + * "Any intelligent fool can make things bigger, more complex, and more violent. +" + * -- Albert Einstein + */ + +#include "global.h" +#include "screen.h" +#include "lib.h" +#include "../include/refit_call_wrapper.h" + +static void cursor_left(UINTN *cursor, UINTN *first) +{ + if ((*cursor) > 0) + (*cursor)--; + else if ((*first) > 0) + (*first)--; +} + +static void cursor_right(UINTN *cursor, UINTN *first, UINTN x_max, UINTN len) +{ + if ((*cursor)+2 < x_max) + (*cursor)++; + else if ((*first) + (*cursor) < len) + (*first)++; +} + +BOOLEAN line_edit(CHAR16 *line_in, CHAR16 **line_out, UINTN x_max) { + CHAR16 *line; + UINTN size; + UINTN len; + UINTN first; + UINTN y_pos = 3; + CHAR16 *print; + UINTN cursor; + BOOLEAN exit; + BOOLEAN enter; + + DrawScreenHeader(L"Line Editor"); + refit_call3_wrapper(ST->ConOut->SetCursorPosition, ST->ConOut, (ConWidth - 71) / 2, ConHeight - 1); + refit_call2_wrapper(ST->ConOut->OutputString, ST->ConOut, + L"Use cursor keys to edit, Esc to exit, Enter to boot with edited options"); + + if (!line_in) + line_in = L""; + size = StrLen(line_in) + 1024; + line = AllocatePool(size * sizeof(CHAR16)); + StrCpy(line, line_in); + len = StrLen(line); + print = AllocatePool(x_max * sizeof(CHAR16)); + + refit_call2_wrapper(ST->ConOut->EnableCursor, ST->ConOut, TRUE); + + first = 0; + cursor = 0; + enter = FALSE; + exit = FALSE; + while (!exit) { + UINTN index; + EFI_STATUS err; + EFI_INPUT_KEY key; + UINTN i; + + i = len - first; + if (i >= x_max-2) + i = x_max-2; + CopyMem(print, line + first, i * sizeof(CHAR16)); + print[i++] = ' '; + print[i] = '\0'; + + refit_call3_wrapper(ST->ConOut->SetCursorPosition, ST->ConOut, 0, y_pos); + refit_call2_wrapper(ST->ConOut->OutputString, ST->ConOut, print); + refit_call3_wrapper(ST->ConOut->SetCursorPosition, ST->ConOut, cursor, y_pos); + + refit_call3_wrapper(BS->WaitForEvent, 1, &ST->ConIn->WaitForKey, &index); + err = refit_call2_wrapper(ST->ConIn->ReadKeyStroke, ST->ConIn, &key); + if (EFI_ERROR(err)) + continue; + + switch (key.ScanCode) { + case SCAN_ESC: + exit = TRUE; + break; + case SCAN_HOME: + cursor = 0; + first = 0; + continue; + case SCAN_END: + cursor = len; + if (cursor >= x_max) { + cursor = x_max-2; + first = len - (x_max-2); + } + continue; + case SCAN_UP: + while((first + cursor) && line[first + cursor] == ' ') + cursor_left(&cursor, &first); + while((first + cursor) && line[first + cursor] != ' ') + cursor_left(&cursor, &first); + while((first + cursor) && line[first + cursor] == ' ') + cursor_left(&cursor, &first); + if (first + cursor != len && first + cursor) + cursor_right(&cursor, &first, x_max, len); + refit_call3_wrapper(ST->ConOut->SetCursorPosition, ST->ConOut, cursor, y_pos); + continue; + case SCAN_DOWN: + while(line[first + cursor] && line[first + cursor] == ' ') + cursor_right(&cursor, &first, x_max, len); + while(line[first + cursor] && line[first + cursor] != ' ') + cursor_right(&cursor, &first, x_max, len); + while(line[first + cursor] && line[first + cursor] == ' ') + cursor_right(&cursor, &first, x_max, len); + refit_call3_wrapper(ST->ConOut->SetCursorPosition, ST->ConOut, cursor, y_pos); + continue; + case SCAN_RIGHT: + if (first + cursor == len) + continue; + cursor_right(&cursor, &first, x_max, len); + refit_call3_wrapper(ST->ConOut->SetCursorPosition, ST->ConOut, cursor, y_pos); + continue; + case SCAN_LEFT: + cursor_left(&cursor, &first); + refit_call3_wrapper(ST->ConOut->SetCursorPosition, ST->ConOut, cursor, y_pos); + continue; + case SCAN_DELETE: + if (len == 0) + continue; + if (first + cursor == len) + continue; + for (i = first + cursor; i < len; i++) + line[i] = line[i+1]; + line[len-1] = ' '; + len--; + continue; + } + + switch (key.UnicodeChar) { + case CHAR_LINEFEED: + case CHAR_CARRIAGE_RETURN: + *line_out = line; + line = NULL; + enter = TRUE; + exit = TRUE; + break; + case CHAR_BACKSPACE: + if (len == 0) + continue; + if (first == 0 && cursor == 0) + continue; + for (i = first + cursor-1; i < len; i++) + line[i] = line[i+1]; + len--; + if (cursor > 0) + cursor--; + if (cursor > 0 || first == 0) + continue; + /* show full line if it fits */ + if (len < x_max-2) { + cursor = first; + first = 0; + continue; + } + /* jump left to see what we delete */ + if (first > 10) { + first -= 10; + cursor = 10; + } else { + cursor = first; + first = 0; + } + continue; + case '\t': + case ' ' ... '~': + case 0x80 ... 0xffff: + if (len+1 == size) + continue; + for (i = len; i > first + cursor; i--) + line[i] = line[i-1]; + line[first + cursor] = key.UnicodeChar; + len++; + line[len] = '\0'; + if (cursor+2 < x_max) + cursor++; + else if (first + cursor < len) + first++; + continue; + } + } + + refit_call2_wrapper(ST->ConOut->EnableCursor, ST->ConOut, FALSE); + FreePool(print); + FreePool(line); + return enter; +} /* BOOLEAN line_edit() */ diff --git a/refind/line_edit.h b/refind/line_edit.h new file mode 100644 index 0000000..83338de --- /dev/null +++ b/refind/line_edit.h @@ -0,0 +1,38 @@ +/* + * refind/screen_edit.h + * + * Line-editing functions borrowed from gummiboot + * + */ +/* + * Simple UEFI boot loader which executes configured EFI images, where the + * default entry is selected by a configured pattern (glob) or an on-screen + * menu. + * + * All gummiboot code is LGPL not GPL, to stay out of politics and to give + * the freedom of copying code from programs to possible future libraries. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * Copyright (C) 2012-2013 Kay Sievers + * Copyright (C) 2012 Harald Hoyer + * + * "Any intelligent fool can make things bigger, more complex, and more violent. +" + * -- Albert Einstein + */ + +#ifndef __LINE_EDIT_H_ +#define __LINE_EDIT_H_ + +BOOLEAN line_edit(CHAR16 *line_in, CHAR16 **line_out, UINTN x_max); + +#endif diff --git a/refind/main.c b/refind/main.c index 9d19107..ab584f0 100644 --- a/refind/main.c +++ b/refind/main.c @@ -37,10 +37,23 @@ * Modifications copyright (c) 2012-2015 Roderick W. Smith * * Modifications distributed under the terms of the GNU General Public - * License (GPL) version 3 (GPLv3), a copy of which must be distributed - * with this source code or binaries made from it. + * License (GPL) version 3 (GPLv3), or (at your option) any later version. * */ +/* + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #include "global.h" #include "config.h" diff --git a/refind/menu.c b/refind/menu.c index 63bf9fc..8fe0c1e 100644 --- a/refind/menu.c +++ b/refind/menu.c @@ -34,13 +34,26 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* - * Modifications copyright (c) 2012 Roderick W. Smith + * Modifications copyright (c) 2012-2015 Roderick W. Smith * * Modifications distributed under the terms of the GNU General Public - * License (GPL) version 3 (GPLv3), a copy of which must be distributed - * with this source code or binaries made from it. + * License (GPL) version 3 (GPLv3), or (at your option) any later version. * */ +/* + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #include "global.h" #include "screen.h" diff --git a/refind/screen.c b/refind/screen.c index 29d11c8..94c3039 100644 --- a/refind/screen.c +++ b/refind/screen.c @@ -34,13 +34,26 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* - * Modifications copyright (c) 2012-2014 Roderick W. Smith + * Modifications copyright (c) 2012-2015 Roderick W. Smith * * Modifications distributed under the terms of the GNU General Public - * License (GPL) version 3 (GPLv3), a copy of which must be distributed - * with this source code or binaries made from it. + * License (GPL) version 3 (GPLv3), or (at your option) any later version. * */ +/* + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #include "global.h" #include "screen.h" @@ -58,8 +71,6 @@ UINTN ConWidth; UINTN ConHeight; CHAR16 *BlankLine = NULL; -static VOID DrawScreenHeader(IN CHAR16 *Title); - // UGA defines and variables UINTN UGAWidth; @@ -266,7 +277,7 @@ VOID TerminateScreen(VOID) refit_call2_wrapper(ST->ConOut->EnableCursor, ST->ConOut, TRUE); } -static VOID DrawScreenHeader(IN CHAR16 *Title) +VOID DrawScreenHeader(IN CHAR16 *Title) { UINTN y; @@ -581,191 +592,3 @@ VOID BltImageCompositeBadge(IN EG_IMAGE *BaseImage, IN EG_IMAGE *TopImage, IN EG GraphicsScreenDirty = TRUE; } } - -// Line-editing functions borrowed from gummiboot (cursor_left(), cursor_right(), & line_edit()). -// gummiboot is copyright (c) 2012 by Kay Sievers and Harald Hoyer -// and is licensed under the LGPL 2.1. - -static void cursor_left(UINTN *cursor, UINTN *first) -{ - if ((*cursor) > 0) - (*cursor)--; - else if ((*first) > 0) - (*first)--; -} - -static void cursor_right(UINTN *cursor, UINTN *first, UINTN x_max, UINTN len) -{ - if ((*cursor)+2 < x_max) - (*cursor)++; - else if ((*first) + (*cursor) < len) - (*first)++; -} - -BOOLEAN line_edit(CHAR16 *line_in, CHAR16 **line_out, UINTN x_max) { - CHAR16 *line; - UINTN size; - UINTN len; - UINTN first; - UINTN y_pos = 3; - CHAR16 *print; - UINTN cursor; - BOOLEAN exit; - BOOLEAN enter; - - DrawScreenHeader(L"Line Editor"); - refit_call3_wrapper(ST->ConOut->SetCursorPosition, ST->ConOut, (ConWidth - 71) / 2, ConHeight - 1); - refit_call2_wrapper(ST->ConOut->OutputString, ST->ConOut, - L"Use cursor keys to edit, Esc to exit, Enter to boot with edited options"); - - if (!line_in) - line_in = L""; - size = StrLen(line_in) + 1024; - line = AllocatePool(size * sizeof(CHAR16)); - StrCpy(line, line_in); - len = StrLen(line); - print = AllocatePool(x_max * sizeof(CHAR16)); - - refit_call2_wrapper(ST->ConOut->EnableCursor, ST->ConOut, TRUE); - - first = 0; - cursor = 0; - enter = FALSE; - exit = FALSE; - while (!exit) { - UINTN index; - EFI_STATUS err; - EFI_INPUT_KEY key; - UINTN i; - - i = len - first; - if (i >= x_max-2) - i = x_max-2; - CopyMem(print, line + first, i * sizeof(CHAR16)); - print[i++] = ' '; - print[i] = '\0'; - - refit_call3_wrapper(ST->ConOut->SetCursorPosition, ST->ConOut, 0, y_pos); - refit_call2_wrapper(ST->ConOut->OutputString, ST->ConOut, print); - refit_call3_wrapper(ST->ConOut->SetCursorPosition, ST->ConOut, cursor, y_pos); - - refit_call3_wrapper(BS->WaitForEvent, 1, &ST->ConIn->WaitForKey, &index); - err = refit_call2_wrapper(ST->ConIn->ReadKeyStroke, ST->ConIn, &key); - if (EFI_ERROR(err)) - continue; - - switch (key.ScanCode) { - case SCAN_ESC: - exit = TRUE; - break; - case SCAN_HOME: - cursor = 0; - first = 0; - continue; - case SCAN_END: - cursor = len; - if (cursor >= x_max) { - cursor = x_max-2; - first = len - (x_max-2); - } - continue; - case SCAN_UP: - while((first + cursor) && line[first + cursor] == ' ') - cursor_left(&cursor, &first); - while((first + cursor) && line[first + cursor] != ' ') - cursor_left(&cursor, &first); - while((first + cursor) && line[first + cursor] == ' ') - cursor_left(&cursor, &first); - if (first + cursor != len && first + cursor) - cursor_right(&cursor, &first, x_max, len); - refit_call3_wrapper(ST->ConOut->SetCursorPosition, ST->ConOut, cursor, y_pos); - continue; - case SCAN_DOWN: - while(line[first + cursor] && line[first + cursor] == ' ') - cursor_right(&cursor, &first, x_max, len); - while(line[first + cursor] && line[first + cursor] != ' ') - cursor_right(&cursor, &first, x_max, len); - while(line[first + cursor] && line[first + cursor] == ' ') - cursor_right(&cursor, &first, x_max, len); - refit_call3_wrapper(ST->ConOut->SetCursorPosition, ST->ConOut, cursor, y_pos); - continue; - case SCAN_RIGHT: - if (first + cursor == len) - continue; - cursor_right(&cursor, &first, x_max, len); - refit_call3_wrapper(ST->ConOut->SetCursorPosition, ST->ConOut, cursor, y_pos); - continue; - case SCAN_LEFT: - cursor_left(&cursor, &first); - refit_call3_wrapper(ST->ConOut->SetCursorPosition, ST->ConOut, cursor, y_pos); - continue; - case SCAN_DELETE: - if (len == 0) - continue; - if (first + cursor == len) - continue; - for (i = first + cursor; i < len; i++) - line[i] = line[i+1]; - line[len-1] = ' '; - len--; - continue; - } - - switch (key.UnicodeChar) { - case CHAR_LINEFEED: - case CHAR_CARRIAGE_RETURN: - *line_out = line; - line = NULL; - enter = TRUE; - exit = TRUE; - break; - case CHAR_BACKSPACE: - if (len == 0) - continue; - if (first == 0 && cursor == 0) - continue; - for (i = first + cursor-1; i < len; i++) - line[i] = line[i+1]; - len--; - if (cursor > 0) - cursor--; - if (cursor > 0 || first == 0) - continue; - /* show full line if it fits */ - if (len < x_max-2) { - cursor = first; - first = 0; - continue; - } - /* jump left to see what we delete */ - if (first > 10) { - first -= 10; - cursor = 10; - } else { - cursor = first; - first = 0; - } - continue; - case '\t': - case ' ' ... '~': - case 0x80 ... 0xffff: - if (len+1 == size) - continue; - for (i = len; i > first + cursor; i--) - line[i] = line[i-1]; - line[first + cursor] = key.UnicodeChar; - len++; - line[len] = '\0'; - if (cursor+2 < x_max) - cursor++; - else if (first + cursor < len) - first++; - continue; - } - } - - refit_call2_wrapper(ST->ConOut->EnableCursor, ST->ConOut, FALSE); - FreePool(print); - FreePool(line); - return enter; -} /* BOOLEAN line_edit() */ diff --git a/refind/screen.h b/refind/screen.h index 25bdbb9..9a1c911 100644 --- a/refind/screen.h +++ b/refind/screen.h @@ -84,6 +84,8 @@ VOID FinishTextScreen(IN BOOLEAN WaitAlways); VOID BeginExternalScreen(IN BOOLEAN UseGraphicsMode, IN CHAR16 *Title); VOID FinishExternalScreen(VOID); VOID TerminateScreen(VOID); +VOID DrawScreenHeader(IN CHAR16 *Title); + #if REFIT_DEBUG > 0 VOID DebugPause(VOID); #else @@ -106,6 +108,4 @@ VOID BltImageAlpha(IN EG_IMAGE *Image, IN UINTN XPos, IN UINTN YPos, IN EG_PIXEL //VOID BltImageComposite(IN EG_IMAGE *BaseImage, IN EG_IMAGE *TopImage, IN UINTN XPos, IN UINTN YPos); VOID BltImageCompositeBadge(IN EG_IMAGE *BaseImage, IN EG_IMAGE *TopImage, IN EG_IMAGE *BadgeImage, IN UINTN XPos, IN UINTN YPos); -BOOLEAN line_edit(CHAR16 *line_in, CHAR16 **line_out, UINTN x_max); - #endif