Skip to content

Commit 717ec49

Browse files
dack-fefe-tdavisfe-wickhamCDack
authored
Make uSD Card Image for the Audio Mini (#24)
* Added initial files * Rough draft of the instructions * Updated sdimage script with working directory option and added bash script for making image for audiomini * Added checks to download the Image artifacts from S3 * Added blueprint for creating uSD images * Documentation update * Updated the build script * Moved the Build Audio Mini Image Script * Initial Commit * Updated the Dockerfile for the audiomini build Removed the curl install Changed the starting script to the audiomini build script * Updated the file name * Updated the docker_build script for the Audio Mini Linux Image * Updated the docker build script name * Removed the folder/file checks * Updated the gitignore * Added Giti and Python3 * Updated the checkout * Working on Debugging the Docker Build * Debugging with Dylan * Updated the folder name * Initial Commit * Copying Artifacts from Jenkins * Added the Image Builder Folder Structure * Updated the Jenkinsfile to check the image builder folder * Removed the Procedure Section * Removed the old Altera Python Script * Added Read Me with Key Files and Instructions to build the Audio Mini Image * Updated with current master branch * Removed the ReadMe Call Out Numbers * Removed the Read Me Call Out Numbers * Updated the instructions * Removed the debugging line that was commetted out * Updated the git ignore with the folder change * Added comments to the Docker file * Added copy artifact of the Audio Mini Passthrough RBF * Update the project name * Updated Jenkins Project Name * Updated back to the Linux LKM Jenkins Pipeline Co-authored-by: Tyler Davis <[email protected]> Co-authored-by: Dylan Wickham <[email protected]> Co-authored-by: Connor <[email protected]>
1 parent e138651 commit 717ec49

10 files changed

+308
-9
lines changed

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
*.dtbo
44
**/.vscode
55
**/__pycache__/**
6+
image_builder/audiomini/DistroBlueprint.xml

Diff for: Jenkinsfile

+13
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,19 @@ pipeline
2525
build job: 'Frost_Edge'
2626
}
2727
}
28+
stage ('Image Builder - Audio Mini')
29+
{
30+
when {
31+
anyOf {
32+
changeset "image_builder/frost_usd_card_blueprint.xml"
33+
changeset "image_builder/audiomini/*"
34+
}
35+
}
36+
steps
37+
{
38+
build job: 'audiomini-linux-image'
39+
}
40+
}
2841
stage('Frost Root File System')
2942
{
3043
when { changeset "rootfs/*"}

Diff for: ReadMe.md

+19-9
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,25 @@
22
FrOST Utilities
33

44
## Folder Structure
5-
|-- frost_edge # Frost Edge Packager
6-
|-- packaging # Packaging Files
7-
|-- debian # Debian Packaging Files
8-
|-- scripts # Frost Edge Scripts
9-
|-- frost_edge.service # Frost Edge Service that calls frost_edge.sh on boot
10-
|-- frost_edge.sh # Bash Script that starts the web app and node server
11-
|-- makefile # Makefile to build the package
12-
|-- Jenkinsfile # Jenkins File to build the package
13-
|-- Install.md # Installation Steps
5+
|-- frost_edge # Frost Edge Packager
6+
|-- packaging # Packaging Files
7+
|-- debian # Debian Packaging Files
8+
|-- scripts # Frost Edge Scripts
9+
|-- frost_edge.service # Frost Edge Service that calls frost_edge.sh on boot
10+
|-- frost_edge.sh # Bash Script that starts the web app and node server
11+
|-- makefile # Makefile to build the package
12+
|-- Jenkinsfile # Jenkins File to build the package
13+
|-- Install.md # Installation Steps
14+
15+
|-- image_builder # Files and Scripts required to build the FrOST Linux Images
16+
|-- audiomini # Files specific to the Audio Mini
17+
|-- build_audiomini_image.sh # Bash Script to build the Audio Mini Linux Image
18+
|-- docker_build_audiomini.sh # Bash Script to build the Audio Mini Image with Docker
19+
|-- Dockerfile # Dockerfile to define the Docker Container
20+
|-- Jenkinsile # Jenkins Build Script
21+
|-- ReadMe.md # Audio Mini Linux Image Build Instructions
22+
|-- frost_usd_card_blueprint.xml # The FrOST uSD Card Partition Structure
23+
|-- README.md # Image Builder Read Me
1424

1525
|-- json # MATLAB Functions to Read and Write JSON Files
1626
|-- readjson.m

Diff for: image_builder/README.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# FrOST Linux Image Builder
2+
The FrOST Linux Image Builder utility provide a simple way to generate a new uSD Linux Image for the various FrOST Hardware. The build script will check the local system for the required files and download the missing files from the FrOST Release S3 Bucket. More details about the specific builds can be found in the hardware folders.
3+
4+
## Generated Images
5+
- [Audio Mini](https://frost-release.s3-us-west-2.amazonaws.com/linux-images/audio-mini-image.zip)
6+
7+
## Image Builder Folder Structure
8+
|-- audiomini # Files specific to the Audio Mini
9+
|-- build_audiomini_image.sh # Bash Script to build the Audio Mini Linux Image
10+
|-- docker_build_audiomini.sh # Bash Script to build the Audio Mini Image with Docker
11+
|-- Dockerfile # Dockerfile to define the Docker Container
12+
|-- Jenkinsile # Jenkins Build Script
13+
|-- ReadMe.md # Audio Mini Linux Image Build Instructions
14+
|-- frost_usd_card_blueprint.xml # The FrOST uSD Card Partition Structure
15+
|-- README.md # Image Builder Read Me
16+
17+

Diff for: image_builder/audiomini/Dockerfile

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Define the Container - Ubuntu 20.04
2+
FROM ubuntu:focal
3+
# Update the Packages
4+
RUN apt-get update
5+
# Install the required packages for the Audio Mini Build Script
6+
RUN apt install \
7+
# WGET to download the artifcats from S3
8+
wget \
9+
# Sudo to run the build script
10+
sudo \
11+
# Git to clone the Linux Builder Repo
12+
git \
13+
# Python3 to run the Linux Builder Python Script
14+
python3 \
15+
# dosfstools installs mkfs.vfat which is used in the image creation
16+
dosfstools -y
17+
# Copy the local files into the container
18+
COPY * /tmp/
19+
# Set the working directory to the location of the files
20+
WORKDIR /tmp
21+
# Set the entry point as the Build Audio Mini Script
22+
ENTRYPOINT ["/bin/bash","./build_audiomini_image.sh"]

Diff for: image_builder/audiomini/Jenkinsfile

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
pipeline
2+
{
3+
agent none
4+
stages
5+
{
6+
stage ('Ubuntu_20.04.1')
7+
{
8+
agent {label 'Ubuntu_20.04.1'}
9+
stages
10+
{
11+
stage('Copy Audio Mini Passthrough RBF')
12+
{
13+
steps
14+
{
15+
copyArtifacts filter: 'soc_system.rbf', fingerprintArtifacts: true, projectName: 'DE10_AudioMini_Passthrough', selector: lastSuccessful(), target: 'image_builder/audiomini/'
16+
}
17+
}
18+
19+
stage('Copy Frost Linux Kernel')
20+
{
21+
steps
22+
{
23+
copyArtifacts filter: 'zImage', fingerprintArtifacts: true, projectName: 'Linux_Kernel', selector: lastSuccessful(), target: 'image_builder/audiomini/'
24+
}
25+
}
26+
27+
stage('Copy Audio Mini uBoot')
28+
{
29+
steps
30+
{
31+
copyArtifacts filter: 'u-boot.scr', fingerprintArtifacts: true, projectName: 'audiomini-uboot', selector: lastSuccessful(), target: 'image_builder/audiomini/'
32+
copyArtifacts filter: 'u-boot.img', fingerprintArtifacts: true, projectName: 'audiomini-uboot', selector: lastSuccessful(), target: 'image_builder/audiomini/'
33+
}
34+
}
35+
36+
stage('Copy Audio Mini Preloader')
37+
{
38+
steps
39+
{
40+
copyArtifacts filter: 'audiomini_preloader.bin', fingerprintArtifacts: true, projectName: 'audiomini-preloader', selector: lastSuccessful(), target: 'image_builder/audiomini/'
41+
}
42+
}
43+
44+
stage('Copy Frost Root File System')
45+
{
46+
steps
47+
{
48+
copyArtifacts filter: 'frost_rootfs.tar.gz', fingerprintArtifacts: true, projectName: 'Frost_RootFS', selector: lastSuccessful(), target: 'image_builder/audiomini/'
49+
}
50+
}
51+
52+
stage('Build Audio Mini Linux Image')
53+
{
54+
steps
55+
{ dir("image_builder/audiomini")
56+
{
57+
sh 'chmod +x docker_build_audiomini.sh;'
58+
sh './docker_build_audiomini.sh;'
59+
}
60+
}
61+
}
62+
63+
stage('Archive')
64+
{
65+
steps
66+
{
67+
dir("image_builder/audiomini/")
68+
{
69+
sh 'zip audio-mini-image.zip audio-mini.img'
70+
archiveArtifacts artifacts: 'audio-mini-image.zip', fingerprint: true
71+
}
72+
}
73+
}
74+
75+
stage('Cleanup')
76+
{
77+
steps
78+
{
79+
deleteDir()
80+
dir("${workspace}@tmp") {
81+
deleteDir()
82+
}
83+
}
84+
}
85+
}
86+
}
87+
}
88+
}

Diff for: image_builder/audiomini/ReadMe.md

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Audio Mini Linux Image Builder
2+
The Audio Mini Linux Image Builder generates the complete Audio Mini uSD Card Image using Docker and the [Linux Boot Image File Generator](https://github.com/fpga-open-speech-tools/LinuxBootImageFileGenerator)
3+
4+
## Key Files
5+
- `build_audiomini_image.sh` - The Audio Mini Image Build Script
6+
- Checks for and downloads the required files from the FrOST Release S3 Bucket
7+
- Runs the Linux Boot Image File Generator Python Script
8+
- `docker_build_audiomini.sh` - The Docker Build Script
9+
- Copies the `frost_usd_card_blueprint.xml` into the current folder
10+
- Runs the Docker Container
11+
- `Dockerfile`
12+
- Defines the Docker Container
13+
- Copies all of the files from the current folder in the Docker Container
14+
- Run `build_audiomini_image.sh`
15+
- `Jenkinsfile`
16+
- Automation of the build process using Jenkins
17+
18+
## Building the Audio Mini Linux Image with Docker
19+
1. Install [Docker for Windows](https://docs.docker.com/docker-for-windows/install/)
20+
2. Open Windows Subsystem for Linux and Navigate to `[FrOST Repos]\utils\image_builder\audiomini`
21+
3. Make the Docker Build Script executable by running
22+
- `chmod +x docker_build_audiomini.sh`
23+
4. Run the Docker Build - Audio Mini Bash Script with
24+
- `./docker_build_audiomini.sh`

Diff for: image_builder/audiomini/build_audiomini_image.sh

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
#!/bin/bash
2+
# Clone the LinuxBootImageFileGenerator Repo
3+
git clone https://github.com/fpga-open-speech-tools/LinuxBootImageFileGenerator.git
4+
5+
# Copy DistroBlueprint.xml into LinuxBootImageFileGenerator
6+
cp DistroBlueprint.xml LinuxBootImageFileGenerator/;
7+
8+
# Make the Image_partitions/Pat_1_vfat Folder
9+
mkdir -p LinuxBootImageFileGenerator/Image_partitions/Pat_1_vfat/;
10+
11+
# Check for the Audio Mini DTB
12+
if [ -f soc_system.dtb ]; then
13+
echo 'Using the local Audio Mini DTB.'
14+
else
15+
echo 'Downloading the Audio Mini DTB from S3 Archive'
16+
wget https://frost-release.s3-us-west-2.amazonaws.com/linux-images/artifacts/audiomini/soc_system.dtb
17+
fi
18+
cp soc_system.dtb LinuxBootImageFileGenerator/Image_partitions/Pat_1_vfat/;
19+
20+
# Check for the Audio Mini Raw Binary File
21+
if [ -f soc_system.rbf ]; then
22+
echo 'Using the local Audio Mini RBF.'
23+
else
24+
echo 'Downloading the Audio Mini RBF from S3 Archive'
25+
wget https://frost-release.s3-us-west-2.amazonaws.com/linux-images/artifacts/audiomini/soc_system.rbf
26+
fi
27+
cp soc_system.rbf LinuxBootImageFileGenerator/Image_partitions/Pat_1_vfat/;
28+
29+
# Check for the zImage
30+
if [ -f zImage ]; then
31+
echo 'Using the local zImage.'
32+
else
33+
echo 'Downloading the zImage from S3 Archive'
34+
wget https://frost-release.s3-us-west-2.amazonaws.com/linux-images/artifacts/common/zImage
35+
fi
36+
cp zImage LinuxBootImageFileGenerator/Image_partitions/Pat_1_vfat/;
37+
38+
# Check for the Audio Mini uBoot Source
39+
if [ -f u-boot.scr ]; then
40+
echo 'Using the local Audio Mini uBoot Source.'
41+
else
42+
echo 'Downloading the Audio Mini uBoot Source from S3 Archive'
43+
wget https://frost-release.s3-us-west-2.amazonaws.com/linux-images/artifacts/audiomini/u-boot.scr
44+
fi
45+
cp u-boot.scr LinuxBootImageFileGenerator/Image_partitions/Pat_1_vfat/;
46+
47+
# Check for the Audio Mini uBoot Image
48+
if [ -f u-boot.img ]; then
49+
echo 'Using the local Audio Mini uBoot Image.'
50+
else
51+
echo 'Downloading the Audio Mini uBoot Image from S3 Archive'
52+
wget https://frost-release.s3-us-west-2.amazonaws.com/linux-images/artifacts/audiomini/u-boot.img
53+
fi
54+
cp u-boot.img LinuxBootImageFileGenerator/Image_partitions/Pat_1_vfat/;
55+
56+
# Make the Image_partitions/Pat_3_raw Folder
57+
mkdir -p LinuxBootImageFileGenerator/Image_partitions/Pat_3_raw;
58+
# Check for the Audio Mini Preloader
59+
if [ -f audiomini_preloader.bin ]; then
60+
echo 'Using the local Audio Mini Preloader.'
61+
else
62+
echo 'Downloading the Audio Mini Preloader from S3 Archive.'
63+
wget https://frost-release.s3-us-west-2.amazonaws.com/linux-images/artifacts/audiomini/audiomini_preloader.bin
64+
fi
65+
cp audiomini_preloader.bin LinuxBootImageFileGenerator/Image_partitions/Pat_3_raw;
66+
67+
# Make the Image_partitions/Pat_2_ext3 Folder
68+
mkdir -p LinuxBootImageFileGenerator/Image_partitions/Pat_2_ext3;
69+
# Check for the Root File System
70+
if [ -d ubuntu-base ]; then
71+
echo 'Using the local extracted file system - ubuntu-base.'
72+
else
73+
if [ -f frost_rootfs.tar.gz ]; then
74+
echo 'Using the local Root File System.'
75+
tar -xhzvf frost_rootfs.tar.gz;
76+
else
77+
echo 'Downloading the FrOST Root File System from S3 Archive.'
78+
wget https://frost-release.s3-us-west-2.amazonaws.com/linux-images/artifacts/common/frost_rootfs.tar.gz
79+
tar -xhzvf frost_rootfs.tar.gz;
80+
fi
81+
fi
82+
echo "Copying Root File System to LinuxBootImageFileGenerator/Image_partitions/Pat_2_ext3"
83+
mv ubuntu-base/* LinuxBootImageFileGenerator/Image_partitions/Pat_2_ext3;
84+
85+
cd LinuxBootImageFileGenerator;
86+
python3 LinuxBootImageGenerator.py;
87+
mv LinuxDistro*.img audio-mini.img;

Diff for: image_builder/audiomini/docker_build_audiomini.sh

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
cp ../frost_usd_card_blueprint.xml ./DistroBlueprint.xml
3+
4+
# Build the Audio Mini Linux Image with Docker
5+
project="build_audiomini_image"
6+
7+
docker build -t $project .
8+
docker run -v /dev:/dev --name $project --privileged $project
9+
docker cp $project:/tmp/LinuxBootImageFileGenerator/audio-mini.img .
10+
docker rm -f $project
11+
docker rmi -f $project

Diff for: image_builder/frost_usd_card_blueprint.xml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding = "UTF-8" ?>
2+
<!-- Linux Distribution Blueprint XML file -->
3+
<!-- Used by the Python script "LinuxDistro2Image.py" -->
4+
<!-- to create a custom Linux boot image file -->
5+
<!-- Description: -->
6+
<!-- item "partition" describes a partition on the final image file-->
7+
<!-- L "id" => Partition number on the final image (1 is the lowest number) -->
8+
<!-- L "type" => Filesystem type of partition -->
9+
<!-- L => ext[2-4], Linux, xfs, vfat, fat, none, raw, swap -->
10+
<!-- L "size" => Partition size -->
11+
<!-- L => <no>: Byte, <no>K: Kilobyte, <no>M: Megabyte or <no>G: Gigabyte -->
12+
<!-- L => "*" dynamic file size => Size of the files2copy + offset -->
13+
<!-- L "offset" => in case a dynamic size is used the offset value is added to file size-->
14+
<!-- L "devicetree"=> compile the Linux Device (.dts) inside the partition if available (Top folder only)-->
15+
<!-- L => Yes: Y or No: N -->
16+
<!-- L "unzip" => Unzip a compressed file if available (Top folder only) -->
17+
<!-- L => Yes: Y or No: N -->
18+
<!-- L "ubootscript" => Compile the u-boot script file ("boot.script") -->
19+
<!-- L => Yes, for the ARMv7A (32-bit) architecture ="arm" -->
20+
<!-- L => Yes, for the ARMv8A (64-bit) architecture ="arm64" -->
21+
<!-- L => No ="" -->
22+
<LinuxDistroBlueprint>
23+
<partition id="1" type="vfat" size="1G" offset="500M" devicetree="N" unzip="N" ubootscript="" />
24+
<partition id="2" type="ext3" size="12G" offset="1M" devicetree="N" unzip="Y" ubootscript="" />
25+
<partition id="3" type="RAW" size="*" offset="20M" devicetree="N" unzip="N" ubootscript="" />
26+
</LinuxDistroBlueprint>

0 commit comments

Comments
 (0)