-------------------
* 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
* 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.<BR>
+ * 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.
*
*/
}
return ReturnValue;
-}
\ No newline at end of file
+}
/*
- * 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.<BR>
+ * 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.
*
*/
/*
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
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 <harald@redhat.com>
+ 2012-2013 Kay Sievers <kay@vrfy.org>
+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. <mjg@redhat.com>
+ 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
* 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 <http://www.gnu.org/licenses/>.
+ */
static uint32_t crc32c_table [256];
/**
* \file fsw_ntfs.c
* ntfs file system driver code.
- * by Samuel Liao
+ * Copyright (C) 2015 by Samuel Liao
*/
/*-
*
* 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 <http://www.gnu.org/licenses/>.
+ */
+
#include "fsw_efi.h"
#ifdef __MAKEWITH_GNUEFI
#include "edk2/DriverBinding.h"
*/
/*
* 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 <http://www.gnu.org/licenses/>.
*/
#include "libegint.h"
* 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 <http://www.gnu.org/licenses/>.
+ */
#include "global.h"
#include "../refind/screen.h"
lodepng_free(PixelData);
return NewImage;
-} // EG_IMAGE * egDecodePNG()
\ No newline at end of file
+} // EG_IMAGE * egDecodePNG()
* 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 <http://www.gnu.org/licenses/>.
+ */
#include "libegint.h"
#include "../refind/screen.h"
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....
------------------------------------------------------------------------
# /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)
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)
* 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 <http://www.gnu.org/licenses/>.
+*/
#include "global.h"
#include "lib.h"
* 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 <http://www.gnu.org/licenses/>.
+*/
#include "gpt.h"
#include "lib.h"
* 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 <http://www.gnu.org/licenses/>.
+*/
#include "global.h"
#include "icns.h"
* 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 <http://www.gnu.org/licenses/>.
+ */
#include "global.h"
#include "lib.h"
--- /dev/null
+// 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 <kay@vrfy.org>
+ * Copyright (C) 2012 Harald Hoyer <harald@redhat.com>
+ *
+ * "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() */
--- /dev/null
+/*
+ * 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 <kay@vrfy.org>
+ * Copyright (C) 2012 Harald Hoyer <harald@redhat.com>
+ *
+ * "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
* 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 <http://www.gnu.org/licenses/>.
+ */
#include "global.h"
#include "config.h"
* 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 <http://www.gnu.org/licenses/>.
+ */
#include "global.h"
#include "screen.h"
* 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 <http://www.gnu.org/licenses/>.
+ */
#include "global.h"
#include "screen.h"
UINTN ConHeight;
CHAR16 *BlankLine = NULL;
-static VOID DrawScreenHeader(IN CHAR16 *Title);
-
// UGA defines and variables
UINTN UGAWidth;
refit_call2_wrapper(ST->ConOut->EnableCursor, ST->ConOut, TRUE);
}
-static VOID DrawScreenHeader(IN CHAR16 *Title)
+VOID DrawScreenHeader(IN CHAR16 *Title)
{
UINTN y;
GraphicsScreenDirty = TRUE;
}
}
-
-// Line-editing functions borrowed from gummiboot (cursor_left(), cursor_right(), & line_edit()).
-// gummiboot is copyright (c) 2012 by Kay Sievers <kay.sievers@vrfy.org> and Harald Hoyer
-// <harald@redhat.com> 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() */
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
//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