Skip to content

Instantly share code, notes, and snippets.

@decuser
Last active August 6, 2020 21:13
Show Gist options
  • Save decuser/288b263867442ac8dfe6052ae7b63beb to your computer and use it in GitHub Desktop.
Save decuser/288b263867442ac8dfe6052ae7b63beb to your computer and use it in GitHub Desktop.
/*********************************************************************
** freebsd-device-driver-development.txt
** last modified 20200729.1151
*********************************************************************/
Download 8.4 dvd 1
aria2c http://ftp-archive.freebsd.org/pub/FreeBSD-Archive/old-releases/i386/ISO-IMAGES/8.4/FreeBSD-8.4-RELEASE-i386-dvd1.iso
Create a new virtual box instance
freebsd32
FreeBSD (32-bit)
2048 MB RAM
20 GB HDD
AHCI
Enable I/O APIC
Hardware clock in UTC
2 Processors
ssh port forward 3344
Attach FreeBSD ISO
after installation, the DVD can be moved down in the boot order
Boot from DVD image and install (where's da source)
Select 1. or just wait for autoboot
Select OK for 235 United States as Country Selection
Choose Standard as the install method
Select OK after reading the MBR message
Choose A to Use Entire Disk and Q to Finish
Choose Standard to install MBR
Select OK after reading the Create BSD partitions message
Choose A to use Auto Defaults and Q to Finish
Choose X to exit to previous menu
Choose 1 CD/DVD as the installation source
Select Yes to confirm
The files are extracted
Select OK after reading the congratulations message
Select Yes to configure ethernet devices
Select em0
Select No to try IPv6
Select Yes to try DHCP
freebsd, home, OK
Select No to gateway
Select Yes to configure inetd
Select Yes to confirm
Select Yes to open the editor
Uncomment the ssh and telnet entries for tcp
Esc and a to exit
a to save changes
Select Yes to enable SSH login
Select No for FTP
Select No for NFS server
Select No for NFS client
Select No for customize console
Select Yes for timezone
Select Yes for UTC clock
Select 2 for America
Select 49 for US
Select 11 for Central
Select Yes for CDT
Select Yes for mouse
Select 2 to enable and test the mouse
Select X to exit mouse setup
Select No for browse collection
Select Yes to add initial user
Select User
wsenn, pw, confirm, Will Senn, wheel in member groups, OK
Select X to exit
Select OK to enter root password and confirm
Select No to skip general configuration
Select Exit install
Select Yes to confirm
Select OK after reading the remove media message
System will reboot
Login as root
ssh localhost -p 5555 -l wsenn
Attach the CD
mount -t cd9660 /dev/acd0 /dist
cd /dist/8.4-RELEASE/src
sh install.sh all
To install sudo and bash:
cd /dist/packages/All
pkg_add sudo-1.8.6.p7.tbz
pkg_add bash-4.2.42.tbz
visudo
uncomment wheel nopasswd line
exit
sudo ls
chsh -s /usr/local/bin/bash wsenn
exit
relogin and bash and sudo ought to be working
sudo umount /dist
# reduce the boot delay
vi /boot/loader.conf
autoboot_delay="1"
sudo shutdown -p now
snapshot predev
set cd after disk in System->Boot Order
mkdir dd-work
cd dd-work
vi hello.c
#include <sys/param.h>
#include <sys/module.h>
#include <sys/kernel.h>
#include <sys/systm.h>
static int
hello_modevent(module_t mod __unused, int event, void *arg __unused)
{
int error = 0;
switch (event) {
case MOD_LOAD:
uprintf("Hello, world!\n");
break;
case MOD_UNLOAD:
uprintf("Good-bye, cruel world!\n");
break;
default:
error = EOPNOTSUPP;
break;
}
return (error);
}
static moduledata_t hello_mod = {
"hello",
hello_modevent,
NULL
};
DECLARE_MODULE(hello, hello_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE);
vi makefile
KMOD= hello
SRCS= hello.c
.include <bsd.kmod.mk>
make
sudo kldload ./hello.ko
kldstat
sudo kldunload ./hello.ko
kldstat
sudo make load
kldstat
sudo make unload
kldstat
sudo shutdown -p now
snapshot vm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment