Bar
SpaceWire UK
Specialist providers of VHDL Intellectual Property & Design Services
BarBarBarBar
Tutorial
Missing Image!
Part 21 - Move from multiple repositories to a single repository

Introduction

This tutorial details the steps required to splice together the four exiting repositories (common, zedboard_hello_world, zedboard_leds_switches & zedboard_linux) into one new single repository. The resulting repository should preserve the history, commits, commit comments, tags & tag comments of the original four repositories. The ultimate goal being a perfect match between the new single repository and the original four separate repositories.

The separate repositories worked OK at the beginning of this tutorial but as time went on the alignment issue between them got worst. Rolling back in time to build a specific version of a specific project would require different versions of one or more repositories. If all the projects had been in one repository from the start this would not have been an issue.

Requirements :-

Aims

The aims of this tutorial are as follows :-

    Part 1 - Project Setup

    1. Setup environment

    Part 2 - Repository splice

    1. Obtain repository hashes
    2. Splice existing repositories
    3. Create new repository
    4. Split new repository
    5. Compare results
    6. Fix any issues
    7. Examine history

    Part 3 - Headers

    1. Headers

    Part 4 - Final build

    1. Putting it all together

    Part 5 - Revision Control

    1. Commit new & updated files
    2. Clone the remote repository
    #### Part 1 - Project Setup ####

    1. Setup environment

    Create a temporary area to work from.
    steve@Desktop:~$ mkdir /tmp/scratch
    steve@Desktop:~$ cd /tmp/scratch
    steve@Desktop:/tmp/scratch$ PATH="/tmp/scratch:"$PATH
    steve@Desktop:/tmp/scratch$ export swuk_user="$HOME/Documents/swuk_tutorial"
    steve@Desktop:/tmp/scratch$ mkdir -p ${swuk_user}
    
    #### Part 2 - Repository splice ####

    2. Obtain repository hashes

    Obtain all the commit hashes for the 5 projects (4 repositories). Get these fresh from Bitbucket.
    steve@Desktop:/tmp/scratch$ git clone https://bitbucket.org/spacewire_firmware/common
    steve@Desktop:/tmp/scratch$ git clone https://bitbucket.org/spacewire_firmware/zedboard_hello_world
    steve@Desktop:/tmp/scratch$ git clone https://bitbucket.org/spacewire_firmware/zedboard_leds_switches
    steve@Desktop:/tmp/scratch$ git clone https://bitbucket.org/spacewire_firmware/zedboard_linux
    
    steve@Desktop:/tmp/scratch$ git --git-dir common/.git log --reverse --oneline --decorate-refs='tags' --pretty='%C(auto)%h  %<(13)%D  %C(green)%cd  %C(cyan)%s%C(reset)' --date=format:'%d-%b-%Y %H:%M:%S'
    630ee63  tag: v1.0      24-Jan-2022 08:28:28  Initial commit of common files.
    5da451d  tag: v2.0      23-Oct-2022 09:54:07  Added PetaLinux build script that updates the project information file with timestamp & hash.
    
    steve@Desktop:/tmp/scratch$ git --git-dir zedboard_hello_world/.git log --reverse --oneline --decorate-refs='tags' --pretty='%C(auto)%h  %<(13)%D  %C(green)%cd  %C(cyan)%s%C(reset)' --date=format:'%d-%b-%Y %H:%M:%S'
    908af3b  tag: v1.0      13-Jan-2022 14:41:43  Basic Zedboard design consisting of just the ZYNQ7 Processing System.
    
    steve@Desktop:/tmp/scratch$ git --git-dir zedboard_leds_switches/.git log --reverse --oneline --decorate-refs='tags' --pretty='%C(auto)%h  %<(13)%D  %C(green)%cd  %C(cyan)%s%C(reset)' --date=format:'%d-%b-%Y %H:%M:%S'
    ce7164b  tag: v1.0      16-Jan-2022 12:42:21  Basic Zedboard design consisting of just the ZYNQ7 Processing System.
    acaaa4e  tag: v2.0      16-Jan-2022 12:45:13  Added general purpose AXI register bank.
    42e2ca1  tag: v3.0      16-Jan-2022 12:48:44  Added AXI Identification to the design.
    cc42e7b  tag: v4.0      23-Oct-2022 09:25:16  Updated Firmware Identification fields to use static information from GIT
    9841486  tag: v5.0      08-Aug-2023 09:14:33  Replaced Xilinx GPIO with custom GPIO for the Zedboard. Also replaced auto-generated Register Bank with custom version.
    
    steve@Desktop:/tmp/scratch$ git --git-dir zedboard_leds_switches/.git log --reverse --oneline --decorate-refs='tags' --pretty='%C(auto)%h  %<(13)%D  %C(green)%cd  %C(cyan)%s%C(reset)' --date=format:'%d-%b-%Y %H:%M:%S' origin/zedboard_leds_buttons
    ce7164b  tag: v1.0      16-Jan-2022 12:42:21  Basic Zedboard design consisting of just the ZYNQ7 Processing System.
    f1b445e  tag: v2.0_int  16-Jan-2022 12:54:04  Changed GPIO2 connection from DIP Switches (8-bit) to Push Buttons (5-bit).
    
    steve@Desktop:/tmp/scratch$ git --git-dir zedboard_linux/.git log --reverse --oneline --decorate-refs='tags' --pretty='%C(auto)%h  %<(13)%D  %C(green)%cd  %C(cyan)%s%C(reset)' --date=format:'%d-%b-%Y %H:%M:%S'
    8827d6c  tag: v1.0      17-Jan-2022 11:05:35  Initial PetaLinux project configured for ZYNQ and using the XSA from zedboard_leds_switches v1.0.
    095dd72  tag: v2.0      17-Jan-2022 11:05:39  Enabled Peek/Poke application.
    26d544e  tag: v3.0      17-Jan-2022 11:05:43  Added & enabled LED runner auto-start application.
    ad0542f                 17-Jan-2022 11:05:47  Enabled webserver application and created website installer application (static).
    bfc084e                 17-Jan-2022 11:05:48  Added dynamic server-side elements to website application.
    156d5b4  tag: v4.0      17-Jan-2022 11:05:50  Added dynamic client-side elements to website application.
    785110e  tag: v5.0      17-Jan-2022 11:05:54  Added peek/poke CGI application.
    c625e6b  tag: v6.0      17-Jan-2022 11:05:57  Added peek/poke CGI access to website application.
    89f9faf  tag: v7.0      17-Jan-2022 11:06:01  Added Style Sheet and improved webpage layout for website application.
    8d47468  tag: v8.0      17-Jan-2022 11:06:04  Enhanced webpage for website application to have multiple location access into PL address space.
    5e865c5  tag: v9.0      17-Jan-2022 11:06:08  Enhanced webpage for website application to have access to product ID strings within PL address space.
    980d0a8                 23-Oct-2022 10:04:44  Updated webpage to include PetaLinux ID table & add hash field to Firmware ID table.
    9bea7fd  tag: v10.0     23-Oct-2022 10:08:02  Updated webpage to include PetaLinux ID table & add hash field to Firmware ID table.
    47363ef  tag: v11.0     08-Aug-2023 11:03:26  Enabled Userspace IO Driver & added application to test new PL AXI GPIO Zed module.
    e5a2cde  tag: v12.0     08-Aug-2023 17:36:08  Removed busybox-httpd Webserver and replaced it with a LAMP style stack of Apache, SQLite, PHP & myLiteAdmin.
    fd3d8fb  tag: v13.0     23-Feb-2024 13:38:28  Added the ability to load new PL firmware without a rebuild or reboot of PetaLinux. Updated the peek/poke address table to include range & select HTML elements.
    ec080e8  tag: v14.0     03-Mar-2024 17:12:16  Restructured website to include a menu bar. Added a better SQLite Test webpage. Changed Apache to run as root.
    
    The main dependency between projects is due to the hardware platform hand off, the flow of this is as follows.
    1. Build the firmware with Vivado.
    2. Generate the hardware platform from the build.
    3. Feed the hardware platform into the Vitis/PetaLinux build process.
    The correct ordering can easily be determined using a mixture of the commit comments, tag information and tutorial pages. Sadly the commit timestamps are of little use!

    Tutorial Count Hash Timestamp Common Hello World LEDs & Buttons LEDs & Switches Linux Notes
    Part 1  1 630ee6324-Jan-2022 08:28:28v1.0-   -       -   -    -
    Part 2  2 908af3b13-Jan-2022 14:41:43-   v1.0-       -   -    -
    Part 3  3 ce7164b16-Jan-2022 12:42:21-   -   -       v1.0-    -
    Part 4  4 f1b445e16-Jan-2022 12:54:04-   -   v2.0_int-   -    To become v1.0 in separated project
    Part 5  5 8827d6c17-Jan-2022 11:05:35-   -   -       -   v1.0 -
    Part 6  6 095dd7217-Jan-2022 11:05:39-   -   -       -   v2.0 -
    Part 7  7 26d544e17-Jan-2022 11:05:43-   -   -       -   v3.0 -
    Part 8a 8 ad0542f17-Jan-2022 11:05:47-   -   -       -   -    Server-side web elements
    Part 8b 9 bfc084e17-Jan-2022 11:05:48-   -   -       -   -    Client-side web elements
    Part 8c 10156d5b417-Jan-2022 11:05:50-   -   -       -   v4.0 -
    Part 9  - -      -                   -   -   -       -   -    -
    Part 10 11785110e17-Jan-2022 11:05:54-   -   -       -   v5.0 -
    Part 11 12c625e6b17-Jan-2022 11:05:57-   -   -       -   v6.0 -
    Part 12 1389f9faf17-Jan-2022 11:06:01-   -   -       -   v7.0 -
    Part 13a14acaaa4e16-Jan-2022 12:45:13-   -   -       v2.0-    -
    Part 13b158d4746817-Jan-2022 11:06:04-   -   -       -   v8.0 -
    Part 14a1642e2ca116-Jan-2022 12:48:44-   -   -       v3.0-    -
    Part 14b175e865c517-Jan-2022 11:06:08-   -   -       -   v9.0 -
    Part 15 - -      -                   -   -   -       -   -    -
    Part 16a18cc42e7b23-Oct-2022 09:25:16-   -   -       v4.0-    -
    Part 16b195da451d23-Oct-2022 09:54:07v2.0-   -       -   -    -
    Part 16c20980d0a823-Oct-2022 10:04:44-   -   -       -   -    Did not commit project.txt
    Part 16d219bea7fd23-Oct-2022 10:08:02-   -   -       -   v10.0-
    Part 17a22984148608-Aug-2023 09:14:33-   -   -       v5.0-    -
    Part 17b2347363ef08-Aug-2023 11:03:26-   -   -       -   v11.0-
    Part 18 24e5a2cde08-Aug-2023 17:36:08-   -   -       -   v12.0-
    Part 19 25fd3d8fb23-Feb-2024 13:38:28-   -   -       -   v13.0-
    Part 20 26ec080e803-Mar-2024 17:12:16-   -   -       -   v14.0-

    3. Splice existing repositories

    Using the table above as a reference, take in the 4 repositories and merge them into an historically correct collection of directories that track the projects through their life span. Alongside this create a history file that holds the commit comments, tags and tag comments for each of the original repository commits.

    steve@Desktop:/tmp/scratch$ wget https://spacewire.co.uk/tutorial/shared/repos/0027/common/other/src/script/swuk_repos_splice
    steve@Desktop:/tmp/scratch$ chmod +x swuk_repos_splice
    

    swuk_repos_splice

    #!/bin/bash
    
    #
    # File .......... swuk_repos_splice
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Common (SpaceWire UK Tutorial)
    # Date .......... 08 Feb 2025
    # Version ....... 1.0
    # Description ...
    #   Splice together the 4 separate SWUK tutorial repositories into a collection
    # of ordered directories that represent the change history of the projects as if
    # they had originally been part of one single repository.
    #
    
    # Strict
    set -euo pipefail
    
    ################################################################################
    # Checkout a specific version of a repository into a shared area and copy the
    # entire file structure into a separate directory.
    # Arguments ...... $1 = Separate destination directory
    #                  $2 = Hash of the required version from the repository
    #                  $3 = Repository in which to checkout the files
    #                  $4 = Destination directory for the repository checkout
    # Return ......... None
    # Shared (In) .... None
    # Shared (Out) ... None
    checkout_repo()
    {
      # Declare local constants
      local -r history="history.tsv"  # Str: File containing the GIT history
      local -r dest=$1                # Str: Separate destination directory
      local -r hash=$2                # Str: Hash of the required version from the repository
      local -r repo=$3                # Str: Repository in which to checkout the files
      local -r proj=$4                # Str: Destination directory for the repository checkout
    
      # Remove checkout directory to avoid any staleness
      [ -d ${proj} ] && rm -rf ${proj}
    
      # Clone the repository
      git clone https://bitbucket.org/spacewire_firmware/${repo} ${proj}
    
      # Move into project subdirectory
      cd ${proj}
    
      # Get the commit comment, tag & tag comment
      local comment=$(git show ${hash} --no-patch --oneline --pretty="%s")
      local tag=$(git describe --tags --exact-match ${hash})
      local tcomment=""
      if [ -n "${tag}" ]; then
        tcomment=$(git tag -l --format='%(contents)' ${tag})
        tag="${proj}_${tag}"
      fi
    
      # Output the 3 fields into the history details file
      echo -e "${comment}\t${tag}\t${tcomment}" >> ../../${history}
    
      # Switch to a commit (version) using its hash
      git checkout ${hash}
      rm -rf .git
    
      # Move out of project subdirectory
      cd ..
    
      # Copy the entire directory structure
      cp -r . ../${dest}
    }
    
    
    ################################################################################
    # Splice together the four separate SWUK tutorial repositories in the correct
    # order.
    # Arguments ...... None
    # Return ......... None
    # Shared (In) .... None
    # Shared (Out) ... None
    splice_repos()
    {
      # Declare local constants
      local -r repo="repo"  # Str: Repository directory
    
      # Create repository directory
      mkdir -p ${repo}
    
      # Move into repository directory
      cd ${repo}
    
      #              Dest   Hash      Repository               Project                  # Tutorial
      checkout_repo "0001" "630ee63" "common"                 "common"                  # 1
      checkout_repo "0002" "908af3b" "zedboard_hello_world"   "zedboard_hello_world"    # 2
      checkout_repo "0003" "ce7164b" "zedboard_leds_switches" "zedboard_leds_switches"  # 3
      checkout_repo "0004" "f1b445e" "zedboard_leds_switches" "zedboard_leds_buttons"   # 4
      checkout_repo "0005" "8827d6c" "zedboard_linux"         "zedboard_linux"          # 5
      checkout_repo "0006" "095dd72" "zedboard_linux"         "zedboard_linux"          # 6
      checkout_repo "0007" "26d544e" "zedboard_linux"         "zedboard_linux"          # 7
      checkout_repo "0008" "ad0542f" "zedboard_linux"         "zedboard_linux"          # 8a
      checkout_repo "0009" "bfc084e" "zedboard_linux"         "zedboard_linux"          # 8b
      checkout_repo "0010" "156d5b4" "zedboard_linux"         "zedboard_linux"          # 8c
      checkout_repo "0011" "785110e" "zedboard_linux"         "zedboard_linux"          # 10
      checkout_repo "0012" "c625e6b" "zedboard_linux"         "zedboard_linux"          # 11
      checkout_repo "0013" "89f9faf" "zedboard_linux"         "zedboard_linux"          # 12
      checkout_repo "0014" "acaaa4e" "zedboard_leds_switches" "zedboard_leds_switches"  # 13b
      checkout_repo "0015" "8d47468" "zedboard_linux"         "zedboard_linux"          # 13a
      checkout_repo "0016" "42e2ca1" "zedboard_leds_switches" "zedboard_leds_switches"  # 14b
      checkout_repo "0017" "5e865c5" "zedboard_linux"         "zedboard_linux"          # 14a
      checkout_repo "0018" "cc42e7b" "zedboard_leds_switches" "zedboard_leds_switches"  # 16a
      checkout_repo "0019" "5da451d" "common"                 "common"                  # 16b
      checkout_repo "0020" "980d0a8" "zedboard_linux"         "zedboard_linux"          # 16c
      checkout_repo "0021" "9bea7fd" "zedboard_linux"         "zedboard_linux"          # 16d
      checkout_repo "0022" "9841486" "zedboard_leds_switches" "zedboard_leds_switches"  # 17a
      checkout_repo "0023" "47363ef" "zedboard_linux"         "zedboard_linux"          # 17b
      checkout_repo "0024" "e5a2cde" "zedboard_linux"         "zedboard_linux"          # 18
      checkout_repo "0025" "fd3d8fb" "zedboard_linux"         "zedboard_linux"          # 19
      checkout_repo "0026" "ec080e8" "zedboard_linux"         "zedboard_linux"          # 20
    
      # Move out of repository directory
      cd ..
    
      # Delete repository directory
      rm -rf ${repo}
    }
    
    
    ################################################################################
    # Fix known issues within the checked out repositories.
    # Arguments ...... None
    # Return ......... None
    # Shared (In) .... None
    # Shared (Out) ... None
    fix_repos()
    {
      # Declare local variables
      local lineip  # Str: SED Search
      local lineop  # Str: SED Replace
    
      echo "Applying fixes for known repository issues!"
    
      # File put in too early, valid from 0003
      rm 0001/common/fw/src/script/zedboard_presets.tcl
      rm 0002/common/fw/src/script/zedboard_presets.tcl
    
      # File in wrong location & at this location it breaks the PetaLinux build
      mkdir -p 0024/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-httpd/apache2
      mv 0024/zedboard_linux/os/petalinux/components/yocto/layers/meta-openembedded/meta-webserver/recipes-httpd/apache2/apache2_%.bbappend 0024/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-httpd/apache2/apache2_%.bbappend
      rm -rf 0024/zedboard_linux/os/petalinux/components
    
      # Fix history for separated out LEDs & Buttons design
      lineip='Basic Zedboard design consisting of just the ZYNQ7 Processing System.\tzedboard_leds_switches_v1.0\tZYNQ & GPIO'
      lineop='Basic Zedboard design consisting of a ZYNQ7 Processing System controlling \& monitoring LEDs \& DIP Switches via a GPIO.\tzedboard_leds_switches_v1.0\tZYNQ \& GPIO'
      sed -i "s/${lineip}/${lineop}/" history.tsv
    
      lineip='Changed GPIO2 connection from DIP Switches (8-bit) to Push Buttons (5-bit).\tzedboard_leds_buttons_v2.0_int\tZYNQ, GPIO & Interrupts'
      lineop='Basic Zedboard design consisting of a ZYNQ7 Processing System controlling \& monitoring LEDs \& Push Buttons via a GPIO.\tzedboard_leds_buttons_v1.0\tZYNQ, GPIO \& Interrupts'
      sed -i "s/${lineip}/${lineop}/" history.tsv
    
      # Fix comment consistency
      lineip='Updated Firmware Identification fields to use static information from GIT\tzedboard_leds_switches_v4.0\tZYNQ, GPIO, Register Bank & Identification (timestamp & hash from GIT)'
      lineop='Updated Firmware Identification fields to use static information from GIT.\tzedboard_leds_switches_v4.0\tZYNQ, GPIO, Register Bank \& Identification (timestamp \& hash from GIT)'
      sed -i "s/${lineip}/${lineop}/" history.tsv
    }
    
    
    ################################################################################
    # Check if an argument option is set.
    # Arguments ...... $1 ... Str: Option
    # Return ......... Set (0=unset, 1=set)
    # Shared (In) .... argv
    # Shared (Out) ... None
    option_set()
    {
      [[ " ${argv[*]} " =~ " ${1} " ]] && echo 1 || echo 0
    }
    
    
    ################################################################################
    # Main function.
    # Arguments ...... None
    # Return ......... None
    # Exit code ...... Status (0=success, 1=failure)
    # Shared (In) .... argv
    # Shared (Out) ... argv
    main()
    {
      # Declare local constants
      local -r  optfix="--fix"    # Str: Fix option name
      local -r  opthelp="--help"  # Str: Help option name
      local -Ar options=(         # ARR: Options & associated help information
        [${optfix}]="Fix known repository issues."
        [${opthelp}]="Display this help and exit."
      )
      local -ar optorder=(        # Arr: Help options display order
        ${optfix}
        ${opthelp}
      )
    
      # Declare local variables
      local    arg                # Str: Current argument from argv array
      local    project=""         # Str: Project directory [arg] (mandatory)
      local    option             # Str: Current option from optorder array
    
      # Display help information
      if (($(option_set ${opthelp}))); then
        echo "Usage: $(basename ${0}) PROJECT-DIRECTORY... [OPTION]..."
        echo "Splice the 4 SWUK project repositories into separate subdirectories in the PROJECT-DIRECTORY & generate a history report."
        echo
        for option in ${optorder[@]}
        do
          echo "      ${option} $(printf ' %.0s' {1..12} | head -c $((12-${#option}))) ${options[${option}]}"
        done
        echo
        exit 0
      fi
    
      # Get & check the arguments
      for arg in ${argv[@]}; do
        if [[ ${arg:0:2} == "--" ]]; then  # Option
          [[ ! -v options[${arg}] ]] && echo "Option (${arg}) is not recognised!" && exit 1
        elif [[ -z ${project} ]]; then  # Project directory
          project=${arg}
          [[ -d ${project} ]] && echo "Project directory (${arg}) already exists!" && exit 1
        else
          echo "Unexpected argument (${arg}) found!" && exit 1
          exit 1
        fi
      done
    
      # Further check the arguments
      [[ -z ${project} ]] && echo "No project directory specified!" && exit 1
    
      # Create project directory
      mkdir ${project}
    
      # Move into project directory
      cd ${project}
    
      # Do the repository splice
      splice_repos
    
      # Fix known repository issues
      (($(option_set ${optfix}))) &&
        fix_repos
    
      # Move out of project directory
      cd ..
    }
    
    
    ################################################################################
    # Opening gambit.
    # Arguments ...... None
    # Return ......... None
    # Exit code ...... Status (0=success, 1=failure)
    # Shared (In) .... $#, $@
    # Shared (Out) ... argc, argv
    declare -ri argc=${#}    # Int: Get argument count
    declare -ra argv=(${@})  # Arr: Get argument values (space-separated) into array
    main
    exit 0
    
    steve@Desktop:/tmp/scratch$ swuk_repos_splice --help
    Usage: swuk_repos_splice PROJECT-DIRECTORY... [OPTION]...
    Splice the 4 SWUK project repositories into separate subdirectories in the PROJECT-DIRECTORY & generate a history report.
    
          --fix         Fix known repository issues.
          --help        Display this help and exit.
    
    
    steve@Desktop:/tmp/scratch$ swuk_repos_splice web_splice
    
    The script should splice together the 4 separate repositories and produce the complete historical evolution of the splice. This script should also produce an accompanying comments & tags information file.

    Have a look see...
    steve@Desktop:/tmp/scratch$ ls web_splice
    0001  0002  0003  0004  0005  0006  0007  0008  0009  0010  0011  0012  0013  0014  0015  0016  0017  0018  0019  0020  0021  0022  0023  0024  0025  0026  history.tsv
    Looks good! Expecting 26 directories along with 1 accompanying file.
    steve@Desktop:/tmp/scratch$ bcompare web_splice/0001 web_splice/0003 web_splice/0002 &
    
    From within the ribbon select All and Structure and then click on Expand. The following should be displayed. Missing Image! Looks good! The history appears to be building up as expected.
    steve@Desktop:/tmp/scratch$ libreoffice web_splice/history.tsv &
    
    Missing Image! Looks good! Commit comments are there, tags & tag comments are there, plus the tag names have been prefix with the project they belong to.

    4. Create new repository

    Using the collection of directories along with the history file, create a new repository and commit the contents of each directory into it, commenting and tagging each commit along the way.
    steve@Desktop:/tmp/scratch$ wget https://spacewire.co.uk/tutorial/shared/repos/0027/common/other/src/script/swuk_repos_join
    steve@Desktop:/tmp/scratch$ chmod +x swuk_repos_join
    

    swuk_repos_join

    #!/bin/bash
    
    #
    # File .......... swuk_repos_join
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Common (SpaceWire UK Tutorial)
    # Date .......... 12 Feb 2025
    # Version ....... 1.0
    # Description ...
    #   Join an ordered history of project subdirectories into a new single GIT
    # repository on a remote server. Also make use of a history file that includes
    # the tab separated values of commit comment, tag name & tag comment.
    #
    
    # Strict
    set -euo pipefail
    
    ################################################################################
    # Perform the repository join.
    # Arguments ...... None
    # Return ......... None
    # Shared (In) .... argv, optfix, project, user, addr, repo
    # Shared (Out) ... argv
    do_join()
    {
      # Declare local constants
      local -r now=$(date +"%d-%b-%Y_%H_%M_%S")  # Str: Current date & time
      local -r history="history.tsv"             # Str: File containing GIT history
    
      # Declare local variables
      local -a projdirs=()                       # Arr: List of project directories (alphanumeric order)
      local    projdir                           # Str: Current project directory from projdirs array
      local -a projhist=()                       # Arr: List of project git change history
      local -i index=0                           # Int: Current directory index
    
      # Get all separate repository directories into an ordered array
      readarray -t projdirs < <(find ${project} -mindepth 1 -maxdepth 1 -type d | sort | cut -d'/' -f2-)
    
      # Get GIT history into an array
      readarray -t projhist < ${project}/${history}
    
      # Backup existing remote repository
      ssh -t ${user}@${addr} "if [[ -d ${repo}.git ]]; then mv ${repo}.git ${repo}_${now}.git; fi"
    
      # Create a new remote repository
      ssh -t ${user}@${addr} "git init --bare ${repo}.git"
    
      # Move into project directory
      cd ${project}
    
      # Iterate through project subdirectories
      for projdir in ${projdirs[@]}
      do
        # Move into project subdirectory
        cd ${projdir}
    
        echo -ne "\e[93mProcessing project directory : ${projdir}\e[0m\n"
    
        # Create local repository
        if [[ ${index} -eq 0 ]]; then
          git init
          git remote add origin ${user}@${addr}:${repo}.git
        fi
    
        # Move repository (.git) from previous to current
        if [[ ${index} -gt 0 ]]; then
          mv ../${projdirs[$((index-1))]}/.git .
        fi
    
        # Get GIT commit comment, tag & tag comment
        IFS=$'\n\t'
        local -a split=(${projhist[index]}) # Get history values (tab-separated) into array
        unset IFS
        [[ ${#split[@]} -ge 1 ]] && local comment=${split[0]} || local comment=""
        [[ ${#split[@]} -ge 2 ]] && local tag=${split[1]} || local tag=""
        [[ ${#split[@]} -ge 3 ]] && local tcomment=${split[2]} || local tcomment=""
    
        # Add files, commit & push to remote
        git add -A
    
        # Action the --fix option
        if (($(option_set ${optfix}))); then
          # Force through the ignored .gitignore files
          [[ ($(expr ${projdir} + 0) -ge 18) && ($(expr ${projdir} + 0) -le 21) ]] &&
            git add -f zedboard_leds_switches/.gitignore
          # Force through the wrongly placed apache2_%.bbappend (only if it exists, i.e. not fixed during splice)
          [[ ($(expr ${projdir} + 0) -eq 24) && (-f zedboard_linux/os/petalinux/components/yocto/layers/meta-openembedded/meta-webserver/recipes-httpd/apache2/apache2_%.bbappend) ]] &&
            git add -f zedboard_linux/os/petalinux/components/yocto/layers/meta-openembedded/meta-webserver/recipes-httpd/apache2/apache2_%.bbappend
        fi
    
        git commit -a -m "${comment}"
        git push -u origin master
    
        # Add tag & push to remote
        if [ -n "${tag}" ]; then
          git tag -a "${tag}" -m "${tcomment}"
          git push origin "${tag}"
        fi
    
        # Delete local repository
        if [[ $((index+1)) -eq ${#projhist[@]} ]]; then
          rm -rf ".git"
        fi
    
        # Move out of project subdirectory
        cd ..
    
        # Increment current directory index
        ((index+=1))
      done
    
      # Move out of project directory
      cd ..
    }
    
    
    ################################################################################
    # Check if an argument option is set.
    # Arguments ...... $1 ... Str: Option
    # Return ......... Set (0=unset, 1=set)
    # Shared (In) .... argv
    # Shared (Out) ... None
    option_set()
    {
      [[ " ${argv[*]} " =~ " ${1} " ]] && echo 1 || echo 0
    }
    
    
    ################################################################################
    # Main function.
    # Arguments ...... None
    # Return ......... None
    # Exit code ...... Status (0=success, 1=failure)
    # Shared (In) .... argv
    # Shared (Out) ... argv, optfix, project, user, addr, repo
    main()
    {
      # Declare local constants
      local -r  optfix="--fix"    # Str: Fix option name
      local -r  opthelp="--help"  # Str: Help option name
      local -Ar options=(         # ARR: Options & associated help information
        [${optfix}]="Fix known repository issues."
        [${opthelp}]="Display this help and exit."
      )
      local -ar optorder=(        # Arr: Help options display order
        ${optfix}
        ${opthelp}
      )
    
      # Declare local variables
      local    arg                # Str: Current argument from argv array
      local    project=""         # Str: Project directory [arg] (mandatory)
      local    url=""             # Str: GIT repository URL [arg] (mandatory) (tab separated)
      local    user=""            # Str: GIT repository user [arg] (mandatory)
      local    addr=""            # Str: GIT repository address [arg] (mandatory)
      local    repo=""            # Str: GIT repository name [arg] (mandatory)
      local    option             # Str: Current option from optorder array
    
      # Display help information
      if (($(option_set ${opthelp}))); then
        echo "Usage: $(basename ${0}) PROJECT-DIRECTORY... GIT-REPOSITORY... [OPTION]..."
        echo "Combine an ordered history of project subdirectories in PROJECT-DIRECTORY into a new single GIT-REPOSITORY."
        echo
        for option in ${optorder[@]}
        do
          echo "      ${option} $(printf ' %.0s' {1..12} | head -c $((12-${#option}))) ${options[${option}]}"
        done
        echo
        exit 0
      fi
    
      # Get & check the arguments
      for arg in ${argv[@]}; do
        if [[ ${arg:0:2} == "--" ]]; then  # Option
          [[ ! -v options[${arg}] ]] && echo "Option (${arg}) is not recognised!" && exit 1
        elif [[ -z ${project} ]]; then  # Project directory
          project=${arg}
          [[ ! -d ${project} ]] && echo "Project directory (${arg}) does not exist!" && exit 1
        elif [[ -z ${url} ]]; then  # GIT repository URL
          url=$(sed -n 's/^\(.\+\)@\(.\+\):\(.\+\)$/\1\t\2\t\3/p' <<< ${arg})
          [[ -z ${url} ]] && echo "GIT repository URL (${arg}) seems incorrect!" && exit 1
          local -ra split=(${url})  # Get url values (tab-separated) into array
          user=${split[0]}
          addr=${split[1]}
          repo=${split[2]}
        else
          echo "Unexpected argument (${arg}) found!" && exit 1
        fi
      done
    
      # Further check the arguments
      [[ -z ${project} ]] && echo "No project directory specified!" && exit 1
      [[ -z ${url} ]] && echo "No GIT repository URL specified!" && exit 1
    
      # Do the join operation
      do_join
    }
    
    
    ################################################################################
    # Opening gambit.
    # Arguments ...... None
    # Return ......... None
    # Exit code ...... Status (0=success, 1=failure)
    # Shared (In) .... $#, $@
    # Shared (Out) ... argc, argv
    declare -ri argc=${#}    # Int: Get argument count
    declare -ra argv=(${@})  # Arr: Get argument values (space-separated) into array
    main
    exit 0
    
    steve@Desktop:/tmp/scratch$ swuk_repos_join --help
    Usage: swuk_repos_join PROJECT-DIRECTORY... GIT-REPOSITORY... [OPTION]...
    Combine an ordered history of project subdirectories in PROJECT-DIRECTORY into a new single GIT-REPOSITORY.
    
          --fix         Fix known repository issues.
          --help        Display this help and exit.
    
    
    steve@Desktop:/tmp/scratch$ swuk_repos_join web_splice git@192.168.2.20:tmp_repo
    
    The script should take in the separate historical evolution directories along with the accompanying comments & tags information file and produce a combined single repository.

    Have a look see...
    steve@Desktop:/tmp/scratch$ git clone git@192.168.2.20:tmp_repo
    
    Check the commits & commit comments.
    steve@Desktop:/tmp/scratch$ cd tmp_repo
    steve@Desktop:/tmp/scratch/tmp_repo$ git log --reverse --oneline --decorate-refs='tags' --pretty='%C(auto)%h  %<(35)%D  %C(green)%cd  %C(cyan)%s%C(reset)' --date=format:'%d-%b-%Y %H:%M:%S'
    74e8a40  tag: common_v1.0                     27-Mar-2025 06:57:21  Initial commit of common files.
    1a5a443  tag: zedboard_hello_world_v1.0       27-Mar-2025 06:57:25  Basic Zedboard design consisting of just the ZYNQ7 Processing System.
    fc64a19  tag: zedboard_leds_switches_v1.0     27-Mar-2025 06:57:29  Basic Zedboard design consisting of just the ZYNQ7 Processing System.
    c63acc3  tag: zedboard_leds_buttons_v2.0_int  27-Mar-2025 06:57:32  Changed GPIO2 connection from DIP Switches (8-bit) to Push Buttons (5-bit).
    f04a874  tag: zedboard_linux_v1.0             27-Mar-2025 06:57:36  Initial PetaLinux project configured for ZYNQ and using the XSA from zedboard_leds_switches v1.0.
    923f1bb  tag: zedboard_linux_v2.0             27-Mar-2025 06:57:40  Enabled Peek/Poke application.
    c2ee518  tag: zedboard_linux_v3.0             27-Mar-2025 06:57:43  Added & enabled LED runner auto-start application.
    fbcec6a                                       27-Mar-2025 06:57:47  Enabled webserver application and created website installer application (static).
    9c23312                                       27-Mar-2025 06:57:49  Added dynamic server-side elements to website application.
    2fbe426  tag: zedboard_linux_v4.0             27-Mar-2025 06:57:51  Added dynamic client-side elements to website application.
    f2e7adb  tag: zedboard_linux_v5.0             27-Mar-2025 06:57:54  Added peek/poke CGI application.
    0264c3b  tag: zedboard_linux_v6.0             27-Mar-2025 06:57:58  Added peek/poke CGI access to website application.
    8746809  tag: zedboard_linux_v7.0             27-Mar-2025 06:58:02  Added Style Sheet and improved webpage layout for website application.
    da6d75a  tag: zedboard_leds_switches_v2.0     27-Mar-2025 06:58:05  Added general purpose AXI register bank.
    79ae66d  tag: zedboard_linux_v8.0             27-Mar-2025 06:58:09  Enhanced webpage for website application to have multiple location access into PL address space.
    c45f018  tag: zedboard_leds_switches_v3.0     27-Mar-2025 06:58:13  Added AXI Identification to the design.
    03404ab  tag: zedboard_linux_v9.0             27-Mar-2025 06:58:16  Enhanced webpage for website application to have access to product ID strings within PL address space.
    97d3733  tag: zedboard_leds_switches_v4.0     27-Mar-2025 06:58:20  Updated Firmware Identification fields to use static information from GIT
    3fc4f6e  tag: common_v2.0                     27-Mar-2025 06:58:24  Added PetaLinux build script that updates the project information file with timestamp & hash.
    d8ec01b                                       27-Mar-2025 06:58:27  Updated webpage to include PetaLinux ID table & add hash field to Firmware ID table.
    06d4435  tag: zedboard_linux_v10.0            27-Mar-2025 06:58:29  Updated webpage to include PetaLinux ID table & add hash field to Firmware ID table.
    af2f86a  tag: zedboard_leds_switches_v5.0     27-Mar-2025 06:58:33  Replaced Xilinx GPIO with custom GPIO for the Zedboard. Also replaced auto-generated Register Bank with custom version.
    ec7ee48  tag: zedboard_linux_v11.0            27-Mar-2025 06:58:37  Enabled Userspace IO Driver & added application to test new PL AXI GPIO Zed module.
    7e75dc1  tag: zedboard_linux_v12.0            27-Mar-2025 06:58:40  Removed busybox-httpd Webserver and replaced it with a LAMP style stack of Apache, SQLite, PHP & myLiteAdmin.
    a29403b  tag: zedboard_linux_v13.0            27-Mar-2025 06:58:44  Added the ability to load new PL firmware without a rebuild or reboot of PetaLinux. Updated the peek/poke address table to include range & select HTML elements.
    0e7aea8  tag: zedboard_linux_v14.0            27-Mar-2025 06:58:48  Restructured website to include a menu bar. Added a better SQLite Test webpage. Changed Apache to run as root.
    
    Looks good! At least on the surface.

    Check the tags & tag comments.
    steve@Desktop:/tmp/scratch/tmp_repo$ git for-each-ref --color --sort=creatordate --format='%(color:yellow)%(objectname:short)|%(color:magenta)tag: %(refname:short)|%(color:green)%(creatordate:format:%d-%b-%Y %H:%M:%S)|%(color:cyan)%(contents:subject)' refs/tags | column -t -s '|'
    
    7e875dc  tag: common_v1.0                     27-Mar-2025 06:57:23  Common files
    ee71bfc  tag: zedboard_hello_world_v1.0       27-Mar-2025 06:57:27  Just ZYNQ
    851a658  tag: zedboard_leds_switches_v1.0     27-Mar-2025 06:57:30  ZYNQ & GPIO
    04e7f9f  tag: zedboard_leds_buttons_v2.0_int  27-Mar-2025 06:57:34  ZYNQ, GPIO & Interrupts
    e64ff11  tag: zedboard_linux_v1.0             27-Mar-2025 06:57:38  PetaLinux with XSA from zedboard_leds_switches v1.0
    9a30f2e  tag: zedboard_linux_v2.0             27-Mar-2025 06:57:42  PetaLinux & Peek/Poke with XSA from zedboard_leds_switches v1.0
    3cd1786  tag: zedboard_linux_v3.0             27-Mar-2025 06:57:45  PetaLinux, Peek/Poke & LED Runner with XSA from zedboard_leds_switches v1.0
    7c3a2ff  tag: zedboard_linux_v4.0             27-Mar-2025 06:57:53  PetaLinux, Peek/Poke, LED Runner & Webserver with XSA from zedboard_leds_switches v1.0
    a98bdeb  tag: zedboard_linux_v5.0             27-Mar-2025 06:57:56  PetaLinux, Peek/Poke, LED Runner, Webserver & Peek/Poke CGI with XSA from zedboard_leds_switches v1.0
    5f36bc9  tag: zedboard_linux_v6.0             27-Mar-2025 06:58:00  PetaLinux, Peek/Poke, LED Runner, Webserver, Peek/Poke CGI & PL Access with XSA from zedboard_leds_switches v1.0
    bf32266  tag: zedboard_linux_v7.0             27-Mar-2025 06:58:03  PetaLinux, Peek/Poke, LED Runner, Webserver, Peek/Poke CGI, PL Access & Style Sheet with XSA from zedboard_leds_switches v1.0
    242461e  tag: zedboard_leds_switches_v2.0     27-Mar-2025 06:58:07  ZYNQ, GPIO & Register Bank
    31244d0  tag: zedboard_linux_v8.0             27-Mar-2025 06:58:11  PetaLinux, Peek/Poke, LED Runner, Webserver, Peek/Poke CGI, PL Access, Style Sheet & Register Bank with XSA from zedboard_leds_switches v2.0
    676f047  tag: zedboard_leds_switches_v3.0     27-Mar-2025 06:58:14  ZYNQ, GPIO, Register Bank & Identification
    c65df54  tag: zedboard_linux_v9.0             27-Mar-2025 06:58:18  PetaLinux, Peek/Poke, LED Runner, Webserver, Peek/Poke CGI, PL Access, Style Sheet, Register Bank & ID Strings with XSA from zedboard_leds_switches v3.0
    2d15023  tag: zedboard_leds_switches_v4.0     27-Mar-2025 06:58:22  ZYNQ, GPIO, Register Bank & Identification (timestamp & hash from GIT)
    25cabaa  tag: common_v2.0                     27-Mar-2025 06:58:25  Common files update
    557de4b  tag: zedboard_linux_v10.0            27-Mar-2025 06:58:31  PetaLinux, Peek/Poke, LED Runner, Webserver, Peek/Poke CGI, PL Access, Style Sheet, Register Bank & ID Strings (PetaLinux & Firmware hash) with XSA from zedboard_leds_switches v4.0
    d1f48c3  tag: zedboard_leds_switches_v5.0     27-Mar-2025 06:58:35  ZYNQ, GPIO Zed, Register Bank & Identification
    60941a3  tag: zedboard_linux_v11.0            27-Mar-2025 06:58:39  PetaLinux, Peek/Poke, LED Runner, Webserver, Peek/Poke CGI, PL Access, Style Sheet, Register Bank, ID Strings, UIO & GPIO Zed Test with XSA from zedboard_leds_switches v5.0
    adb3b03  tag: zedboard_linux_v12.0            27-Mar-2025 06:58:42  PetaLinux, Peek/Poke, LED Runner, LAMP (Apache, SQLite, PHP & myLiteAdmin), Peek/Poke CGI, PL Access, Style Sheet, Register Bank & ID Strings with XSA from zedboard_leds_switches v5.0
    3974d33  tag: zedboard_linux_v13.0            27-Mar-2025 06:58:46  PetaLinux, Peek/Poke, LED Runner, LAMP (Apache, SQLite, PHP & myLiteAdmin), Peek/Poke CGI, Load Firmware CGI, PL Access, Style Sheet, Register Bank & ID Strings with XSA from zedboard_leds_switches v5.0
    edbe71e  tag: zedboard_linux_v14.0            27-Mar-2025 06:58:50  PetaLinux, Peek/Poke, LED Runner, LAMP (Apache:root, SQLite, PHP & myLiteAdmin), Peek/Poke CGI, Load Firmware CGI, PL Access, Style Sheet, Register Bank & ID Strings with XSA from zedboard_leds_switches v5.0
    
    Looks good!

    Check for differences between the master and the last historical directory.
    steve@Desktop:/tmp/scratch/tmp_repo$ cd ..
    steve@Desktop:/tmp/scratch$ diff -r tmp_repo web_splice/0026
    Only in tmp_repo: .git
    
    Looks good! Again on the surface!

    5. Split new repository

    Do a virtually identical process to the one in stage 1, but this time use the newly created repository as the source.
    steve@Desktop:/tmp/scratch$ wget https://spacewire.co.uk/tutorial/shared/repos/0027/common/other/src/script/swuk_repos_split
    steve@Desktop:/tmp/scratch$ chmod +x swuk_repos_split
    

    swuk_repos_split

    #!/bin/bash
    
    #
    # File .......... swuk_repos_split
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Common (SpaceWire UK Tutorial)
    # Date .......... 12 Feb 2025
    # Version ....... 1.0
    # Description ...
    #   Clone a repository and checkout every one of its commits into a separate
    # directory.
    #
    
    # Strict
    set -euo pipefail
    
    ################################################################################
    # Split a repository into its historial parts.
    # Arguments ...... None
    # Return ......... None
    # Exit code ...... None
    # Shared (In) .... argv, optkeepgit, project, url
    # Shared (Out) ... argv
    split()
    {
      # Declare local constants
      local -r repo="repo"            # Str: Repository checkout directory
      local -r history="history.tsv"  # Str: History details file
    
      # Declare local variables
      local    hash                   # Str: Commit hash
      local -i index=1                # Int: Subdirectory index
    
      # Create project directory
      mkdir ${project}
    
      # Move into project directory
      cd ${project}
    
      # Clone repository
      echo -e "\e[93mCloning ... ${url} into ${repo}\e[0m"
      git clone ${url} ${repo}
    
      # Move into repository directory
      cd ${repo}
    
      # Iterate through all repository commits (versions)
      for hash in $(git log --reverse --pretty=format:"%h")
      do
        local tmp=$(printf "%04d" ${index})
        echo -e "\e[93mChecking out ... ${hash} into ${tmp}\e[0m"
    
        # Switch to a commit (version) using its hash
        git checkout ${hash}
    
        # Copy all the files in the commit (version)
        cp -r . ../${tmp}
        [[ ($(option_set ${optkeepgit}) -eq 0) ]] && rm -rf ../${tmp}/.git
    
        # Get the commit comment, tag & tag comment
        local comment=$(git show ${hash} --no-patch --oneline --pretty="%s")
        local tag=$(git describe --tags --exact-match ${hash})
        local tcomment=""
        if [ -n "${tag}" ]; then
          tcomment=$(git tag -l --format='%(contents)' ${tag})
        fi
    
        # Output the 3 fields into the history details file
        echo -e "${comment}\t${tag}\t${tcomment}" >> ../${history}
    
        # Increment subdirectory index
        ((index+=1))
      done
    
      # Move out of repository directory
      cd ..
    
      # Delete repository directory
      rm -rf ${repo}
    
      # Move out of project directory
      cd ..
    }
    
    
    ################################################################################
    # Check if an argument option is set.
    # Arguments ...... $1 ... Str: Option
    # Return ......... Set (0=unset, 1=set)
    # Shared (In) .... argv
    # Shared (Out) ... None
    option_set()
    {
      [[ " ${argv[*]} " =~ " ${1} " ]] && echo 1 || echo 0
    }
    
    
    ################################################################################
    # Main function.
    # Arguments ...... None
    # Return ......... None
    # Exit code ...... Status (0=success, 1=failure)
    # Shared (In) .... argv
    # Shared (Out) ... argv, optkeepgit, project, url
    main()
    {
      # Declare local constants
      local -r  optkeepgit="--keepgit"  # Str: KeepGIT option name
      local -r  opthelp="--help"        # Str: Help option name
      local -Ar options=(               # ARR: Options & associated help information
        [${optkeepgit}]="Keep the .git repository directories."
        [${opthelp}]="Display this help and exit."
      )
      local -ar optorder=(              # Arr: Help options display order
        ${optkeepgit}
        ${opthelp}
      )
    
      # Declare local variables
      local    arg                      # Str: Current argument from argv array
      local    project=""               # Str: Project directory [arg] (mandatory)
      local    url=""                   # Str: GIT repository URL [arg] (mandatory)
      local    option                   # Str: Current option from optorder array
    
      # Display help information
      if (($(option_set ${opthelp}))); then
        echo "Usage: $(basename ${0}) GIT-REPOSITORY... PROJECT-DIRECTORY... [OPTION]..."
        echo "Clone a GIT-REPOSITORY and checkout every one of its commits into a separate subdirectory within the PROJECT-DIRECTORY."
        echo
        for option in ${optorder[@]}
        do
          echo "      ${option} $(printf ' %.0s' {1..12} | head -c $((12-${#option}))) ${options[${option}]}"
        done
        echo
        exit 0
      fi
    
      # Get & check the arguments
      for arg in ${argv[@]}; do
        if [[ ${arg:0:2} == "--" ]]; then  # Option
          [[ ! -v options[${arg}] ]] && echo "Option (${arg}) is not recognised!" && exit 1
        elif [[ -z ${url} ]]; then  # GIT repository URL
          url=$(sed -n 's/^\(.\+@.\+:.\+\)$/\1/p' <<< ${arg})
          [[ -z ${url} ]] && echo "GIT repository URL (${arg}) seems incorrect!" && exit 1
        elif [[ -z ${project} ]]; then  # Project directory
          project=${arg}
          [[ -d ${project} ]] && echo "Project Directory (${arg}) already exist!" && exit 1
        else
          echo "Unexpected argument (${arg}) found!" && exit 1
        fi
      done
    
      # Further check the arguments
      [[ -z ${url} ]] && echo "No GIT repository URL specified!" && exit 1
      [[ -z ${project} ]] && echo "No project directory specified!" && exit 1
    
      # Do the repository split
      split
    }
    
    
    ################################################################################
    # Opening gambit.
    # Arguments ...... None
    # Return ......... None
    # Exit code ...... Status (0=success, 1=failure)
    # Shared (In) .... $#, $@
    # Shared (Out) ... argc, argv
    declare -ri argc=${#}    # Int: Get argument count
    declare -ra argv=(${@})  # Arr: Get argument values (space-separated) into array
    main
    exit 0
    
    steve@Desktop:/tmp/scratch$ swuk_repos_split --help
    Usage: swuk_repos_split GIT-REPOSITORY... PROJECT-DIRECTORY... [OPTION]...
    Clone a GIT-REPOSITORY and checkout every one of its commits into a separate subdirectory within the PROJECT-DIRECTORY.
    
          --keepgit     Keep the .git repository directories.
          --help        Display this help and exit.
    
    
    steve@Desktop:/tmp/scratch$ swuk_repos_split git@192.168.2.20:tmp_repo local_split
    
    The script should produce the complete historical evolution of the new repository. This script should also produce an accompanying comments & tags information file.

    Have a look see...
    steve@Desktop:/tmp/scratch$ ls local_split
    0001  0002  0003  0004  0005  0006  0007  0008  0009  0010  0011  0012  0013  0014  0015  0016  0017  0018  0019  0020  0021  0022  0023  0024  0025  0026  history.tsv
    Looks good! Expecting 26 directories along with 1 accompanying file.

    6. Compare results

    Compare the outputs from the splice and the split to check that the process worked correctly.
    steve@Desktop:/tmp/scratch$ diff -r web_splice local_split
    Only in web_splice/0018/zedboard_leds_switches: .gitignore
    Only in web_splice/0019/zedboard_leds_switches: .gitignore
    Only in web_splice/0020/zedboard_leds_switches: .gitignore
    Only in web_splice/0021/zedboard_leds_switches: .gitignore
    Only in web_splice/0024/zedboard_linux/os/petalinux: components
    
    Take a look at issues 1-4.
    steve@Desktop:/tmp/scratch$ cat web_splice/{0018,0019,0020,0021}/zedboard_leds_switches/.gitignore
    
    /*
    /*
    /*
    /*
    
    Thinking back to Part 16 of the Tutorial we have the following comment "For the modified script to work properly untracked files need to be kept away from the status command. To do this a blanket GIT ignore can be added that ignores everything GIT isn't tracking."

    The .gitignore's are set to ignore everything including themselves, hence the reason they did not make there way into the new repository for the commits of directories 0018 through 0021.

    This issue will need to be addressed.

    Take a look at issue 5.
    steve@Desktop:/tmp/scratch$ ls web_splice/0024/zedboard_linux/os/petalinux/components/yocto/layers/meta-openembedded/meta-webserver/recipes-httpd/apache2
    apache2_%.bbappend
    
    Check the PetaLinux .gitignore.
    steve@Desktop:/tmp/scratch$ cat web_splice/0024/zedboard_linux/os/petalinux/.gitignore
    */*/config.old
    */*/rootfs_config.old
    build/
    images/linux/
    pre-built/linux/
    .petalinux/*
    !.petalinux/metadata
    *.o
    *.jou
    *.log
    /components/plnx_workspace
    /components/yocto
    
    The problem is with the path being ignored, worse still, placing a file in this path breaks the PetaLinux build process for a fresh checkout. The apache2_%.bbappend file, as shown in Tutorial 18 is in the wrong location and should be in the location shown below. The problem is mentioned and fixed in Tutorial 19.
    steve@Desktop:/tmp/scratch$ ls web_splice/0025/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-httpd/apache2
    apache2_%.bbappend
    
    This issue will need to be addressed.

    7. Fix any issues

    The above two issues need to be fixed during the join stage. The --fix input argument can be used to enable/disable the required corrections. At this point achieving an identical match between the split of the newly created repository and the splice of the original individual repositories is the main goal. Breaking the tutorial unnecessarily is not desirable right now.
    steve@Desktop:/tmp/scratch$ swuk_repos_join web_splice git@192.168.2.20:tmp_repo --fix
    steve@Desktop:/tmp/scratch$ swuk_repos_split git@192.168.2.20:tmp_repo local_split_fix
    steve@Desktop:/tmp/scratch$ diff -r local_split_fix web_splice
    
    No difference found, job done!

    8. Examine history

    To get a better feel for the newly created repository a history script that examines its split will be used to see what changed during the life time of the the various projects. This script will produce an interactive history report in HTML format.
    steve@Desktop:/tmp/scratch$ wget https://spacewire.co.uk/tutorial/shared/repos/0027/common/other/src/script/swuk_repos_history
    steve@Desktop:/tmp/scratch$ chmod +x swuk_repos_history
    

    swuk_repos_history

    #!/bin/bash
    
    #
    # File .......... swuk_repos_history
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Common (SpaceWire UK Tutorial)
    # Date .......... 09 Feb 2025
    # Version ....... 1.0
    # Description ...
    #   Simple script that examines a sequential series of directories containing
    # the history of a project(s) and publishes the results as a webpage.
    #
    # Internal :-
    #
    # Project files array string format, an associative array using the full path &
    # filename as the key :-
    #
    # The last known hash of the file, wrapped with HTML table tags :-
    # - Fixed @ 41x characters [40:00] :-
    # - <td>000000 -- 32-digit hash -- 00000</td>
    #
    # The last known version of the file, wrapped with HTML table tags :-
    # - Fixed @ 12x characters [52:41] :-
    # - <td>ver</td>
    #
    # Current version of the file, basically $(git log --oneline $file | wc -l) :-
    # - Variable length (number or dash), wrapped with HTML table tags :-
    # - <td>v</td> or <td>-</td>
    # - There will be $(git log --oneline | wc -l) number of these entries.
    #
    
    # Strict
    set -euo pipefail
    
    ################################################################################
    # Write out results table webpage.
    # Arguments ...... None
    # Return ......... None
    # Shared (In) .... argv, exclude, fouthtml, hdr, lenhash, lentdclose, lentdopen,
    #                  lenvers, optexclude, projfiles
    # Shared (Out) ... argv
    write_html()
    {
      # Declare local variables
      local -a  keys  # Sorted keys
      local -i  tmplen=$(expr 2*${lentdopen}+2*${lentdclose}+${lenhash}+${lenvers})
      local     now=$(date +"%d %b %Y %H:%M:%S")  # Current date & time
      local -i  pos  # File position
    
    cat << EOF > ${fouthtml}
    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <title>SWUK Repository History</title>
    <style>
    body {
     font-family: "Muli", sans-serif;
    }
    
    
    table.repo {
      background-color: rgba(239,239,255,0.8);
      border: 1px solid #AAAAAA;
      border-collapse: collapse;
      padding: 2px 8px;
      overflow: hidden;
      z-index: 1;
    }
    
    table.repo td, th {
      border: 1px solid #AAAAAA;
      border-collapse: collapse;
      text-align: center;
      padding: 2px 8px;
      cursor: pointer;
      position: relative;
    }
    
    table.repo th {
      background-color: rgb(224,224,255);
    }
    
    table.repo th:hover {
      background-color: rgb(180,180,255);
      font-weight: bold;
    }
    
    table.repo td.chg {
      background-color: rgb(200,200,255);
    }
    
    table.repo td.chg:hover {
      background-color: rgb(180,180,255);
      font-weight: bold;
    }
    
    table.repo td.side:hover {
      background-color: rgb(224,224,255);
    }
    
    /* Row */
    table.repo td.side:hover::before {
      background-color: rgb(180,180,255);
      content: '\00a0';
      height: 100%;
      left: -5000px;
      position: absolute;
      top: 0;
      width: 10000px;
      z-index: -1;
    }
    
    /* Column */
    table.repo td.side:hover::after {
      background-color: rgb(239, 239, 255);
      content: '\00a0';
      height: 10000px;
      left: 0;
      position: absolute;
      top: -5000px;
      width: 100%;
      z-index: -1;
    }
    
    /* Row */
    table.repo td:hover::before {
      background-color: rgb(180,180,255);
      content: '\00a0';
      height: 100%;
      left: -5000px;
      position: absolute;
      top: 0;
      width: 10000px;
      z-index: -1;
    }
    
    /* Column */
    table.repo td:hover::after, table.repo th:hover::after {
      background-color: rgb(180,180,255);
      content: '\00a0';
      height: 10000px;
      left: 0;
      position: absolute;
      top: -5000px;
      width: 100%;
      z-index: -1;
    }
    </style>
    
    </head>
    <body>
    EOF
    
      # Get sorted keys for project files list
      readarray -td '' keys < <(printf '%s\0' "${!projfiles[@]}" | sort -n -z)
    
      echo '<table class=repo id=table><tbody>' >> ${fouthtml}
      echo "<tr><th>No.</th><th style='text-align:left'>Files @ ${now}</th><th>I/E</th>${hdr}</tr>" >> ${fouthtml}
    
      # Iterate through project files list
      pos=1  # Reset file position
      for key in ${keys[@]}
      do
        if [[ ! " ${exclude[*]} " =~ " ${key} " ]]; then  # Inclusive file
          echo "<tr><td class=side style='text-align:left'>$(printf "%03d" ${pos})</td><td class=side style='text-align:left'>${key}<td class=side> Inc</td>${projfiles[${key}]:tmplen}</tr>" >> ${fouthtml}
          ((pos+=1))
        elif (($(option_set ${optexclude}))); then
          echo "<tr><td class=side style='text-align:left'>$(printf "%03d" ${pos})</td><td class=side style='text-align:left'><s>${key}</s><td class=side>Exc</td>${projfiles[${key}]:tmplen}</tr>" >> ${fouthtml}
          ((pos+=1))
        fi
    
      done
      echo '</tbody></table>' >> ${fouthtml}
    
    cat << EOF >> ${fouthtml}
    <script>
    function compare(a, b) {
      return (a<b) ? -1 : (a>b) ? 1 : 0;
    }
    
    function sort(col) {
      let tbody = table.querySelector(\`tbody\`);
      let rows = Array.from(table.querySelectorAll(\`tr\`));
      rows = rows.slice(1);
      let qs = \`td:nth-child(\${col})\`;
      rows.sort( (r1,r2) => {
        let t1 = r1.querySelector(qs);
        let t2 = r2.querySelector(qs);
        return compare(t1.textContent.toLowerCase(), t2.textContent.toLowerCase());
      });
      rows.forEach(row => tbody.appendChild(row));
    }
    
    table.querySelectorAll(\`th\`).forEach((th, position) => {
      th.addEventListener(\`click\`, evt => sort(position+1));
    });
    </script>
    EOF
      echo '</body></html>' >> ${fouthtml}
    }
    
    
    ################################################################################
    # Read the comment header block from a source file.
    # Arguments ...... None
    # Return ......... None
    # Shared (In) .... file, header*, projdir, project, versi*, versitrunc*
    # Shared (Out) ... header*, versi*, versitrunc*
    #
    # Note: The single line read used below is the stock way of doing this, where :-
    # 1. IFS= (or IFS='') prevents leading/trailing whitespace from being trimmed.
    # 2. -r prevents backslash escapes from being interpreted.
    # 3. [[ -n ${line} ]] prevents the last line from being ignored if it doesn't end with a \n.
    get_header()
    {
      # Declare local variables
      local line         # Line string
      local -i pos=0     # Line position
      local -i type=0    # File type (0=Unknown, 1=Script)
      local -i stage=0   # Operation stage (0=Empty lines, 1=Header lines)
      local -i start=-1  # Start position of header
      local -i end=-1    # End position of header
      local -i valid=0   # Found a valid header (0=No, 1=Yes)
    
      # Initialise shared variables
      header=""          # Captured header block
      versi=""           # Captured version from header block
      versitrunc=""      # Captured version from header block (truncated)
    
      while IFS= read -r  line || [[ -n "${line}" ]]; do
        if [[ (${pos} -eq 0) && (${line:0:2} == "#!") ]]; then
          type=1
        elif [[ "${line}" =~ ^[[:space:]]*$ ]]; then
          [[ ${stage} -eq 1 ]] && break  # End of header
        else
          [[ ${stage} -eq 0 ]] && start=${pos}
          end=${pos}
          stage=1
          [[ "${line}" =~ ^.*[Ff][Ii][Ll][Ee]\ \.{3,}\ .+$ ]] && valid=1
    
          # Extract version number from the header
          local tmp=$(sed -n 's/^.*Version \.\{7\} \(.*\)$/\1/p' <<< "${line}")
          if [[ (${tmp} != "") && (${versi} == "") ]]; then
            versi=${tmp}
            local versplit=(${tmp//./ })
            [[ (${#versplit[@]} -eq 2) && (${versplit[1]} == "0") ]] &&
              versitrunc=${versplit[0]} || versitrunc=${tmp}
          fi
    
          header+="${line}&#10;"
        fi
        pos=$((pos+1))
        [[ ${pos} -eq 100 ]] && break
      done < "${project}/${projdir}/${file}"
    
      [[ ${valid} -eq 0 ]] && header="No header found!"
    
      # Swap out characters that cause HTML display issues
      header=${header//\'/&#39;}
    }
    
    
    ################################################################################
    # Process project directories & produce report.
    # Arguments ...... None
    # Return ......... None
    # Shared (In) .... argv, exclude, foutfileset, fouthashset, fouthtml,
    #                  optexclude, optheader, optlink, projdirs, project
    # Shared (Out) ... argv, exclude, file, fouthtml, hdr, lenhash, lentdclose,
    #                  lentdopen, lenvers, optexclude, projdir, project, projfiles,
    #                  header*, versi*, versitrunc*
    process_project()
    {
      # Declare local constants
      local -r  tdopen="<td>"           # Str: Table data cell open tag
      local -r  tdclose="</td>"         # Str: Table data cell close tag
      local -ri lentdopen=${#tdopen}    # Int: Length of 'tdopen' string
      local -ri lentdclose=${#tdclose}  # Int: Length of 'tdclose' string
      local -ri lenhash=32              # Int: Length of 'vers' & 'oldvers' strings
      local -ri lenvers=3               # Int: Length of 'hash' & 'oldhash' strings
    
      # Declare local variables
      local     projdir                 # Str: Current subdirectory name
      local     projdirprev             # Str: Previous subdirectory name
      local -i  projdirnum=1            # Int: Current subdirectory number
      local -a  hashes=()               # Arr: List of hashes for changed files
      local -A  projfiles=()            # ARR: List of processed files (associative array)
      local -a  files                   # Arr: List of files in current subdirectory (array)
      local     file                    # Str: Current file
      local     vers                    # Str: Current file version (3-char string, 0 padded unsigned)
      local     oldvers                 # Str: Last known file version (3-char string, 0 padded unsigned)
      local     hash                    # Str: Current file hash (32-char string, hex)
      local     oldhash                 # Str: Last known file hash (32-char string, hex)
      local     hdr                     # Str: Table header cells
      local     header                  # Str: Captured header block
      local     versi                   # Str: Captured version from header block
      local     versitrunc              # Str: Captured version from header block (truncated)
    
      # Iterate through subdirectories
      for projdir in ${projdirs[@]}
      do
        echo Processing ... ${projdirnum} @ ${projdir}
        # Get all files in current subdirectory
        readarray -t files < <(find ${project}/${projdir} \( -type l -o -type f \) -not -path '*/*/.git/*' | sort | cut -d'/' -f3-)
        # Iterate through all files in subdirectory
        for file in ${files[@]}
        do
          # Get hash for current file
          hash=$(md5sum ${project}/${projdir}/${file} | cut -c -${lenhash})
          # Check file vs. master files list (to add)
          if [[ -v projfiles[${file}] ]]; then  # Existing file, in master files list, check against last known
            # Get last known hash & version
            oldhash=${projfiles[${file}]:lentdopen:lenhash}
            local -i tmppos=$(expr 2*${lentdopen}+${lentdclose}+${lenhash})
            oldvers=${projfiles[${file}]:tmppos:lenvers}
            # Check for hash difference
            if [[ ${hash} == ${oldhash} ]]; then  # Same file, identical contents
              # Carry forward version to indicate no change
              vers=${oldvers}
              # Replace duplicate file with link to its original
              (($(option_set ${optlink}))) &&
                ln -fs $(pwd)/${project}/${projdirprev}/${file} ${project}/${projdir}/${file}
              # Check if file is a link, if so indicate with an underline
              if [ -L ${project}/${projdir}/${file} ]; then
                # Add table data cell for the current file version
                projfiles[${file}]+="<td><u>$(expr ${vers} + 0)</u></td>"
              else
                # Add table data cell for the current file version
                projfiles[${file}]+="<td>$(expr ${vers} + 0)</td>"
              fi
            else  # Same file, different contents
              # Increment version to indicate a change
              vers=$(printf "%03d" $(expr ${oldvers} + 1))
              # Update hash & version (changes on hash difference)
              local -i tmplen=$(expr 2*${lentdopen}+2*${lentdclose}+${lenhash}+${lenvers})
              projfiles[${file}]="<td>${hash}</td><td>${vers}</td>${projfiles[${file}]:tmplen}"
              # Add table data cell for the current file version
              if (($(option_set ${optheader}))); then
                get_header
                if [[ ${versi} != "" ]]; then
                  if [[ ${versitrunc} != "$(expr ${vers} + 0)" ]]; then
                    projfiles[${file}]+="<td class=chg style='color:orange' title='${header}'> ${versi}</td>"
                  else
                    projfiles[${file}]+="<td class=chg title='${header}'> ${versi}</td>"
                  fi
                else
                  projfiles[${file}]+="<td class=chg title='${header}'> $(expr ${vers} + 0)</td>"
                fi
              else
                projfiles[${file}]+="<td class=chg> $(expr ${vers} + 0)</td>"
              fi
              # Add hash & filename to hash list
              hashes+=("${hash} - $(printf "%03d" ${projdirnum}) - ${file}")
            fi
          else  # New file, not in master files list, add file to list
            # Set version to 1
            vers="001"
            # Add hash & version for the newly discovered file
            projfiles[${file}]="<td>${hash}</td><td>${vers}</td>"
            # Fill in version backstory (empty table data cells)
            for (( i = 1; i < ${projdirnum}; i++ )); do
              projfiles[${file}]+="<td>•</td>"
            done
            # Add new table data cell for the newly discovered file
            if (($(option_set ${optheader}))); then
              get_header
              if [[ ${versi} != "" ]]; then
                if [[ ${versitrunc} != "$(expr ${vers} + 0)" ]]; then
                  projfiles[${file}]+="<td class=chg style='color:red' title='${header}'> ${versi}</td>"
                else
                  projfiles[${file}]+="<td class=chg title='${header}'> ${versi}</td>"
                fi
              else
                projfiles[${file}]+="<td class=chg title='${header}'> $(expr ${vers} + 0)</td>"
              fi
            else
              projfiles[${file}]+="<td class=chg> $(expr ${vers} + 0)</td>"
            fi
            # Add hash & filename to hash list
            hashes+=("${hash} - $(printf "%03d" ${projdirnum}) - ${file}")
          fi
        done
    
        # Check master files list vs. file (to remove)
        for key in ${!projfiles[@]}
        do
          if [[ ! " ${files[*]} " =~ " ${key} " ]]; then
            # Add new table cell (empty) for absent file
            projfiles[${key}]+="<td>•</td>"
          fi
        done
    
        # Add new table header cell (current subdirectory number)
        hdr+="<th>$(printf "%02d" ${projdirnum})</th>"
    
        # Exit early (testing)
     #   [[ ${projdirnum} -eq 9 ]] && break
    
        # Shift current subdirectory name
        projdirprev=${projdir}
    
        # Increment subdirectory directory number
        ((projdirnum+=1))
      done
    
      # Write out HTML report
      write_html
    
      # Write out hash list of new, changed & renamed files
      printf '%s\n' "${hashes[@]}" | sort -n > ${fouthashset}
    
      # Write out list of all discovered files
      printf '%s\n' "${!projfiles[@]}" | sort -n > ${foutfileset}
    
      # Summary
      echo -e "\nDiscovered ${#projfiles[@]} files & ${#hashes[@]} file changes.\n"
    }
    
    
    ################################################################################
    # Check if an argument option is set.
    # Arguments ...... $1 ... Str: Option
    # Return ......... Set (0=unset, 1=set)
    # Shared (In) .... argv
    # Shared (Out) ... None
    option_set()
    {
      [[ " ${argv[*]} " =~ " ${1} " ]] && echo 1 || echo 0
    }
    
    
    ################################################################################
    # Main function.
    # Arguments ...... None
    # Return ......... None
    # Exit code ...... Status (0=success, 1=failure)
    # Shared (In) .... argv
    # Shared (Out) ... argv, exclude, foutfileset, fouthashset, fouthtml,
    #                  optexclude, optheader, optlink, projdirs, project
    main()
    {
      # Declare local constants
      local -r  optexclude="--exclude"    # Str: Exclude option name
      local -r  optlink="--link"          # Str: Link option name
      local -r  optheader="--header"      # Str: Header option name
      local -r  opthelp="--help"          # Str: Help option name
      local -Ar options=(                 # ARR: Options & associated help information
        [${optexclude}]="Display excluded files in the history report."
        [${optlink}]="Replace files with symbolic links for duplicate files."
        [${optheader}]="Read headers & display them in the history report."
        [${opthelp}]="Display this help and exit."
      )
      local -ar optorder=(                # Arr: Help options display order
        ${optexclude}
        ${optlink}
        ${optheader}
        ${opthelp}
      )
    
      # Declare local variables
      local    arg                        # Str: Current argument from argv array
      local    project=""                 # Str: Project directory [arg] (mandatory)
      local    exfile=""                  # Str: Exclude file [arg] (optional)
      local    option                     # Str: Current option from optorder array
    
      # Display help information
      if (($(option_set ${opthelp}))); then
        echo "Usage: $(basename $0) PROJECT-DIRECTORY... [EXCLUDE-FILE]... [OPTION]..."
        echo "Scan the subdirectories in the PROJECT-DIRECTORY & generate a history report."
        echo
        for option in ${optorder[@]}
        do
          echo "      ${option} $(printf ' %.0s' {1..12} | head -c $((12-${#option}))) ${options[${option}]}"
        done
        echo
        exit 0
      fi
    
      # Get & check the arguments
      for arg in ${argv[@]}; do
        if [[ ${arg:0:2} == "--" ]]; then  # Option
          [[ ! -v options[${arg}] ]] && echo "Option (${arg}) is not recognised!" && exit 1
        elif [[ -z ${project} ]]; then  # Project directory
          project=${arg}
          [[ ! -d ${project} ]] && echo "Project directory (${arg}) does not exist!" && exit 1
        elif [[ -z ${exfile} ]]; then  # Exclude file
          exfile=${arg}
          [[ ! -f ${exfile} ]] && echo "Exclude file (${arg}) does not exist!" && exit 1
        else
          echo "Unexpected argument (${arg}) found!" && exit 1
        fi
      done
    
      # Further check the arguments
      [[ -z ${project} ]] && echo "No project directory specified!" && exit 1
    
      # Read list of excluded files
      local -a exclude=()  # Arr: List of excluded files
      [[ -n ${exfile} ]] && readarray -t exclude < ${exfile}
    
      # Get all subdirectories into an ordered array
      local -a projdirs=()  # Arr: List of project subdirectories (alphanumeric order)
      readarray -t projdirs < <(find ${project} -mindepth 1 -maxdepth 1 -type d | sort | cut -d'/' -f2-)
      [[ ${#projdirs[@]} -eq 0 ]] && echo "Project directory specified (${project}) does not contain any subdirectories!" && exit 1
    
      # Declare local constants
      local -r fouthtml="history.html"    # Str: Report HTML page
      local -r foutfileset="fileset.txt"  # Str: List of all discovered files
      local -r fouthashset="hashset.txt"  # Str: Hash list of new, changed & renamed files
    
      # Process the project subdirectories
      process_project
    }
    
    
    ################################################################################
    # Opening gambit.
    # Arguments ...... None
    # Return ......... None
    # Exit code ...... Status (0=success, 1=failure)
    # Shared (In) .... $#, $@
    # Shared (Out) ... argc, argv
    declare -ri argc=${#}    # Int: Get argument count
    declare -ra argv=(${@})  # Arr: Get argument values (space-separated) into array
    main
    exit 0
    
    steve@Desktop:/tmp/scratch$ swuk_repos_history --help
    Usage: swuk_repos_history PROJECT-DIRECTORY... [EXCLUDE-FILE]... [OPTION]...
    Scan the subdirectories in the PROJECT-DIRECTORY & generate a history report.
    
          --exclude     Display excluded files in the history report.
          --link        Replace files with symbolic links for duplicate files.
          --header      Read headers & display them in the history report.
          --help        Display this help and exit.
    
    
    Run the history script, initially to obtain the full list of repository files. All the files that ever existed in the repository.
    steve@Desktop:/tmp/scratch$ swuk_repos_history local_split_fix
    
    The script generates the following output files. Squirrel away the full list for later use.
    steve@Desktop:/tmp/scratch$ mkdir -p ${swuk_user}/general
    steve@Desktop:/tmp/scratch$ cp fileset.txt ${swuk_user}/general/v14_fileset.txt
    
    View the file :-
    steve@Desktop:/tmp/scratch$ subl ${swuk_user}/general/v14_fileset.txt
    

    v14_fileset.txt

    common/fw/src/constraint/zedboard_master_XDC_RevC_D_v3.xdc
    common/fw/src/script/create_vivado_project.sh
    common/fw/src/script/create_vivado_project.tcl
    common/fw/src/script/zedboard_presets.tcl
    common/other/src/script/create_project_structure.sh
    common/other/src/script/petalinux-build-id.sh
    common/other/src/script/xilinx_2021_2.sh
    common/other/src/script/xilinx.sh
    common/sw/src/script/create_vitis_project.sh
    common/sw/src/script/create_vitis_project.tcl
    zedboard_hello_world/fw/src/diagram/system/system.bd
    zedboard_hello_world/fw/system_wrapper.xsa
    zedboard_hello_world/sw/src/c/hello_world.c
    zedboard_leds_buttons/fw/src/constraint/zedboard.xdc
    zedboard_leds_buttons/fw/src/diagram/system/system.bd
    zedboard_leds_buttons/fw/src/testbench/testbench.sv
    zedboard_leds_buttons/fw/system_wrapper.xsa
    zedboard_leds_buttons/sw/src/c/zedboard_leds_buttons.c
    zedboard_leds_switches/fw/project.txt
    zedboard_leds_switches/fw/src/constraint/zedboard.xdc
    zedboard_leds_switches/fw/src/design/axi_gpio_zed.v
    zedboard_leds_switches/fw/src/design/axi_identification.v
    zedboard_leds_switches/fw/src/design/axi_register_bank.v
    zedboard_leds_switches/fw/src/design/debounce.v
    zedboard_leds_switches/fw/src/diagram/system/hdl/system_wrapper.sv
    zedboard_leds_switches/fw/src/diagram/system/system.bd
    zedboard_leds_switches/fw/src/ip_repo/register_bank_1.0/bd/bd.tcl
    zedboard_leds_switches/fw/src/ip_repo/register_bank_1.0/component.xml
    zedboard_leds_switches/fw/src/ip_repo/register_bank_1.0/drivers/register_bank_v1_0/data/register_bank.mdd
    zedboard_leds_switches/fw/src/ip_repo/register_bank_1.0/drivers/register_bank_v1_0/data/register_bank.tcl
    zedboard_leds_switches/fw/src/ip_repo/register_bank_1.0/drivers/register_bank_v1_0/src/Makefile
    zedboard_leds_switches/fw/src/ip_repo/register_bank_1.0/drivers/register_bank_v1_0/src/register_bank.c
    zedboard_leds_switches/fw/src/ip_repo/register_bank_1.0/drivers/register_bank_v1_0/src/register_bank.h
    zedboard_leds_switches/fw/src/ip_repo/register_bank_1.0/drivers/register_bank_v1_0/src/register_bank_selftest.c
    zedboard_leds_switches/fw/src/ip_repo/register_bank_1.0/example_designs/bfm_design/design.tcl
    zedboard_leds_switches/fw/src/ip_repo/register_bank_1.0/example_designs/bfm_design/register_bank_v1_0_tb.sv
    zedboard_leds_switches/fw/src/ip_repo/register_bank_1.0/example_designs/debug_hw_design/design.tcl
    zedboard_leds_switches/fw/src/ip_repo/register_bank_1.0/example_designs/debug_hw_design/register_bank_v1_0_hw_test.tcl
    zedboard_leds_switches/fw/src/ip_repo/register_bank_1.0/hdl/register_bank_v1_0_S00_AXI.v
    zedboard_leds_switches/fw/src/ip_repo/register_bank_1.0/hdl/register_bank_v1_0.v
    zedboard_leds_switches/fw/src/ip_repo/register_bank_1.0/xgui/register_bank_v1_0.tcl
    zedboard_leds_switches/fw/src/script/post_bit.tcl
    zedboard_leds_switches/fw/src/script/pre_synth.tcl
    zedboard_leds_switches/fw/src/testbench/testbench.sv
    zedboard_leds_switches/fw/system_wrapper.xsa
    zedboard_leds_switches/.gitignore
    zedboard_leds_switches/sw/src/c/zedboard_leds_switches.c
    zedboard_linux/os/petalinux/components/yocto/layers/meta-openembedded/meta-webserver/recipes-httpd/apache2/apache2_%.bbappend
    zedboard_linux/os/petalinux/config.project
    zedboard_linux/os/petalinux/.gitignore
    zedboard_linux/os/petalinux/.petalinux/metadata
    zedboard_linux/os/petalinux/project-spec/attributes
    zedboard_linux/os/petalinux/project-spec/configs/busybox/inetd.conf
    zedboard_linux/os/petalinux/project-spec/configs/config
    zedboard_linux/os/petalinux/project-spec/configs/init-ifupdown/interfaces
    zedboard_linux/os/petalinux/project-spec/configs/rootfs_config
    zedboard_linux/os/petalinux/project-spec/hw-description/drivers/register_bank_v1_0/data/register_bank.mdd
    zedboard_linux/os/petalinux/project-spec/hw-description/drivers/register_bank_v1_0/data/register_bank.tcl
    zedboard_linux/os/petalinux/project-spec/hw-description/drivers/register_bank_v1_0/src/Makefile
    zedboard_linux/os/petalinux/project-spec/hw-description/drivers/register_bank_v1_0/src/register_bank.c
    zedboard_linux/os/petalinux/project-spec/hw-description/drivers/register_bank_v1_0/src/register_bank.h
    zedboard_linux/os/petalinux/project-spec/hw-description/drivers/register_bank_v1_0/src/register_bank_selftest.c
    zedboard_linux/os/petalinux/project-spec/hw-description/metadata
    zedboard_linux/os/petalinux/project-spec/hw-description/ps7_init.c
    zedboard_linux/os/petalinux/project-spec/hw-description/ps7_init_gpl.c
    zedboard_linux/os/petalinux/project-spec/hw-description/ps7_init_gpl.h
    zedboard_linux/os/petalinux/project-spec/hw-description/ps7_init.h
    zedboard_linux/os/petalinux/project-spec/hw-description/ps7_init.html
    zedboard_linux/os/petalinux/project-spec/hw-description/ps7_init.tcl
    zedboard_linux/os/petalinux/project-spec/hw-description/system_wrapper.bit
    zedboard_linux/os/petalinux/project-spec/hw-description/system.xsa
    zedboard_linux/os/petalinux/project-spec/meta-user/conf/layer.conf
    zedboard_linux/os/petalinux/project-spec/meta-user/conf/petalinuxbsp.conf
    zedboard_linux/os/petalinux/project-spec/meta-user/conf/user-rootfsconfig
    zedboard_linux/os/petalinux/project-spec/meta-user/COPYING.MIT
    zedboard_linux/os/petalinux/project-spec/meta-user/README
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/axi-gpio-zed-test/axi-gpio-zed-test.bb
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/axi-gpio-zed-test/files/axi-gpio-zed-test.c
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/axi-gpio-zed-test/files/Makefile
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/axi-gpio-zed-test/.gdbinit
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/axi-gpio-zed-test/README
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/gpio-demo/files/gpio-demo.c
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/gpio-demo/files/Makefile
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/gpio-demo/gpio-demo.bb
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/led-runner/files/led-runner
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/led-runner/.gdbinit
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/led-runner/led-runner.bb
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/led-runner/README
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/peekpokecgi/files/bitbash.c
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/peekpokecgi/files/loadfirmware.c
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/peekpokecgi/files/Makefile
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/peekpokecgi/files/peek.c
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/peekpokecgi/files/peekstring.c
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/peekpokecgi/files/poke.c
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/peekpokecgi/.gdbinit
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/peekpokecgi/peekpokecgi.bb
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/peekpokecgi/README
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/peekpoke/files/Makefile
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/peekpoke/files/peek.c
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/peekpoke/files/poke.c
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/peekpoke/peekpoke.bb
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/amber.gif
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/cgi-bin/hello_world.php
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/cgi-bin/index.cgi
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/cgi-bin/index.php
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/cgi-bin/phpliteadmin.config.php
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/cgi-bin/phpliteadmin.php
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/cgi-bin/sqlite_test.php
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/cgi-bin/test-cgi
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/cgi-bin/uptime.cgi
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/green.gif
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/home/index.php
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/index.html
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/index.php
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/peekpoke/index.php
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/peekpoke/script.js
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/project.txt
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/red.gif
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/share/amber.gif
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/share/footer.php
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/share/green.gif
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/share/header.php
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/share/red.gif
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/share/script.js
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/share/style.css
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/styles.css
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/system/index.php
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/system/script.js
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/uptime.js
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/zedboard/btn_none.png
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/zedboard/btn_off.png
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/zedboard/btn_on.png
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/zedboard/index.php
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/zedboard/led_off.png
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/zedboard/led_on.png
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/zedboard.png
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/zedboard/script.js
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/zedboard/style.css
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/zedboard/sw_none.png
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/zedboard/sw_off.png
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/zedboard/sw_on.png
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/zedboard/zedboard.png
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/.gdbinit
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/README
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/website.bb
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-bsp/device-tree/device-tree.bbappend
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-bsp/device-tree/files/pl-custom.dtsi
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-bsp/uboot-device-tree/files/system-user.dtsi
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-bsp/uboot-device-tree/uboot-device-tree.bbappend
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-bsp/u-boot/files/bsp.cfg
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-bsp/u-boot/files/platform-top.h
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-bsp/u-boot/u-boot-xlnx_%.bbappend
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-httpd/apache2/apache2_%.bbappend
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-kernel/linux/linux-xlnx_%.bbappend
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-kernel/linux/linux-xlnx/bsp.cfg
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-kernel/linux/linux-xlnx/user_2023-08-08-08-28-00.cfg
    zedboard_linux/os/src/other/axi_gpio_zed.txt
    zedboard_linux/os/src/other/zedboard_leds_switches.txt
    
    Direct download available here :-
    steve@Desktop:/tmp/scratch$ wget https://spacewire.co.uk/tutorial/shared/documents/swuk_tutorial/general/v14_fileset.txt -O ${swuk_user}/general/v14_fileset.txt
    
    Create an ignore list from the full list & edit it to leave only the files that are to be ignored.

    The known source files can be commented out instead of being removed. Do whatever is easier to follow. The ignore list can also be re-ordered. Again, do whatever is easier to follow.
    steve@Desktop:/tmp/scratch$ cp ${swuk_user}general/v14_fileset.txt ${swuk_user}general/v14_fileset_ignore.txt
    
    Edit the file :-
    steve@Desktop:/tmp/scratch$ subl ${swuk_user}/general/v14_fileset_ignore.txt
    

    v14_fileset_ignore.txt

    common/fw/src/constraint/zedboard_master_XDC_RevC_D_v3.xdc
    
    
    
    
    
    
    
    
    
    zedboard_hello_world/fw/src/diagram/system/system.bd
    zedboard_hello_world/fw/system_wrapper.xsa
    
    
    zedboard_leds_buttons/fw/src/diagram/system/system.bd
    
    zedboard_leds_buttons/fw/system_wrapper.xsa
    
    
    
    
    
    
    
    
    zedboard_leds_switches/fw/src/diagram/system/system.bd
    zedboard_leds_switches/fw/src/ip_repo/register_bank_1.0/bd/bd.tcl
    zedboard_leds_switches/fw/src/ip_repo/register_bank_1.0/component.xml
    zedboard_leds_switches/fw/src/ip_repo/register_bank_1.0/drivers/register_bank_v1_0/data/register_bank.mdd
    zedboard_leds_switches/fw/src/ip_repo/register_bank_1.0/drivers/register_bank_v1_0/data/register_bank.tcl
    zedboard_leds_switches/fw/src/ip_repo/register_bank_1.0/drivers/register_bank_v1_0/src/Makefile
    zedboard_leds_switches/fw/src/ip_repo/register_bank_1.0/drivers/register_bank_v1_0/src/register_bank.c
    zedboard_leds_switches/fw/src/ip_repo/register_bank_1.0/drivers/register_bank_v1_0/src/register_bank.h
    zedboard_leds_switches/fw/src/ip_repo/register_bank_1.0/drivers/register_bank_v1_0/src/register_bank_selftest.c
    zedboard_leds_switches/fw/src/ip_repo/register_bank_1.0/example_designs/bfm_design/design.tcl
    zedboard_leds_switches/fw/src/ip_repo/register_bank_1.0/example_designs/bfm_design/register_bank_v1_0_tb.sv
    zedboard_leds_switches/fw/src/ip_repo/register_bank_1.0/example_designs/debug_hw_design/design.tcl
    zedboard_leds_switches/fw/src/ip_repo/register_bank_1.0/example_designs/debug_hw_design/register_bank_v1_0_hw_test.tcl
    zedboard_leds_switches/fw/src/ip_repo/register_bank_1.0/hdl/register_bank_v1_0_S00_AXI.v
    zedboard_leds_switches/fw/src/ip_repo/register_bank_1.0/hdl/register_bank_v1_0.v
    zedboard_leds_switches/fw/src/ip_repo/register_bank_1.0/xgui/register_bank_v1_0.tcl
    
    
    
    zedboard_leds_switches/fw/system_wrapper.xsa
    
    
    
    zedboard_linux/os/petalinux/config.project
    zedboard_linux/os/petalinux/.gitignore
    zedboard_linux/os/petalinux/.petalinux/metadata
    zedboard_linux/os/petalinux/project-spec/attributes
    zedboard_linux/os/petalinux/project-spec/configs/busybox/inetd.conf
    zedboard_linux/os/petalinux/project-spec/configs/config
    zedboard_linux/os/petalinux/project-spec/configs/init-ifupdown/interfaces
    zedboard_linux/os/petalinux/project-spec/configs/rootfs_config
    zedboard_linux/os/petalinux/project-spec/hw-description/drivers/register_bank_v1_0/data/register_bank.mdd
    zedboard_linux/os/petalinux/project-spec/hw-description/drivers/register_bank_v1_0/data/register_bank.tcl
    zedboard_linux/os/petalinux/project-spec/hw-description/drivers/register_bank_v1_0/src/Makefile
    zedboard_linux/os/petalinux/project-spec/hw-description/drivers/register_bank_v1_0/src/register_bank.c
    zedboard_linux/os/petalinux/project-spec/hw-description/drivers/register_bank_v1_0/src/register_bank.h
    zedboard_linux/os/petalinux/project-spec/hw-description/drivers/register_bank_v1_0/src/register_bank_selftest.c
    zedboard_linux/os/petalinux/project-spec/hw-description/metadata
    zedboard_linux/os/petalinux/project-spec/hw-description/ps7_init.c
    zedboard_linux/os/petalinux/project-spec/hw-description/ps7_init_gpl.c
    zedboard_linux/os/petalinux/project-spec/hw-description/ps7_init_gpl.h
    zedboard_linux/os/petalinux/project-spec/hw-description/ps7_init.h
    zedboard_linux/os/petalinux/project-spec/hw-description/ps7_init.html
    zedboard_linux/os/petalinux/project-spec/hw-description/ps7_init.tcl
    zedboard_linux/os/petalinux/project-spec/hw-description/system_wrapper.bit
    zedboard_linux/os/petalinux/project-spec/hw-description/system.xsa
    zedboard_linux/os/petalinux/project-spec/meta-user/conf/layer.conf
    
    zedboard_linux/os/petalinux/project-spec/meta-user/conf/user-rootfsconfig
    zedboard_linux/os/petalinux/project-spec/meta-user/COPYING.MIT
    zedboard_linux/os/petalinux/project-spec/meta-user/README
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/axi-gpio-zed-test/axi-gpio-zed-test.bb
    
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/axi-gpio-zed-test/files/Makefile
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/axi-gpio-zed-test/.gdbinit
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/axi-gpio-zed-test/README
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/gpio-demo/files/gpio-demo.c
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/gpio-demo/files/Makefile
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/gpio-demo/gpio-demo.bb
    
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/led-runner/.gdbinit
    
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/led-runner/README
    
    
    
    
    
    
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/peekpokecgi/.gdbinit
    
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/peekpokecgi/README
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/peekpoke/files/Makefile
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/peekpoke/files/peek.c
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/peekpoke/files/poke.c
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/peekpoke/peekpoke.bb
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/amber.gif
    
    
    
    
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/cgi-bin/phpliteadmin.php
    
    
    
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/green.gif
    
    
    
    
    
    
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/red.gif
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/share/amber.gif
    
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/share/green.gif
    
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/share/red.gif
    
    
    
    
    
    
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/zedboard/btn_none.png
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/zedboard/btn_off.png
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/zedboard/btn_on.png
    
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/zedboard/led_off.png
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/zedboard/led_on.png
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/zedboard.png
    
    
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/zedboard/sw_none.png
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/zedboard/sw_off.png
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/zedboard/sw_on.png
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/zedboard/zedboard.png
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/.gdbinit
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/README
    
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-bsp/device-tree/device-tree.bbappend
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-bsp/device-tree/files/pl-custom.dtsi
    
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-bsp/uboot-device-tree/files/system-user.dtsi
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-bsp/uboot-device-tree/uboot-device-tree.bbappend
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-bsp/u-boot/files/bsp.cfg
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-bsp/u-boot/files/platform-top.h
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-bsp/u-boot/u-boot-xlnx_%.bbappend
    
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-kernel/linux/linux-xlnx_%.bbappend
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-kernel/linux/linux-xlnx/bsp.cfg
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-kernel/linux/linux-xlnx/user_2023-08-08-08-28-00.cfg
    
    
    
    Direct download available here :-
    steve@Desktop:/tmp/scratch$ wget https://spacewire.co.uk/tutorial/shared/documents/swuk_tutorial/general/v14_fileset_ignore.txt -O ${swuk_user}/general/v14_fileset_ignore.txt
    
    The differences can easy be seen using a difference tool.
    steve@Desktop:/tmp/scratch$ bcompare ${swuk_user}/general/v14_fileset.txt ${swuk_user}/general/v14_fileset_ignore.txt
    
    Run the history script again, this time feed in the ignore list so the script is aware of unimportant files. Throw the --exclude switch so the unimportant files are displayed. Throw the --header switch to let the script have a crack at reading source file headers.
    steve@Desktop:/tmp/scratch$ swuk_repos_history local_split_fix ${swuk_user}/general/v14_fileset_ignore.txt --exclude --header
    
    Open up the resulting HTML report file in a browser.
    steve@Desktop:/tmp/scratch$ firefox history.html
    
    Behold the file history - history.html (iframe shown below).

    Click on the table header columns to sort by column and hover over the version numbers to see the source file headers (if any were detected).



    Run the history script again, this time without the --exclude switch to see only the files of interest.
    steve@Desktop:/tmp/scratch$ swuk_repos_history local_split_fix ${swuk_user}/general/v14_fileset_ignore.txt --header
    
    Open up the resulting HTML report file in a browser.
    steve@Desktop:/tmp/scratch$ firefox history.html
    
    Behold the file history - history.html (iframe shown below).

    This now makes much more sense from a users point of view, as sorting by column now shows just the user edited files for that iteration of the repository. Clicking on column 01 shows all the files from Part 1 of the Tutorial, clicking on column 26 shows all the files from Part 20 of the Tutorial.



    #### Part 3 - Headers ####

    9. Headers

    There exists a handful of files that have been created and/or edited that contain no header block whatsoever. These poor unloved souls should become part of the family and have a nice shiny header block just like the rest of their brethren.

    Two options exist :-
    1. Go through the files in the repository and fumble together the missing headers.
    2. Write a script to do the majority of the donkey work.
    Who can pass up the opportunity to write some new code? 😉

    Destination unknown! Summary of what is required... Note: By using a full list and ignore list combo instead of just an include list prevents any new file additions from easily being missed. Much the same as with the .gitignore philosophy.

    Lets consider the comment style to be used for the various source files in the repository. Many different styles & types exist in the world of source code. So far four distinct styles & types have been used, which we will stick with for now.

    Hash (script) example (header starts from line 3 not 1)

    xilinx.sh

    #!/bin/bash
    
    #
    # File .......... xilinx.sh
    # Author ........ Steve Haywood
    # Version ....... 1.0
    # Date .......... 8 February 2021
    # Description ...
    #   Determine and list which Xilinx tools are available and let the user select
    # the require ones to use. Does not reverse any previously selected tools upon
    # selecting news ones so to is cleaner to use in a new Terminal session.
    #
    
    Hash (non-script) example

    create_vivado_project.tcl

    #
    # File .......... create_vivado_project.tcl
    # Author ........ Steve Haywood
    # Version ....... 1.0
    # Date .......... 23 December 2021
    # Description ...
    #   Simple Tcl script to create a new Vivado project, import external
    # sources and (optionally) generate the bitstream & export the hardware.
    #
    
    Slash example

    hello_world.c

    //
    // File .......... hello_world.c
    // Author ........ Steve Haywood
    // Version ....... 1.0
    // Date .......... 27 December 2021
    // Description ...
    //   The classic hello world C application.
    //
    
    Star example (kind of a missing extra empty comment line at end, for correct balance)

    style.css

    /*
     * File .......... style.css
     * Author ........ Steve Haywood
     * Website ....... http://www.spacewire.co.uk
     * Project ....... SpaceWire UK Tutorial
     * Version ....... 1.1
     * Conception .... 17 January 2022
     * Standard ...... CSS 3
     * Description ...
     *   Global Cascading Style Sheet for use in all webpages.
     */
    
    PHP example (kind of an extra empty comment line at start & end, but looks balanced)

    index.php

    <?php
    //
    // File .......... index.php
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... SpaceWire UK Tutorial
    // Version ....... 1.0
    // Conception .... 27 February 2024
    // Standard ...... PHP 7
    // Description ...
    //   Webpage for Home.
    //
    ?>
    
    A script to achieve the above requirements.
    steve@Desktop:/tmp/scratch$ wget https://spacewire.co.uk/tutorial/shared/repos/0027/common/other/src/script/swuk_repos_gen_fix_headers
    steve@Desktop:/tmp/scratch$ chmod +x swuk_repos_gen_fix_headers
    

    swuk_repos_gen_fix_headers

    #!/bin/bash
    
    #
    # File .......... swuk_repos_gen_fix_headers
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Common (SpaceWire UK Tutorial)
    # Date .......... 30 Jan 2025
    # Version ....... 1.0
    # Description ...
    #   Iterate through a collection of project directories and create/correct any
    # of the missing/erroneous headers. All functions are controlled by command line
    # switches.
    #
    # Fields in the header :-
    #
    # File .......... Set to the filename of the source in question.
    # Author ........ Set to a constant in this script.
    # Website ....... Set to a constant in this script.
    # Project ....... Set to the project name plus a constant in this script.
    # Date .......... If not provided set to a default value, otherwise corrected to
    #                 have a consistent format.
    # Version ....... Major part set to be the number of changes provided from
    #                 'git log' for the source in question. Minor part is optionally
    #                 set to 0.
    # Description ... If not provided set to a default value.
    #
    
    # Strict
    set -euo pipefail
    
    # General constants
    declare -r c_newline=$'\n'
    
    # Verbosity levels             # Summary - Err - Warn - Note - Files(Inc) - Files(Exc)
    declare -ri c_verb_summary=0   # Yes     - No  - No   - No   - No         - No
    declare -ri c_verb_errors=1    # Yes     - Yes - No   - No   - No         - No
    declare -ri c_verb_warnings=2  # Yes     - Yes - Yes  - No   - No         - No
    declare -ri c_verb_notes=3     # Yes     - Yes - Yes  - Yes  - No         - No
    declare -ri c_verb_include=4   # Yes     - Yes - Yes  - Yes  - Yes        - No
    declare -ri c_verb_exclude=5   # Yes     - Yes - Yes  - Yes  - Yes        - Yes
    
    # Message types
    declare -ri c_error=${c_verb_errors}
    declare -ri c_warning=${c_verb_warnings}
    declare -ri c_note=${c_verb_notes}
    declare -ri c_action=${c_verb_include}
    
    # User constants
    declare -r c_author="Steve Haywood"
    declare -r c_website="http://www.spacewire.co.uk"
    declare -r c_project="SpaceWire UK Tutorial"
    declare -r c_date="Sage date!"
    declare -r c_description="Sage words!"
    
    # Known filenames (very in-extensive!)
    declare -ra c_name_hash=(Makefile)
    
    # Known extensions (by no means extensive or 100% correct!)
    declare -ra c_ext_hash=(bb bbappend cgi conf sh tcl xdc)
    declare -ra c_ext_slash=(c h js sv v vh)
    declare -ra c_ext_star=(css dtsi)
    declare -ra c_ext_php=(php)
    declare -ra c_ext_html=(htm html)
    
    # Comment types (by no means extensive!)
    declare -ri c_type_unknown=0
    declare -ri c_type_hash=1
    declare -ri c_type_slash=2
    declare -ri c_type_star=3
    declare -ri c_type_php=4
    declare -ri c_type_html=5
    
    # Opening comments
    declare -rA c_hdr_open=(
      [${c_type_unknown}]="?"
      [${c_type_hash}]="#"
      [${c_type_slash}]="//"
      [${c_type_star}]="/*"
      [${c_type_php}]="<?php"
      [${c_type_html}]="<!--"
    )
    
    # Empty comments
    declare -rA c_hdr_empty=(
      [${c_type_unknown}]="?"
      [${c_type_hash}]="#"
      [${c_type_slash}]="//"
      [${c_type_star}]=" *"
      [${c_type_php}]="//"
      [${c_type_html}]="//"
    )
    
    # Body comments
    declare -rA c_hdr_body=(
      [${c_type_unknown}]="? "
      [${c_type_hash}]="# "
      [${c_type_slash}]="// "
      [${c_type_star}]=" * "
      [${c_type_php}]="// "
      [${c_type_html}]="// "
    )
    
    # Closing comments
    declare -rA c_hdr_close=(
      [${c_type_unknown}]="?"
      [${c_type_hash}]="#"
      [${c_type_slash}]="//"
      [${c_type_star}]=" */"
      [${c_type_php}]="?>"
      [${c_type_html}]="-->"
    )
    
    
    ################################################################################
    # Display formatted message for comments, warnings, errors & notes.
    # Arguments ...... $1 = Level (2 = Error 3 = Warning, 4 = Note)
    #                  $2 = Line number (1..) (0 = Do not display line number)
    #                  $3 = Message text
    # Return ......... None
    # Shared (In) .... errors*, file, filenamedisp*, verbosity, warnings*
    # Shared (Out) ... errors*, filenamedisp*, warnings*
    msg() {
      local -ri level=$1    # Int: Error level
      local -ri lineno=$2   # Int: Line number
      local -r  message=$3  # Str: Error message
      local -rA lookup=(
        [${c_error}]="\e[31mError\e[0m ....."
        [${c_warning}]="\e[36mWarning\e[0m ..."
        [${c_note}]="\e[32mNote\e[0m ......"
        [${c_action}]="\e[93mAction\e[0m ...."
      )
      if [[ ${verbosity} -ge ${level} ]]; then
        if [[ ${filenamedisp} -eq 0 ]]; then
          >&2 echo ${file}
          filenamedisp=1
        fi
        >&2 echo -ne "  ${lookup[${level}]}"
        [[ ${lineno} -gt 0 ]] && >&2 printf " %02d :" ${lineno} || >&2 echo -n "... :"
        >&2 echo " ${message}"
      fi
    
      if [[ ${level} -eq ${c_warning} ]]; then
        warnings=$((warnings+1))
      fi
    
      if [[ ${level} -eq ${c_error} ]]; then
        errors=$((errors+1))
      fi
    }
    
    
    ################################################################################
    # Get the file type based on name and/or extension.
    # Arguments ...... None
    # Return ......... File type
    # Shared (In) .... file
    # Shared (Out) ... None
    getcomtype()
    {
      # Default to unknown type
      local -i type=${c_type_unknown}    # Int: File type
    
      # Standard path/filename split     #      $file ..... path/to/dir/filename.extension
      local fname=$(basename "${file}")  # Str: $fname .... filename.extension
      local fbase="${fname%.*}"          # Str: $fbase .... filename
      local fext="${fname##*.}"          # Str: $fext ..... extension
    
      # Get comment type (name is primary, extension is secondary)
      if [[ " ${c_name_hash[*]} " =~ " ${fname} " ]]; then
        type=${c_type_hash}
      elif [[ " ${c_ext_hash[*]} " =~ " ${fext} " ]]; then
        type=${c_type_hash}
      elif [[ " ${c_ext_slash[*]} " =~ " ${fext} " ]]; then
        type=${c_type_slash}
      elif [[ " ${c_ext_star[*]} " =~ " ${fext} " ]]; then
        type=${c_type_star}
      elif [[ " ${c_ext_php[*]} " =~ " ${fext} " ]]; then
        type=${c_type_php}
      elif [[ " ${c_ext_html[*]} " =~ " ${fext} " ]]; then
        type=${c_type_html}
      fi
    
      echo ${type}
    }
    
    
    ################################################################################
    # Read the comment header block from a source file.
    # Arguments ...... None
    # Return ......... None
    # Shared (In) .... com*, end*, file, header*, lines*, start*, type*, valid*
    # Shared (Out) ... com*, end*, header*, lines*, start*, type*, valid*
    #
    # Note: The single line read used below is the stock way of doing this, where :-
    # 1. IFS= (or IFS='') prevents leading/trailing whitespace from being trimmed.
    # 2. -r prevents backslash escapes from being interpreted.
    # 3. [[ -n ${line} ]] prevents the last line from being ignored if it doesn't end with a \n.
    #
    read_header()
    {
      # Declare local variables
      local line=""     # Str: Line string
      local -i pos=1    # Int: Line position
      local -i stage=0  # Int: Operation stage (0=Pre-header, 1=Header)
    
      # Initialise shared variables
      type=0            # Int: File type (0=Unknown, 1=Script)
      com=""            # Str: Comment style
      valid=0           # Int: Found a valid header (0:No, 1:Yes)
      start=0           # Int: Start position of header
      end=0             # Int: End position of header
      header=""         # Str: Captured header block (string)
      lines=()          # Arr: Captured header block (array)
    
      # Iterate through lines of file
      while IFS= read -r  line || [[ -n "${line}" ]] && [[ ${pos} -lt 100 ]]; do
        if [[ (${pos} -eq 1) && (${line:0:2} == "#!") ]]; then
          type=1
        elif [[ "${line}" =~ ^[[:space:]]*$ ]]; then
          [[ ${stage} -eq 1 ]] && break  # End of header
        else
          [[ ${stage} -eq 0 ]] &&
            start=${pos}
          end=${pos}
          stage=1
          if [[ "${line}" =~ ^.*[Ff][Ii][Ll][Ee]\ \.{3,}\ .+$ ]]; then
            valid=1
            com=$(echo "${line}" | sed -n 's/^\(.*\)[Ff][Ii][Ll][Ee] \.\{3,\} .\+/\1/p')
          fi
          header+="${line}${c_newline}"
          lines+=("${line}")
        fi
        pos=$((pos+1))
      done < "${file}"
    
      # Clean up positions
      if [[ ${valid} -eq 0 ]]; then
        end=0
        if [[ ${type} -eq 0 ]]; then
          start=0
        else
          start=2
        fi
      fi
    }
    
    
    ################################################################################
    # Parse header block into an associative array.
    # Arguments ...... None
    # Return ......... None
    # Shared (In) .... default*, keys*, lines, type
    # Shared (Out) ... default*, keys*
    parse_header()
    {
      # Declare local variables
      local     textblock=""          # Str: Block of text (description, history)
      local -ir linecnt=${#lines[@]}  # Int: Header line count
      local -i  linenum               # Int: Header line number
      local     line                  # Str: Header line string
      local -i  sling                 # Int: Sling trailing description line (0=keep, 1=sling)
      local     parts                 # Str: Field parts string (2 or 3 parts, | separated)
    
      IFS=''
      for (( linenum=0; linenum<${linecnt}; linenum++ )); do
        line=${lines[linenum]}
        line="${line%"${line##*[![:space:]]}"}"  # Trim trailing whitespace
        local -a fields=()  # Header fields array
    
        if [[ ${textblock} != "" ]]; then
          sling=0
          case ${linenum} in
            $((linecnt-3)))
              if [[ ${type} == ${c_type_php} && ${line} == " *" ]]; then
                sling=1  # Sling pre-pre-closing ' *' for PHP headers
              fi
            ;;
            $((linecnt-2)))
              if [[ (${type} == ${c_type_php}) && (${line} == "//" || ${line} == "*/" || ${line} == " */") ]]; then
                sling=1  # Sling pre-closing '//', '*/' & ' */' for PHP headers
              fi
            ;;
            $((linecnt-1)))
              if [[ ${type} == ${c_type_star} || ${type} == ${c_type_php} || ${type} == ${c_type_html} ]]; then
                sling=1  # Sling closing ' */', '?>' & '-->' for CSS, PHP & HTML headers
              fi
            ;;
          esac
    
          if [[ ${sling} -eq 0 ]]; then
            default[${fid}]+="${line}|"
          fi
        fi
    
        # Obtain the 3 part variant of the field (name dots value) in the header block
        parts=$(echo "${line}" | sed -n 's/^.*\([A-Z][a-z]\{3,11\}\) \(\.\{3,11\}\) \(.*\)/\1|\2|\3/p')
        # Split the field parts into an array
        IFS='|' read -ra fields <<< "${parts}"
        if [[ ${#fields[@]} -eq 3 ]]; then
          # Extra check
          local tmp="${fields[0]}${fields[1]}"
          if [[ ${#tmp} -eq 14 ]]; then
            local fid=${fields[0],,}  # Lower case fid
            #local fdots=${fields[1]}
            local fvalue=${fields[2]}
            default[${fid}]=${fvalue}
            keys+=("${fid}")  # Add discovered field (name) to the keys list
            [[ ${textblock} != "" ]] && textblock=""
          fi
        fi
    
        # Obtain the 2 part variant of the field (name dots) in the header block
        parts=$(echo "${line}" | sed -n 's/^.*\([A-Z][a-z]\{3,11\}\) \(\.\{3,11\}\)$/\1|\2/p')
        # Split the field parts into an array
        IFS='|' read -ra fields <<< "${parts}"
        # Determine if field is known
        if [[ ${#fields[@]} -eq 2 ]]; then
          # Extra check
          local tmp="${fields[0]}${fields[1]}"
          if [[ ${#tmp} -eq 14 ]]; then
            local fid=${fields[0],,}  # Lower case fid
            #local fdots=${fields[1]}
            default[${fid}]=""
            keys+=("${fid}")  # Add discovered field (name) to the keys list
            [[ ${textblock} != "" ]] && textblock="" || textblock=${fid}
          fi
        fi
    
      done
      unset IFS
    }
    
    
    ################################################################################
    # Write the 'ed' commands required to strip out the source file headers and
    # replace them with new ones.
    # Arguments ...... None
    # Return ......... None
    # Shared (In) .... addheader, addminor, addproject, addwebsite, com, end, file,
    #                  fixfilename, formatdate, gitversion, hdr_body, hdr_close,
    #                  hdr_empty, hdr_open, lines, projdir, remstandard,
    #                  renconception, reorganise, rewrite, start, type, valid
    # Shared (Out) ... default*, keys*, lines, type
    rewrite_write()
    {
      # Declare local variables
      [[ ${type} == ${c_type_html} || ${type} == ${c_type_php} ]] &&
        local post_open="${c_newline}${hdr_empty}" || local post_open=""
    
      [[ ${type} == ${c_type_html} || ${type} == ${c_type_php} ]] &&
        local pre_close="${hdr_empty}${c_newline}" || local pre_close=""
    
      # Declare shared variables
      local -a keys=()    # Arr : List of fields discovered in header
      local -A default=(  # ARR: Default header
        [file]=""
        [author]=""
        [website]=""
        [project]=""
        [conception]=""
        [date]=""
        [version]=""
        [history]=""
        [description]=""
      )
    
      # Obtain filename from full path
      local -r filename=$(basename "${file}")
    
      # Obtain major version based on log entry count
      local -ir major=$(git log --oneline ${file} | wc -l)
    
      # Add minor version (fixed at .0)
      local minor=""
      [[ ${addminor} -eq 1 ]] && local minor=".0"
    
      local -Ar projects=(  # ARR: Project names
        ["common"]="Common"
        ["zedboard_hello_world"]="Zedboard Hello World"
        ["zedboard_leds_buttons"]="Zedboard LEDs & Buttons"
        ["zedboard_leds_switches"]="Zedboard LEDs & Switches"
        ["zedboard_linux"]="Zedboard Linux"
      )
    
      # Obtain project
      local proj=$(echo ${file} | cut -d'/' -f1)
    
      if [[ ${valid} -eq 1 ]]; then  # Header detected, process it
    
        # Parse header block into associated array & keys list
        parse_header
    
        # Iterate though all the fields in the default header & apply the options requested
        for key in ${!default[@]}
        do
          local fieldvalue=${default[${key}]}
          case ${key} in
    
            "file")  ## 'mandatory'
              # Check for difference between field value vs. expected field value
              if [[ (${fixfilename} -eq 1) && (${filename} != ${fieldvalue}) ]]; then
                # Throw a warning to signal file modification
                msg c_warning 0 "Changing value of '${key^}' field from '${default[${key}]}' to '${filename}'."
                # Override 'File' field value
                default[${key}]=${filename}
              fi
            ;;
    
            "date")
              # Check for a field value
              if [[ ${default[${key}]} != "" ]]; then
                # Evaluate 'Date' value using the date command
                local date=$(date -d "${fieldvalue}" +'%d %b %Y' 2>/dev/null)
                # Check for field viability
                if [[ ${date} != "" ]]; then
                  # Check for difference between field value vs. expected field value
                  if [[ (${formatdate} -eq 1) && (${date} != ${fieldvalue}) ]]; then
                    # Throw a warning to signal file modification
                    msg c_warning 0 "'${key^}' field is incorrectly formatted, found '${default[${key}]}', changing to '${date}'."
                    # Override 'Date' field value
                    default[${key}]=${date}
                  else
                    # No big deal, throw note
                    msg c_note 0 "'${key^}' field is correctly formatted, found '${default[${key}]}'."
                  fi
                else
                  # Unrecognizable date, throw error
                  msg c_error 0 "'${key^}' field is invalid, expecting a valid date, found '${default[${key}]}'."
                fi
              fi
            ;;
    
            "conception")
              # Check for a field value
              if [[ (${renconception} -eq 1) && (${default[${key}]} != "") ]]; then
                # Evaluate 'Date' value using the date command
                local date=$(date -d "${fieldvalue}" +'%d %b %Y' 2>/dev/null)
                # Check for field viability
                if [[ ${date} != "" ]]; then
                  # Check for difference between field value vs. expected field value
                  if [[ (${formatdate} -eq 1) && (${date} != ${fieldvalue}) ]]; then
                    # Throw a warning to signal file modification
                    msg c_warning 0 "'${key^}' field detected, renaming it to 'Date', field is incorrectly formatted, found '${default[${key}]}', changing to '${date}'."
                    # Override 'Date' value with 'Conception' value
                    default[date]=${date}
                  else
                    # Throw a warning to signal file modification
                    msg c_warning 0 "'${key^}' field detected, renaming to 'Date', field is correctly formatted, found '${default[${key}]}'."
                    default[date]=${date}
                  fi
                else
                  # Unrecognizable date, throw error
                  msg c_error 0 "'${key^}' field detected, renaming to 'Date', field is invalid, expecting a valid date, found '${default[${key}]}'."
                  default[date]=${default[${key}]}
                fi
                # Override field value with default
                default[${key}]=""
              fi
            ;;
    
            "version")
              # Obtain major version based on log entry count
              local versexp="${major}"
              # Check for difference between field value vs. expected field value
              if [[ (${gitversion} -eq 1) && (${versexp} != ${fieldvalue}) ]]; then
                # Throw a warning to signal file modification
                msg c_warning 0 "'${key^}' field incorrect, found '${default[${key}]}', changing to '${versexp}'."
                # Override field value with expected
                default[${key}]="${versexp}${minor}"
              else
                # No big deal, throw note
                msg c_note 0 "'${key^}' field is correct, found '${default[${key}]}'."
              fi
            ;;
    
            "standard")
              # Check for a field value
              if [[ (${remstandard} -eq 1) && (${default[${key}]} != "") ]]; then
                # Throw a warning to signal modification
                msg c_warning 0 "'${key^}' field detected, removing '${c_website}'."
                # Override field value with default
                default[${key}]=""
              fi
            ;;
    
            "website")
              # Check for a field value
              if [[ (${addwebsite} -eq 1) && (${default[${key}]} == "") ]]; then
                # Throw a warning to signal modification
                msg c_warning 0 "'${key^}' field missing, inserting '${c_website}'."
                # Override field value with default
                default[${key}]=${c_website}
              fi
            ;;
    
            "project")
              # Check for a field value
              if [[ (${addproject} -eq 1) && (${default[${key}]} == "") ]]; then
                # Throw a warning to signal modification
                msg c_warning 0 "'${key^}' field missing, inserting '${c_project}'."
                # Override field value with default
                default[${key}]="${projects[${proj}]} (${c_project})"
              elif [[ (${addproject} -eq 1) && (${default[${key}]} == "${c_project}") ]]; then
                # Throw a warning to signal modification
                msg c_warning 0 "'${key^}' field incomplete, adding '${projects[${proj}]}'."
                # Override field value with default
                default[${key}]="${projects[${proj}]} (${c_project})"
              fi
            ;;
    
            "author"|"history"|"version"|"description")
              :  # Ignore known!
            ;;
    
            *)
              msg c_error 0 "'${key^}' field is unknown, its value is '${default[${key}]}', ignoring."
            ;;
    
          esac
        done
    
        #################################
        # Output the final header block #
        #################################
    
        echo -e "\ned ${projdir}/${file} <<END" >> ../${rewrite}
        echo "${start},${end}d" >> ../${rewrite}
        echo "." >> ../${rewrite}
        echo "$((start-1))a" >> ../${rewrite}
    
        local text=""  # Str: Text from texts array
        local key      # Str: Key from keys array
    
        # Put the 'mandatory' fields in the 'correct' display order
        [[ ${reorganise} -eq 1 ]] &&
          keys=(file author website project date version history description)
        # Opening comment
        echo "${hdr_open}${post_open}" >> ../${rewrite}
        # Iterate though all the 'mandatory' fields
        for key in ${keys[@]}; do
          local dots=$(printf '.%.0s' {1..28} | head -c $((14-${#key})))
    
          case ${key} in
    
            "description")
              echo "${hdr_body}${key^} ${dots}" >> ../${rewrite}
              # Split the 'whole string' text block back into separate 'lines'
              IFS='|' read -ra texts <<< "${default[${key}]}"
              # Get the comment marker of the very first line
              local -l lcom=${#com}
              # Display separate lines with their comment markers exchanged
              for text in "${texts[@]}"; do
                local ttmp="${text:lcom}"
                if [[ ${#ttmp} -eq 0 ]]; then
                  echo "${hdr_empty}" >> ../${rewrite}
                else
                  echo "${hdr_empty} ${text:lcom}" >> ../${rewrite}
                fi
              done
            ;;
    
            *)
              if [[ -n ${default[${key}]} ]]; then
                echo "${hdr_body}${key^} ${dots} ${default[${key}]}" >> ../${rewrite}
              fi
            ;;
          esac
        done
    
        # Closing comment (adjust according to last comment marker of description)
        if [[ "${text}" != "${pre_close}${hdr_close}" ]]; then
          echo "${pre_close}${hdr_close}" >> ../${rewrite}
        fi
    
        echo "." >> ../${rewrite}
        echo "wq" >> ../${rewrite}
        echo "END" >> ../${rewrite}
    
      else  # No header detected, add a new one
    
        if [[ ${addheader} -eq 1 ]]; then  # '--add' option, output 'ed' commands to add a new header
    
          # Throw as a warning due to file modification
          msg c_warning 0 "No identifiable header comment block found, inserting a new header @ line $((start+1))."
    
    cat << EOF >> ../${rewrite}
    
    ed ${projdir}/${file} <<END
    ${start}a
    ${hdr_open}${post_open}
    ${hdr_body}File .......... ${filename}
    ${hdr_body}Author ........ ${c_author}
    ${hdr_body}Website ....... ${c_website}
    ${hdr_body}Project ....... ${projects[${proj}]} (${c_project})
    ${hdr_body}Date .......... ${c_date}
    ${hdr_body}Version ....... ${major}${minor}
    ${hdr_body}Description ...
    ${hdr_body}  ${c_description}
    ${pre_close}${hdr_close}
    
    .
    wq
    END
    EOF
    
        else  # No '--add' option, output commented out 'ed' commands to add a new header
    
    cat << EOF >> ../${rewrite}
    
    #ed ${projdir}/${file} <<END
    #${start}a
    #Sage header!
    #.
    #wq
    #END
    EOF
        fi
      fi
    }
    
    
    ################################################################################
    # Write the 'ed' commands required to strip out the source file headers and
    # replace them with new ones (in this case the existing ones).
    # Arguments ...... None
    # Return ......... None
    # Shared (In) .... end, file, lines, projdir, start, template, valid
    # Shared (Out) ... None
    template_write()
    {
      # Take appropriate action depending on header presence
      if [[ ${valid} -eq 1 ]]; then
        # Write commands to replace original header with itself
        echo -e "\ned ${projdir}/${file} <<END" >> ../${template}
        echo "${start},${end}d"                 >> ../${template}
        echo "."                                >> ../${template}
        echo "$((start-1))a"                    >> ../${template}
        printf '%s\n' "${lines[@]}"             >> ../${template}
        echo -e "."                             >> ../${template}
        echo "wq"                               >> ../${template}
        echo "END"                              >> ../${template}
      else
        # Write commented out insert header stub
    cat << EOF >> ../${template}
    
    #ed ${projdir}/${file} <<END
    #${start}a
    #Sage header!
    #.
    #wq
    #END
    EOF
      fi
    }
    
    
    ################################################################################
    # Process single project directory & produce 'ed' scripts.
    # Arguments ...... None
    # Return ......... None
    # Shared (In) .... addheader, addminor, addproject, addwebsite, argv,
    #                  considered*, examined*, exclude, fixfilename, formatdate,
    #                  gitversion, optwhitespace, projdir, remstandard,
    #                  renconception, reorganise, rewrite, template, verbosity
    # Shared (Out) ... addheader, addminor, addproject, addwebsite, argv, com*,
    #                  considered*, end*, examined*, file, fixfilename, formatdate,
    #                  gitversion, hdr_body, hdr_close, hdr_empty, hdr_open,
    #                  header*, lines*, projdir, remstandard, renconception,
    #                  reorganise, rewrite, start*, template, type*, valid*
    process_project()
    {
      # Declare local variables
      local -a files=()        # Arr: List of repository files (array)
      local file               # Str: File name
      local -i filenamedisp=0  # Int: Filename displayed flag (0=no, 1=yes)
    
      # Declare local (shared) variables
      local -i type=0          # Int: File type (0=Unknown, 1=Script)
      local com=""             # Str: Comment style
      local -i valid=0         # Int: Found a valid header (0:No, 1:Yes)
      local -i start=0         # Int: Start position of header
      local -i end=0           # Int: End position of header
      local header=""          # Str: Captured header block (string)
      local lines=()           # Arr: Captured header block (array)
    
        # Write template
        echo -e "\n#### ${projdir} ######################################################################" >> ../${template}
        echo -e "\n#### ${projdir} ######################################################################" >> ../${rewrite}
    
        # Get repository file list
        readarray -t files < <(git ls-files)
    
        # Iterate though all the repository files
        for file in "${files[@]}"; do
    
          # Set header for changes (filename) to not yet displayed
          filenamedisp=0
    
          # Exclude files that are not created or edited source
          if [[ ! " ${exclude[*]} " =~ " ${file} " ]]; then
    
            # Remove trailing whitespace (in place)
            if [[ ! -L ${file} ]]; then
              if (($(option_set ${optwhitespace}))); then
                dos2unix ${file}
                sed -i 's/[[:blank:]]*$//' ${file}
              fi
            fi
    
            # Display action for inclusive file
            if [[ ${verbosity} -ge ${c_verb_include} ]]; then
              msg c_action 0 "Processing"
            fi
    
            # Read comment header block into an array
            read_header
    
            # Determine file type from filename
            [[ ${type} -eq ${c_type_unknown} ]] &&
              type=$(getcomtype)
    
            # Check for known file type
            if [[ ${type} -ne ${c_type_unknown} ]]; then
    
              # Check the source file exists
              if [[ -L ${file} ]]; then
                msg c_note 0 "Source file is a link, skipping."
              elif [[ -f ${file} ]]; then
                # Obtain comment construction parts
                local hdr_open=${c_hdr_open[${type}]}
                local hdr_empty=${c_hdr_empty[${type}]}
                local hdr_body=${c_hdr_body[${type}]}
                local hdr_close=${c_hdr_close[${type}]}
    
                template_write
                rewrite_write
              else
                msg c_error 0 "Source file not found, skipping."
              fi
            else
              msg c_error 0 "Source file type is unknown, skipping."
            fi
            # Increase examined files count
            examined=$((examined+1))
          else
            # Display action for exclusive file
            [[ ${verbosity} -ge ${c_verb_exclude} ]] &&
              msg c_action 0 "Skipping"
          fi
          # Increase considered files count
          considered=$((considered+1))
        done
    }
    
    
    ################################################################################
    # Process project directories & produce 'ed' scripts.
    # Arguments ...... None
    # Return ......... None
    # Shared (In) .... addheader, addminor, addproject, addwebsite, argv,
    #                  considered*, examined*, exclude, fixfilename, formatdate,
    #                  gitversion, optwhitespace, projdirs, remstandard,
    #                  renconception, reorganise, rewrite, template, verbosity
    # Shared (Out) ... addheader, addminor, addproject, addwebsite, argv,
    #                  considered*, examined*, exclude, fixfilename, formatdate,
    #                  gitversion, optwhitespace, projdir, remstandard,
    #                  renconception, reorganise, rewrite, template, verbosity
    process_projects()
    {
      local projdir  # Str: Current subdirectory name
    
      # Iterate through subdirectories
      for projdir in ${projdirs[@]}
      do
        # Move into subdirectory
        cd ${projdir}
    
        echo -e "\nProcessing ... ${projdir}\n"
    
        # Process subdirectory
        process_project
    
        # Move out of subdirectory
        cd ..
      done
    }
    
    
    ################################################################################
    # Check if an argument option is set.
    # Arguments ...... $1 ... Str: Option
    # Return ......... Set (0=unset, 1=set)
    # Shared (In) .... argv
    # Shared (Out) ... None
    option_set()
    {
      [[ " ${argv[*]} " =~ " ${1} " ]] && echo 1 || echo 0
    }
    
    
    ################################################################################
    # Main function
    # Arguments ...... None
    # Return ......... None
    # Exit code ...... Status (0=success, 1=failure)
    # Shared (In) .... argv
    # Shared (Out) ... addheader, addminor, addproject, addwebsite, argv,
    #                  considered*, examined*, exclude, fixfilename, formatdate,
    #                  gitversion, optwhitespace, projdirs, remstandard,
    #                  renconception, reorganise, rewrite, template, verbosity
    main()
    {
      # Declare local constants
      local -r  optadd="--add"                # Str: Add option name
      local -r  optfilename="--filename"      # Str: Filename option name
      local -r  optwebsite="--website"        # Str: Website option name
      local -r  optproject="--project"        # Str: Project option name
      local -r  optfmtdate="--fmtdate"        # Str: Format Date option name
      local -r  optconception="--conception"  # Str: Conception option name
      local -r  optversion="--version"        # Str: Version option name
      local -r  optminor="--minor"            # Str: Minor option name
      local -r  optstandard="--standard"      # Str: Standard option name
      local -r  optreorg="--reorg"            # Str: Reorganise option name
      local -r  optall="--all"                # Str: All option name
      local -r  optwhitespace="--whitespace"  # Str: Whitespace option name
      local -r  opthelp="--help"              # Str: Help option name
      local -Ar options=(                     # ARR: Options & associated help information
        [${optadd}]="Add missing header block and populated it with default fields."
        [${optfilename}]="Correct 'File' field if incorrect."
        [${optwebsite}]="Add 'Website' field if missing."
        [${optproject}]="Add 'Project' field if missing."
        [${optfmtdate}]="Reformat 'Date' field to DD Mmm YYYY."
        [${optconception}]="Rename 'Conception' field to 'Date' & reformat it to DD Mmm YYYY."
        [${optversion}]="Update the 'Version' field to pair with the GIT commit count."
        [${optminor}]="Add minor part (x.0) to the version string."
        [${optstandard}]="Remove 'Standard' field if present."
        [${optreorg}]="Reorganise header into desired field order."
        [${optall}]="Action all above options, except ${optminor}."
        [${optwhitespace}]="Remove all trailing whitespace in file (done directly not via the 'ed' scripts)."
        [${opthelp}]="Display this help and exit."
      )
      local -ar optorder=(                    # Arr: Help options display order
        ${optadd}
        ${optfilename}
        ${optwebsite}
        ${optproject}
        ${optfmtdate}
        ${optconception}
        ${optversion}
        ${optminor}
        ${optstandard}
        ${optreorg}
        ${optall}
        ${optwhitespace}
        ${opthelp}
      )
    
      # Declare local variables
      local    arg                            # Str: Current argument from argv array
      local    project=""                     # Str: Project directory [arg] (mandatory)
      local    exfile=""                      # Str: Exclude file [arg] (mandatory)
      local -i verbosity=10                   # Int: Verbosity level [arg] (optional)
    
      local -i addheader=0
      local -i fixfilename=0
      local -i addwebsite=0
      local -i addproject=0
      local -i formatdate=0
      local -i renconception=0
      local -i gitversion=0
      local -i addminor=0
      local -i remstandard=0
      local -i reorganise=0
    
      local    option                         # Str: Current option from optorder array
    
      # Display help information
      if (($(option_set ${opthelp}))); then
        echo "Usage: $(basename $0) PROJECT-DIRECTORY... EXCLUDE-FILE... [VERBOSITY]... [OPTION]..."
        echo "Generate 'ed' scripts for adding & correcting source file headers in the PROJECT-DIRECTORY."
        echo
        echo "Mandatory arguments to long options are mandatory for short options too."
        for option in ${optorder[@]}
        do
          echo "      ${option} $(printf ' %.0s' {1..12} | head -c $((12-${#option}))) ${options[${option}]}"
        done
        echo
        echo "The VERBOSITY argument:"
        echo " 0  Summary"
        echo " 1  Summary + Errors"
        echo " 2  Summary + Errors + Warnings"
        echo " 3  Summary + Errors + Warnings + Notes"
        echo " 4  Summary + Errors + Warnings + Notes + Include"
        echo " 5  Summary + Errors + Warnings + Notes + Include + Exclude"
        exit 0
      fi
    
      # Get & check the arguments
      for arg in ${argv[@]}; do
        if [[ ${arg:0:2} == "--" ]]; then  # Option
          [[ ! -v options[${arg}] ]] && echo "Option (${arg}) is not recognised!" && exit 1
    
          case ${arg} in
            "--add")        addheader=1 ;;
            "--filename")   fixfilename=1 ;;
            "--website")    addwebsite=1 ;;
            "--project")    addproject=1 ;;
            "--fmtdate")    formatdate=1 ;;
            "--conception") renconception=1 ;;
            "--version")    gitversion=1 ;;
            "--minor")      addminor=1 ;;
            "--standard")   remstandard=1 ;;
            "--reorg")      reorganise=1 ;;
            "--all")
              addheader=1
              fixfilename=1
              addwebsite=1
              addproject=1
              formatdate=1
              renconception=1
              gitversion=1
             #addminor=1
              remstandard=1
              reorganise=1
            ;;
          esac
    
        elif [[ -z ${project} ]]; then  # Project directory
          project=${arg}
          [[ ! -d ${project} ]] && echo "Project directory (${arg}) does not exist!" && exit 1
        elif [[ -z ${exfile} ]]; then  # Exclude file
          exfile=${arg}
          [[ ! -f ${exfile} ]] && echo "Exclude file (${arg}) does not exist!" && exit 1
        elif [[ ${verbosity} -eq 10 ]]; then  # Verbosity level
          verbosity=${arg}
        else
          echo "Unexpected argument (${arg}) found!" && exit 1
        fi
      done
    
      # Further check the arguments
      [[ -z ${project} ]] && echo "No project directory specified!" && exit 1
      [[ -z ${exfile} ]] && echo "No exclude file specified!" && exit 1
    
      local template="do_proof"
      local rewrite="do_fixes"
    
      # Get all subdirectories into an ordered array
      local -a projdirs=()  # List of project subdirectories (array, alphanumeric order)
      readarray -t projdirs < <(find ${project} -mindepth 1 -maxdepth 1 -type d | sort | cut -d'/' -f2-)
      [[ ${#projdirs[@]} -eq 0 ]] && echo "Project Directory specified (${argv[0]}) does not contain any subdirectories!" && exit 1
    
      # Get excluded file list
      local -a exclude=()  # List of excluded files (array)
      readarray -t exclude < ${argv[1]}
    
      # Variables
      local -i considered=0  # Number of files considered
      local -i examined=0    # Number of files examined
      local -i errors=0      # Number of errors encountered
      local -i warnings=0    # Number of warnings encountered
    
      # Move into project directory
      cd ${project}
    
      # Kick off template & rewrite scripts
      echo "#!/bin/bash" > ${template}
      echo "#!/bin/bash" > ${rewrite}
      chmod +x ${template} ${rewrite}
    
      # Perform the operations
      process_projects
    
      # Move out of project directory
      cd ..
    
      [[ ${verbosity} -ge ${c_verb_summary} ]] &&
        echo -e "\nConsidered ${considered} files, skipped $((considered-examined)), examined ${examined}, detected ${errors} errors and ${warnings} warnings."
    }
    
    
    ################################################################################
    # Opening gambit.
    # Arguments ...... None
    # Return ......... None
    # Exit code ...... Status (0=success, 1=failure)
    # Shared (In) .... $#, $@
    # Shared (Out) ... argc, argv
    declare -ri argc=${#}    # Int: Get argument count
    declare -ra argv=(${@})  # Arr: Get argument values (space-separated) into array
    main
    exit 0
    
    steve@Desktop:/tmp/scratch$ swuk_repos_gen_fix_headers --help
    Usage: swuk_repos_gen_fix_headers PROJECT-DIRECTORY... EXCLUDE-FILE... [VERBOSITY]... [OPTION]...
    Generate 'ed' scripts for adding & correcting source file headers in the PROJECT-DIRECTORY.
    
          --add         Add missing header block and populated it with default fields.
          --filename    Correct 'File' field if incorrect.
          --website     Add 'Website' field if missing.
          --project     Add 'Project' field if missing.
          --fmtdate     Reformat 'Date' field to DD Mmm YYYY.
          --conception  Rename 'Conception' field to 'Date' & reformat it to DD Mmm YYYY.
          --version     Update the 'Version' field to pair with the GIT commit count.
          --minor       Add minor part (x.0) to the version string.
          --standard    Remove 'Standard' field if present.
          --reorg       Reorganise header into desired field order.
          --all         Action all above options, except --minor.
          --whitespace  Remove all trailing whitespace in file (done directly not via the 'ed' scripts)
          --help        Display this help and exit.
    
    The VERBOSITY argument:
     0  Summary
     1  Summary + Errors
     2  Summary + Errors + Warnings
     3  Summary + Errors + Warnings + Notes
     4  Summary + Errors + Warnings + Notes + Include
     5  Summary + Errors + Warnings + Notes + Include + Exclude
    
    Create a split project in /tmp that includes the .git directory in each of the commit subdirectories.
    steve@Desktop:/tmp/scratch$ swuk_repos_split git@192.168.2.20:tmp_repo local_split_git --keepgit
    
    Replace all the duplicate files in the split project subdirectories with symbolic links.
    steve@Desktop:/tmp/scratch$ swuk_repos_history local_split_git --link
    
    Execute the generate fix headers script using the pre-existing ignore file & set the verbosity level to 1 (errors).
    steve@Desktop:/tmp/scratch$ swuk_repos_gen_fix_headers local_split_git ${swuk_user}/general/v14_fileset_ignore.txt 1
    
    The result (parts of interest from the last subdirectory scan)...
    zedboard_leds_switches/.gitignore
      Error ........ :  Error Source file type is unknown, skipping.
    zedboard_leds_switches/fw/project.txt
      Error ........ : Source file type is unknown, skipping.
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/project.txt
      Error ........ : Source file type is unknown, skipping.
    zedboard_linux/os/src/other/zedboard_leds_switches.txt
      Error ........ : Source file type is unknown, skipping.
    
    There are a couple of extra files that a are best ignored at this stage. Create a specific header ignore file based on the previous ignore file to include the .gitignore, project identification and Zedboard configuration files.
    steve@Desktop:/tmp/scratch$ cp ${swuk_user}/general/v14_fileset_ignore.txt ${swuk_user}/general/v14_fileset_ignore_hdr.txt
    
    Edit the file :-
    steve@Desktop:/tmp/scratch$ subl ${swuk_user}/general/v14_fileset_ignore_hdr.txt
    

    v14_fileset_ignore_hdr.txt

    common/fw/src/constraint/zedboard_master_XDC_RevC_D_v3.xdc
    
    
    
    
    
    
    
    
    
    zedboard_hello_world/fw/src/diagram/system/system.bd
    zedboard_hello_world/fw/system_wrapper.xsa
    
    
    zedboard_leds_buttons/fw/src/diagram/system/system.bd
    
    zedboard_leds_buttons/fw/system_wrapper.xsa
    
    zedboard_leds_switches/fw/project.txt
    
    
    
    
    
    
    zedboard_leds_switches/fw/src/diagram/system/system.bd
    zedboard_leds_switches/fw/src/ip_repo/register_bank_1.0/bd/bd.tcl
    zedboard_leds_switches/fw/src/ip_repo/register_bank_1.0/component.xml
    zedboard_leds_switches/fw/src/ip_repo/register_bank_1.0/drivers/register_bank_v1_0/data/register_bank.mdd
    zedboard_leds_switches/fw/src/ip_repo/register_bank_1.0/drivers/register_bank_v1_0/data/register_bank.tcl
    zedboard_leds_switches/fw/src/ip_repo/register_bank_1.0/drivers/register_bank_v1_0/src/Makefile
    zedboard_leds_switches/fw/src/ip_repo/register_bank_1.0/drivers/register_bank_v1_0/src/register_bank.c
    zedboard_leds_switches/fw/src/ip_repo/register_bank_1.0/drivers/register_bank_v1_0/src/register_bank.h
    zedboard_leds_switches/fw/src/ip_repo/register_bank_1.0/drivers/register_bank_v1_0/src/register_bank_selftest.c
    zedboard_leds_switches/fw/src/ip_repo/register_bank_1.0/example_designs/bfm_design/design.tcl
    zedboard_leds_switches/fw/src/ip_repo/register_bank_1.0/example_designs/bfm_design/register_bank_v1_0_tb.sv
    zedboard_leds_switches/fw/src/ip_repo/register_bank_1.0/example_designs/debug_hw_design/design.tcl
    zedboard_leds_switches/fw/src/ip_repo/register_bank_1.0/example_designs/debug_hw_design/register_bank_v1_0_hw_test.tcl
    zedboard_leds_switches/fw/src/ip_repo/register_bank_1.0/hdl/register_bank_v1_0_S00_AXI.v
    zedboard_leds_switches/fw/src/ip_repo/register_bank_1.0/hdl/register_bank_v1_0.v
    zedboard_leds_switches/fw/src/ip_repo/register_bank_1.0/xgui/register_bank_v1_0.tcl
    
    
    
    zedboard_leds_switches/fw/system_wrapper.xsa
    zedboard_leds_switches/.gitignore
    
    
    zedboard_linux/os/petalinux/config.project
    zedboard_linux/os/petalinux/.gitignore
    zedboard_linux/os/petalinux/.petalinux/metadata
    zedboard_linux/os/petalinux/project-spec/attributes
    zedboard_linux/os/petalinux/project-spec/configs/busybox/inetd.conf
    zedboard_linux/os/petalinux/project-spec/configs/config
    zedboard_linux/os/petalinux/project-spec/configs/init-ifupdown/interfaces
    zedboard_linux/os/petalinux/project-spec/configs/rootfs_config
    zedboard_linux/os/petalinux/project-spec/hw-description/drivers/register_bank_v1_0/data/register_bank.mdd
    zedboard_linux/os/petalinux/project-spec/hw-description/drivers/register_bank_v1_0/data/register_bank.tcl
    zedboard_linux/os/petalinux/project-spec/hw-description/drivers/register_bank_v1_0/src/Makefile
    zedboard_linux/os/petalinux/project-spec/hw-description/drivers/register_bank_v1_0/src/register_bank.c
    zedboard_linux/os/petalinux/project-spec/hw-description/drivers/register_bank_v1_0/src/register_bank.h
    zedboard_linux/os/petalinux/project-spec/hw-description/drivers/register_bank_v1_0/src/register_bank_selftest.c
    zedboard_linux/os/petalinux/project-spec/hw-description/metadata
    zedboard_linux/os/petalinux/project-spec/hw-description/ps7_init.c
    zedboard_linux/os/petalinux/project-spec/hw-description/ps7_init_gpl.c
    zedboard_linux/os/petalinux/project-spec/hw-description/ps7_init_gpl.h
    zedboard_linux/os/petalinux/project-spec/hw-description/ps7_init.h
    zedboard_linux/os/petalinux/project-spec/hw-description/ps7_init.html
    zedboard_linux/os/petalinux/project-spec/hw-description/ps7_init.tcl
    zedboard_linux/os/petalinux/project-spec/hw-description/system_wrapper.bit
    zedboard_linux/os/petalinux/project-spec/hw-description/system.xsa
    zedboard_linux/os/petalinux/project-spec/meta-user/conf/layer.conf
    
    zedboard_linux/os/petalinux/project-spec/meta-user/conf/user-rootfsconfig
    zedboard_linux/os/petalinux/project-spec/meta-user/COPYING.MIT
    zedboard_linux/os/petalinux/project-spec/meta-user/README
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/axi-gpio-zed-test/axi-gpio-zed-test.bb
    
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/axi-gpio-zed-test/files/Makefile
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/axi-gpio-zed-test/.gdbinit
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/axi-gpio-zed-test/README
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/gpio-demo/files/gpio-demo.c
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/gpio-demo/files/Makefile
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/gpio-demo/gpio-demo.bb
    
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/led-runner/.gdbinit
    
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/led-runner/README
    
    
    
    
    
    
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/peekpokecgi/.gdbinit
    
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/peekpokecgi/README
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/peekpoke/files/Makefile
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/peekpoke/files/peek.c
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/peekpoke/files/poke.c
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/peekpoke/peekpoke.bb
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/amber.gif
    
    
    
    
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/cgi-bin/phpliteadmin.php
    
    
    
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/green.gif
    
    
    
    
    
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/project.txt
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/red.gif
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/share/amber.gif
    
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/share/green.gif
    
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/share/red.gif
    
    
    
    
    
    
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/zedboard/btn_none.png
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/zedboard/btn_off.png
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/zedboard/btn_on.png
    
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/zedboard/led_off.png
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/zedboard/led_on.png
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/zedboard.png
    
    
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/zedboard/sw_none.png
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/zedboard/sw_off.png
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/zedboard/sw_on.png
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/zedboard/zedboard.png
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/.gdbinit
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/README
    
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-bsp/device-tree/device-tree.bbappend
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-bsp/device-tree/files/pl-custom.dtsi
    
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-bsp/uboot-device-tree/files/system-user.dtsi
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-bsp/uboot-device-tree/uboot-device-tree.bbappend
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-bsp/u-boot/files/bsp.cfg
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-bsp/u-boot/files/platform-top.h
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-bsp/u-boot/u-boot-xlnx_%.bbappend
    
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-kernel/linux/linux-xlnx_%.bbappend
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-kernel/linux/linux-xlnx/bsp.cfg
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-kernel/linux/linux-xlnx/user_2023-08-08-08-28-00.cfg
    zedboard_linux/os/src/other/axi_gpio_zed.txt
    zedboard_linux/os/src/other/zedboard_leds_switches.txt
    
    Direct download available here :-
    steve@Desktop:/tmp/scratch$ wget https://spacewire.co.uk/tutorial/shared/documents/swuk_tutorial/general/v14_fileset_ignore_hdr.txt -O ${swuk_user}/general/v14_fileset_ignore_hdr.txt
    
    Execute the generate fix headers script again using the new header ignore file.
    steve@Desktop:/tmp/scratch$ swuk_repos_gen_fix_headers local_split_git ${swuk_user}/general/v14_fileset_ignore_hdr.txt 1
    
    The result, bad date spelling. Example below :-
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/peekpokecgi/files/peek.c
      Error ........ : 'Date' field is invalid, expecting a valid date, found '26 Novemebr 2021'.
    zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/peekpokecgi/files/poke.c
      Error ........ : 'Date' field is invalid, expecting a valid date, found '26 Novemebr 2021'.
    
    The two generated scripts inside the project directory (do_proof & do_fixes) can be used to remove all the source file headers in all the project subdirectories and replace them with new ones. Execute the do_proof script to confirm it does what it should. Strips off the original header and replaces it (in this case) with the original header.
    steve@Desktop:/tmp/scratch$ cp -r local_split_git local_split_git_copy
    steve@Desktop:/tmp/scratch$ cd local_split_git
    steve@Desktop:/tmp/scratch/local_split_git$ ./do_proof
    steve@Desktop:/tmp/scratch/local_split_git$ cd ..
    steve@Desktop:/tmp/scratch$ diff -r local_split_git local_split_git_copy
    
    Looks good! No differences detected!

    With confidence that do_proof does not break anything it makes for a nice template to compare alongside do_fixes.

    Execute Beyond Compare & keep it open going forward to see the differences. Select the Diffs option on the ribbon of Behond Compare to see just the differences.
    steve@Desktop:/tmp/scratch$ bcompare local_split_git/{do_fixes,do_proof} &
    
    Looks good! Some trailing whitespace has shown up (unexpected) and four of the PHP files have had their header style made consistent (expected).

    There should not be any trailing whitespace at all, an editor malfunction, lets see how bad it is.
    steve@Desktop:/tmp/scratch$ swuk_repos_gen_fix_headers local_split_git ${swuk_user}/general/v14_fileset_ignore_hdr.txt 0 --whitespace
    steve@Desktop:/tmp/scratch$ cp local_split_git/{do_proof,do_fixes} local_split_git_copy
    steve@Desktop:/tmp/scratch$ diff -r local_split_git local_split_git_copy | grep "^>" | wc -l
    13
    
    Awful result! This should be 0. Sublime isn't clearing the trailing whitespace for some reason even though it is set to do so! Looking at the Behond Compare window should now show only the PHP style changes.

    With the difference tool kept open the various switches of the generate fix headers script can be applied.
    Run the fix_headers script with the --add switch thrown to add any missing headers.
    steve@Desktop:/tmp/scratch$ swuk_repos_gen_fix_headers local_split_git ${swuk_user}/general/v14_fileset_ignore_hdr.txt 0 --add --minor
    Considered 2104 files, skipped 1379, examined 725, detected 2 errors and 54 warnings.
    
    Lots of missing headers and lots of red in Behond Compare as expected.
    Run the fix_headers script with the --filename switch thrown to fix any File field errors.
    steve@Desktop:/tmp/scratch$ swuk_repos_gen_fix_headers local_split_git ${swuk_user}/general/v14_fileset_ignore_hdr.txt 0 --filename
    Considered 2104 files, skipped 1379, examined 725, detected 2 errors and 1 warnings.
    
    1 File field to be spelt correctly.
    Run the fix_headers script with the --fmtdate switch thrown to make the Date field consistent.
    steve@Desktop:/tmp/scratch$ swuk_repos_gen_fix_headers local_split_git ${swuk_user}/general/v14_fileset_ignore_hdr.txt 0 --fmtdate
    Considered 2104 files, skipped 1379, examined 725, detected 2 errors and 26 warnings.
    
    26 Date fields to be reformatted.
    Run the fix_headers script with the --version switch thrown to change the Version field to that of the GIT change count.
    steve@Desktop:/tmp/scratch$ swuk_repos_gen_fix_headers local_split_git ${swuk_user}/general/v14_fileset_ignore_hdr.txt 0 --version --minor
    Considered 2104 files, skipped 1379, examined 725, detected 2 errors and 48 warnings.
    
    15 Version fields that need to tally with the change count in GIT.
    Run the fix_headers script with the --standard switch thrown to remove the Standard field.
    steve@Desktop:/tmp/scratch$ swuk_repos_gen_fix_headers local_split_git ${swuk_user}/general/v14_fileset_ignore_hdr.txt 0 --standard
    Considered 2104 files, skipped 1379, examined 725, detected 2 errors and 25 warnings.
    
    25 Standard fields to be removed.
    Run the script with the --website & --reorg switches thrown to add the Website field.
    steve@Desktop:/tmp/scratch$ swuk_repos_gen_fix_headers local_split_git ${swuk_user}/general/v14_fileset_ignore_hdr.txt 0 --website --reorg
    Considered 2104 files, skipped 1379, examined 725, detected 2 errors and 31 warnings.
    
    31 Website fields to be added.
    Run the script with the --project & --reorg switches thrown to add the Project field.
    steve@Desktop:/tmp/scratch$ swuk_repos_gen_fix_headers local_split_git ${swuk_user}/general/v14_fileset_ignore_hdr.txt 0 --project --reorg
    Considered 2104 files, skipped 1379, examined 725, detected 2 errors and 48 warnings.
    
    31 Project fields to be added.
    Run the script with the --conception & --reorg switches thrown to change the field name Conception to be Date and reformat the date.
    steve@Desktop:/tmp/scratch$ swuk_repos_gen_fix_headers local_split_git ${swuk_user}/general/v14_fileset_ignore_hdr.txt 0 --conception --reorg
    Considered 2104 files, skipped 1379, examined 725, detected 2 errors and 17 warnings.
    
    17 Conception to Date field renames required.
    Run the fix_headers script with the --all switch thrown to apply ALL changes.
    steve@Desktop:/tmp/scratch$ swuk_repos_gen_fix_headers local_split_git ${swuk_user}/general/v14_fileset_ignore_hdr.txt 0 --all --minor
    Considered 2104 files, skipped 1379, examined 725, detected 2 errors and 250 warnings.
    

    Take a look at how much missing information there is.
    steve@Desktop:/tmp/scratch$ grep 'Sage' local_split_git/do_fixes | wc -l
    108
    
    54 new headers need to have Date & Description fields added. My bad!
    This is for me to do: Take the generated do_fixes script, hand edit it to achieve the desired results and wrap it with the standard bash command pleasantries.
    steve@Desktop:/tmp/scratch$ wget https://spacewire.co.uk/tutorial/shared/repos/0027/common/other/src/script/swuk_repos_fix_headers
    steve@Desktop:/tmp/scratch$ chmod +x swuk_repos_fix_headers
    

    swuk_repos_fix_headers

    #!/bin/bash
    
    #
    # File .......... swuk_repos_fix_headers
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Common (SpaceWire UK Tutorial)
    # Date .......... 25 Mar 2025
    # Version ....... 1.0
    # Description ...
    #   Edit the headers in a split repository using the 'ed' command. Core function
    # is basically the output from swuk_repos_gen_fix_headers, edited by hand to add
    # the missing information.
    #
    
    # Strict
    set -euo pipefail
    
    ################################################################################
    # Edit the headers.
    # Arguments ...... None
    # Return ......... None
    # Shared (In) .... None
    # Shared (Out) ... None
    edit_headers()
    {
    #### 0001 - Part 1 #############################################################
    
    ed 0001/common/fw/src/script/create_vivado_project.sh <<END
    3,15d
    .
    2a
    #
    # File .......... create_vivado_project.sh
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Common (SpaceWire UK Tutorial)
    # Date .......... 03 May 2021
    # Version ....... 1.0
    # Description ...
    #   Very simple script to launch Vivado and run the TCL script. Should be run
    # in the project host directory that contains the fw & sw subdirectories, for
    # example :-
    #
    # user@host:~/projects/project$ create_vivado_project.sh
    # user@host:~/projects/project$ create_vivado_project.sh build
    #
    .
    wq
    END
    
    ed 0001/common/fw/src/script/create_vivado_project.tcl <<END
    1,9d
    .
    0a
    #
    # File .......... create_vivado_project.tcl
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Common (SpaceWire UK Tutorial)
    # Date .......... 23 Dec 2021
    # Version ....... 1.0
    # Description ...
    #   Simple Tcl script to create a new Vivado project, import external
    # sources and (optionally) generate the bitstream & export the hardware.
    #
    .
    wq
    END
    
    ed 0001/common/other/src/script/create_project_structure.sh <<END
    4,13d
    .
    3a
    #
    # File .......... create_project_structure.sh
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Common (SpaceWire UK Tutorial)
    # Date .......... 29 Dec 2021
    # Version ....... 1.0
    # Description ...
    #   Simple script to create a possible project directory structure for combined
    # firmware, hardware, operating system & software development. Very much work
    # in progress and by all means not a golden solution to anything.
    #
    .
    wq
    END
    
    ed 0001/common/other/src/script/xilinx.sh <<END
    3,12d
    .
    2a
    #
    # File .......... xilinx.sh
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Common (SpaceWire UK Tutorial)
    # Date .......... 08 Feb 2021
    # Version ....... 1.0
    # Description ...
    #   Determine and list which Xilinx tools are available and let the user select
    # the require ones to use. Does not reverse any previously selected tools upon
    # selecting news ones so to is cleaner to use in a new Terminal session.
    #
    .
    wq
    END
    
    ed 0001/common/other/src/script/xilinx_2021_2.sh <<END
    2a
    #
    # File .......... xilinx_2021_2.sh
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Common (SpaceWire UK Tutorial)
    # Date .......... 08 Feb 2021
    # Version ....... 1.0
    # Description ...
    #   Setup for the 2021.2 Xilinx tools.
    #
    
    .
    wq
    END
    
    ed 0001/common/sw/src/script/create_vitis_project.sh <<END
    3,15d
    .
    2a
    #
    # File .......... create_vitis_project.sh
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Common (SpaceWire UK Tutorial)
    # Date .......... 03 May 2021
    # Version ....... 1.0
    # Description ...
    #   Very simple script to launch the Xilinx software command-line tool,
    # run the TCL script and launch Vitis. Should be run in the project host
    # directory that contains the fw & sw subdirectories, for example :-
    #
    # user@host:~/projects/project$ create_vitis_project.sh
    # user@host:~/projects/project$ create_vitis_project.sh build
    #
    .
    wq
    END
    
    ed 0001/common/sw/src/script/create_vitis_project.tcl <<END
    1,9d
    .
    0a
    #
    # File .......... create_vitis_project.tcl
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Common (SpaceWire UK Tutorial)
    # Date .......... 21 Dec 2021
    # Version ....... 1.0
    # Description ...
    #   Simple Tcl script to create a new Vitis application, import external
    # sources and (optionally) build the application.
    #
    .
    wq
    END
    
    #### 0002 - Part 2 #############################################################
    
    ed 0002/zedboard_hello_world/sw/src/c/hello_world.c <<END
    1,8d
    .
    0a
    //
    // File .......... hello_world.c
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard Hello World (SpaceWire UK Tutorial)
    // Date .......... 27 Dec 2021
    // Version ....... 1.0
    // Description ...
    //   The classic hello world C application.
    //
    .
    wq
    END
    
    #### 0003 - Part 3 #############################################################
    
    ed 0003/common/fw/src/script/zedboard_presets.tcl <<END
    0a
    #
    # File .......... zedboard_presets.tcl
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Common (SpaceWire UK Tutorial)
    # Date .......... 22 Dec 2021
    # Version ....... 1.0
    # Description ...
    #   ZYNQ7 Processing System presets, as set by the Zedboard BSP.
    #
    
    .
    wq
    END
    
    ed 0003/zedboard_leds_switches/fw/src/constraint/zedboard.xdc <<END
    0a
    #
    # File .......... zedboard.xdc
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Zedboard LEDs & Switches (SpaceWire UK Tutorial)
    # Date .......... 22 Dec 2021
    # Version ....... 1.0
    # Description ...
    #   Pin & timing constraints for the Zedboard LEDs & Switches design.
    #
    
    .
    wq
    END
    
    ed 0003/zedboard_leds_switches/fw/src/testbench/testbench.sv <<END
    1,10d
    .
    0a
    //
    // File .......... testbench.sv
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard LEDs & Switches (SpaceWire UK Tutorial)
    // Date .......... 22 Dec 2021
    // Version ....... 1.0
    // Description ...
    //   Very simple testbench to check correct connectivity of the block diagram.
    // Uses the Zynq Verification IP suite to read/write the GPIO LED register and
    // read the GPIO switch register.
    //
    .
    wq
    END
    
    ed 0003/zedboard_leds_switches/sw/src/c/zedboard_leds_switches.c <<END
    1,8d
    .
    0a
    //
    // File .......... zedboard_leds_switches.c
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard LEDs & Switches (SpaceWire UK Tutorial)
    // Date .......... 15 Jan 2022
    // Version ....... 1.0
    // Description ...
    //   Very simple LEDs & Switches example design.
    //
    .
    wq
    END
    
    #### 0004 - Part 4 #############################################################
    
    ed 0004/zedboard_leds_buttons/fw/src/constraint/zedboard.xdc <<END
    0a
    #
    # File .......... zedboard.xdc
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Zedboard LEDs & Buttons (SpaceWire UK Tutorial)
    # Date .......... 22 Dec 2021
    # Version ....... 1.0
    # Description ...
    #   Pin & timing constraints for the Zedboard LEDs & Buttons design.
    #
    
    .
    wq
    END
    
    ed 0004/zedboard_leds_buttons/fw/src/testbench/testbench.sv <<END
    1,10d
    .
    0a
    //
    // File .......... testbench.sv
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard LEDs & Buttons (SpaceWire UK Tutorial)
    // Date .......... 22 Dec 2021
    // Version ....... 1.0
    // Description ...
    //   Very simple testbench to check correct connectivity of the block diagram.
    // Uses the Zynq Verification IP suite to read/write the GPIO LED register and
    // read the GPIO switch register.
    //
    .
    wq
    END
    
    ed 0004/zedboard_leds_buttons/sw/src/c/zedboard_leds_buttons.c <<END
    1,8d
    .
    0a
    //
    // File .......... zedboard_leds_buttons.c
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard LEDs & Buttons (SpaceWire UK Tutorial)
    // Date .......... 15 Jan 2022
    // Version ....... 1.0
    // Description ...
    //   Very simple LEDs & Push Buttons interrupt example design.
    //
    .
    wq
    END
    
    #### 0005 - Part 5 #############################################################
    
    ed 0005/zedboard_linux/os/petalinux/project-spec/meta-user/conf/petalinuxbsp.conf <<END
    0a
    #
    # File .......... petalinuxbsp.conf
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    # Date .......... 17 Jan 2022
    # Version ....... 1.0
    # Description ...
    #   Updated to install the following :-
    # -- ntp ....... Network Time Protocol
    # -- ntpdate ... Set the date and time via NTP
    # -- ntpq ...... Standard NTP query program
    # -- sntp ...... Simple Network Time Protocol
    #
    
    .
    wq
    END
    
    #ed 0005/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi <<END
    #0a
    #/*
    # * File .......... system-user.dtsi
    # * Author ........ Steve Haywood
    # * Website ....... http://www.spacewire.co.uk
    # * Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    # * Date .......... Sage date!
    # * Version ....... 1.0
    # * Description ...
    # *   Sage words!
    # */
    #
    #.
    #wq
    #END
    
    #### 0006 - Part 6 #############################################################
    
    #### 0007 - Part 7 #############################################################
    
    ed 0007/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/led-runner/files/led-runner <<END
    2a
    #
    # File .......... led-runner
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    # Date .......... 18 Jan 2022
    # Version ....... 1.0
    # Description ...
    #   Expanding & contracting LED sequence using the GPIO located at 0x4120_0000.
    #
    
    .
    wq
    END
    
    ed 0007/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/led-runner/led-runner.bb <<END
    1,3d
    .
    0a
    #
    # File .......... led-runner.bb
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    # Date .......... 18 Jan 2022
    # Version ....... 1.0
    # Description ...
    #   Recipe for an autostart application.
    #
    
    .
    wq
    END
    
    #### 0008 - Part 8a ############################################################
    
    ed 0008/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/index.html <<END
    0a
    <!--
    // File .......... index.html
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    // Date .......... 21 Jan 2022
    // Version ....... 1.0
    // Description ...
    //   Simple hello world in HTML that displays the Zedboard image.
    -->
    
    .
    wq
    END
    
    ed 0008/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/website.bb <<END
    1,4d
    .
    0a
    #
    # File .......... website.bb
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    # Date .......... 21 Jan 2022
    # Version ....... 1.0
    # Description ...
    #   Application recipe for a basic website that consists of a webpage (html) & an
    # image of the Zedboard (png).
    #
    
    .
    wq
    END
    
    #### 0009 - Part 8b ############################################################
    
    ed 0009/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/cgi-bin/index.cgi <<END
    2a
    #
    # File .......... index.cgi
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    # Date .......... 21 Jan 2022
    # Version ....... 1.0
    # Description ...
    #   Dynamic (server side) webpage to display system information from PetaLinux
    # running on the Zedboard.
    #
    
    .
    wq
    END
    
    ed 0009/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/website.bb <<END
    1,4d
    .
    0a
    #
    # File .......... website.bb
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    # Date .......... 21 Jan 2022
    # Version ....... 2.0
    # Description ...
    #   Application recipe for a dynamic (server side) webpage that consists of a
    # webpage (cgi) & an image of the Zedboard (png).
    #
    
    .
    wq
    END
    
    #### 0010 - Part 8c ############################################################
    
    ed 0010/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/cgi-bin/index.cgi <<END
    2a
    #
    # File .......... index.cgi
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    # Date .......... 21 Jan 2022
    # Version ....... 2.0
    # Description ...
    #   Dynamic (server & client side) webpage to display system information from
    # PetaLinux running on the Zedboard. Updated to add a widget that displays the
    # uptime of PetaLinux.
    #
    
    .
    wq
    END
    
    ed 0010/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/cgi-bin/uptime.cgi <<END
    2a
    #
    # File .......... uptime.cgi
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    # Date .......... 21 Jan 2022
    # Version ....... 1.0
    # Description ...
    #   Simple CGI to provide the system uptime.
    #
    
    .
    wq
    END
    
    ed 0010/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/uptime.js <<END
    0a
    //
    // File .......... uptime.js
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    // Date .......... 21 Jan 2022
    // Version ....... 1.0
    // Description ...
    //   Uptime support functions for the dynamic (client side) webpage.
    //
    
    .
    wq
    END
    
    ed 0010/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/website.bb <<END
    1,4d
    .
    0a
    #
    # File .......... website.bb
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    # Date .......... 21 Jan 2022
    # Version ....... 3.0
    # Description ...
    #   Application recipe for a dynamic (server & client side) webpage that consists
    # of a webpage (cgi), uptime script (cgi), support functions (js) & an image of
    # the Zedboard (png).
    #
    
    .
    wq
    END
    
    #### 0011 - Part 10 ############################################################
    
    ed 0011/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/peekpokecgi/files/Makefile <<END
    0a
    #
    # File .......... Makefile
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    # Date .......... 05 Mar 2022
    # Version ....... 1.0
    # Description ...
    #   Makefile for the peek & poke CGI binaries.
    #
    
    .
    wq
    END
    
    ed 0011/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/peekpokecgi/files/peek.c <<END
    1,9d
    .
    0a
    //
    // File .......... peek.c
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    // Date .......... 26 Nov 2021
    // Version ....... 1.0
    // Description ...
    //   Very simple CGI peek application for single 32-bit reads. Provides
    // status & error reporting back to the client side application.
    //
    .
    wq
    END
    
    ed 0011/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/peekpokecgi/files/poke.c <<END
    1,9d
    .
    0a
    //
    // File .......... poke.c
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    // Date .......... 26 Nov 2021
    // Version ....... 1.0
    // Description ...
    //   Very simple CGI poke application for single 32-bit writes. Provides
    // status & error reporting back to the client side application.
    //
    .
    wq
    END
    
    ed 0011/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/peekpokecgi/peekpokecgi.bb <<END
    1,5d
    .
    0a
    #
    # File .......... peekpokecgi.bb
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    # Date .......... 05 Mar 2022
    # Version ....... 1.0
    # Description ...
    #   Application recipe for the peek & poke CGI binaries.
    #
    
    .
    wq
    END
    
    #### 0012 - Part 11 ############################################################
    
    ed 0012/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/cgi-bin/index.cgi <<END
    2a
    #
    # File .......... index.cgi
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    # Date .......... 06 Mar 2022
    # Version ....... 3.0
    # Description ...
    #   Dynamic (server & client side) webpage to display system information from
    # PetaLinux running on the Zedboard. Already includes a widget that displays the
    # uptime of PetaLinux.  Updated to add extra widgets to read & write register
    # functionality.
    #
    
    .
    wq
    END
    
    ed 0012/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/uptime.js <<END
    0a
    //
    // File .......... uptime.js
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    // Date .......... 06 Mar 2022
    // Version ....... 2.0
    // Description ...
    //   Uptime support functions for the dynamic (client side) webpage. Updated to
    // add read and write register requests that call the peek & poke CGI scripts
    // and update the client side webpage accordingly.
    //
    
    .
    wq
    END
    
    #### 0013 - Part 12 ############################################################
    
    ed 0013/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/cgi-bin/index.cgi <<END
    2a
    #
    # File .......... index.cgi
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    # Date .......... 07 Mar 2022
    # Version ....... 4.0
    # Description ...
    #   Dynamic (server & client side) webpage to display system information from
    # PetaLinux running on the Zedboard. Already includes a widget that displays the
    # uptime of PetaLinux and widgets to read & write register functionality.
    # Updated to use a style sheet for a more improved look.
    #
    
    .
    wq
    END
    
    ed 0013/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/styles.css <<END
    0a
    /*
     * File .......... styles.css
     * Author ........ Steve Haywood
     * Website ....... http://www.spacewire.co.uk
     * Project ....... Zedboard Linux (SpaceWire UK Tutorial)
     * Date .......... 07 Mar 2022
     * Version ....... 1.0
     * Description ...
     *   Introduction of a style sheet to separate out the embedded styles from the
     * webpage. Much more flexible and easier to maintain.
     */
    
    .
    wq
    END
    
    ed 0013/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/website.bb <<END
    1,4d
    .
    0a
    #
    # File .......... website.bb
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    # Date .......... 07 Mar 2022
    # Version ....... 4.0
    # Description ...
    #   Application recipe for a dynamic (server & client side) webpage that consists
    # of a webpage (cgi), uptime script (cgi), support functions (js), styles (css) &
    # an image of the Zedboard (png).
    #
    
    .
    wq
    END
    
    #### 0014 - Part 13a ###########################################################
    
    ed 0014/zedboard_leds_switches/fw/src/testbench/testbench.sv <<END
    1,10d
    .
    0a
    //
    // File .......... testbench.sv
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard LEDs & Switches (SpaceWire UK Tutorial)
    // Date .......... 17 Jun 2022
    // Version ....... 2.0
    // Description ...
    //   Very simple testbench to check correct connectivity of the block diagram.
    // Uses the Zynq Verification IP suite to read/write the GPIO LED register and
    // read the GPIO switch register.
    //
    .
    wq
    END
    
    #### 0015 - Part 13b ###########################################################
    
    ed 0015/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/cgi-bin/index.cgi <<END
    2a
    #
    # File .......... index.cgi
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    # Date .......... 17 Jun 2022
    # Version ....... 5.0
    # Description ...
    #   Dynamic (server & client side) webpage to display system information from
    # PetaLinux running on the Zedboard. Already includes a widget that displays the
    # uptime of PetaLinux and widgets to read & write register functionality. Also
    # uses a style sheet for a more improved look. Enhanced the peek & poke
    # capabilities such that multiple registers can be accessed. Added in global
    # controls for the multiple registers and also file access so the register
    # configuration can be saved and re-loaded.
    #
    
    .
    wq
    END
    
    ed 0015/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/uptime.js <<END
    0a
    //
    // File .......... uptime.js
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    // Date .......... 17 Jun 2022
    // Version ....... 3.0
    // Description ...
    //   Uptime support functions for the dynamic (client side) webpage. Updated to
    // add read and write register requests that call the peek & poke CGI scripts
    // and update the client side webpage accordingly. Enhanced functions to
    // improve webpage look & feel, including the use of new status animation images
    // for success/fail of register read/write calls and also a register
    // configuration save & re-load facility.
    //
    
    .
    wq
    END
    
    ed 0015/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/website.bb <<END
    1,4d
    .
    0a
    #
    # File .......... website.bb
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    # Date .......... 17 Jun 2022
    # Version ....... 5.0
    # Description ...
    #   Application recipe for a dynamic (server & client side) webpage that consists
    # of a webpage (cgi), uptime script (cgi), support functions (js), styles (css),
    # an image of the Zedboard (png) & 3 status animation images (gif).
    #
    
    .
    wq
    END
    
    #### 0016 - Part 14a ###########################################################
    
    ed 0016/zedboard_leds_switches/fw/src/design/axi_identification.v <<END
    1,20d
    .
    0a
    //
    // File .......... axi_identification.v
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard LEDs & Switches (SpaceWire UK Tutorial)
    // Date .......... 05 Dec 2021
    // Version ....... 1.0
    // Description ...
    //   AXI4-Lite controlled register bank written in basic Verilog. The register
    // bank contains the following fixed length identification and timestamp
    // strings.
    //
    // Product Description ........ 128 Characters - 32 Registers - 0x000 - 0x07F
    // Company ....................  64 Characters - 16 Registers - 0x080 - 0x0BF
    // Author .....................  64 Characters - 16 Registers - 0x0C0 - 0x0FF
    // Product Version ............  16 Characters -  4 Registers - 0x100 - 0x10F
    // Firmware Build Timestamp ...  32 Characters -  8 Registers - 0x110 - 0x12F
    // Unused ..................... 208 Characters - 52 Registers - 0x130 - 0x1FF
    //                              ---              ---            -------------
    //                              512              128          - 0x000 - 0x1FF
    //
    .
    wq
    END
    
    ed 0016/zedboard_leds_switches/fw/src/diagram/system/hdl/system_wrapper.sv <<END
    1,9d
    .
    0a
    //
    // File .......... system_wrapper.sv
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard LEDs & Switches (SpaceWire UK Tutorial)
    // Date .......... 06 Dec 2021
    // Version ....... 1.0
    // Description ...
    //   Top level wrapper for the underlying block design.
    //
    .
    wq
    END
    
    ed 0016/zedboard_leds_switches/fw/src/script/post_bit.tcl <<END
    1,10d
    .
    0a
    #
    # File .......... post_bit.tcl
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Zedboard LEDs & Switches (SpaceWire UK Tutorial)
    # Date .......... 24 Oct 2021
    # Version ....... 1.0
    # Description ...
    #   Script to replace 'project.txt' (Information about last version of firmware)
    # with 'project_new.txt' (Information about new version of firmware). The file
    # replace only occurs if the bitstream was generated successfully.
    #
    .
    wq
    END
    
    ed 0016/zedboard_leds_switches/fw/src/script/pre_synth.tcl <<END
    1,10d
    .
    0a
    #
    # File .......... pre_synth.tcl
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Zedboard LEDs & Switches (SpaceWire UK Tutorial)
    # Date .......... 24 Oct 2021
    # Version ....... 1.0
    # Description ...
    #   Script to read product/project information from a text file, increase
    # the version/revision, get current timestamp and set the generics/parameters
    # on the top level module.
    #
    .
    wq
    END
    
    ed 0016/zedboard_leds_switches/fw/src/testbench/testbench.sv <<END
    1,10d
    .
    0a
    //
    // File .......... testbench.sv
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard LEDs & Switches (SpaceWire UK Tutorial)
    // Date .......... 13 Sep 2022
    // Version ....... 3.0
    // Description ...
    //   Very simple testbench to check correct connectivity of the block diagram.
    // Uses the Zynq Verification IP suite to read/write the GPIO LED register and
    // read the GPIO switch register.
    //
    .
    wq
    END
    
    #### 0017 - Part 14b ###########################################################
    
    ed 0017/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/peekpokecgi/files/Makefile <<END
    0a
    #
    # File .......... Makefile
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    # Date .......... 13 Sep 2022
    # Version ....... 2.0
    # Description ...
    #   Makefile for the peek, poke & peekstring CGI binaries.
    #
    
    .
    wq
    END
    
    ed 0017/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/peekpokecgi/files/peekstring.c <<END
    1,14d
    .
    0a
    //
    // File .......... peekstring.c
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    // Date .......... 29 Oct 2021
    // Version ....... 1.0
    // Description ...
    //   CGI type module to read a string from memory and return it.
    // Usage ...
    //   http://<web address>/cgi-bin/peekstring?base&size&offset&maxchars
    // base = Base address of memory region to be used
    // size = Size of memory region to be used
    // offset = Offset address of string within memory region
    // maxchars = Maximum length of return string
    //
    .
    wq
    END
    
    ed 0017/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/peekpokecgi/peekpokecgi.bb <<END
    1,5d
    .
    0a
    #
    # File .......... peekpokecgi.bb
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    # Date .......... 13 Sep 2022
    # Version ....... 2.0
    # Description ...
    #   Application recipe for the peek, poke & peekstring CGI binaries.
    #
    
    .
    wq
    END
    
    ed 0017/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/cgi-bin/index.cgi <<END
    2a
    #
    # File .......... index.cgi
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    # Date .......... 13 Sep 2022
    # Version ....... 6.0
    # Description ...
    #   Dynamic (server & client side) webpage to display system information from
    # PetaLinux running on the Zedboard. Already includes a widget that displays the
    # uptime of PetaLinux and widgets to read & write register functionality. Also
    # uses a style sheet for a more improved look. Enhanced the peek & poke
    # capabilities such that multiple registers can be accessed. Added in global
    # controls for the multiple registers and also file access so the register
    # configuration can be saved and re-loaded. Added a Product Information
    # section for the Firmware.
    #
    
    .
    wq
    END
    
    ed 0017/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/uptime.js <<END
    0a
    //
    // File .......... uptime.js
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    // Date .......... 13 Sep 2022
    // Version ....... 4.0
    // Description ...
    //   Uptime support functions for the dynamic (client side) webpage. Updated to
    // add read and write register requests that call the peek & poke CGI scripts
    // and update the client side webpage accordingly. Enhanced functions to improve
    // webpage look & feel, including the use of new status animation images for
    // success/fail of register read/write calls and also a register configuration
    // save & re-load facility. Added the functions required to support reading
    // strings from the PL address space and dynamically updating the the webpage
    // accordingly.
    //
    
    .
    wq
    END
    
    #### 0018 - Part 16a ###########################################################
    
    ed 0018/zedboard_leds_switches/fw/src/design/axi_identification.v <<END
    1,21d
    .
    0a
    //
    // File .......... axi_identification.v
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard LEDs & Switches (SpaceWire UK Tutorial)
    // Date .......... 02 Oct 2022
    // Version ....... 2.0
    // Description ...
    //   AXI4-Lite controlled register bank written in basic Verilog. The register
    // bank contains the following fixed length identification and timestamp
    // strings.
    //
    // Description ................ 128 Characters - 32 Registers - 0x000 - 0x07F
    // Company ....................  64 Characters - 16 Registers - 0x080 - 0x0BF
    // Author .....................  64 Characters - 16 Registers - 0x0C0 - 0x0FF
    // Version ....................  32 Characters -  8 Registers - 0x100 - 0x11F
    // Timestamp ..................  32 Characters -  8 Registers - 0x120 - 0x13F
    // Hash .......................  64 Characters - 16 Registers - 0x140 - 0x17F
    // Unused ..................... 144 Characters - 36 Registers - 0x180 - 0x20F
    //                              ---              ---            -------------
    //                              528              132          - 0x000 - 0x20F
    //
    .
    wq
    END
    
    ed 0018/zedboard_leds_switches/fw/src/diagram/system/hdl/system_wrapper.sv <<END
    1,9d
    .
    0a
    //
    // File .......... system_wrapper.sv
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard LEDs & Switches (SpaceWire UK Tutorial)
    // Date .......... 02 Oct 2022
    // Version ....... 2.0
    // Description ...
    //   Top level wrapper for the underlying block design.
    //
    .
    wq
    END
    
    ed 0018/zedboard_leds_switches/fw/src/script/pre_synth.tcl <<END
    1,10d
    .
    0a
    #
    # File .......... pre_synth.tcl
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Zedboard LEDs & Switches (SpaceWire UK Tutorial)
    # Date .......... 02 Oct 2022
    # Version ....... 2.0
    # Description ...
    #   Script to read product/project information from a text file, obtain GIT
    # repository information and set the generics/parameters on the top level
    # module.
    #
    .
    wq
    END
    
    #### 0019 - Part 16b ###########################################################
    
    ed 0019/common/other/src/script/petalinux-build-id.sh <<END
    3,13d
    .
    2a
    #
    # File .......... petalinux-build-id.sh
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Common (SpaceWire UK Tutorial)
    # Date .......... 02 Oct 2022
    # Version ....... 1.0
    # Description ...
    #   Script to read project information file, obtain GIT repository information,
    # append project information file with GIT information, build PetaLinux project
    # and then restore project information file.
    #
    .
    wq
    END
    
    #### 0020 - Part 16c ###########################################################
    
    ed 0020/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/cgi-bin/index.cgi <<END
    2a
    #
    # File .......... index.cgi
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    # Date .......... 02 Oct 2022
    # Version ....... 7.0
    # Description ...
    #   Dynamic (server & client side) webpage to display system information from
    # PetaLinux running on the Zedboard. Already includes a widget that displays the
    # uptime of PetaLinux and widgets to read & write register functionality. Also
    # uses a style sheet for a more improved look. Enhanced the peek & poke
    # capabilities such that multiple registers can be accessed. Added in global
    # controls for the multiple registers and also file access so the register
    # configuration can be saved and re-loaded. Added a Product Information
    # section for the Firmware & the Operating System.
    #
    
    .
    wq
    END
    
    ed 0020/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/uptime.js <<END
    0a
    //
    // File .......... uptime.js
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    // Date .......... 02 Oct 2022
    // Version ....... 5.0
    // Description ...
    //   Uptime support functions for the dynamic (client side) webpage. Updated to
    // add read and write register requests that call the peek & poke CGI scripts
    // and update the client side webpage accordingly. Enhanced functions to improve
    // webpage look & feel, including the use of new status animation images for
    // success/fail of register read/write calls and also a register configuration
    // save & re-load facility. Added the functions required to support reading
    // strings from the PL address space and dynamically updating the the webpage
    // accordingly. Now displays the GIT Hash in the Firmware Information section &
    // supports the displaying of a whole new PetaLinux Information section.
    //
    
    .
    wq
    END
    
    ed 0020/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/website.bb <<END
    1,4d
    .
    0a
    #
    # File .......... website.bb
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    # Date .......... 02 Oct 2022
    # Version ....... 6.0
    # Description ...
    #   Application recipe for a dynamic (server & client side) webpage that consists
    # of a webpage (cgi), uptime script (cgi), support functions (js), styles (css),
    # an image of the Zedboard (png), 3 status animation images (gif) & a project
    # information file (txt).
    #
    
    .
    wq
    END
    
    #### 0021 - Part 16d ###########################################################
    
    #### 0022 - Part 17a ###########################################################
    
    ed 0022/zedboard_leds_switches/fw/src/constraint/zedboard.xdc <<END
    0a
    #
    # File .......... zedboard.xdc
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Zedboard LEDs & Switches (SpaceWire UK Tutorial)
    # Date .......... 29 Oct 2022
    # Version ....... 2.0
    # Description ...
    #   Pin & timing constraints for the Zedboard LEDs & Switches design. Now includes
    # constraints for the Buttons.
    #
    
    .
    wq
    END
    
    ed 0022/zedboard_leds_switches/fw/src/design/axi_gpio_zed.v <<END
    1,13d
    .
    0a
    //
    // File .......... axi_gpio_zed.v
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard LEDs & Switches (SpaceWire UK Tutorial)
    // Date .......... 29 Oct 2022
    // Version ....... 1.0
    // Description ...
    //   AXI4-Lite controlled GPIO block written in basic Verilog. Primary purpose
    // is to provide access to the LEDs, Switches & Push Buttons of the Zedboard.
    // Design offers an Interrupt that can be thrown when any of the Push Buttons
    // are pressed or released. Address map is compatible with the one used in the
    // AXI GPIO IP from Xilinx, albeit a cut-down version.
    //
    .
    wq
    END
    
    ed 0022/zedboard_leds_switches/fw/src/design/axi_register_bank.v <<END
    1,25d
    .
    0a
    //
    // File .......... axi_register_bank.v
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard LEDs & Switches (SpaceWire UK Tutorial)
    // Date .......... 29 Oct 2022
    // Version ....... 1.0
    // Description ...
    //   AXI4-Lite controlled general purpose register bank written in basic
    // Verilog. This module is intended to be a building block for something more
    // useful.
    //
    // With c_data_w = 32 the number of registers is as follows :-
    //
    // c_addr_w - c_registers
    // ~~~~~~~~ - ~~~~~~~~~~~
    // 2        -   1
    // 3        -   2
    // 4        -   4
    // 5        -   8
    // 6        -  16
    // 7        -  32
    // 8        -  64
    // 9        - 128
    // 10       - 256
    //
    .
    wq
    END
    
    ed 0022/zedboard_leds_switches/fw/src/design/debounce.v <<END
    1,9d
    .
    0a
    //
    // File .......... debounce.v
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard LEDs & Switches (SpaceWire UK Tutorial)
    // Date .......... 29 Oct 2022
    // Version ....... 1.0
    // Description ...
    //   Simple switch debouncer.
    //
    .
    wq
    END
    
    ed 0022/zedboard_leds_switches/fw/src/diagram/system/hdl/system_wrapper.sv <<END
    1,9d
    .
    0a
    //
    // File .......... system_wrapper.sv
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard LEDs & Switches (SpaceWire UK Tutorial)
    // Date .......... 29 Oct 2022
    // Version ....... 3.0
    // Description ...
    //   Top level wrapper for the underlying block design.
    //
    .
    wq
    END
    
    #### 0023 - Part 17b ###########################################################
    
    ed 0023/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/axi-gpio-zed-test/files/axi-gpio-zed-test.c <<END
    1,9d
    .
    0a
    //
    // File .......... axi-gpio-zed-test.c
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    // Date .......... 29 Oct 2022
    // Version ....... 1.0
    // Description ...
    //   Very simple program to access a GPIO device using the User Space I/O
    // subsystem. Demonstrates a blocking wait on interrupt routine.
    //
    .
    wq
    END
    
    ed 0023/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/led-runner/files/led-runner <<END
    2a
    #
    # File .......... led-runner
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    # Date .......... 29 Oct 2022
    # Version ....... 2.0
    # Description ...
    #   Expanding & contracting LED sequence using the GPIO located at 0x4001_0000.
    #
    
    .
    wq
    END
    
    ed 0023/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi <<END
    0a
    /*
     * File .......... system-user.dtsi
     * Author ........ Steve Haywood
     * Website ....... http://www.spacewire.co.uk
     * Project ....... Zedboard Linux (SpaceWire UK Tutorial)
     * Date .......... 29 Oct 2022
     * Version ....... 2.0
     * History .......
     *   1.0 TEMPLATE
     * Description ...
     *   Added User Space I/O (UIO) for the AXI GPIO Zed module.
     */
    
    .
    wq
    END
    
    #### 0024 - Part 18 ############################################################
    
    ed 0024/zedboard_linux/os/petalinux/project-spec/meta-user/conf/petalinuxbsp.conf <<END
    0a
    #
    # File .......... petalinuxbsp.conf
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    # Date .......... 03 Aug 2023
    # Version ....... 2.0
    # Description ...
    #   Updated to install the following :-
    # -- ntp ....... Network Time Protocol
    # -- ntpdate ... Set the date and time via NTP
    # -- ntpq ...... Standard NTP query program
    # -- sntp ...... Simple Network Time Protocol
    # -- nano ...... Text editor
    # Updated to install a LAMP style stack :-
    # -- Apache .... HTTP server
    # -- SQLite .... SQL database engine
    # -- PHP ....... Scripting language
    #
    
    .
    wq
    END
    
    ed 0024/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/peekpokecgi/peekpokecgi.bb <<END
    1,5d
    .
    0a
    #
    # File .......... peekpokecgi.bb
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    # Date .......... 03 Aug 2023
    # Version ....... 3.0
    # Description ...
    #   Application recipe for the peek, poke & peekstring CGI binaries. Forced
    # run-as-root privileges set.
    #
    
    .
    wq
    END
    
    ed 0024/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/cgi-bin/hello_world.php <<END
    0a
    <?php
    //
    // File .......... hello_world.php
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    // Date .......... 03 Aug 2023
    // Version ....... 1.0
    // Description ...
    //   Simple hello world in PHP.
    //
    ?>
    
    .
    wq
    END
    
    ed 0024/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/cgi-bin/index.php <<END
    0a
    <?php
    //
    // File .......... index.php
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    // Date .......... 03 Aug 2023
    // Version ....... 8.0
    // History .......
    //   7.0 zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/cgi-bin/index.cgi
    // Description ...
    //   Dynamic (server & client side) webpage to display system information from
    // PetaLinux running on the Zedboard. Already includes a widget that displays the
    // uptime of PetaLinux and widgets to read & write register functionality. Also
    // uses a style sheet for a more improved look. Enhanced the peek & poke
    // capabilities such that multiple registers can be accessed. Added in global
    // controls for the multiple registers and also file access so the register
    // configuration can be saved and re-loaded. Added a Product Information
    // section for the Firmware & the Operating System. This source is a direct
    // conversion from the previous CGI (shell script).
    //
    ?>
    
    .
    wq
    END
    
    ed 0024/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/cgi-bin/phpliteadmin.config.php <<END
    0a
    <?php
    //
    // File .......... phpliteadmin.config.php
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    // Date .......... 03 Aug 2023
    // Version ....... 1.0
    // History .......
    //   0.0 TEMPLATE
    // Description ...
    //   PHPLite configuration with the database location changed from . to db.
    //
    ?>
    
    .
    wq
    END
    
    ed 0024/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/cgi-bin/sqlite_test.php <<END
    1,16d
    .
    0a
    <?php
    //
    // File .......... sqlite_test.php
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    // Date .......... 03 Aug 2023
    // Version ....... 1.0
    // Description ...
    //   Simple HTML, PHP & SQLite example code that checks the basic operation of
    // SQLite. SQL queries used are :-
    //
    // 1. Create/open database
    // 1. Create table
    // 3. Insert row
    // 4. Close database
    //
    ?>
    .
    wq
    END
    
    ed 0024/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/cgi-bin/test-cgi <<END
    2a
    #
    # File .......... test-cgi
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    # Date .......... 03 Aug 2023
    # Version ....... 1.0
    # Description ...
    #   Stock test script (now enabled to run).
    #
    
    .
    wq
    END
    
    ed 0024/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/index.html <<END
    0a
    <!--
    // File .......... index.html
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    // Date .......... 03 Aug 2023
    // Version ....... 2.0
    // Description ...
    //   Simple index page for accessing all the other pages.
    -->
    
    .
    wq
    END
    
    ed 0024/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/uptime.js <<END
    0a
    //
    // File .......... uptime.js
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    // Date .......... 03 Aug 2023
    // Version ....... 6.0
    // Description ...
    //   Uptime support functions for the dynamic (client side) webpage. Updated to
    // add read and write register requests that call the peek & poke CGI scripts
    // and update the client side webpage accordingly. Enhanced functions to improve
    // webpage look & feel, including the use of new status animation images for
    // success/fail of register read/write calls and also a register configuration
    // save & re-load facility. Added the functions required to support reading
    // strings from the PL address space and dynamically updating the the webpage
    // accordingly. Now displays the GIT Hash in the Firmware Information section &
    // supports the displaying of a whole new PetaLinux Information section. Added
    // backslash to uptime CGI call.
    //
    
    .
    wq
    END
    
    ed 0024/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/website.bb <<END
    1,4d
    .
    0a
    #
    # File .......... website.bb
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    # Date .......... 03 Aug 2023
    # Version ....... 7.0
    # Description ...
    #   Application recipe for a dynamic (server & client side) webpage that consists
    # of a webpage (php), uptime script (cgi), support functions (js), styles (css),
    # an image of the Zedboard (png), 3 status animation images (gif) & a project
    # information file (txt). The move to a LAMP style stack introduces new PHP
    # files (index, hello_world, sqlite_test & phpliteadmin).
    #
    
    .
    wq
    END
    
    ed 0024/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-httpd/apache2/apache2_%.bbappend <<END
    0a
    #
    # File .......... apache2_%.bbappend
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    # Date .......... 03 Aug 2023
    # Version ....... 1.0
    # Description ...
    #   Modify Apache 2 recipe to suite PetaLinux.
    #
    
    .
    wq
    END
    
    #### 0025 - Part 19 ############################################################
    
    ed 0025/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/peekpokecgi/files/Makefile <<END
    0a
    #
    # File .......... Makefile
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    # Date .......... 09 Feb 2024
    # Version ....... 3.0
    # Description ...
    #   Makefile for the peek, poke, peekstring & loadfirmware CGI binaries.
    #
    
    .
    wq
    END
    
    ed 0025/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/peekpokecgi/files/loadfirmware.c <<END
    1,11d
    .
    0a
    //
    // File .......... loadfirmware.c
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    // Date .......... 09 Feb 2024
    // Version ....... 1.0
    // Description ...
    //   Very simple CGI to load PL bitstream.
    //
    .
    wq
    END
    
    ed 0025/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/peekpokecgi/peekpokecgi.bb <<END
    1,5d
    .
    0a
    #
    # File .......... peekpokecgi.bb
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    # Date .......... 09 Feb 2024
    # Version ....... 4.0
    # Description ...
    #   Application recipe for the peek, poke, peekstring & loadfirmware CGI binaries.
    # Forced run-as-root privileges set.
    #
    
    .
    wq
    END
    
    ed 0025/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/cgi-bin/index.php <<END
    1,11d
    .
    0a
    <?php
    //
    // File .......... index.php
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    // Date .......... 09 Feb 2024
    // Version ....... 9.0
    // History .......
    //   7.0 zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/cgi-bin/index.cgi
    // Description ...
    //   Dynamic (server & client side) webpage to display system information from
    // PetaLinux running on the Zedboard. Already includes a widget that displays the
    // uptime of PetaLinux and widgets to read & write register functionality. Also
    // uses a style sheet for a more improved look. Enhanced the peek & poke
    // capabilities such that multiple registers can be accessed. Added in global
    // controls for the multiple registers and also file access so the register
    // configuration can be saved and re-loaded. Added a Product Information
    // section for the Firmware & the Operating System. This source is a direct
    // conversion from the previous CGI (shell script). Now includes a table that
    // displays the loadable firmware images available on the SD Card.
    //
    ?>
    .
    wq
    END
    
    ed 0025/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/uptime.js <<END
    1,11d
    .
    0a
    //
    // File .......... uptime.js
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    // Date .......... 09 Feb 2024
    // Version ....... 7.0
    // Description ...
    //   Uptime support functions for the dynamic (client side) webpage. Updated to
    // add read and write register requests that call the peek & poke CGI scripts
    // and update the client side webpage accordingly. Enhanced functions to improve
    // webpage look & feel, including the use of new status animation images for
    // success/fail of register read/write calls and also a register configuration
    // save & re-load facility. Added the functions required to support reading
    // strings from the PL address space and dynamically updating the the webpage
    // accordingly. Now displays the GIT Hash in the Firmware Information section &
    // supports the displaying of a whole new PetaLinux Information section. Added
    // backslash to uptime CGI call. Now includes support for loadable firmware
    // images.
    //
    .
    wq
    END
    
    #### 0026 - Part 20 ############################################################
    
    ed 0026/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/peekpokecgi/files/Makefile <<END
    0a
    #
    # File .......... Makefile
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    # Date .......... 27 Feb 2024
    # Version ....... 4.0
    # Description ...
    #   Makefile for the peek, poke, peekstring, loadfirmware & bitbash CGI binaries.
    #
    
    .
    wq
    END
    
    ed 0026/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/peekpokecgi/files/bitbash.c <<END
    1,17d
    .
    0a
    //
    // File .......... bitbash.c
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    // Date .......... 28 Feb 2024
    // Version ....... 2.0
    // History .......
    //   1.0 zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/peekpokecgi/files/peek.c
    //  +1.0 zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/peekpokecgi/files/poke.c
    // Description ...
    //   Very simple CGI application for peeking, poking and general bit bashing
    // of a single 32-bit address location. Provides read back value or an error
    // message to the client side application.
    //
    // Examples :-
    //   http://192.168.2.87/cgi-bin/bitbash?peek&0x40010000 ......... Peek value @ 0x40010000
    //   http://192.168.2.87/cgi-bin/bitbash?poke&0x40010000&0xF ..... Poke 0xF @ 0x40010000
    //   http://192.168.2.87/cgi-bin/bitbash?set&0x40010000&0x81 ..... Set bits 0 & 7 @ 0x40010000
    //   http://192.168.2.87/cgi-bin/bitbash?clear&0x40010000&0x2 .... Clear bit 1 @ 0x40010000
    //   http://192.168.2.87/cgi-bin/bitbash?toggle&0x40010000&0xC ... Toggle bits 2 & 3 @ 0x40010000
    //
    .
    wq
    END
    
    ed 0026/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/peekpokecgi/peekpokecgi.bb <<END
    1,5d
    .
    0a
    #
    # File .......... peekpokecgi.bb
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    # Date .......... 27 Feb 2024
    # Version ....... 5.0
    # Description ...
    #   Application recipe for the peek, poke, peekstring, loadfirmware & bitbash CGI
    # binaries.
    #
    
    .
    wq
    END
    
    ed 0026/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/cgi-bin/phpliteadmin.config.php <<END
    0a
    <?php
    //
    // File .......... phpliteadmin.config.php
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    // Date .......... 27 Feb 2024
    // Version ....... 2.0
    // History .......
    //   0.0 TEMPLATE
    // Description ...
    //   PHPLite configuration with the database location changed to be a directory on the
    // Zedboard SD-Card.
    //
    ?>
    
    .
    wq
    END
    
    ed 0026/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/cgi-bin/sqlite_test.php <<END
    1,23d
    .
    0a
    <?php
    //
    // File .......... sqlite_test.php
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    // Date .......... 27 Feb 2024
    // Version ....... 2.0
    // Description ...
    //   Simple HTML, PHP & SQLite example code that offers some degree of error
    // checking on the form inputs. Reports SQL operations and success/failure
    // status. Demonstrates some of the common SQL queries :-
    //
    // 1. Create/open database
    // 2. Create table
    // 3. Drop table
    // 4. Insert row
    // 5. Delete row
    // 6. Update row
    // 7. Close database
    //
    ?>
    .
    wq
    END
    
    ed 0026/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/home/index.php <<END
    1,13d
    .
    0a
    <?php
    //
    // File .......... index.php
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    // Date .......... 27 Feb 2024
    // Version ....... 1.0
    // Description ...
    //   Webpage for Home.
    //
    ?>
    .
    wq
    END
    
    ed 0026/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/index.php <<END
    1,13d
    .
    0a
    <?php
    //
    // File .......... index.php
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    // Date .......... 27 Feb 2024
    // Version ....... 1.0
    // Description ...
    //   Forwarder page for use in root www directory.
    //
    ?>
    .
    wq
    END
    
    ed 0026/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/peekpoke/index.php <<END
    1,13d
    .
    0a
    <?php
    //
    // File .......... index.php
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    // Date .......... 27 Feb 2024
    // Version ....... 10.0
    // History .......
    //   9.0 zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/cgi-bin/index.php
    //   7.0 zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/cgi-bin/index.cgi
    // Description ...
    //   Webpage for Peek & Poke Addresses.
    //
    ?>
    .
    wq
    END
    
    ed 0026/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/peekpoke/script.js <<END
    1,11d
    .
    0a
    //
    // File .......... script.js
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    // Date .......... 27 Feb 2024
    // Version ....... 8.0
    // History .......
    //   7.0 zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/uptime.js
    // Description ...
    //   Javascript for Peek & Poke Addresses.
    //
    .
    wq
    END
    
    ed 0026/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/share/footer.php <<END
    1,13d
    .
    0a
    <?php
    //
    // File .......... footer.php
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    // Date .......... 27 Feb 2024
    // Version ....... 1.0
    // Description ...
    //   Footer include for website pages.
    //
    ?>
    .
    wq
    END
    
    ed 0026/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/share/header.php <<END
    1,13d
    .
    0a
    <?php
    //
    // File .......... header.php
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    // Date .......... 27 Feb 2024
    // Version ....... 1.0
    // Description ...
    //   Header include for website pages.
    //
    ?>
    .
    wq
    END
    
    ed 0026/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/share/script.js <<END
    1,11d
    .
    0a
    //
    // File .......... script.js
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    // Date .......... 28 Feb 2024
    // Version ....... 1.0
    // Description ...
    //   Global Javascript for use in all webpages.
    //
    .
    wq
    END
    
    ed 0026/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/share/style.css <<END
    1,11d
    .
    0a
    /*
     * File .......... style.css
     * Author ........ Steve Haywood
     * Website ....... http://www.spacewire.co.uk
     * Project ....... Zedboard Linux (SpaceWire UK Tutorial)
     * Date .......... 27 Feb 2024
     * Version ....... 2.0
     * History .......
     *   1.0 zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/styles.css
     * Description ...
     *   Global Cascading Style Sheet for use in all webpages.
     */
    .
    wq
    END
    
    ed 0026/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/system/index.php <<END
    1,11d
    .
    0a
    <?php
    //
    // File .......... index.php
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    // Date .......... 27 Feb 2024
    // Version ....... 10.0
    // History .......
    //   9.0 zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/cgi-bin/index.php
    //   7.0 zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/cgi-bin/index.cgi
    // Description ...
    //   Webpage for System Information & Firmware Load.
    //
    ?>
    .
    wq
    END
    
    ed 0026/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/system/script.js <<END
    1,11d
    .
    0a
    //
    // File .......... script.js
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    // Date .......... 27 Feb 2024
    // Version ....... 8.0
    // History .......
    //   7.0 zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/uptime.js
    // Description ...
    //   Javascript for System Information & Firmware Load.
    //
    .
    wq
    END
    
    ed 0026/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/zedboard/index.php <<END
    1,15d
    .
    0a
    <?php
    //
    // File .......... index.php
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    // Date .......... 26 Feb 2024
    // Version ....... 1.0
    // Description ...
    //   Webpage for Interactive Zedboard.
    //
    ?>
    .
    wq
    END
    
    ed 0026/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/zedboard/script.js <<END
    1,11d
    .
    0a
    //
    // File .......... script.js
    // Author ........ Steve Haywood
    // Website ....... http://www.spacewire.co.uk
    // Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    // Date .......... 28 Feb 2024
    // Version ....... 1.0
    // Description ...
    //   Javascript for Interactive Zedboard.
    //
    .
    wq
    END
    
    ed 0026/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/zedboard/style.css <<END
    1,11d
    .
    0a
    /*
     * File .......... style.css
     * Author ........ Steve Haywood
     * Website ....... http://www.spacewire.co.uk
     * Project ....... Zedboard Linux (SpaceWire UK Tutorial)
     * Date .......... 28 Feb 2024
     * Version ....... 1.0
     * Description ...
     *   Cascading Style Sheet for Interactive Zedboard.
     */
    .
    wq
    END
    
    ed 0026/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/website.bb <<END
    1,4d
    .
    0a
    #
    # File .......... website.bb
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    # Date .......... 27 Feb 2024
    # Version ....... 8.0
    # Description ...
    #   Application recipe for a dynamic (server & client side) website that is split
    # into separate sections (directories). Each section contains an index page
    # along with any associated files (sub-pages, scripts, styles, images, etc.).
    # There are also two shared areas for common files.
    #
    
    .
    wq
    END
    
    ed 0026/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-httpd/apache2/apache2_%.bbappend <<END
    0a
    #
    # File .......... apache2_%.bbappend
    # Author ........ Steve Haywood
    # Website ....... http://www.spacewire.co.uk
    # Project ....... Zedboard Linux (SpaceWire UK Tutorial)
    # Date .......... 27 Feb 2024
    # Version ....... 2.0
    # Description ...
    #   Modified Apache 2 recipe to suite PetaLinux. Updated to allow Apache to run as
    # root instead of deamon.
    #
    
    .
    wq
    END
    }
    
    
    ################################################################################
    # Check if an argument option is set.
    # Arguments ...... $1 ... Str: Option
    # Return ......... Set (0=unset, 1=set)
    # Shared (In) .... argv
    # Shared (Out) ... None
    option_set()
    {
      [[ " ${argv[*]} " =~ " ${1} " ]] && echo 1 || echo 0
    }
    
    
    ################################################################################
    # Main function.
    # Arguments ...... None
    # Return ......... None
    # Shared (In) .... argv
    # Shared (Out) ... argv
    main()
    {
      # Declare local constants
      local -r  opthelp="--help"  # Str: Help option name
      local -Ar options=(         # ARR: Options & associated help information
        [${opthelp}]="Display this help and exit."
      )
      local -ar optorder=(        # Arr: Help options display order
        ${opthelp}
      )
    
      # Declare local variables
      local     arg               # Str: Current argument from argv array
      local     project=""        # Str: Project directory [arg] (mandatory)
      local     option            # Str: Current option from optorder array
    
      # Display help information
      if (($(option_set ${opthelp}))); then
        echo "Usage: $(basename ${0}) PROJECT-DIRECTORY... [OPTION]..."
        echo "Edit headers in the source files in PROJECT-DIRECTORY. Core function is the output from swuk_repos_gen_fix_headers."
        echo
        for option in ${optorder[@]}
        do
          echo "      ${option} $(printf ' %.0s' {1..12} | head -c $((12-${#option}))) ${options[${option}]}"
        done
        echo
        exit 0
      fi
    
      # Get & check the arguments
      for arg in ${argv[@]}; do
        if [[ ${arg:0:2} == "--" ]]; then  # Option
          [[ ! -v options[${arg}] ]] && echo "Option (${arg}) is not recognised!" && exit 1
        elif [[ -z ${project} ]]; then  # Project directory
          project=${arg}
          [[ ! -d ${project} ]] && echo "Project directory (${arg}) does not exist!" && exit 1
        else
          echo "Unexpected argument (${arg}) found!" && exit 1
          exit 1
        fi
      done
    
      # Further check the arguments
      [[ -z ${project} ]] && echo "No project directory specified!" && exit 1
    
      # Move into project directory
      cd ${project}
    
      # Edit the headers
      edit_headers
    
      # Move out of project directory
      cd ..
    }
    
    
    ################################################################################
    # Opening gambit.
    # Arguments ...... None
    # Return ......... None
    # Exit code ...... Status (0=success, 1=failure)
    # Shared (In) .... $#, $@
    # Shared (Out) ... argc, argv
    declare -ri argc=${#}    # Int: Get argument count
    declare -ra argv=(${@})  # Arr: Get argument values (space-separated) into array
    main
    exit 0
    
    steve@Desktop:/tmp/scratch$ swuk_repos_fix_headers --help
    Usage: swuk_repos_fix_headers PROJECT-DIRECTORY... [OPTION]...
    Edit headers in the source files in PROJECT-DIRECTORY. Core function is the output from swuk_repos_gen_fix_headers.
    
          --help        Display this help and exit.
    
    
    #### Part 4 - Final build ####

    10. Putting it all together

    With all the pieces now in place the final repository can be built. All the steps from scratch are given below.
    1. Combine all the SWUK repositories into a historically correct collection of directories.
    2. Join the directories together to form a new repository.
    3. Split the new repository into a collection of directories.
    4. Create symbolic links for all the identical files across the directories.
    5. Remove all the trailing whitespace on the source files.
    6. Add & correct all the headers on the source files.
    7. Convert all the links back into actual files.
    8. Remove all the .git subdirectories.
    9. Create a HTML history report file.
    10. Join the directories together to form a new repository.
    11. Clone the final repository.
    steve@Desktop:/tmp/scratch$ cd ..
    steve@Desktop:/tmp$ mkdir final
    steve@Desktop:/tmp$ cd final
    steve@Desktop:/tmp/final$ swuk_repos_splice web_splice --fix
    steve@Desktop:/tmp/final$ swuk_repos_join web_splice git@192.168.2.20:final_repo --fix
    steve@Desktop:/tmp/final$ swuk_repos_split git@192.168.2.20:final_repo local_split_git --keepgit
    steve@Desktop:/tmp/final$ swuk_repos_history local_split_git --link
    steve@Desktop:/tmp/final$ swuk_repos_gen_fix_headers local_split_git ${swuk_user}/general/v14_fileset_ignore.txt 0 --whitespace
    steve@Desktop:/tmp/final$ swuk_repos_fix_headers local_split_git
    steve@Desktop:/tmp/final$ for f in $(find local_split_git -type l); do cp --remove-destination $(readlink $f) $f; done
    steve@Desktop:/tmp/final$ rm -rf local_split_git/*/.git
    steve@Desktop:/tmp/final$ swuk_repos_history local_split_git ${swuk_user}/general/v14_fileset_ignore_hdr.txt --header
    steve@Desktop:/tmp/final$ swuk_repos_join local_split_git git@192.168.2.20:swuk_tutorial --fix
    steve@Desktop:/tmp/final$ git clone git@192.168.2.20:swuk_tutorial
    
    steve@Desktop:/tmp/final$ cd swuk_tutorial
    steve@Desktop:/tmp/final/swuk_tutorial$ git log --reverse --oneline --decorate-refs='tags' --pretty='%C(auto)%h  %<(32)%D  %C(green)%cd  %C(cyan)%s%C(reset)' --date=format:'%d-%b-%Y %H:%M:%S'
    
    2ae09b3  tag: common_v1.0                  28-Mar-2025 06:18:04  Initial commit of common files.
    7ba08ef  tag: zedboard_hello_world_v1.0    28-Mar-2025 06:18:07  Basic Zedboard design consisting of just the ZYNQ7 Processing System.
    82b84d8  tag: zedboard_leds_switches_v1.0  28-Mar-2025 06:18:11  Basic Zedboard design consisting of a ZYNQ7 Processing System controlling & monitoring LEDs & DIP Switches via a GPIO.
    f0dfc1e  tag: zedboard_leds_buttons_v1.0   28-Mar-2025 06:18:14  Basic Zedboard design consisting of a ZYNQ7 Processing System controlling & monitoring LEDs & Push Buttons via a GPIO.
    09c48f3  tag: zedboard_linux_v1.0          28-Mar-2025 06:18:18  Initial PetaLinux project configured for ZYNQ and using the XSA from zedboard_leds_switches v1.0.
    d17d85e  tag: zedboard_linux_v2.0          28-Mar-2025 06:18:22  Enabled Peek/Poke application.
    39723cb  tag: zedboard_linux_v3.0          28-Mar-2025 06:18:25  Added & enabled LED runner auto-start application.
    9478094                                    28-Mar-2025 06:18:29  Enabled webserver application and created website installer application (static).
    26482cc                                    28-Mar-2025 06:18:31  Added dynamic server-side elements to website application.
    ee594d2  tag: zedboard_linux_v4.0          28-Mar-2025 06:18:33  Added dynamic client-side elements to website application.
    f00964f  tag: zedboard_linux_v5.0          28-Mar-2025 06:18:36  Added peek/poke CGI application.
    ff2b81d  tag: zedboard_linux_v6.0          28-Mar-2025 06:18:40  Added peek/poke CGI access to website application.
    ff1e889  tag: zedboard_linux_v7.0          28-Mar-2025 06:18:43  Added Style Sheet and improved webpage layout for website application.
    7f7523e  tag: zedboard_leds_switches_v2.0  28-Mar-2025 06:18:47  Added general purpose AXI register bank.
    f379077  tag: zedboard_linux_v8.0          28-Mar-2025 06:18:51  Enhanced webpage for website application to have multiple location access into PL address space.
    06ff755  tag: zedboard_leds_switches_v3.0  28-Mar-2025 06:18:55  Added AXI Identification to the design.
    5c2f469  tag: zedboard_linux_v9.0          28-Mar-2025 06:18:58  Enhanced webpage for website application to have access to product ID strings within PL address space.
    c18d670  tag: zedboard_leds_switches_v4.0  28-Mar-2025 06:19:02  Updated Firmware Identification fields to use static information from GIT.
    9038d60  tag: common_v2.0                  28-Mar-2025 06:19:06  Added PetaLinux build script that updates the project information file with timestamp & hash.
    1ef071c                                    28-Mar-2025 06:19:09  Updated webpage to include PetaLinux ID table & add hash field to Firmware ID table.
    53ccfbf  tag: zedboard_linux_v10.0         28-Mar-2025 06:19:11  Updated webpage to include PetaLinux ID table & add hash field to Firmware ID table.
    f27abb6  tag: zedboard_leds_switches_v5.0  28-Mar-2025 06:19:15  Replaced Xilinx GPIO with custom GPIO for the Zedboard. Also replaced auto-generated Register Bank with custom version.
    c1e8dda  tag: zedboard_linux_v11.0         28-Mar-2025 06:19:19  Enabled Userspace IO Driver & added application to test new PL AXI GPIO Zed module.
    08ec9fa  tag: zedboard_linux_v12.0         28-Mar-2025 06:19:22  Removed busybox-httpd Webserver and replaced it with a LAMP style stack of Apache, SQLite, PHP & myLiteAdmin.
    e93ae1d  tag: zedboard_linux_v13.0         28-Mar-2025 06:19:26  Added the ability to load new PL firmware without a rebuild or reboot of PetaLinux. Updated the peek/poke address table to include range & select HTML elements.
    29a856b  tag: zedboard_linux_v14.0         28-Mar-2025 06:19:30  Restructured website to include a menu bar. Added a better SQLite Test webpage. Changed Apache to run as root.
    
    steve@Desktop:/tmp/final/swuk_tutorial$ git for-each-ref --color --sort=creatordate --format='%(color:yellow)%(objectname:short)|%(color:magenta)tag: %(refname:short)|%(color:green)%(creatordate:format:%d-%b-%Y %H:%M:%S)|%(color:cyan)%(contents:subject)' refs/tags | column -t -s '|'
    
    8c7183b  tag: common_v1.0                  28-Mar-2025 06:18:06  Common files
    717fca7  tag: zedboard_hello_world_v1.0    28-Mar-2025 06:18:09  Just ZYNQ
    3593435  tag: zedboard_leds_switches_v1.0  28-Mar-2025 06:18:12  ZYNQ & GPIO
    84b6837  tag: zedboard_leds_buttons_v1.0   28-Mar-2025 06:18:16  ZYNQ, GPIO & Interrupts
    ec6593e  tag: zedboard_linux_v1.0          28-Mar-2025 06:18:20  PetaLinux with XSA from zedboard_leds_switches v1.0
    5aad9f3  tag: zedboard_linux_v2.0          28-Mar-2025 06:18:23  PetaLinux & Peek/Poke with XSA from zedboard_leds_switches v1.0
    f8f17db  tag: zedboard_linux_v3.0          28-Mar-2025 06:18:27  PetaLinux, Peek/Poke & LED Runner with XSA from zedboard_leds_switches v1.0
    7ac0a7a  tag: zedboard_linux_v4.0          28-Mar-2025 06:18:34  PetaLinux, Peek/Poke, LED Runner & Webserver with XSA from zedboard_leds_switches v1.0
    06bc509  tag: zedboard_linux_v5.0          28-Mar-2025 06:18:38  PetaLinux, Peek/Poke, LED Runner, Webserver & Peek/Poke CGI with XSA from zedboard_leds_switches v1.0
    4dceb23  tag: zedboard_linux_v6.0          28-Mar-2025 06:18:42  PetaLinux, Peek/Poke, LED Runner, Webserver, Peek/Poke CGI & PL Access with XSA from zedboard_leds_switches v1.0
    425f2f1  tag: zedboard_linux_v7.0          28-Mar-2025 06:18:45  PetaLinux, Peek/Poke, LED Runner, Webserver, Peek/Poke CGI, PL Access & Style Sheet with XSA from zedboard_leds_switches v1.0
    b8c825e  tag: zedboard_leds_switches_v2.0  28-Mar-2025 06:18:49  ZYNQ, GPIO & Register Bank
    ae4c875  tag: zedboard_linux_v8.0          28-Mar-2025 06:18:53  PetaLinux, Peek/Poke, LED Runner, Webserver, Peek/Poke CGI, PL Access, Style Sheet & Register Bank with XSA from zedboard_leds_switches v2.0
    01b0cd4  tag: zedboard_leds_switches_v3.0  28-Mar-2025 06:18:56  ZYNQ, GPIO, Register Bank & Identification
    665c936  tag: zedboard_linux_v9.0          28-Mar-2025 06:19:00  PetaLinux, Peek/Poke, LED Runner, Webserver, Peek/Poke CGI, PL Access, Style Sheet, Register Bank & ID Strings with XSA from zedboard_leds_switches v3.0
    88cd9b1  tag: zedboard_leds_switches_v4.0  28-Mar-2025 06:19:04  ZYNQ, GPIO, Register Bank & Identification (timestamp & hash from GIT)
    a6511a5  tag: common_v2.0                  28-Mar-2025 06:19:07  Common files update
    c7a5916  tag: zedboard_linux_v10.0         28-Mar-2025 06:19:13  PetaLinux, Peek/Poke, LED Runner, Webserver, Peek/Poke CGI, PL Access, Style Sheet, Register Bank & ID Strings (PetaLinux & Firmware hash) with XSA from zedboard_leds_switches v4.0
    bcb4560  tag: zedboard_leds_switches_v5.0  28-Mar-2025 06:19:17  ZYNQ, GPIO Zed, Register Bank & Identification
    409384b  tag: zedboard_linux_v11.0         28-Mar-2025 06:19:21  PetaLinux, Peek/Poke, LED Runner, Webserver, Peek/Poke CGI, PL Access, Style Sheet, Register Bank, ID Strings, UIO & GPIO Zed Test with XSA from zedboard_leds_switches v5.0
    b45e30c  tag: zedboard_linux_v12.0         28-Mar-2025 06:19:24  PetaLinux, Peek/Poke, LED Runner, LAMP (Apache, SQLite, PHP & myLiteAdmin), Peek/Poke CGI, PL Access, Style Sheet, Register Bank & ID Strings with XSA from zedboard_leds_switches v5.0
    a79f3c8  tag: zedboard_linux_v13.0         28-Mar-2025 06:19:28  PetaLinux, Peek/Poke, LED Runner, LAMP (Apache, SQLite, PHP & myLiteAdmin), Peek/Poke CGI, Load Firmware CGI, PL Access, Style Sheet, Register Bank & ID Strings with XSA from zedboard_leds_switches v5.0
    3d01be0  tag: zedboard_linux_v14.0         28-Mar-2025 06:19:32  PetaLinux, Peek/Poke, LED Runner, LAMP (Apache:root, SQLite, PHP & myLiteAdmin), Peek/Poke CGI, Load Firmware CGI, PL Access, Style Sheet, Register Bank & ID Strings with XSA from zedboard_leds_switches v5.0
    
    Main points of note :- Behold the file history - history.html (iframe shown below). Open up the final resulting HTML report file in a browser.
    steve@Desktop:/tmp/final/swuk_tutorial$ firefox ../history.html
    
    Now includes the missing comments and dates. The versions are in alignment with GIT.

    Remember that clicking on the header cells sorts the rows and hovering over the version number cells displays the header for the source file.



    #### Part 5 - Revision Control ####

    11. Commit new & updated files

    Copy the 6 scripts used to create the newly spliced repository. Some of these scripts may provide useful in the course of time.
    steve@Desktop:/tmp/final/swuk_tutorial$ cp /tmp/scratch/swuk* common/other/src/script
    
    Check GIT status to make sure all is well and there are no spurious elements.
    steve@Desktop:/tmp/final/swuk_tutorial$ git status -u
    On branch master
    Your branch is up-to-date with 'origin/master'.
    
    Untracked files:
      (use "git add <file>..." to include in what will be committed)
            common/other/src/script/swuk_repos_fix_headers      
            common/other/src/script/swuk_repos_gen_fix_headers      
            common/other/src/script/swuk_repos_history      
            common/other/src/script/swuk_repos_join      
            common/other/src/script/swuk_repos_splice      
            common/other/src/script/swuk_repos_split      
    
    nothing added to commit but untracked files present (use "git add" to track)
    
    Looks good!. Commit the updates, create an annotated tag and push the commit & tag up to the remote repository.
    steve@Desktop:/tmp/final/swuk_tutorial$ git add -A
    steve@Desktop:/tmp/final/swuk_tutorial$ git commit -a -m "Added scripts required to take the four separate SpaceWire UK project repositories and merge them into one spliced repository."
    steve@Desktop:/tmp/final/swuk_tutorial$ git push
    steve@Desktop:/tmp/final/swuk_tutorial$ git tag -a spliced_repository -m "SpaceWire UK spliced repository"
    steve@Desktop:/tmp/final/swuk_tutorial$ git push origin spliced_repository
    

    12. Clone the remote repository

    Clone the newly created (remote) SpaceWire UK Tutorial repository locally, located at say ${HOME}/swuk_tutorial.
    steve@Desktop:/tmp/final/swuk_tutorial$ cd ~
    steve@Desktop:~$ git clone git@192.168.2.20:swuk_tutorial