-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Freebsd support #31
Open
pietrushnic
wants to merge
4
commits into
rel_v1.1.2
Choose a base branch
from
freebsd_support
base: rel_v1.1.2
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
FreeBSD support | ||
--------------- | ||
|
||
# Requirements | ||
|
||
* TFTP server with root set to `/tftpboot` | ||
* DHCP server | ||
* FreeBSD-based NFS server | ||
|
||
# Environment preparation | ||
|
||
TBD | ||
|
||
Variables for script manipulation: | ||
* `PXE_SERVER` - sets access to PXE server host in form `<user>@<host>` | ||
|
||
2. Relevant entry in DHCP server config: | ||
`option root-path "/srv/tftp/images/freebsd";` | ||
`/srv/tftp/images/freebsd` is the path to the extracted ISO. | ||
|
||
3. Relevant entries in PXELINUX config: | ||
``` | ||
label FreeBSD | ||
menu label FreeBSD | ||
pxe images/freebsd/boot/pxeboot | ||
``` | ||
|
||
The path 'images/freebsd/boot/pxeboot' is relative to TFTP root directory. | ||
It's a path to the PXE loader in the extracted FreeBSD installation image. | ||
|
||
4. You only need this if you want to use unattended install mechanism. | ||
|
||
FreeBSD uses configuration file which needs to be located in | ||
`/etc/installerconfig` of the exported NFS filesystem. | ||
|
||
The configuration file has two sections: | ||
a) preambule - options with which the installations will be performed, | ||
b) setup script - a script that runs after the OS is installed, You can perform | ||
anything you need to run to customize the OS. | ||
|
||
Example of a script: | ||
``` | ||
export ZFSBOOT_DISKS="da0" | ||
export nonInteractive="YES" | ||
DISTRIBUTIONS="kernel.txz kernel-dbg.txz base.txz base-dbg.txz doc.txz lib32.txz lib32-dbg.txz src.txz" | ||
|
||
#!/bin/sh | ||
cat << BOOT > /boot/loader.conf | ||
boot_multicons="YES" | ||
boot_serial="YES" | ||
comconsole_speed="115200" | ||
console="comconsole,vidconsole" | ||
kern.cam.boot_delay="10000" | ||
zfs_load="YES" | ||
amdtemp_load="YES" | ||
BOOT | ||
|
||
cat > /etc/rc.conf << RC_CONF | ||
hostname="3mdeb.dev" | ||
sshd_enable="YES" | ||
ntpd_enable="YES" | ||
ntpd_sync_on_start="YES" | ||
keymap=pl | ||
ifconfig_igb0="SYNCDHCP" | ||
zfs_enable="YES" | ||
RC_CONF | ||
|
||
/bin/cp /usr/share/zoneinfo/Europe/Warsaw /etc/localtime | ||
/usr/bin/touch /etc/wall_cmos_clock | ||
/sbin/adjkerntz -a | ||
|
||
/sbin/dhclient igb0 | ||
env PAGER=cat freebsd-update fetch install | ||
|
||
mkdir /home/emdeb | ||
cp /usr/share/skel/dot.cshrc /home/emdeb/.cshrc | ||
cp /usr/share/skel/dot.login /home/emdeb/.login | ||
cp /usr/share/skel/dot.login_conf /home/emdeb/.login_conf | ||
cp /usr/share/skel/dot.mail_aliases /home/emdeb/.mail_aliases | ||
cp /usr/share/skel/dot.mailrc /home/emdeb/.mailrc | ||
cp /usr/share/skel/dot.profile /home/emdeb/.profile | ||
cp /usr/share/skel/dot.rhosts /home/emdeb/.rhosts | ||
cp /usr/share/skel/dot.shrc /home/emdeb/.shrc | ||
chown -R 1000:1000 /home/emdeb | ||
|
||
reboot | ||
``` | ||
|
||
This script installs FreeBSD on ZFS on da0 drive. It installs the whole base | ||
system with i386 compatibility libs and debug symbols in case you need to debug. | ||
|
||
After the installation, `/boot/loader.conf` is set up to allow serial console, | ||
load amdtemp(4) module to detect CPU temperature and ZFS module. | ||
In `/etc/rc.conf`, I set up hostname, enable SSH and NTPD daemons, | ||
set keymap to Polish, enable DHCP on igb0 NIC and enable ZFS. | ||
|
||
Next, I set up time zone, install updates and create user directory with necessary files. | ||
|
||
FreeBSD uses `/etc/passwd` and `/etc/master.passwd` files | ||
for easy text access to the user accounts data. | ||
It also has db(3)-format databases with user accounts. | ||
|
||
Those files have been precreated by me and `base.txz` set has been apriopriately modified. | ||
Login data are: | ||
Login: emdeb | ||
Password: 3mdeb.dev | ||
|
||
In order to modify base.txz to include the new account, one needs to: | ||
|
||
1. Install FreeBSD (on VM, other PC etc.), | ||
2. Add a new account (using adduser(8)), | ||
3. Back up /etc/passwd, /etc/master.passwd, /etc/pwd.db, /etc/spwd.db files. | ||
4. Extract the images/freebsd/usr/freebsd-dist/base.txz (path relative to | ||
TFTP root). | ||
5. Replace the files in /etc with the backed-up copies. | ||
6. Compress the extracted files to base.txz and put it in | ||
7. images/freebsd/usr/freebsd-dist/base.txz. | ||
8. Make a new SHA256 hash of base.txz and put it in | ||
images/freebsd/usr/freebsd-dist/MANIFEST (second column). |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about iPXE?
I wonder if forcing DHCP options:
filename
,next-server
androot-path
could help here without specifying it in DHCP serverThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@miczyg1 I'm working on a complete rewrite and redesign of our infrastructure to handle more complex cases. I published my notes in the internal NASPF project, you can check there. I just wanted to have all changes that Piotr Kubaj did in the past on our branches and not rely on his fork.
For FreeBSD what I'm targeting in short: