Helio/notes

From FBSD_tips

Jump to: navigation, search

These are my notes on the FreeBSD source code. DO NOT USE THIS INFORMATION. I make no claim that this is correct.

Contents

[edit] List of files in the boot system that reference /boot:

/usr/src/sys/boot/alpha/Makefile.inc
/usr/src/sys/boot/alpha/common/Makefile.common
/usr/src/sys/boot/alpha/common/main.c
/usr/src/sys/boot/arc/lib/arch/alpha/start.S
/usr/src/sys/boot/arc/loader/Makefile
/usr/src/sys/boot/common/commands.c
/usr/src/sys/boot/common/dev_net.c
/usr/src/sys/boot/common/help.common
/usr/src/sys/boot/common/interp.c
/usr/src/sys/boot/common/interp_forth.c
/usr/src/sys/boot/common/loader.8
/usr/src/sys/boot/common/module.c
/usr/src/sys/boot/common/pnp.c
/usr/src/sys/boot/efi/Makefile.inc
/usr/src/sys/boot/forth/beastie.4th
/usr/src/sys/boot/forth/loader.4th
/usr/src/sys/boot/forth/loader.4th.8
/usr/src/sys/boot/forth/loader.conf
/usr/src/sys/boot/forth/loader.conf.5
/usr/src/sys/boot/forth/loader.rc
/usr/src/sys/boot/forth/pnp.4th
/usr/src/sys/boot/forth/support.4th
/usr/src/sys/boot/i386/Makefile.inc
/usr/src/sys/boot/i386/cdboot/cdboot.s
/usr/src/sys/boot/i386/loader/Makefile
/usr/src/sys/boot/i386/loader/loader.rc
/usr/src/sys/boot/i386/pxeldr/pxeboot.8
/usr/src/sys/boot/i386/pxeldr/pxeldr.S
/usr/src/sys/boot/ia64/Makefile.inc
/usr/src/sys/boot/ia64/efi/Makefile
/usr/src/sys/boot/pc98/Makefile.inc
/usr/src/sys/boot/pc98/cdboot/cdboot.s
/usr/src/sys/boot/pc98/loader/Makefile
/usr/src/sys/boot/powerpc/loader/Makefile
/usr/src/sys/boot/powerpc/loader/metadata.c
/usr/src/sys/boot/sparc64/Makefile.inc
/usr/src/sys/boot/sparc64/loader/Makefile

[edit] shell script to implement boot loader versioning:

#!/bin/sh
cd /usr/src/sys/boot/
for i in $(cat /root/bootfiles)
do
    sed -i .bak "s_/boot_/.boot/0.1r1/${TARGET_ARCH}_g" ${i}
done
make
mkdir -p /.boot/0.1r1/${TARGET_ARCH}/defaults
cp /boot/device.hints /.boot/0.1r1/${TARGET_ARCH}/
cp forth/loader.conf /.boot/0.1r1/${TARGET_ARCH}/defaults/
make install

[edit] Removing NFS requirement from pxeboot:

open /usr/src/sys/boot/i386/libi386/pxe.c

change:

   /* get an NFS filehandle for our root filesystem */
   pxe_setnfshandle(rootpath);

   if (pxe_sock >= 0) {

to:

   /* get an NFS filehandle for our root filesystem */
   /* pxe_setnfshandle(rootpath); */

   if (pxe_sock >= 0) {

and build with -DLOADER_TFTP_SUPPORT

[edit] Userland Filesystem notes

  • Access data blocks via a hash of the data as much as possible (anything that can be seeked); good to choose a hash with a large collision domain (my favorite is sha256 but sha512 is also usable). This makes cache coherency simpler, a block referenced by hash is guarenteed to always be the same data.
  • Have everything reference blocks that can be passed directly, ie, a filesystem service takes a filename, and returns the hash.
  • Permanent storage was just made expensive; while this seems bad; it's really good. Things are committed when they actually need to be. Not 'just because'
  • Blocks should be consolidated as much as possible.
  • You are encouraged to create as many 'copies' of a file as you want, but since it's referenced by hash, which is static, and based on the data, it's inherently copy-on-write.
  • Data only needs to be on disk once.
  • This is an extension of UNIX links, however, the count doesn't matter. You can hint the block service to make things 'on-reference' close, marking as 'permanent' (which uses a quota system) and 'temporary'; But don't trust the block service to keep data forever, an archival service would be used with FS for permanent storage.
  • simple polling support in the FS portion, not the block portions; blocks are WORM by nature, and should be independent.
Personal tools