Replace ad-hoc format in efiemu (for variables) and XNU (for device tree) by environment variables
PATCH 1/1 Replace ad-hoc format in efiemu (for variables) and XNU (for device tree) by environment variables
Signature · 4 lines
Regards Vladimir 'phcoder' Serbinenko Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
conf/common.rmk +5 -0
@@ -617,3 +617,8 @@ pkglib_MODULES += setjmp.mod setjmp_mod_SOURCES = lib/$(target_cpu)/setjmp.S setjmp_mod_ASFLAGS = $(COMMON_ASFLAGS) setjmp_mod_LDFLAGS = $(COMMON_LDFLAGS) + +pkglib_MODULES += utf.mod +utf_mod_SOURCES = lib/utf.c +utf_mod_CFLAGS = $(COMMON_CFLAGS) +utf_mod_LDFLAGS = $(COMMON_LDFLAGS)
efiemu/main.c +1 -6
@@ -282,7 +282,7 @@ grub_efiemu_prepare (void) err =grub_efiemu_autocore (); -/* Create NVRAM if not yet done. */ +/* Create NVRAM. */ grub_efiemu_pnvram ();if (grub_efiemu_sizeof_uintn_t () ==4 )
@@ -316,9 +316,6 @@ grub_cmd_efiemu_load (grub_command_t cmd __attribute__ ((unused)),static grub_command_t cmd_loadcore, cmd_prepare, cmd_unload; -void -grub_efiemu_pnvram_cmd_register (void ); -GRUB_MOD_INIT (efiemu) { cmd_loadcore = grub_register_command ("efiemu_loadcore",
@@ -332,7 +329,6 @@ GRUB_MOD_INIT(efiemu) cmd_unload =grub_register_command ("efiemu_unload" , grub_cmd_efiemu_unload,"efiemu_unload" ,"Unload EFI emulator" ); -grub_efiemu_pnvram_cmd_register (); }GRUB_MOD_FINI (efiemu)
@@ -340,5 +336,4 @@ GRUB_MOD_FINI(efiemu)grub_unregister_command (cmd_loadcore);grub_unregister_command (cmd_prepare);grub_unregister_command (cmd_unload); -grub_efiemu_pnvram_cmd_unregister (); }
efiemu/pnvram.c +163 -285
503 lines not on this page · raw message
include/grub/utf.h new file +29 -0
@@ -0,0 +1,29 @@ +/* +* GRUB -- GRand Unified Bootloader +* Copyright (C) 2009 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/>. +*/ + +#ifndef GRUB_UTF_HEADER +#define GRUB_UTF_HEADER 1 + +#include <grub/types.h> + +grub_ssize_t +grub_utf8_to_utf16 (grub_uint16_t *dest,grub_size_t destsize, +const grub_uint8_t *src,grub_size_t srcsize, +const grub_uint8_t **srcend); + +#endif
include/grub/xnu.h +1 -0
@@ -100,6 +100,7 @@ grub_err_t grub_xnu_scan_dir_for_kexts (char *dirname, char *osbundlerequired,grub_err_t grub_xnu_load_kext_from_dir (char *dirname,char *osbundlerequired,int maxrecursion);void *grub_xnu_heap_malloc (int size); +grub_err_t grub_xnu_fill_devicetree (void );extern grub_uint32_t grub_xnu_heap_real_start;extern grub_size_t grub_xnu_heap_size;extern char *grub_xnu_heap_start;
lib/utf.c new file +116 -0
116 lines not on this page · raw message
loader/i386/xnu.c +8 -0
@@ -439,6 +439,14 @@ grub_xnu_boot (void)grub_size_t devtreelen;int i; + err =grub_cpu_xnu_fill_devicetree (); +if (err) +return err; + + err =grub_xnu_fill_devicetree (); +if (err) +return err; +/* Page-align to avoid following parts to be inadvertently freed. */ err =grub_xnu_align_heap (GRUB_XNU_PAGESIZE );if (err)
loader/xnu.c +103 -184
335 lines not on this page · raw message
util/i386/efi/grub-dumpdevtree +5 -7
@@ -15,11 +15,9 @@ # You should have received a copy of the GNU General Public License # along with GRUB. If not, see <http://www.gnu.org/licenses/>. -hexify() -{ - echo -n "$@" | od -A n -t x1 - | sed -e 's/ //g' | tr '\n' '\0' -} +string=`ioreg -lw0 -p IODeviceTree -n efi -r -x |grep device-properties | sed 's/.*<//;s/>.*//;'` +astring=; +l=0 +while [ "x${string:l:2}" != x ]; do astring="$astring%${string:l:2}"; l=$((l+2)); done -echo "`hexify efi`{ `hexify device-properties`:" -ioreg -lw0 -p IODeviceTree -n efi -r -x |grep device-properties | sed 's/.*<//;s/>.*//;' -echo ";}" +echo "set XNU.DeviceTree.efi.device-properties=$astring"
Quoted 4 lines · Vladimir 'phcoder' Serbinenko
[...]
(quoted diff) +3
-0+ +pkglib_MODULES += utf.mod +utf_mod_SOURCES = lib/utf.c
Review
Quoted 10 lines
(quoted diff) +9
-0+utf_mod_CFLAGS = $(COMMON_CFLAGS) +utf_mod_LDFLAGS = $(COMMON_LDFLAGS) +#include <grub/utf.h> + +grub_ssize_t +grub_utf8_to_utf16 (grub_uint16_t *dest, grub_size_t destsize, + const grub_uint8_t *src, grub_size_t srcsize, + const grub_uint8_t **srcend) +{
This was moved from another file, right? Please could you send it as a separate patch?
Also, please remember to include a ChangeLog entry.
Signature · 5 lines
Robert Millan The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."
Quoted 10 lines · Robert Millan
Quoted 9 lines · Vladimir 'phcoder' Serbinenko
[...]
conf/common.rmk +7
-0+ +pkglib_MODULES += utf.mod +utf_mod_SOURCES = lib/utf.c +utf_mod_CFLAGS = $(COMMON_CFLAGS) +utf_mod_LDFLAGS = $(COMMON_LDFLAGS) +#include <grub/utf.h> +
Quoted 8 lines
lib/utf.c line 32
Quoted 5 lines
lib/utf.c new file +5
-0+grub_ssize_t +grub_utf8_to_utf16 (grub_uint16_t *dest,grub_size_t destsize, + const grub_uint8_t *src, grub_size_t srcsize, + const grub_uint8_t **srcend) +{This was moved from another file, right? Please could you send it as a separate patch?
Nope, it's a new function. But I'm ok with splitting patches.
Quoted 16 lines
Also, please remember to include a ChangeLog entry.
--
Robert MillanThe DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."
_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 4 lines
Regards Vladimir 'phcoder' Serbinenko Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
Splitted. Another split part is in thread UTF-8 to UTF-16
Quoted 45 lines · Vladimir 'phcoder' Serbinenko
Quoted 10 lines · Robert Millan
Quoted 9 lines · Vladimir 'phcoder' Serbinenko
[...]
(quoted diff) +7
-0+ +pkglib_MODULES += utf.mod +utf_mod_SOURCES = lib/utf.c +utf_mod_CFLAGS = $(COMMON_CFLAGS) +utf_mod_LDFLAGS = $(COMMON_LDFLAGS) +#include <grub/utf.h> +Quoted 8 lines
Review
Quoted 5 lines
(quoted diff) +5
-0+grub_ssize_t +grub_utf8_to_utf16 (grub_uint16_t *dest, grub_size_t destsize, + const grub_uint8_t *src, grub_size_t srcsize, + const grub_uint8_t **srcend) +{This was moved from another file, right? Please could you send it as a separate patch?
Nope, it's a new function. But I'm ok with splitting patches.
Quoted 11 lines
Also, please remember to include a ChangeLog entry.
--
Robert MillanThe DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."
Quoted 5 lines
_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel--
Regards
Vladimir 'phcoder' SerbinenkoPersonal git repository: http://repo.or.cz/w/grub2/phcoder.git
Signature · 4 lines
Regards Vladimir 'phcoder' Serbinenko Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
ChangeLog +18 -0
@@ -1,5 +1,23 @@ 2009-08-24 Vladimir Serbinenko <[email protected]> + Eliminate ad-hoc tree format in XNU and EfiEmu. + + * efiemu/main.c (grub_efiemu_prepare): Update comment. + * efiemu/pnvram.c: Rewritten to use environment variables. + All users updated. + * include/grub/xnu.h (grub_xnu_fill_devicetree): New prototype. + * loader/i386/xnu.c (grub_xnu_boot): Call grub_cpu_xnu_fill_devicetree + and grub_xnu_fill_devicetree. + * loader/xnu.c (grub_cmd_xnu_kernel): Don't call + grub_cpu_xnu_fill_devicetree. + (grub_xnu_parse_devtree): Removed. + (grub_cmd_xnu_devtree): Likewise. + (hextoval): New function. + (unescape): Likewise. + (grub_xnu_fill_devicetree): Likewise. + +2009-08-24 Vladimir Serbinenko <[email protected]> + UTF-8 to UTF-16 transformation. * conf/common.rmk (pkglib_MODULES): Add utf.mod
efiemu/main.c +1 -6
@@ -282,7 +282,7 @@ grub_efiemu_prepare (void) err =grub_efiemu_autocore (); -/* Create NVRAM if not yet done. */ +/* Create NVRAM. */ grub_efiemu_pnvram ();if (grub_efiemu_sizeof_uintn_t () ==4 )
@@ -316,9 +316,6 @@ grub_cmd_efiemu_load (grub_command_t cmd __attribute__ ((unused)),static grub_command_t cmd_loadcore, cmd_prepare, cmd_unload; -void -grub_efiemu_pnvram_cmd_register (void ); -GRUB_MOD_INIT (efiemu) { cmd_loadcore = grub_register_command ("efiemu_loadcore",
@@ -332,7 +329,6 @@ GRUB_MOD_INIT(efiemu) cmd_unload =grub_register_command ("efiemu_unload" , grub_cmd_efiemu_unload,"efiemu_unload" ,"Unload EFI emulator" ); -grub_efiemu_pnvram_cmd_register (); }GRUB_MOD_FINI (efiemu)
@@ -340,5 +336,4 @@ GRUB_MOD_FINI(efiemu)grub_unregister_command (cmd_loadcore);grub_unregister_command (cmd_prepare);grub_unregister_command (cmd_unload); -grub_efiemu_pnvram_cmd_unregister (); }
efiemu/pnvram.c +163 -285
503 lines not on this page · raw message
include/grub/xnu.h +1 -0
@@ -100,6 +100,7 @@ grub_err_t grub_xnu_scan_dir_for_kexts (char *dirname, char *osbundlerequired,grub_err_t grub_xnu_load_kext_from_dir (char *dirname,char *osbundlerequired,int maxrecursion);void *grub_xnu_heap_malloc (int size); +grub_err_t grub_xnu_fill_devicetree (void );extern grub_uint32_t grub_xnu_heap_real_start;extern grub_size_t grub_xnu_heap_size;extern char *grub_xnu_heap_start;
loader/i386/xnu.c +8 -0
@@ -439,6 +439,14 @@ grub_xnu_boot (void)grub_size_t devtreelen;int i; + err =grub_cpu_xnu_fill_devicetree (); +if (err) +return err; + + err =grub_xnu_fill_devicetree (); +if (err) +return err; +/* Page-align to avoid following parts to be inadvertently freed. */ err =grub_xnu_align_heap (GRUB_XNU_PAGESIZE );if (err)
loader/xnu.c +103 -184
335 lines not on this page · raw message
util/i386/efi/grub-dumpdevtree +5 -7
@@ -15,11 +15,9 @@ # You should have received a copy of the GNU General Public License # along with GRUB. If not, see <http://www.gnu.org/licenses/>. -hexify() -{ - echo -n "$@" | od -A n -t x1 - | sed -e 's/ //g' | tr '\n' '\0' -} +string=`ioreg -lw0 -p IODeviceTree -n efi -r -x |grep device-properties | sed 's/.*<//;s/>.*//;'` +astring=; +l=0 +while [ "x${string:l:2}" != x ]; do astring="$astring%${string:l:2}"; l=$((l+2)); done -echo "`hexify efi`{ `hexify device-properties`:" -ioreg -lw0 -p IODeviceTree -n efi -r -x |grep device-properties | sed 's/.*<//;s/>.*//;' -echo ";}" +echo "set XNU.DeviceTree.efi.device-properties=$astring"