Compiling GhostBSD src code, What I learned Oct 28 2023

Compiling GhostBSD 14.0 src code, What I learned Oct 28 2023


Not sure if it is STABLE or RELEASE RC3, most likely STABLE source code

Get the source code from Github.com/ghostbsd/ghostbsd-src  with this String

 I  just finished the Make BuildKernel  compile for Ghostbsd 14.0 on the Raspberry Pi 4B , 8gb hardware running FreeBSD 15.0-CURRENT  ghostbsd-arm64.blogspot.com

From Eric Turgeon:
by the way, if you want to build ghostbsd from stable/14 you can use:
mkdir -p /usr/ghost14
cd /usr/ghost14
git clone -b stable/14 https://github.com/ghostbsd/ghostbsd-src.git
 
to update sources:
cd /usr/ghost14/ghostbsd-src
git -C /usr/ghost14/ghostbsd-src pull --ff-only 
 
Build both World and Kernel:
 time make -j4 buildworld buildkernel TARGET_ARCH=aarch64 KERNCONF=GENERIC-VCHIQ -DNO_CLEAN 
For just building the kernel;
cd /usr/ghost14/ghostbsd-src
time make -j4 buildkernel TARGET_ARCH=aarch64 KERNCONF=GENERIC-VCHIQ -DNO_CLEAN 


I had many errors to correct with these files:
/usr/ghost14/ghostbsd-src/sys/contrib/vchiq/interface/vchiq_arm/vchiq_core.c
/usr/ghost14/ghostbsd-src/sys/contrib/vchiq/interface/vchiq_arm/vchiq_core.h
/usr/ghost14/ghostbsd-src/sys/contrib/vchiq/interface/vchiq_arm/vchiq_2835_arm.c
/usr/ghost14/ghostbsd-src/sys/contrib/vchiq/interface/vchiq_arm/vchiq_arm.c
/usr/ghost14/ghostbsd-src/sys/contrib/vchiq/interface/vchiq_arm/vchiq_kmod.c
/usr/ghost14/ghostbsd-src/sys/contrib/vchiq/interface/vchiq_arm/vchiq_kern_lib.c
 
Will place the tar.gz  patch files somewhere in a single tar.gz file??
Learned about ARM aarch64  instruction:  DSB  and DSB(sy) 
 
Need the armv8a assembly language manual from developer.arm.com  Here you go:

Stack overflow reference to "Real Life use cases of barriers DSB DMB ISB in Arm64
Steven Smith Blog about DSB

Microsoft Raymond Chen August 2022
 
University of Washington Quick Reference Chart of Armv8a assembly language instructions
 


Compiling sources RockPi must have used the 32bit armv7a code and caused a failure in the compile for this file snippet: 





Had to place dsb(sy) on both sides of the if 64bit dsb(sy) else 32bit dsb(sy) endif.
The 32bit should have been just dsb()  with no dsb(option) member
 
__unused static inline void
remote_event_destroy(REMOTE_EVENT_T *event)
{
        (void)event;
}
 
static inline int
remote_event_wait(REMOTE_EVENT_T *event)
{
        if (!event->fired) {
                event->armed = 1;
#if defined(__arch64__)
                dsb(sy);
#else
                dsb(sy);
#endif
                if (!event->fired) {
                        if (down_interruptible(event->event) != 0) {
                                event->armed = 0;
                                return 0;
                        }
                }
                event->armed = 0;
                wmb();
        }
 
        event->fired = 0;
        return 1;
}

static inline void
remote_event_signal_local(REMOTE_EVENT_T *event)
{
        event->armed = 0;
vchiq_core.c: 3957 lines, 107385 characters.
root@fredselfbuilt_rpi4b:/usr/ghost14/ghostbsd-src/sys/contrib/vchiq/interface/vchiq_arm #

 

Makes a difference if armv8a 64 bit processor or armv7a 32 bit processor. 

#if defined(__aarch64__)

#else

#endif

 vchiq_core.h  line 183 was modified :


 
#if VCHIQ_ENABLE_DEBUG

#if defined(__aarch64__)
#define DEBUG_INITIALISE(local) int *debug_ptr = (local)->debug;
#define DEBUG_TRACE(d) \
        do { debug_ptr[DEBUG_ ## d] = __LINE__; dsb(sy); } while (0)
#define DEBUG_VALUE(d, v) \
        do { debug_ptr[DEBUG_ ## d] = (v); dsb(sy); } while (0)
#define DEBUG_COUNT(d) \
        do { debug_ptr[DEBUG_ ## d]++; dsb(sy); } while (0)
#else
#define DEBUG_INITIALISE(local) int *debug_ptr = (local)->debug;
#define DEBUG_TRACE(d) \
        do { debug_ptr[DEBUG_ ## d] = __LINE__; dsb(); } while (0)
#define DEBUG_VALUE(d, v) \
        do { debug_ptr[DEBUG_ ## d] = (v); dsb(); } while (0)
#define DEBUG_COUNT(d) \
        do { debug_ptr[DEBUG_ ## d]++; dsb(); } while (0)
#endif
#else /* VCHIQ_ENABLE_DEBUG */

#define DEBUG_INITIALISE(local)
#define DEBUG_TRACE(d)
#define DEBUG_VALUE(d, v)
#define DEBUG_COUNT(d)

#endif /* VCHIQ_ENABLE_DEBUG */


 

/usr/ghost14/ghostbsd-src/sys/contrib/vchiq/interface/vchiq_arm/  directory time sorted:  Note the files edited on Oct 27,28 

 


root@fredselfbuilt_rpi4b:/usr/ghost14/ghostbsd-src/sys/arm/broadcom/bcm2835 # cat bcm2835_audio.c.patch
diff --git a/sys/arm/broadcom/bcm2835/bcm2835_audio.c b/sys/arm/broadcom/bcm2835/bcm2835_audio.c
index e0f525fa952..8358c58b2ba 100644
--- a/sys/arm/broadcom/bcm2835/bcm2835_audio.c
+++ b/sys/arm/broadcom/bcm2835/bcm2835_audio.c
@@ -237,7 +237,7 @@ bcm2835_audio_callback(void *param, const VCHI_CALLBACK_REASON_T reason, void *m
                     device_printf(sc->dev, "available_space == %d, count = %d, perr=%d\n",
                         ch->available_space, count, perr);
                     device_printf(sc->dev,
-                        "retrieved_samples = %lld, submitted_samples = %lld\n",
+                        "retrieved_samples = %uld, submitted_samples = %uld\n",
                         ch->retrieved_samples, ch->submitted_samples);
                 }
                 ch->available_space += count;
root@fredselfbuilt_rpi4b:/usr/ghost14/ghostbsd-src/sys/arm/broadcom/bcm2835 # 

 

Could change %ld long decimal to unsigned long decimal %uld 


Patch files for October 28, 2023  /usr/ghost14/patch_oct28/ directory

tar -cvzf  ./patch_vchiq_arm64_files_oct28.tar.gz ./patch_oct28/*

root@fredselfbuilt_rpi4b:/usr/ghost14 # tar -cvzf  ./patch_vchiq_arm64_files_oct28.tar.gz ./patch_oct28/*
a ./patch_oct28/bcm2835_audio.c.patch
a ./patch_oct28/vchiq_2835_arm.c.patch
a ./patch_oct28/vchiq_arm.c.patch
a ./patch_oct28/vchiq_core.c.patch
a ./patch_oct28/vchiq_core.h.patch
a ./patch_oct28/vchiq_kern_lib.c.patch
a ./patch_oct28/vchiq_kmod.c.patch

-rw-r--r--   1 root wheel 10984 Oct 28 22:30 patch_vchiq_arm64_files_oct28.tar.gz

 

 

Setup Poudriere for GhostBSD 14.0; Ports do not have a Release#

poudriere jail -c -j ghostbsd-14-aarch64  -m src=/usr/ghost14/ghostbsd-src

To create  ghostbsd ports for poudriere, where does file poudriere.conf place the Ghostbsd Ports code??

root@fredselfbuilt_rpi4b:/usr/local/etc # ls -l poudriere.conf
-rw-r--r--  1 root wheel 12556 Oct 25 02:37 poudriere.conf
root@fredselfbuilt_rpi4b:/usr/local/etc # pwd
/usr/local/etc/poudriere.conf   file contents

poudriere ports -c -p ghostbsd_ports -m git -U "https://github.com/ghostbsd/ghostbsd-ports" -B main



To update ghostbsd ports source code to latest main version

Update previously existing installed ports for GhostBSD:

poudriere ports -u -p ghostbsd_ports -m git -U "https://github.com/ghostbsd/ghostbsd-ports" -B main

https://github.com/ghostbsd/ghostbsd-ports  Eric Turgeon GhostBSD Ports Github

To bulk build packages 
poudriere bulk -j ghostbsd-14-aarch64  -p ghostbsd_ports -a



Files:  /usr/local/etc/poudriere.conf configuration file

Directory /usr/local/etc/poudriere.d  

poudriere jail -l

poudriere ports -l 

IP=192.168.1.7

echo $(IP)


l

 



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

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