Re: FreeBSD port work

2019-06-08 Thread Eric McCorkle
On 6/8/19 8:53 AM, Eric McCorkle wrote:

> Basically, you have to treat R_X86_64_PLT32 linker symbols as R_X86_64_32.

I'm sorry, I meant R_X86_64_PC32.



signature.asc
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: FreeBSD port work

2019-06-08 Thread Eric McCorkle
On 6/3/19 6:05 AM, Leif Lindholm wrote:
> Hi Eric,
> 
> Well, feels a bit silly to deal with the other main BSDs and not
> FreeBSD... (especially as it looks like it was supported at some point
> in the past).

A bit of info here: the way the FreeBSD ports system works, we have a
bunch of patch files which get applied to a standard distribution to fix
up any issues.  The port system unpacks the distribution archive,
applies the patches, and builds.  We actually have scripts to create
these patches as part of a porting effort.  That's what these files are.

I also had to do a bit more work to get GRUB to a point where
grub-install works.  Basically, you have to treat R_X86_64_PLT32 linker
symbols as R_X86_64_32.  The reason for this is that binutils is
creating a single R_X86_64_PLT32 symbol for the main, which gets
referenced from _start.  I'll repost that, plus any other work I end up
doing once I get it booting.

Unfortunately, I'm getting a boot hang when it boots the FreeBSD kernel.
 This might be a regression of some kind, so I'm going back to the
FreeBSD port to see if the same behavior happens.  If that fails, I'll
try log messages to figure out what's going on.

> Most of the below is out of my area of knowledge, but the patch seems
> to have some whitespace-only changes (pointed out individually below)
> that should probably be filtered out separately, or dropped.

That's an artifact of my emacs setup, I think.  It auto-deletes trailing
whitespace.  I can undo it.

>> +#include 
>> +
>> +typedef unsigned int uint_t;
>> +typedef uint64_t hrtime_t;
>> +typedef unsigned char uchar_t;
>> +typedef int boolean_t;
> 
> I see these four lines repeated a couple of times below as well, but I
> don't see any code in the tree making use of them. What are they
> needed for? Is there some common header (i.e. grub/cpu/freebsd.h)
> where they could go?
> 

I think this is an artifact of OS differences, so it would make sense
for it to go there.

I will apply these to the git repo and send them as a git-generated
patch once I get a boot working on 2.02.  Not sure how long that'll be;
I don't have a great deal of time to work on this at present.



signature.asc
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel


Re: FreeBSD port work

2019-06-03 Thread Leif Lindholm
Hi Eric,

On Fri, May 31, 2019 at 07:22:26AM -0400, Eric McCorkle wrote:
> I've been doing some work to refurbish the FreeBSD port, and I may take
> over maintaining it.  I also want to modify GRUB to pass GELI keys into
> the kernel using the newer keybuf mechanism, but that's later (I posted
> about this a while back).
> 
> Attached are some quick-and-dirty patches I created for getting the
> updated port to build in the FreeBSD ports tree.  Note: there's a
> "force-label" flag in the grub-install utility which is currently
> unimplemented; the old version used a kind of script, but the newer one
> is a C file, and I need to do more investigation to figure out how to
> implement it in the C file.
> 
> If people think any of these patches should go into the main tree, let
> me know what I need to do, or how I need to polish them up first and
> I'll get it done

Well, feels a bit silly to deal with the other main BSDs and not
FreeBSD... (especially as it looks like it was supported at some point
in the past).

Most of the below is out of my area of knowledge, but the patch seems
to have some whitespace-only changes (pointed out individually below)
that should probably be filtered out separately, or dropped.

There are probably also some uses of the __FreeBSD__ #define that need
to be cleaned up in the codebase - like the bit in util/getroot.c that
opens with
#if defined(__NetBSD__) || defined(__OpenBSD__)
and ends with
#endif /* defined(__NetBSD__) || defined(__FreeBSD__) || 
#defined(__FreeBSD_kernel__) */

And if you could send the patches out as a series with git send-email,
threaded mode with a cover letter, that would also be helpful.

A few comments inline.

> --- build-aux/test-driver.o   2013-07-29 08:36:33.775875020 -0400
> +++ build-aux/test-driver 2013-07-29 08:35:04.085870311 -0400
> @@ -0,0 +1,127 @@
> +#! /bin/sh
> +# test-driver - basic testsuite driver script.
> +
> +scriptversion=2012-06-27.10; # UTC
> +
> +# Copyright (C) 2011-2013 Free Software Foundation, 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 2, 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 .
> +
> +# As a special exception to the GNU General Public License, if you
> +# distribute this file as part of a program that contains a
> +# configuration script generated by Autoconf, you may include it under
> +# the same distribution terms that you use for the rest of that program.
> +
> +# This file is maintained in Automake, please report
> +# bugs to  or send patches to
> +# .
> +
> +# Make unconditional expansion of undefined variables an error.  This
> +# helps a lot in preventing typo-related bugs.
> +set -u
> +
> +usage_error ()
> +{
> +  echo "$0: $*" >&2
> +  print_usage >&2
> +  exit 2
> +}
> +
> +print_usage ()
> +{
> +  cat < +Usage:
> +  test-driver --test-name=NAME --log-file=PATH --trs-file=PATH
> +  [--expect-failure={yes|no}] [--color-tests={yes|no}]
> +  [--enable-hard-errors={yes|no}] [--] TEST-SCRIPT
> +The '--test-name', '--log-file' and '--trs-file' options are mandatory.
> +END
> +}
> +
> +# TODO: better error handling in option parsing (in particular, ensure
> +# TODO: $log_file, $trs_file and $test_name are defined).
> +test_name= # Used for reporting.
> +log_file=  # Where to save the output of the test script.
> +trs_file=  # Where to save the metadata of the test run.
> +expect_failure=no
> +color_tests=no
> +enable_hard_errors=yes
> +while test $# -gt 0; do
> +  case $1 in
> +  --help) print_usage; exit $?;;
> +  --version) echo "test-driver $scriptversion"; exit $?;;
> +  --test-name) test_name=$2; shift;;
> +  --log-file) log_file=$2; shift;;
> +  --trs-file) trs_file=$2; shift;;
> +  --color-tests) color_tests=$2; shift;;
> +  --expect-failure) expect_failure=$2; shift;;
> +  --enable-hard-errors) enable_hard_errors=$2; shift;;
> +  --) shift; break;;
> +  -*) usage_error "invalid option: '$1'";;
> +  esac
> +  shift
> +done
> +
> +if test $color_tests = yes; then
> +  # Keep this in sync with 'lib/am/check.am:$(am__tty_colors)'.
> +  red='' # Red.
> +  grn='' # Green.
> +  lgn='' # Light green.
> +  blu='' # Blue.
> +  mgn='' # Magenta.
> +  std='' # No color.
> +else
> +  red= grn= lgn= blu= mgn= std=
> +fi
> +
> +do_exit='rm -f $log_file $trs_file; (exit $st); exit $st'
> +trap "st=129; $do_exit" 1
> +trap "st=130; $do_exit" 2
> +trap "st=141; $do_exit" 13
> +trap "st=143;