Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Sep 2010 19:49:12 +0000 (UTC)
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        cvs-src-old@freebsd.org
Subject:   cvs commit: src/sys/boot/common crc32.c crc32.h gpt.c gpt.h util.c util.h src/sys/boot/i386/common cons.c cons.h drv.c drv.h rbx.h src/sys/boot/i386/gptboot Makefile gptboot.c src/sys/boot/i386/gptzfsboot Makefile src/sys/boot/i386/zfsboot ...
Message-ID:  <201009241949.o8OJnRDh076191@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
pjd         2010-09-24 19:49:12 UTC

  FreeBSD src repository

  Modified files:
    sys/boot/i386/gptboot Makefile gptboot.c 
    sys/boot/i386/gptzfsboot Makefile 
    sys/boot/i386/zfsboot Makefile zfsboot.c 
    sys/boot/zfs         Makefile zfsimpl.c 
  Added files:
    sys/boot/common      crc32.c crc32.h gpt.c gpt.h util.c util.h 
    sys/boot/i386/common cons.c cons.h drv.c drv.h rbx.h 
  Log:
  SVN rev 213136 on 2010-09-24 19:49:12Z by pjd
  
  - Split code shared by almost any boot loader into separate files and
    clean up most layering violations:
  
          sys/boot/i386/common/rbx.h:
  
                  RBX_* defines
                  OPT_SET()
                  OPT_CHECK()
  
          sys/boot/common/util.[ch]:
  
                  memcpy()
                  memset()
                  memcmp()
                  bcpy()
                  bzero()
                  bcmp()
                  strcmp()
                  strncmp() [new]
                  strcpy()
                  strcat()
                  strchr()
                  strlen()
                  printf()
  
          sys/boot/i386/common/cons.[ch]:
  
                  ioctrl
                  putc()
                  xputc()
                  putchar()
                  getc()
                  xgetc()
                  keyhit() [now takes number of seconds as an argument]
                  getstr()
  
          sys/boot/i386/common/drv.[ch]:
  
                  struct dsk
                  drvread()
                  drvwrite() [new]
                  drvsize() [new]
  
          sys/boot/common/crc32.[ch] [new]
  
          sys/boot/common/gpt.[ch] [new]
  
  - Teach gptboot and gptzfsboot about new files. I haven't touched the
    rest, but there is still a lot of code duplication to be removed.
  
  - Implement full GPT support. Currently we just read primary header and
    partition table and don't care about checksums, etc. After this change we
    verify checksums of primary header and primary partition table and if
    there is a problem we fall back to backup header and backup partition
    table.
  
  - Clean up most messages to use prefix of boot program, so in case of an
    error we know where the error comes from, eg.:
  
          gptboot: unable to read primary GPT header
  
  - If we can't boot, print boot prompt only once and not every five
    seconds.
  
  - Honour newly added GPT attributes:
  
          bootme - this is bootable partition
          bootonce - try to boot from this partition only once
          bootfailed - we failed to boot from this partition
  
  - Change boot order of gptboot to the following:
  
          1. Try to boot from all the partitions that have both 'bootme'
             and 'bootonce' attributes one by one.
          2. Try to boot from all the partitions that have only 'bootme'
             attribute one by one.
          3. If there are no partitions with 'bootme' attribute, boot from
             the first UFS partition.
  
  - The 'bootonce' functionality is implemented in the following way:
  
          1. Walk through all the partitions and when 'bootonce'
             attribute is found without 'bootme' attribute, remove
             'bootonce' attribute and set 'bootfailed' attribute.
             'bootonce' attribute alone means that we tried to boot from
             this partition, but boot failed after leaving gptboot and
             machine was restarted.
          2. Find partition with both 'bootme' and 'bootonce' attributes.
          3. Remove 'bootme' attribute.
          4. Try to execute /boot/loader or /boot/kernel/kernel from that
             partition. If succeeded we stop here.
          5. If execution failed, remove 'bootonce' and set 'bootfailed'.
          6. Go to 2.
  
     If whole boot succeeded there is new /etc/rc.d/gptboot script coming
     that will log all partitions that we failed to boot from (the ones with
     'bootfailed' attribute) and will remove this attribute. It will also
     find partition with 'bootonce' attribute - this is the partition we
     booted from successfully. The script will log success and remove the
     attribute.
  
     All the GPT updates we do here goes to both primary and backup GPT if
     they are valid. We don't touch headers or partition tables when
     checksum doesn't match.
  
  Reviewed by:    arch (Message-ID: <20100917234542.GE1902@garage.freebsd.pl>)
  Obtained from:  Wheel Systems Sp. z o.o. http://www.wheelsystems.com
  MFC after:      2 weeks
  
  Revision  Changes    Path
  1.1       +108 -0    src/sys/boot/common/crc32.c (new)
  1.1       +13 -0     src/sys/boot/common/crc32.h (new)
  1.1       +381 -0    src/sys/boot/common/gpt.c (new)
  1.1       +39 -0     src/sys/boot/common/gpt.h (new)
  1.1       +176 -0    src/sys/boot/common/util.c (new)
  1.1       +53 -0     src/sys/boot/common/util.h (new)
  1.1       +152 -0    src/sys/boot/i386/common/cons.c (new)
  1.1       +34 -0     src/sys/boot/i386/common/cons.h (new)
  1.1       +131 -0    src/sys/boot/i386/common/drv.c (new)
  1.1       +48 -0     src/sys/boot/i386/common/drv.h (new)
  1.1       +61 -0     src/sys/boot/i386/common/rbx.h (new)
  1.64      +8 -5      src/sys/boot/i386/gptboot/Makefile
  1.92      +142 -434  src/sys/boot/i386/gptboot/gptboot.c
  1.5       +7 -3      src/sys/boot/i386/gptzfsboot/Makefile
  1.4       +10 -7     src/sys/boot/i386/zfsboot/Makefile
  1.13      +14 -405   src/sys/boot/i386/zfsboot/zfsboot.c
  1.5       +1 -0      src/sys/boot/zfs/Makefile
  1.16      +3 -8      src/sys/boot/zfs/zfsimpl.c



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201009241949.o8OJnRDh076191>