ARM64 Boot USB Flash Drive, Hey Buddy can you spare some time? update March 31

update March 31, 2024

 ARM64 Boot USB Flash Drive,  Hey Buddy can you spare some time?

Reference the Cliche,  from the 1930's "Hey Buddy can you spare a dime"  Which was a whole days wages back then.  Enough to buy food to eat for a day.


  1.    Start with a used or new fresh USB Flash Drive.
  2.    Use a  shell script file to create 3 partitions
  3.    Use same shell script file to tar extract 2 .tar.gz files into 2 of the partitions
  4.   gpart status  da1
  5.   gpart show -lp  /dev/da1

Remove USB Flash Drive,  Insert into Raspberry Pi 4B, 400, 3B .  Watch HDMI screen,  turn on power  and see GhostBSD Script boot up


GPT UEFI Partitions placed on a USB Flash Drive

4 GhostBSD CLI commands to understand your disk drive setup
  •  camcontrol devlist 
  •  geom disk list
  •  gpart status 
  •  gpart show -lp

Need Help  use  the Manual command to read more information: 
man gpart ; man geom ; man camcontrol


file contents for  freebsd-partitions_02.sh

#!/bin/sh
# Prompt user for disk selection
echo "Enter the disk to use (e.g., da1, da0, ada0):"read disk

# Destroy existing partitions on the selected disk
gpart destroy -F $disk

# Create GPT partition table on the selected disk
gpart create -s GPT $disk

# Add partitions as specified
gpart add -i 1 -a 1M -s 260M -t fat32 -l esp $disk
gpart add -i 2 -a 1M -s 1024M -t freebsd-swap -l swap0 $disk
gpart add -i 3 -a 1M -s 12G -t freebsd-ufs -l rootfs $disk

# Set the size for the last partition (you can customize this range from 12G to 110G)
gpart modify -s 12G -i 3 $disk
# gpart resize -a 1M -i 3 -S110G

# Create file systems on the specified partitions da0p1 msdos da0p3 ufs
newfs -t msdosfs  /dev/${disk}p1
newfs /dev/${disk}p3

# Create mount points
mkdir -p /mnt/esp
mkdir -p /mnt/rootfs

# Mount the partitions
mount_msdosfs /dev/${disk}p1 /mnt/esp
mount /dev/${disk}p3 /mnt/rootfs

# Extract the contents of garm-esp.tar.gz to /mnt/esp
tar xvzf garm-esp.tar.gz -C /mnt/esp/
tar xvzf garm64_rootfs.tar -C /mnt/rootfs
echo "Script completed successfully."

# Prompt user to unmount partitions
echo "Do you want to unmount the partitions? (y/n)"
read unmount_choice

if [ "$unmount_choice" = "y" ]; then
    umount /mnt/esp
    umount /mnt/rootfs
    echo "Partitions unmounted successfully."
else
    echo "Partitions are still mounted. Please unmount them manually when done."
fi

 

These files can be found in the telegram group,   Arm Open-Source  
https://t.me/+ST6N61pnu3Di8zgk

freebsd-partitions_02.sh   https://t.me/c/1228836331/2188

garm64_esp.tar.gz  garm64_rootfs.tar.gz    https://t.me/c/1228836331/2139


  How to build a custom boot image for Raspberry Pi 4B from make buildworld , make buildkernel, make installkernel 



Definition: for the purposes of this article, an “image” is a file containing the partitions and contents of a complete and bootable FreeBSD system, such that it can be written to a disk without modification. Examples include the USB memstick or VM images available on FreeBSD’s download page.

Note: the following commands require superuser privileges. It is possible to generate an image without this, but the process is slightly different and not covered here.  su - change to 'root' user

This example begins by assuming you have completed a build of FreeBSD by running make buildworld and make buildkernel. With this done, we will begin by installing this system to a temporary directory:

http://www.wonkity.com/~wblock/docs/html/buildworld.html  Short Form
https://www.linuxtopia.org/online_books/freebsd/freebsd_guide/freebsd_makeworld.html
https://github.com/freebsd/freebsd-src/blob/main/Makefile  Makefile to read
example commands to buildworld first,  then buildkernel second:

Example to download GhostBSD-src code and buildworld, buildkernel

su -
mkdir -p /usr/ghost14/ghostbsd-src
git clone github.com/ghostbsd/ghostbsd-src.git /usr/ghost14/ghostbsd-src
cd /usr/ghost14/ghostbsd-src
time make -j4 buildworld   -DNO_CLEAN

# add 3 patch files D36431, D37878, D37879.  DO NOT add D43399 patch file.
# do read https://reviews.freebsd.org/D43399 for instructions on patching source code files.  https://reviews.freebsd.org/F75131370  These are imporved, explicit instructions for installing 3 patch files


time make -j4 buildkernel  KERNCONF=GENERIC-VCHIQ -DNO_CLEAN

$ export ROOTFSDIR=$HOME/rootfs
$ cd $HOME/freebsd-src
$ make DESTDIR=$ROOTFSDIR installworld
$ make DESTDIR=$ROOTFSDIR distribution
$ make DESTDIR=$ROOTFSDIR installkernel
I am going to modify the above 4 commands for ghostbsd-arm64.  
su -   set yourself as 'root' user

#  $ mkdir -p $HOME/gharm64-rootfs
$ export ROOTFSDIR=$HOME/gharm64-rootfs
$ mkdir -p $ROOTFSDIR
# $
cd $HOME/freebsd-src
$ cd /usr/ghost14/ghostbsd-src
$
make DESTDIR=$ROOTFSDIR installworld
$
make DESTDIR=$ROOTFSDIR distribution
# $ make DESTDIR=$ROOTFSDIR installkernel      errors out, no GENERIC file, use GENERIC-VCHIQ
$ make DESTDIR=$ROOTFSDIR installkernel KERNCONF=GENERIC-VCHIQ

./build_ghostbsd_efi_stage_boot_image.sh  Use this shell script to build a GhostBSD-Arm64 install image directory off from /root/


Next 4 shell script files to run. In order to build the 5GB image file to burn into USB Flash Drive Stick.  I execute these 4 shell scripts as ROOT user from /root directory or /root/make_fs_images/ directory;

  1. ./makefs_50M_boot_esp_image.sh
  2. ./ghostbsd_build_efistage_boot_image.sh
  3. ./makefs_10G_boot_image.sh  or ./makefs_5G_boot_image.sh
  4. ./make_ghost14_selfbuilt_final_image_3_partitions_raspi4b.sh

    Then I  cd ../write_test directory  and insert USB Flash drive and issue command 5.
  5. ./write_freebsd_img_dd_to_da1.sh

Location on the internet website running on  Raspberry Pi 15.0-CURRENT server
 
cat ./makefs_50M_boot_esp_image.sh
#!/bin/sh   
echo " Bootloader Partition  create 50M esp FAT32 named efi.part  "
export EFIDIR=$HOME/efistage
mkdir -p $EFIDIR/EFI/BOOT
mkdir -p $EFIDIR/EFI/ghostbsd


# x86_64  setup line for copy loader file to bootx64 in EFI/BOOT default directory
#  cp -p $ROOTFSDIR/boot/loader.efi $EFIDIR/efi/boot/bootx64.efi
#  cp -p $ROOTFSDIR/boot/loader.efi $EFIDIR/efi/ghostbsd/bootx64.efi
# aarch64  We assume you already copied Raspberry Pi MSDOS config & boot files into #${EFIDIR} before making the 50 megabyte directory image.
cp -p $ROOTFSDIR/boot/loader.efi $EFIDIR/EFI/BOOT/bootaa64.efi
cp -p $ROOTFSDIR/boot/loader.efi $EFIDIR/EFI/ghostbsd/bootaa64.efi


makefs -t msdos \
    -o fat_type=32 -o sectors_per_cluster=1 -o volume_label=EFISYS_RPI \
    -s 50m \
    efi.part $EFIDIR

# rEFInd aarch64 stuff setup here below
# /BOOT files: startx4.elf fixup4.dat config.txt cmdline.txt u-boot.bin bootcode.bin
 
 
# cat ghostbsd_build_efistage_boot_image.sh

echo " Installing GhostBSD Arm64 kernel files to  /root/gharm64-rootfs "
 mkdir -p $HOME/gharm64-rootfs
 export ROOTFSDIR=$HOME/gharm64-rootfs
# $ cd $HOME/freebsd-src
 cd /usr/ghost14/ghostbsd-src
 make DESTDIR=$ROOTFSDIR installworld
 make DESTDIR=$ROOTFSDIR distribution
# $ make DESTDIR=$ROOTFSDIR installkernel      errors out, no GENERIC file, use GENERIC-VCHIQ
 make DESTDIR=$ROOTFSDIR installkernel KERNCONF=GENERIC-VCHIQ
echo " Now makefs  /root/gharm64-rootfs using shell script  ./makefs_10G_boot_image.sh"
echo " or  makefs_5G_boot_image.sh  newer Feb 27, 2024 shell script "

 Set your environment variables

su root
password: 
 
 export ROOTFSDIR=$HOME/gharm64-rootfs
# echo $ROOTFSDIR   /root/gharm64-rootfs

Make a Unix File System UFS, 10 Gigabyte File system for Raspberry Pi 4B BCM2711 cpu

Selected a 10G file system so have space in UFS for installing packages from across the internet, before bumping into size restraints.  Later learned how to resize the partition and then format the UFS file system to use the extra free space in the partition.

cat  ./makefs_10G_boot_image.sh
#!/bin/sh
set -x
# cat makefs_10G_boot_image.sh
# echo  Make a UFS  FILE system for the:   This command creates a new file rootfs.ufsGhost14arm64
# containing a UFS partition made up of the contents of $ROOTFSDIR.
# This is the first piece of our final bootable system image.
echo " makefs 10G boot image shell script on directory ${ROOTFSDIR}."
if [ -e ${ROOTFSDIR} ] ; then
makefs -B little -o label=rootfs -o version=2 -o softupdates=1 -S 4096 -s10g  -tffs rootfs.ufs.Ghost14arm64 ${ROOTFSDIR}
else
echo "Set value to ROOTFSDIR environment variable, like /root/gharm64_01_2024 "
fi

Make a UFS 5 Gigabyte Unix File system for Raspberry Pi 4B BCM2711 cpu

Smaller, quicker to download across the internet and then decompress XZ image  before writing image to USB flash drive stick.

$ cat makefs_5G_*.sh
#!/bin/sh
# set -x
# cat makefs_5G_boot_image.sh
# echo  Make a UFS  FILE system for the:   This command creates a new file rootfs.ufsGhost14arm64
# containing a UFS partition made up of the contents of $ROOTFSDIR.
# This is the first piece of our final bootable system image.
echo " makefs 5G boot image shell script executing on directory ${ROOTFSDIR}. Create a 2Gbyte image."
if [ -n "${ROOTFSDIR}" ] ; then
# makefs -B little -o label=rootfs -o version=2 -o softupdates=1 -S2048 -s5g  -tffs rootfs.5g.ufs.Ghost14arm64 ${ROOTFSDIR}
makefs -B little -o label=rootfs -o version=2 -o softupdates=1  -s4g  -tffs rootfs.5g.ufs.Ghost14arm64 ${ROOTFSDIR}
else
echo "Set a value to ROOTFSDIR environment variable, like 
ROOTFSDIR=/root/gharm64_01_2024_rootfs "
fi

Run shell script file to create a 5Gbyte image or 10Gbyte image


./makefs_10G_boot_image.sh
Calculated size of `rootfs.ufs.Ghost14arm64': 10737418240 bytes, 27646 inodes

Extent size set to 32768
density reduced from 388390 to 8192
rootfs.ufs.Ghost14arm64: 10240.0MB (20971520 sectors) block size 32768, fragment size 4096
        using 17 cylinder groups of 626.31MB, 20042 blks, 80256 inodes.
super-block backups (for fsck -b #) at:
      192,  1282880,  2565568,  3848256,  5130944,  6413632,  7696320,
  8979008, 10261696, 11544384, 12827072, 14109760, 15392448, 16675136,
 17957824, 19240512, 20523200
Populating `rootfs.ufs.Ghost14arm64'
Image `rootfs.ufs.Ghost14arm64' complete



-rw-r--r--  1 root wheel   10G Dec 10 20:33 rootfs.ufs.Ghost14arm64
-rw-r--r--  1 root wheel 10737418240 Dec 10 20:33 rootfs.ufs.Ghost14arm64
-rw-r--r--  1 root wheel  694M Dec 10 20:59 Ghost14_selfbuilt_raspi4b.img.xz
 
 time ./makefs_10G_boot_image.sh
Calculated size of `rootfs.ufs.Ghost14arm64': 10737418240 bytes, 27653 inodes
Extent size set to 32768
density reduced from 388292 to 8192
rootfs.ufs.Ghost14arm64: 10240.0MB (20971520 sectors) block size 32768, fragment size 4096
    using 17 cylinder groups of 626.31MB, 20042 blks, 80256 inodes.
super-block backups (for fsck -b #) at:
      192,  1282880,  2565568,  3848256,  5130944,  6413632,  7696320,
  8979008, 10261696, 11544384, 12827072, 14109760, 15392448, 16675136,
 17957824, 19240512, 20523200
Populating `rootfs.ufs.Ghost14arm64'
Image `rootfs.ufs.Ghost14arm64' complete
      312.08 real        19.84 user       245.95 sys
-rw-r--r--   1 root wheel   10G Dec 12 23:13 rootfs.ufs.Ghost14arm64

#!/bin/sh
#  filename make_ghost14_selfbuilt_final_image_3_partitions_raspi4b.sh
# echo create the selfbuilt_raspi4b image file
mkimg -s gpt -f raw \
    -p efi/esp:=efi.part \
    -p freebsd-swap/swapfs::2G \
    -p freebsd-ufs/rootfs:=rootfs.ufs.Ghost14arm64 \
    -o Ghost14_selfbuilt_raspi4b_Jan16_1.img


./make_ghost14_selfbuilt_final_image_3_partitions_raspi4b.sh
root@Ghost14_selfbuilt_rpi4B_nginx_tst1:~ #
time ./make_ghost14_selfbuilt_final_image_3_partitions_raspi4b.sh
      160.11 real         0.88 user       107.31 sys

 
-rw-r--r--  1 root wheel   12G Dec 10 20:59 Ghost14_selfbuilt_raspi4b.img
 
time xz --compress --verbose --keep  Ghost14_selfbuilt_raspi4b.img
Ghost14_selfbuilt_raspi4b.img (1/1)
  100 %        694.2 MiB / 12.0 GiB = 0.056   2.5 MiB/s    1:22:45  
-rw-r--r--  1 root wheel   12G Dec 10 20:59 Ghost14_selfbuilt_raspi4b.img

 pwd
/root
time xz --compress --verbose --keep  Ghost14_selfbuilt_raspi4b_Dec12_3.img
Ghost14_selfbuilt_raspi4b_Dec12_3.img (1/1)
  100 %        694.2 MiB / 12.0 GiB = 0.056   2.7 MiB/s    1:16:12             
     4572.27 real      4254.06 user       316.08 sys
 

View  file  /etc/rc.conf for  the FreeBSD 15.0-CURRENT Arm64 Raspi4B Workstation
# NETWORK
hostname="Ghost14_selfbuilt_rpi4B_nginx_tst1"
defaultrouter="192.168.1.1"   # for my Raspberry Pi 4B network
ifconfig_genet0="DHCP"

# DAEMONS
syslogd_flags="-ss"
sshd_enable="YES"
# zfs_enable="YES"
ntpd_flags="-g -q"
ntpd_enable="YES"
ntpd_sync_on_start="YES"
nginx_enable="YES"

background_dhclient="YES"
sendmail_enable=NONE
# OTHER
clear_tmp_enable="YES"
dumpdev=AUTO

#AUDIO
sound_load="YES"
snd_uaudio_load="YES"


Edit  file  /root/gharm64-rootfs/etc/rc.conf

# https://gist.github.com/yarwelp/3cae5db566f643437fa2  setup Raspiberry Pi B

hostname="rpi-fred-4B_test_Jan16_1"

# ifconfig_DEFAULT="DHCP"
  ifconfig_genet0="DHCP" 
background_dhclient="YES"
#set a static address
# ifconfig_genet0="inet 192.168.1.10 netmask 255.255.255.0"
# ifconfig_ue0="inet 10.42.0.47 netmask 255.255.255.0"
# defaultrouter="10.42.0.1"

sshd_enable="YES"


sendmail_enable="NONE"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"

# NTPD Network Time Protocol Daemon
ntpd_flags="-g -q"
ntpd_enable="YES"
ntpd_sync_on_start="YES"
ntpdate_enable="YES"

# AUDIO

sound_load="YES"
snd_uaudio_load="YES"
#growfs_enable="YES"
snd_uaudio="YES"



 

Edit file  /root/gharm64-rootfs/boot/loader.conf



kern.vty=vt
# Configure USB OTG; see usb_template(4).
# hw.usb.template=3
umodem_load="YES"
# Multiple console (serial+efi gop) enabled.
boot_multicons="YES"
boot_serial="YES"
# Disable the beastie menu and color
#beastie_disable="YES"
loader_color="NO"
security.bsd.allow_destructive_dtrace=0
kern.geom.label.disk_ident.enable=0
kern.geom.label.gptid.enable=1   # for ZFS file system enable=0
# cryptodev_load="YES"
cryptodev_load="NO"
#  zfs_load="YES"   #enable for ZFS boot on root use with a USB SSD device.
vfs.zfs.debug=0

 

boot_multicons="YES"
boot_serial="YES"
# console="comconsole"
# console="comconsole,efi"
console="comconsole,vidconsole"

# Sleep Walker, [10/3/23 11:19 AM]  PersonalBSD
# https://github.com/pftf/RPi4/releases  1.35



# boot_multicons="YES"           #<<<< What this does is allow multiple consoles. IE. Screen and Serial Port >>>>#
# boot_serial="YES"             #<<<< This is the only line needed. This is the trigger >>>>#
# comconsole_speed="115200"       #<<<< This setting is actually the default so it is not needed in most cases >>>>#
# console="comconsole,vidconsole"     #<<<< This sets the multi console interfaces for legacy BIOS >>>>#
# console="comconsole,efi"         #<<<< This sets the multi console interfaces for EFI BIOS >>>>#
# vfs.root.mountfrom="zfs:zroot/ROOT/default"
# vfs.root.mountfrom="zfs:arm64pool/ROOT/default"
# vfs.root.mountfrom="zfs:zpi/ROOT/default"
vfs.root.mountfrom="ufs:/dev/gpt/rootfs"
kldload_list+="cuse snd_uaudio"


# AUDIO
sound_load="YES"
#growfs_enable="YES"
snd_uaudio="YES"
snd_uaudio_load="YES"    # use for USB Headphones / Headsets


 
Disable  crypto_load, geom_eli_load, aesni_load by commenting out those lines! for arm64  or  just say "NO"
# Supports most touchpad
hw.psm.synaptics_support="1"

# Load geom support
# crypto_load="YES"
# geom_eli_load="YES"

crypto_load="NO"
geom_eli_load="NO"


# Enable hardware crypto
# aesni_load="YES"
aesni_load="NO"
 
# Set the brand/loader logo
loader_brand="ghostbsd"
loader_logo="glogo"
loader_menu_title="Welcome to GhostBSD-Arm64 Feb 27, 2024"
# boot_mute="YES"
boot_mute="NO"

Edit file  /root/gharm64-rootfs/boot/defaults/loader.conf
 
cat loader.conf
# This is loader.conf - a file full of useful variables that you can
# set to change the default load behavior of your system. You should
# not edit this file!  Put any overrides into one of the
# loader_conf_files instead and you will be able to update these
# defaults later without spamming your local configuration information.
#
# All arguments must be in double quotes.
#

###  Basic configuration options  ############################
exec="echo Loading /boot/defaults/loader.conf"

kernel="kernel"         # /boot sub-directory containing kernel and modules
bootfile="kernel"       # Kernel name (possibly absolute path)
kernel_options=""       # Flags to be passed to the kernel
loader_conf_files="/boot/device.hints /boot/loader.conf /boot/loader.conf.local"
loader_conf_dirs="/boot/loader.conf.d"
nextboot_conf="/boot/nextboot.conf"
verbose_loading="NO"            # Set to YES for verbose loader output

###  Splash screen configuration  ############################
splash_bmp_load="NO"            # Set this to YES for bmp splash screen!
splash_pcx_load="NO"            # Set this to YES for pcx splash screen!
splash_txt_load="NO"            # Set this to YES for TheDraw splash screen!
vesa_load="NO"                  # Set this to YES to load the vesa module
bitmap_load="NO"                # Set this to YES if you want splash screen!
bitmap_name="splash.bmp"        # Set this to the name of the file
bitmap_type="splash_image_data" # and place it on the module_path

###  Screen saver modules  ###################################
# This is best done in rc.conf
screensave_load="NO"            # Set to YES to load a screensaver module
screensave_name="green_saver"   # Set to the name of the screensaver module

###  Early hostid configuration ############################
hostuuid_load="YES"
hostuuid_name="/etc/hostid"
hostuuid_type="hostuuid"

###  Random number generator configuration  ##################
# See rc.conf(5). The entropy_boot_file config variable must agree with the
# settings below.
entropy_cache_load="YES"                # Set this to NO to disable loading
                                        # cached entropy at boot time
entropy_cache_name="/boot/entropy"      # Set this to the name of the file
entropy_cache_type="boot_entropy_cache" # Required for the kernel to find
                                        # the boot-time entropy cache. This
                                        # must not change value even if the
                                        # _name above does change!
entropy_efi_seed="YES"          # Set this to NO to disable loading
                                        # entropy from the UEFI hardware random number generator API

###  RAM Blacklist configuration  ############################
ram_blacklist_load="NO"                 # Set this to YES to load a file
                                        # containing a list of addresses to
                                        # exclude from the running system.
ram_blacklist_name="/boot/blacklist.txt" # Set this to the name of the file
ram_blacklist_type="ram_blacklist"      # Required for the kernel to find
                                        # the blacklist module

###  Microcode loading configuration  ########################
cpu_microcode_load="NO"                 # Set this to YES to load and apply a
                                        # microcode update file during boot.
cpu_microcode_name="/boot/firmware/ucode.bin" # Set this to the microcode
                                              # update file path.
cpu_microcode_type="cpu_microcode"      # Required for the kernel to find
                                        # the microcode update file.

###  ACPI settings  ##########################################
acpi_dsdt_load="NO"             # DSDT Overriding
acpi_dsdt_type="acpi_dsdt"      # Don't change this
acpi_dsdt_name="/boot/acpi_dsdt.aml"
                                # Override DSDT in BIOS by this file
acpi_video_load="NO"            # Load the ACPI video extension driver

###  Audit settings  #########################################
audit_event_load="NO"           # Preload audit_event config
audit_event_name="/etc/security/audit_event"
audit_event_type="etc_security_audit_event"

###  Initial memory disk settings  ###########################
#mdroot_load="YES"              # The "mdroot" prefix is arbitrary.
#mdroot_type="md_image"         # Create md(4) disk at boot.
#mdroot_name="/boot/root.img"   # Path to a file containing the image.
#rootdev="ufs:/dev/md0"         # Set the root filesystem to md(4) device.

###  Loader settings  ########################################
#loader_delay="3"               # Delay in seconds before loading anything.
                                # Default is unset and disabled (no delay).
#autoboot_delay="10"            # Delay in seconds before autobooting,
                                # -1 for no user interrupts, NO to disable
#password=""                    # Prevent changes to boot options
#bootlock_password=""           # Prevent booting (see check-password.4th(8))
#geom_eli_passphrase_prompt="NO" # Prompt for geli(8) passphrase to mount root
bootenv_autolist="YES"          # Auto populate the list of ZFS Boot Environments
#beastie_disable="NO"           # Turn the beastie boot menu on and off
efi_max_resolution="1x1"        # Set the max resolution for EFI loader to use:
                                # 480p, 720p, 1080p, 2160p/4k, 5k, or specify
                                # WidthxHeight (e.g. 1920x1080)
#kernels="kernel kernel.old"    # Kernels to display in the boot menu
kernels_autodetect="YES"        # Auto-detect kernel directories in /boot
#loader_logo="orbbw"            # Desired logo: orbbw, orb, fbsdbw, beastiebw, beastie, none
#comconsole_speed="115200"      # Set the current serial console speed
#console="vidconsole"           # A comma separated list of console(s)
#currdev="disk1s1a"             # Set the current device
module_path="/boot/modules;/boot/dtb;/boot/dtb/overlays"        # Set the module search path
module_blacklist="drm drm2 radeonkms i915kms amdgpu"    # Loader module blacklist
#prompt="\\${interpret}"        # Set the command prompt
#root_disk_unit="0"             # Force the root disk unit number
#rootdev="disk1s1a"             # Set the root filesystem
#dumpdev="disk1s1b"             # Set a dump device early in the boot process
#tftp.blksize="1428"            # Set the RFC 2348 TFTP block size.
                                # If the TFTP server does not support RFC 2348,
                                # the block size is set to 512. Valid: (8,9007)
#twiddle_divisor="16"           # >16 slows down the progress indicator;
                                # <16 speeds up the progress indicator.

###  Kernel settings  ########################################
# The following boot_ variables are enabled by setting them to any value.
# Their presence in the kernel environment (see kenv(1)) has the same
# effect as setting the given boot flag (see boot(8)).
#boot_askname=""        # -a: Prompt the user for the name of the root device
#boot_cdrom=""          # -C: Attempt to mount root file system from CD-ROM
#boot_ddb=""            # -d: Instructs the kernel to start in the DDB debugger
#boot_dfltroot=""       # -r: Use the statically configured root file system
#boot_gdb=""            # -g: Selects gdb-remote mode for the kernel debugger
#boot_multicons=""      # -D: Use multiple consoles
#boot_mute=""           # -m: Mute the console
#boot_pause=""          # -p: Pause after each line during device probing
#boot_serial=""         # -h: Use serial console
#boot_single=""         # -s: Start system in single-user mode
#boot_verbose=""        # -v: Causes extra debugging information to be printed
#init_path="/sbin/init:/sbin/oinit:/sbin/init.bak:/rescue/init"
                        # Sets the list of init candidates
#init_shell="/bin/sh"   # The shell binary used by init(8).
#init_script=""         # Initial script to run by init(8) before chrooting.
#init_chroot=""         # Directory for init(8) to chroot into.

###  Kernel tunables  ########################################
#hw.physmem="1G"                # Limit physical memory. See loader(8)
#kern.dfldsiz=""                # Set the initial data size limit
#kern.dflssiz=""                # Set the initial stack size limit
#kern.hz="100"                  # Set the kernel interval timer rate
#kern.maxbcache=""              # Set the max buffer cache KVA storage
#kern.maxdsiz=""                # Set the max data size
#kern.maxfiles=""               # Set the sys. wide open files limit
#kern.maxproc=""                # Set the maximum # of processes
#kern.maxssiz=""                # Set the max stack size
#kern.maxswzone=""              # Set the max swmeta KVA storage
#kern.maxtsiz=""                # Set the max text size
#kern.maxusers="32"             # Set size of various static tables
#kern.msgbufsize="65536"        # Set size of kernel message buffer
#kern.nbuf=""                   # Set the number of buffer headers
#kern.ncallout=""               # Set the maximum # of timer events
#kern.ngroups="1023"            # Set the maximum # of supplemental groups
#kern.sgrowsiz=""               # Set the amount to grow stack
#kern.cam.boot_delay="10000"    # Delay (in ms) of root mount for CAM bus
                                # registration, useful for USB sticks as root
#kern.cam.scsi_delay="2000"     # Delay (in ms) before probing SCSI
#kern.ipc.maxsockets=""         # Set the maximum number of sockets available
#kern.ipc.nmbclusters=""        # Set the number of mbuf clusters
#kern.ipc.nsfbufs=""            # Set the number of sendfile(2) bufs
#net.inet.tcp.tcbhashsize=""    # Set the value of TCBHASHSIZE
#vfs.root.mountfrom=""          # Specify root partition
#vm.kmem_size=""                # Sets the size of kernel memory (bytes)
#debug.kdb.break_to_debugger="0" # Allow console to break into debugger.
#debug.ktr.cpumask="0xf"        # Bitmask of CPUs to enable KTR on
#debug.ktr.mask="0x1200"        # Bitmask of KTR events to enable
#debug.ktr.verbose="1"          # Enable console dump of KTR events

###  Module loading syntax example  ##########################
#module_load="YES"              # loads module "module"
#module_name="realname"         # uses "realname" instead of "module"
#module_type="type"             # passes "-t type" to load
#module_flags="flags"           # passes "flags" to the module
#module_before="cmd"            # executes "cmd" before loading the module
#module_after="cmd"             # executes "cmd" after loading the module
#module_error="cmd"             # executes "cmd" if load fails

##############################################################
###  GhostBSD defaults              ##########################
##############################################################

# Accept the wifi firmware license
legal.intel_ipw.license_ack=1
legal.intel_iwi.license_ack=1
legal.realtek.license_ack=1

# Show keystokes for passphrases
kern.geom.eli.visible_passphrase=2

# Skip the often slow memory tests in VMs
hw.memtest.tests=0

# don't waste time on probing USB at early boot
hw.usb.no_boot_wait="1"

# Supports most touchpad
hw.psm.synaptics_support="1"

# Load geom support
# crypto_load="YES"
# geom_eli_load="YES"
crypto_load="NO"
geom_eli_load="NO"

# Enable hardware crypto
# aesni_load="YES"
aesni_load="NO"

# Set ipfw to default accept
net.inet.ip.fw.default_to_accept="1"

# Set the brand/loader logo
loader_brand="ghostbsd"
loader_logo="glogo"
loader_menu_title="Welcome to GhostBSD-Arm64 Jan 16, 2024"
# boot_mute="YES"
boot_mute="NO"

# Speed up boot time
autoboot_delay="5"

 

echo $PATH
/usr/local/bin:/usr/ports/lang:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/root/bin

Ghostbsd-src/arm64.aarch64/tmp/legacy/usr/libexec::/sbin:/bin:/usr/sbin:/usr/bin  make  KERNEL=kernel install
cd: /usr/obj/usr/ghost14/ghostbsd-src/arm64.aarch64/sys/GENERIC: No such file or directory
*** Error code 2


Finished the "make installkernel KERNCONF=GENERIC-VCHIQ"
===> vte (install)
install -T release -o root -g wheel -m 555 if_vte.ko /root/gharm64-rootfs/boot/kernel/
install -T dbg -o root -g wheel -m 555 if_vte.ko.debug /root/gharm64-rootfs/usr/lib/debug/boot/kernel/
===> wlan (install)
install -T release -o root -g wheel -m 555 wlan.ko /root/gharm64-rootfs/boot/kernel/
install -T dbg -o root -g wheel -m 555 wlan.ko.debug /root/gharm64-rootfs/usr/lib/debug/boot/kernel/
===> wlan_acl (install)
install -T release -o root -g wheel -m 555 wlan_acl.ko /root/gharm64-rootfs/boot/kernel/
install -T dbg -o root -g wheel -m 555 wlan_acl.ko.debug /root/gharm64-rootfs/usr/lib/debug/boot/kernel/
===> wlan_amrr (install)
install -T release -o root -g wheel -m 555 wlan_amrr.ko /root/gharm64-rootfs/boot/kernel/
install -T dbg -o root -g wheel -m 555 wlan_amrr.ko.debug /root/gharm64-rootfs/usr/lib/debug/boot/kernel/
===> wlan_ccmp (install)
install -T release -o root -g wheel -m 555 wlan_ccmp.ko /root/gharm64-rootfs/boot/kernel/
install -T dbg -o root -g wheel -m 555 wlan_ccmp.ko.debug /root/gharm64-rootfs/usr/lib/debug/boot/kernel/
===> wlan_rssadapt (install)
install -T release -o root -g wheel -m 555 wlan_rssadapt.ko /root/gharm64-rootfs/boot/kernel/
install -T dbg -o root -g wheel -m 555 wlan_rssadapt.ko.debug /root/gharm64-rootfs/usr/lib/debug/boot/kernel/
===> wlan_tkip (install)
install -T release -o root -g wheel -m 555 wlan_tkip.ko /root/gharm64-rootfs/boot/kernel/
install -T dbg -o root -g wheel -m 555 wlan_tkip.ko.debug /root/gharm64-rootfs/usr/lib/debug/boot/kernel/
===> wlan_wep (install)
install -T release -o root -g wheel -m 555 wlan_wep.ko /root/gharm64-rootfs/boot/kernel/
install -T dbg -o root -g wheel -m 555 wlan_wep.ko.debug /root/gharm64-rootfs/usr/lib/debug/boot/kernel/
===> wlan_xauth (install)
install -T release -o root -g wheel -m 555 wlan_xauth.ko /root/gharm64-rootfs/boot/kernel/
install -T dbg -o root -g wheel -m 555 wlan_xauth.ko.debug /root/gharm64-rootfs/usr/lib/debug/boot/kernel/
===> xdr (install)
install -T release -o root -g wheel -m 555 xdr.ko /root/gharm64-rootfs/boot/kernel/
install -T dbg -o root -g wheel -m 555 xdr.ko.debug /root/gharm64-rootfs/usr/lib/debug/boot/kernel/
===> xl (install)
install -T release -o root -g wheel -m 555 if_xl.ko /root/gharm64-rootfs/boot/kernel/
install -T dbg -o root -g wheel -m 555 if_xl.ko.debug /root/gharm64-rootfs/usr/lib/debug/boot/kernel/
===> xz (install)
install -T release -o root -g wheel -m 555 xz.ko /root/gharm64-rootfs/boot/kernel/
install -T dbg -o root -g wheel -m 555 xz.ko.debug /root/gharm64-rootfs/usr/lib/debug/boot/kernel/
===> zfs (install)
install -T release -o root -g wheel -m 555 zfs.ko /root/gharm64-rootfs/boot/kernel/
install -T dbg -o root -g wheel -m 555 zfs.ko.debug /root/gharm64-rootfs/usr/lib/debug/boot/kernel/
===> zlib (install)
install -T release -o root -g wheel -m 555 zlib.ko /root/gharm64-rootfs/boot/kernel/
install -T dbg -o root -g wheel -m 555 zlib.ko.debug /root/gharm64-rootfs/usr/lib/debug/boot/kernel/
kldxref /root/gharm64-rootfs/boot/kernel
--------------------------------------------------------------
>>> Installing kernel GENERIC-VCHIQ completed on Mon Nov 20 13:33:07 PST 2023
--------------------------------------------------------------
root@fredselfbuilt_rpi4b:/usr/ghost14/ghostbsd-src #


If you are unfamiliar with the distribution target and how it differs from installworld, it simply instructs the build system to install the default configuration files, such as the contents of /etc, to the target directory. Running this target on an existing FreeBSD system would overwrite the existing configuration, so it is not done as part of a normal upgrade procedure.(1)

You should now have $ROOTFSDIR populated with a clean install of FreeBSD:

 Looks good. Let’s give the machine a hostname, and generate an fstab(5):

$ echo "hostname=GhostBSD_Arm64_selfbuilt_Jan16_2024" > $ROOTFSDIR/etc/rc.conf
$ echo "/dev/gpt/rootfs  /         ufs     rw,noatime 1 1" > $ROOTFSDIR/etc/fstab
$ echo "/dev/gpt/esp     /boot/efi msdosfs rw,noatime 0 0" >> $ROOTFSDIR/etc/fstab
$ echo "/dev/gpt/swapfs  none      swap    sw         0 0" >> $ROOTFSDIR/etc/fstab

The exact details of this are somewhat specific to the example, but hopefully it is obvious that we intend to create and mount three different partitions: the UFS root filesystem, the EFI System Partition (ESP) and a swap partition.

ifconfig genet0 192.168.1.7 FreeBSD 15.0 with ZFS rootfs
cat /etc/rc.conf 

# NETWORK
hostname="Ghost14_selfbuilt_rpi4b"
defaultrouter="192.168.1.1" # for my Raspberry Pi 4B network
ifconfig_genet0="DCHP"

# DAEMONS
syslogd_flags="-ss"
sshd_enable="YES"
zfs_enable="YES"
ntpd_enable="YES"
ntpd_sync_on_start="YES"
nginx_enable="YES"
background_dhclient="YES"
sendmail_enable=NONE

# OTHER
clear_tmp_enable="YES"
dumpdev=AUTO

#AUDIO
sound_load="YES"
snd_uaudio_load="YES"

cat /etc/fstab 
# /dev/gpt/rootfs / zfs rw,noatime 1 1
/dev/gpt/esp /boot/efi msdosfs rw,noatime 0 0
/dev/gpt/rootfs / ufs rw,noatime 1 1 
/dev/gpt/swap0 none swap sw 0 0

#ifconfig genet0 192.168.1.10
ifconfig genet0 "DHCP"   # enable the router to give genet0 an IP Number
cat /etc/fstab 
# October 3, 2023 creation of /etc/fstab to use BSD disk labels. 
# gpart modify -l bsd-swap -i 2 /dev/ada1 
# /dev/gpt/bsd-swap none swap sw 0 0 
/dev/gpt/swapfs none swap sw 0 0 
# /dev/gpt/esp /boot/efi vfat rw 0 0 
/dev/gpt/rootfs / ufs rw 1 1 
# Device Mountpoint FStype Options Dump Pass# 
# /dev/ad0s1b none swap sw 0 0 
# /dev/ad0s1a / ufs rw 1 1 # /dev/ad0s1g 
# gpart show -l 
# => 3 121077749 da0 GPT (58G) 
# 3 102400 1 esp (50M) 
# 102403 4194304 2 swapfs (2.0G) 
# 4296707 20971520 3 rootfs (10G) 
# 25268227 95809525 - free - (46G)




fred@rpi-fred4B:~ $ gpart show -l => 
3 121077749 da0 GPT (58G) 
3 102400 1 esp (50M) 
102403 4194304 2 swapfs (2.0G) 
4296707 116781045 3 rootfs (56G) 
fred@rpi-fred4B:~ $ gpart show -lp => 
3 121077749 da0 GPT (58G) 
3 102400 da0p1 esp (50M) 
102403 4194304 da0p2 swapfs (2.0G) 
4296707 116781045 da0p3 rootfs (56G) 
fred@rpi-fred4B:~ $


ifconfig genet0 192.168.1.10
cat /etc/rc.conf 
# https://gist.github.com/yarwelp/3cae5db566f643437fa2 setup Raspiberry Pi B hostname="rpi-fred4B" 
# ifconfig_DEFAULT="DHCP" 
# set a static address 
ifconfig_genet0="inet 192.168.1.10 netmask 255.255.255.0" 
# ifconfig_ue0="inet 10.42.0.47 netmask 255.255.255.0" 
# defaultrouter="10.42.0.1" 
sshd_enable="YES" 
sendmail_enable="NONE" 
sendmail_submit_enable="NO" 
sendmail_outbound_enable="NO" 
sendmail_msp_queue_enable="NO" 
ntpd_enable="YES" 
ntpdate_enable="YES" 
 snd_uaudio_load="YES" 
 #growfs_enable="YES" 
snd_uaudio="YES"

root@Ghost14_selfbuilt_rpi4B_nginx:~ # pwd
/root
root@Ghost14_selfbuilt_rpi4B_nginx:~ # ls -l *.sh
-rwxr-xr-x  1 root wheel  164 Sep 19 21:29 build_efistage_boot_image.sh
-rwxr-xr-x  1 root wheel  297 Sep 19 20:59 create_fstab_hostname.sh
-rw-r--r--  1 root wheel 6645 Oct 16 17:47 freebsd-memory.sh
-rw-r--r--  1 root wheel 1288 Nov 17 01:23 freebsd-partition.sh
-rw-r--r--  1 root wheel  198 Sep 19 21:56 make_final_image_3_partitions_raspi4b.sh
-rw-r--r--  1 root wheel  326 Sep 19 21:51 makefs_10G_boot_image.sh
-rw-r--r--  1 root wheel  432 Sep 19 22:12 makefs_50M_boot_esp_image.sh
root@Ghost14_selfbuilt_rpi4B_nginx:~ #

 

cat  /etc/sysctl.conf
#  This file is read when going to multi-user and its contents piped thru
#  ``sysctl'' to adjust kernel values.  ``man 5 sysctl.conf'' for details.
#

# Uncomment this to prevent users from seeing information about processes that
# are being run under another UID.
#security.bsd.see_other_uids=0

# add user mount
vfs.usermount=1

# the following is required to run chromium browser
kern.ipc.shm_allow_removed=1

# For Desktop use default for server is 80
kern.sched.preempt_thresh=224

# this is required for MBR 4 alignement
kern.geom.part.mbr.enforce_chs=0

# PROPOSED SECURITY ADDITIONS BELOW
#
# hw.kbd.keymap_restrict_change=4
# kern.randompid=1
# kern.sugid_coredump=0

# IPv4 TCP security additions
# net.inet.tcp.always_keepalive=0
# net.inet.tcp.drop_synfin=1
# net.inet.tcp.icmp_may_rst=0
# net.inet.tcp.nolocaltimewait=1
# net.inet.tcp.path_mtu_discovery=0
#
# IPv4 icmp additions
# net.inet.icmp.bmcastecho=0
#
# IPv6 and icmp6 redirect for enhancing security
# net.inet6.icmp6.rediraccept=0
# net.inet6.ip6.redirect=0
#
#   hw.snd.default_unit=1   # use for setting audio output for USB Headphones / Headset
hw.snd.default_unit=0

Save off the 5 edited files to directory /usr/local/etc/conf_files/
root@Ghost14-selfbuilt-rpi4B-nginx-tst1:/usr/repos/ghost14/ghostbsd-src #
 cp -p $ROOTFSDIR/boot/loader.conf  /usr/local/etc/conf_files/
 cp -p $ROOTFSDIR/etc/rc.conf  /usr/local/etc/conf_files/
 cp -p $ROOTFSDIR/etc/sysctl.conf  /usr/local/etc/conf_files/
 cp -p $ROOTFSDIR/etc/wpa*.conf  /usr/local/etc/conf_files/
 cp -p $ROOTFSDIR/etc/fstab  /usr/local/etc/conf_files/
root@Ghost14-selfbuilt-rpi4B-nginx-tst1:/usr/repos/ghost14/ghostbsd-src #


Comments

Popular posts from this blog

HDMI Audio sound patches into GhostBSD source code /usr/ghost14/ghostbsd-src SOLVED Jan20 2024

How to install GhostBSD-Arm64 into a USB Flash Drive stick April 24, 2024 update edition.

January 19, 2024 Howto Download a Raspberry Pi 4B bootable image from http://ghostbsdarm64.hopto.org/packages/