Downloading FreeBSD 14.2 RELEASE image for Raspberry Pi (3/4). dd write to a MicroSD card

Using Linux to download FreeBSD 14.2 image and dd write image to USB flash drive stick at /dev/sdb or to /dev/mmcblk0   microSD card.

First get the Linux shell script image file from this location.

wget -c http://ghostbsdarm64.hopto.org/packages/write_using_Linux_a_freebsd_img_dd_to_sdX.sh

 


--2025-05-06 21:26:07--  http://ghostbsdarm64.hopto.org/packages/write_using_Linux_a_freebsd_img_dd_to_sdX.sh
Resolving ghostbsdarm64.hopto.org (ghostbsdarm64.hopto.org)... 67.171.248.137
Connecting to ghostbsdarm64.hopto.org (ghostbsdarm64.hopto.org)|67.171.248.137|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 6795 (6.6K) [application/octet-stream]
Saving to: ‘write_using_Linux_a_freebsd_img_dd_to_sdX.sh’

write_using_Linux_a_freebsd_img_dd_to 100%[=======================================================================>]   6.64K  --.-KB/s    in 0.02s   

2025-05-06 21:26:07 (266 KB/s) - ‘write_using_Linux_a_freebsd_img_dd_to_sdX.sh’ saved [6795/6795]
 

 

[kliktel-pc FreeBSD]# sh ./write_using_Linux_a_freebsd_img_dd_to_sdX.sh
execute the write_using_Linux_a_freebsd_snapshot_image.sh  shell script file to download an image file  

 
0.)    fetch https://download.freebsd.org/releases/arm64/aarch64/ISO-IMAGES/14.2/CHECKSUM.SHA512-FreeBSD-14.2-RELEASE-arm64-aarch64-RPI
1.)    fetch https://download.freebsd.org/releases/arm64/aarch64/ISO-IMAGES/14.2/FreeBSD-14.2-RELEASE-arm64-aarch64-RPI.img.xz
2.)    fetch  http://ghostbsdarm64.hopto.org/packages/Ghost14_5g_selfbuilt_raspi4b_Feb27_2.img.xz
3.)    fetch   user provided file URL: to download.  
Enter 0,1,2,3 number to select which file to download >0
fetch CHECKSUM.SHA512-FreeBSD-14.2-RELEASE-arm64-aarch64-RPI
FILE_IMAGE = FreeBSD-14.2-RELEASE-arm64-aarch64-RPI.img is your selected download  
Linux gpart status of  mmcblk0 or sda sdb sdc sdd disk devices  

*** Fatal error: open(mmcblk0): No such file or directory.
Download FreeBSD-14.2-RELEASE-arm64-aarch64-RPI.img and write to this device /dev/mmcblk0  Hit Ctrl-C to exit!  
Exit & Edit this shell script to change Filename  
What disk device & size to resize and growfs UFS partition /dev/mmcblk0p3 to size 12G
Enter /dev/mmcblk0  DISK1 dev string: /dev/mmcblk0
Enter /dev/mmcblk0p3 resize partition  size in GBytes like 27G: 27G
DISK1 value/dev/mmcblk0<---- DISK1_tmp value /dev/mmcblk0  

+ echo -e ' Downloading file FreeBSD-14.2-RELEASE-arm64-aarch64-RPI.img.xz , decompress file, dd Writing file image to disk /dev/mmcblk0 , \n Resize the UFS partition
/dev/mmcblk0p3 to size 27G\n  Ctrl-C now to Exit & make changes \n\n'
Downloading file FreeBSD-14.2-RELEASE-arm64-aarch64-RPI.img.xz , decompress file, dd Writing file image to disk /dev/mmcblk0 ,  
Resize the UFS partition /dev/mmcblk0p3 to size 27G
 Ctrl-C now to Exit & make changes  


+ sleep 7
+ '[' -f FreeBSD-14.2-RELEASE-arm64-aarch64-RPI.img.xz ']'
+ echo ' FreeBSD-14.2-RELEASE-arm64-aarch64-RPI.img.xz file exists. '
FreeBSD-14.2-RELEASE-arm64-aarch64-RPI.img.xz file exists.  
+ '[' -f FreeBSD-14.2-RELEASE-arm64-aarch64-RPI.img ']'
+ '[' -f FreeBSD-14.2-RELEASE-arm64-aarch64-RPI.img.xz ']'
+ echo '  File FreeBSD-14.2-RELEASE-arm64-aarch64-RPI.img was already downloaded & decompressed '
 File FreeBSD-14.2-RELEASE-arm64-aarch64-RPI.img was already downloaded & decompressed  
+ '[' -f FreeBSD-14.2-RELEASE-arm64-aarch64-RPI.img ']'
+ echo ' dd write FreeBSD-14.2-RELEASE-arm64-aarch64-RPI.img into whole disk /dev/mmcblk0  Ctrl-C to exit now!  '
dd write FreeBSD-14.2-RELEASE-arm64-aarch64-RPI.img into whole disk /dev/mmcblk0  Ctrl-C to exit now!   
+ echo ' Expect about 8 minutes to write 5.0 Gbytes at 14MB/second into a USB 3.0 16Gbyte or larger Flash Drive '
Expect about 8 minutes to write 5.0 Gbytes at 14MB/second into a USB 3.0 16Gbyte or larger Flash Drive  
+ sleep 7
+ dd if=FreeBSD-14.2-RELEASE-arm64-aarch64-RPI.img of=/dev/mmcblk0 conv=sync bs=4M iflag=direct oflag=direct status=progress
5356126208 bytes (5.4 GB, 5.0 GiB) copied, 363 s, 14.8 MB/s
1280+0 records in
1280+0 records out
5368709120 bytes (5.4 GB, 5.0 GiB) copied, 363.935 s, 14.8 MB/s

real    6m3.940s
user    0m0.043s
sys     0m1.309s
+ echo ' FILE_SELECT value is 0 <--- '
FILE_SELECT value is 0 <---  
+ '[' 0 -eq 2 ']'
+ echo ' show the status and the parition sizes for /dev/mmcblk0 '
show the status and the parition sizes for /dev/mmcblk0  
+ ls -lh FreeBSD-14.2-RELEASE-arm64-aarch64-RPI.img
-rw-r--r-- 1 root root 5.0G Apr 20 18:43 FreeBSD-14.2-RELEASE-arm64-aarch64-RPI.img
[kliktel-pc FreeBSD]#


 

Download FreeBSD 14.2-RELEASE file for (RPI3/4) curl -O

https://freebsd.org/where   Where to find images to download
 
su -       # become ROOT administrative user
 
[kliktel-pc FreeBSD]# whoami
root

 
cd ~/Downloads
mkdir FreeBSD
cd FreeBSD
 
 
[kliktel-pc FreeBSD]# pwd
/root/Downloads/FreeBSD
 

Could use  wget -c  or  curl -O  or fetch  to download a file to here, from over the internet

 
[kliktel-pc FreeBSD]# curl -O https://download.freebsd.org/releases/arm64/aarch64
/ISO-IMAGES/14.2/FreeBSD-14.2-RELEASE-arm64-aarch64-RPI.img.xz
 % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                Dload  Upload   Total   Spent    Left  Speed
100  728M  100  728M    0     0  1270k      0  0:09:47  0:09:47 --:--:-- 1693k
[kliktel-pc FreeBSD]# ls
FreeBSD-14.2-RELEASE-arm64-aarch64-RPI.img.xz
[kliktel-pc FreeBSD]# whoami
root

 

 Tar NOT;  YES,  unxz -kf

 [kliktel-pc FreeBSD]# tar -xkf FreeBSD-14.2*
tar: This does not look like a tar archive
tar: Skipping to next header
tar: Exiting with failure status due to previous errors
[kliktel-pc FreeBSD]# xz -kf FreeBSD-14.2*.img.xz
xz: FreeBSD-14.2-RELEASE-arm64-aarch64-RPI.img.xz: File already has '.xz' suffix,
skipping
[kliktel-pc FreeBSD]# man xz
[kliktel-pc FreeBSD]# unxz -kf FreeBSD-14.2*.img.xz
[kliktel-pc FreeBSD]# ls -l
total 4189976
-rw-r--r-- 1 root root 5368709120 Apr 20 18:43 FreeBSD-14.2-RELEASE-arm64-aarch64
-RPI.img
-rw-r--r-- 1 root root  764011588 Apr 20 18:43 FreeBSD-14.2-RELEASE-arm64-aarch64
-RPI.img.xz
[kliktel-pc FreeBSD]#
 

Checksum the downloaded image file to verify wholeness.

[kliktel-pc FreeBSD]# sha256sum FreeBSD*
30df8a58fe443851e3453052080607710b56411925db042ea8b68e9600d02ac0  FreeBSD-14.2-RE
LEASE-arm64-aarch64-RPI.img
61c1c2d304685b8e33b558e17d2b05942968930f6baa5ad9ecc92138b6922085  FreeBSD-14.2-RE
LEASE-arm64-aarch64-RPI.img.xz
[kliktel-pc FreeBSD]#

 https://download.freebsd.org/releases/arm64/aarch64/ISO-IMAGES/14.2/CHECKSUM.SHA512-FreeBSD-14.2-RELEASE-arm64-aarch64-RPI
 
[kliktel-pc FreeBSD]# wget -c https://download.freebsd.org/releases/arm64/aarch64
/ISO-IMAGES/14.2/CHECKSUM.SHA512-FreeBSD-14.2-RELEASE-arm64-aarch64-RPI
--2025-04-20 19:52:08--  https://download.freebsd.org/releases/arm64/aarch64/ISO-
IMAGES/14.2/CHECKSUM.SHA512-FreeBSD-14.2-RELEASE-arm64-aarch64-RPI
Loaded CA certificate '/etc/ssl/certs/ca-certificates.crt'
Resolving download.freebsd.org (download.freebsd.org)... 204.15.11.67, 2620:11c:5
001:1099:1337::4
Connecting to download.freebsd.org (download.freebsd.org)|204.15.11.67|:443... co
nnected.
HTTP request sent, awaiting response... 200 OK
Length: 186 [application/octet-stream]
Saving to: ‘CHECKSUM.SHA512-FreeBSD-14.2-RELEASE-arm64-aarch64-RPI’

CHECKSUM.SHA512-Free 100%[===================>]     186  --.-KB/s    in 0s       

2025-04-20 19:52:09 (2.61 MB/s) - ‘CHECKSUM.SHA512-FreeBSD-14.2-RELEASE-arm64-aar
ch64-RPI’ saved [186/186]


  

check microSD card contents for partitions using GPART command

 https://forums.freebsd.org/threads/gpart-cheatsheet-wiping-drives-partitioning-formating.45411/

FreeBSD CLI commands to use when looking at a disk partition tables.

For Linux, use gparted command to view,  or  fdisk -l  or gdisk
fdisk -l
gdisk /dev/sdb
print 



Disk /dev/sdb: 28.91 GiB, 31042043904 bytes, 60628992 sectors
Disk model: USB 3.2.1 FD     
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device     Boot  Start      End  Sectors Size Id Type
/dev/sdb1  *      2048   104447   102400  50M  c W95 FAT32 (LBA)
/dev/sdb2       104448 10485759 10381312   5G a5 FreeBSD
[kliktel-pc Downloads]#
 
gdisk /dev/sdb
GPT fdisk (gdisk) version 1.0.10

Partition table scan:
 MBR: MBR only
 BSD: not present
 APM: not present
 GPT: not present


***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format
in memory. THIS OPERATION IS POTENTIALLY DESTRUCTIVE! Exit by
typing 'q' if you don't want to convert your MBR partitions
to GPT format!
***************************************************************


Command (? for help): p
Disk /dev/sdb: 60628992 sectors, 28.9 GiB
Model: USB 3.2.1 FD     
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): F7235146-B4CA-4687-B325-DA213F07F0E4
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 60628958
Partitions will be aligned on 2048-sector boundaries
Total free space is 50145213 sectors (23.9 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name
  1            2048          104447   50.0 MiB    0700  Microsoft basic data
  2          104448        10485759   5.0 GiB     A500  FreeBSD disklabel

Command (? for help): q

USING  SCP to move file from Linux computer to RaspberryPi4B  FreeBSD computer over internet
 
[kliktel-pc Downloads]# ls -l write*
-rw-r--r-- 1 kliktel kliktel 6795 Apr 23 13:27 write_using_Linux_a_freebsd_img_dd_to_sdX.sh
-rwxr-xr-x 1 kliktel kliktel 6983 May  6 22:27 write_using_Linux_a_freebsd_img_dd_to_sdY.sh
[kliktel-pc Downloads]# scp  write_using_Linux_a_freebsd_img_dd_to_sdY.sh  fred@ghostbsdarm64.hopto.org:write_using_Linux_a_freebsd_img_dd_to_sdY.sh  
(fred@ghostbsdarm64.hopto.org) Password for fred@Ghost14-selfbuilt-rpi4B-nginx-tst1:
write_using_Linux_a_freebsd_img_dd_to_sdY.sh  
 

For FreeBSD/GhostBSD   gpart status

camcontrol devlist
geom disk list
gpart status da1
gpart show -lp da1

Linux CLI commands to use when looking at a disk partion tables.

fdisk -l
gdisk
parted 
df -h
mount
 
mount  
/dev/mmcblk0p1 on /run/media/kliktel/0123-4567 type fuseblk (rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096,uhelper=udisks2
)

 

Disk /dev/mmcblk0: 57.95 GiB, 62226694144 bytes, 121536512 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device         Boot Start       End   Sectors  Size Id Type
/dev/mmcblk0p1      32768 121536511 121503744 57.9G  7 HPFS/NTFS/exFAT
[kliktel-pc FreeBSD]# fdisk
fdisk: bad usage
Try 'fdisk --help' for more information.
[kliktel-pc FreeBSD]# fdisk --version
fdisk from util-linux 2.40.4
[kliktel-pc FreeBSD]# fdisk --help

 
[kliktel-pc FreeBSD]# fdisk -l /dev/mmcblk0p1
Disk /dev/mmcblk0p1: 57.94 GiB, 62209916928 bytes, 121503744 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf4f4f4f4

Device           Boot      Start        End    Sectors  Size Id Type
/dev/mmcblk0p1p1      4109694196 8219388391 4109694196  1.9T f4 SpeedStor
/dev/mmcblk0p1p2      4109694196 8219388391 4109694196  1.9T f4 SpeedStor
/dev/mmcblk0p1p3      4109694196 8219388391 4109694196  1.9T f4 SpeedStor
/dev/mmcblk0p1p4      4109694196 8219388391 4109694196  1.9T f4 SpeedStor
[kliktel-pc FreeBSD]#

df -h
/dev/mmcblk0p1   58G   17M   58G   1% /run/media/kliktel/0123-456
 
Download a FreeBSD Shell script file and then modify to be used by Linux SH to write a FreeBSD.img file into a USB flash drive stick or a MicroSD card mounted insize a Full size plastic SD holder to push into the SD card slot on the side of the computer. 

test this quotetesting,   Use this to download the shell script image, that you can modify to execute in a Linux shell.


Linux shell script for downloading and writing a FreeBSD image file to a /dev/sdX usb flash drive

 

Use Linux GPART command to print out a simple MBR partition table for a new empty 64GB microSD card.

[kliktel-pc FreeBSD]# man gpart
[kliktel-pc FreeBSD]# gpart -d -v /dev/mmcblk0

dev(/dev/mmcblk0) mss(512) chs(1899008/4/16) #s(121536512) size(59344mb)
Primary partition(1)
  type: 007(0x07)(OS/2 HPFS, NTFS, QNX or Advanced UNIX)
  size: 59328mb #s(121503744) s(32768-121536511)
  chs:  (2/10/9)-(1023/254/63)d (512/0/1)-(1899007/3/16)r
  hex:  00 0A 09 02 07 FE FF FF 00 80 00 00 00 00 3E 07

Primary partition(2)
  type: 000(0x00)(unused)
  size: 0mb #s(0) s(0-0)
  chs:  (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r
  hex:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Primary partition(3)
  type: 000(0x00)(unused)
  size: 0mb #s(0) s(0-0)
  chs:  (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r
  hex:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Primary partition(4)
  type: 000(0x00)(unused)
  size: 0mb #s(0) s(0-0)
  chs:  (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r
  hex:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Look at using ideas in this FreeBSD Hands ON, article by Ed Maste to setup your ZFS file system and other niceities. 

 freebsd.org/people  https://people.freebsd.org/~emaste/freebsd-hands-on.pdf

Packages built for GhostBSD-Arm64 by Poudriere, just add the GhostBSD.conf file to directory: /usr/local/repos

http://ghostbsdarm64.hopto.org/packages/

Comments

Popular posts from this blog

FreeBSD 14.0 Compiling kernel for Raspberry Pi 4B

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

Honey, I broke my ZFS USB SATA SSD 1 TB disk, Oops. What can I do to fix this ZFS to boot again?