diff options
-rw-r--r-- | .jenkins.groovy | 16 | ||||
-rw-r--r-- | CMakeLists.txt | 4 | ||||
-rw-r--r-- | cmake/version.cmake | 7 | ||||
-rw-r--r-- | fwupd/CMakeLists.txt | 123 | ||||
-rw-r--r-- | fwupd/changelog.cmake | 93 | ||||
-rw-r--r-- | fwupd/metainfo.xml.in | 56 |
6 files changed, 293 insertions, 6 deletions
diff --git a/.jenkins.groovy b/.jenkins.groovy index 84b6e27..e8765a7 100644 --- a/.jenkins.groovy +++ b/.jenkins.groovy @@ -55,7 +55,7 @@ def notify(status, description) targetUrl: BUILD_URL } -def build(nodeName, archive = false, analyze = true) +def build(nodeName, archive = false, archive_cab = false, analyze = true) { node(nodeName) { @@ -131,6 +131,14 @@ def build(nodeName, archive = false, analyze = true) archiveArtifacts artifacts: '*.tar.gz', fingerprint: true } } + + if (archive_cab) + { + dir('build/fwupd') + { + archiveArtifacts artifacts: '*.cab', fingerprint: true + } + } } cleanWs() @@ -141,9 +149,9 @@ try { notify('PENDING', 'Build Pending ') parallel( - "fedora": { build('master', true, true) }, - "ubuntu-18.04": { build('ubuntu-18.04', false, false) }, - "ubuntu-20.04": { build('ubuntu-20.04', true, false) }, + "fedora": { build('master', true, true, true) }, + "ubuntu-18.04": { build('ubuntu-18.04', false, false, false) }, + "ubuntu-20.04": { build('ubuntu-20.04', true, false, false) }, ) } catch(e) diff --git a/CMakeLists.txt b/CMakeLists.txt index 41bc149..e5cb905 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ ### ### @file CMakeLists.txt ### -### @project +### @project ### ### @brief Top level CMake file ### @@ -71,3 +71,5 @@ add_subdirectory(simulator) add_subdirectory(stage1) add_subdirectory(ape) + +add_subdirectory(fwupd) diff --git a/cmake/version.cmake b/cmake/version.cmake index 7ec4eb8..1eff834 100644 --- a/cmake/version.cmake +++ b/cmake/version.cmake @@ -54,6 +54,7 @@ IF(EXISTS ${VERSION_FILE}) # Release package including a version file. FILE(STRINGS ${VERSION_FILE} lines) LIST(GET lines 0 FULL_VERSION) + LIST(GET lines 1 VERSION_DATE) STRING(REPLACE "." ";" FULL_VERSION ${FULL_VERSION}) LIST(GET FULL_VERSION 0 VERSION_MAJOR) @@ -93,6 +94,10 @@ ELSE() ELSE() # No released versions for this major.minor pair. ENDIF() + + EXECUTE_PROCESS(COMMAND git log -1 --date=short --format=%cd + OUTPUT_VARIABLE VERSION_DATE + OUTPUT_STRIP_TRAILING_WHITESPACE) ENDIF() SET(VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}") @@ -103,7 +108,7 @@ add_compile_options( -DVERSION_PATCH=${VERSION_PATCH} ) -FILE(WRITE ${CMAKE_BINARY_DIR}/version ${VERSION_STRING}) +FILE(WRITE ${CMAKE_BINARY_DIR}/version "${VERSION_STRING}\n${VERSION_DATE}") FILE(WRITE ${CMAKE_BINARY_DIR}/changelog ${CHANGELOG}) INSTALL(FILES ${CMAKE_BINARY_DIR}/version DESTINATION .) diff --git a/fwupd/CMakeLists.txt b/fwupd/CMakeLists.txt new file mode 100644 index 0000000..8e41194 --- /dev/null +++ b/fwupd/CMakeLists.txt @@ -0,0 +1,123 @@ +################################################################################ +### +### @file CMakeLists.txt +### +### @project bcm5719 +### +### @brief CMake configuration file for generating fwupd packages. +### +################################################################################ +### +################################################################################ +### +### @copyright Copyright (c) 2020, Evan Lojewski +### @cond +### +### All rights reserved. +### +### Redistribution and use in source and binary forms, with or without +### modification, are permitted provided that the following conditions are met: +### 1. Redistributions of source code must retain the above copyright notice, +### this list of conditions and the following disclaimer. +### 2. Redistributions in binary form must reproduce the above copyright notice, +### this list of conditions and the following disclaimer in the documentation +### and/or other materials provided with the distribution. +### 3. Neither the name of the copyright holder nor the +### names of its contributors may be used to endorse or promote products +### derived from this software without specific prior written permission. +### +################################################################################ +### +### THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +### AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +### IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +### ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +### LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +### CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +### SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +### INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +### CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +### ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +### POSSIBILITY OF SUCH DAMAGE. +### @endcond +################################################################################ + + +project(fwupd) + +find_program(GCAB gcab) +IF(NOT GCAB) + MESSAGE("Unable to locate gcab - disabling fwupd package generation") + RETURN() +ENDIF() + +SET(APP_STREAM_PREFIX com.meklort.bcm5719.firmware) + +add_custom_target(fwupd ALL) + +FUNCTION(CREATE_FWUPD_CAB TARGET_ID TARGET_NAME APE_VARIANT FIRMWARE_ID HARDWARE_ID) + IF(HARDWARE_ID) + SET(HARDWARE_FILTER "<hardware>${HARDWARE_ID}</hardware>") + ELSE() + SET(HARDWARE_FILTER "") + ENDIF() + configure_file(metainfo.xml.in ${APP_STREAM_PREFIX}.${TARGET_ID}.metainfo.xml @ONLY) + + add_custom_command(OUTPUT ${TARGET_ID}-${APE_VARIANT}.${VERSION_STRING}.fw + COMMAND bcmflash -c -t file -i ${TARGET_ID}-${APE_VARIANT}.${VERSION_STRING}.fw + -1 $<TARGET_PROPERTY:stage1,RESOURCE> + -a $<TARGET_PROPERTY:ape-${APE_VARIANT},RESOURCE> + DEPENDS stage1 ape-${APE_VARIANT} + VERBATIM + ) + + add_custom_command(OUTPUT ${TARGET_ID}-bcm5719-${VERSION_STRING}.cab + COMMAND ${GCAB} -c -z ${TARGET_ID}-bcm5719-${VERSION_STRING}.cab + ${APP_STREAM_PREFIX}.${TARGET_ID}.metainfo.xml + ${TARGET_ID}-${APE_VARIANT}.${VERSION_STRING}.fw + DEPENDS + ${APP_STREAM_PREFIX}.${TARGET_ID}.metainfo.xml + ${TARGET_ID}-${APE_VARIANT}.${VERSION_STRING}.fw + ) + + add_custom_target(build-${TARGET_ID}-bcm5719-${VERSION_STRING}.cab DEPENDS ${TARGET_ID}-bcm5719-${VERSION_STRING}.cab) + add_dependencies(fwupd build-${TARGET_ID}-bcm5719-${VERSION_STRING}.cab) + + INSTALL(FILES + "${CMAKE_CURRENT_BINARY_DIR}/${TARGET_ID}-bcm5719-${VERSION_STRING}.cab" + DESTINATION + fwupd + ) +ENDFUNCTION() + +include(changelog.cmake) + +SET(DESCRIPTION + "<p>This stable release has the following changes:</p>\n${FWUPD_CHANGELOG}") + + +# Build LVFS/fwupd cab files +CREATE_FWUPD_CAB( + talos2 "Talos II" port0 + "5d8b12bf-1973-58fc-8b31-3e50fe31954d" # PCI\VEN_14E4&DEV_1657&SUBSYS_14E41981 + "8e28b419-552d-52a6-9a3c-ea2efad5ea66|88201a40-2d9d-51c5-b1ee-ec58659bc701" # Restrict to HardwareID-10: "IBM" + "rcs,talos" + "RAPTOR COMP SYS" + "T2P9D01 REV 1.00" and "T2P9D01 REV 1.01" +) +CREATE_FWUPD_CAB( + blackbird "Blackbird" port2 + "5d8b12bf-1973-58fc-8b31-3e50fe31954d" # PCI\VEN_14E4&DEV_1657&SUBSYS_14E41981 + "9153212f-20c7-5457-a287-22e08f79ea0e" # Restrict to HardwareID-10: "IBM" + "rcs,blackbird" + "RAPTOR COMP SYS" + "C1P9S01 REV 1.01" +) + +# Test LVFS file for the KH08P. Should not be used in production. +# This firmware is only useful for testing fwupd with a KH08P and should +# never be pushed into a testing or stable remote! +# The FIXME below will ensure that the LVFS would block any promotion out +# of private or embargo. +SET(DESCRIPTION + "<p>NCSI support is not implemented via MCTP. As a result, remote management capabilities are not supported on this card.</p> + <p>This stable release has the following changes:</p>\n${FWUPD_CHANGELOG}") +CREATE_FWUPD_CAB( + kh08p "FIXME KH08P" port0 + "ec5b8a9e-973b-58cc-935b-8322fabaebe9" # PCI\VEN_14E4&DEV_1657&SUBSYS_14E41904 + False # No hardware Restrictions +) diff --git a/fwupd/changelog.cmake b/fwupd/changelog.cmake new file mode 100644 index 0000000..47e837e --- /dev/null +++ b/fwupd/changelog.cmake @@ -0,0 +1,93 @@ +################################################################################ +### +### @file changelog.cmake +### +### @project bcm5719 +### +### @brief fwupd support code for generating a changelog. +### +################################################################################ +### +################################################################################ +### +### @copyright Copyright (c) 2020, Evan Lojewski +### @cond +### +### All rights reserved. +### +### Redistribution and use in source and binary forms, with or without +### modification, are permitted provided that the following conditions are met: +### 1. Redistributions of source code must retain the above copyright notice, +### this list of conditions and the following disclaimer. +### 2. Redistributions in binary form must reproduce the above copyright notice, +### this list of conditions and the following disclaimer in the documentation +### and/or other materials provided with the distribution. +### 3. Neither the name of the copyright holder nor the +### names of its contributors may be used to endorse or promote products +### derived from this software without specific prior written permission. +### +################################################################################ +### +### THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +### AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +### IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +### ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +### LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +### CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +### SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +### INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +### CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +### ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +### POSSIBILITY OF SUCH DAMAGE. +### @endcond +################################################################################ + +# List all topics here that should be included in the release notes. +SET(FWUPD_TOPICS APE Stage1) + +# Convert to lower case while preserving original case. +FOREACH(TOPIC IN LISTS FWUPD_TOPICS) + STRING(TOLOWER "${TOPIC}" TOPIC_LOWER) + SET(FWUPD_${TOPIC_LOWER}_NAME ${TOPIC}) +ENDFOREACH() +STRING(TOLOWER "${FWUPD_TOPICS}" FWUPD_TOPICS) + +STRING(REPLACE "\n" ";" CHANGELIST ${CHANGELOG}) + +# Sort the changelog by topics. +FOREACH(CHANGE IN LISTS CHANGELIST) + # Find changes in the format of "topic: subject (#GHID)" + STRING(REGEX MATCHALL "([^:]*):[ \t\r\n]*(.*)(\\(#[0-9]*\\))" FOUND "${CHANGE}") + + IF(FOUND) + SET(TOPIC ${CMAKE_MATCH_1}) + SET(SUBJECT ${CMAKE_MATCH_2}) + SET(GITHUB_ID ${CMAKE_MATCH_3}) + ELSE() + # Find changes in the format of "topic: subject" + STRING(REGEX MATCHALL "([^:]*):[ \t\r\n]*(.*)" FOUND "${CHANGE}") + SET(TOPIC ${CMAKE_MATCH_1}) + SET(SUBJECT ${CMAKE_MATCH_2}) + SET(GITHUB_ID False) + ENDIF() + + STRING(TOLOWER "${TOPIC}" TOPIC) + + IF(TOPIC IN_LIST FWUPD_TOPICS) + string(STRIP ${CMAKE_MATCH_2} CMAKE_MATCH_2) + LIST(APPEND FWUPD_CHANGELOG_${TOPIC} ${CMAKE_MATCH_2}) + ENDIF() +ENDFOREACH() + +SET(FWUPD_CHANGELOG ) +FOREACH(TOPIC IN LISTS FWUPD_TOPICS) + IF(FWUPD_CHANGELOG_${TOPIC}) + LIST(APPEND FWUPD_CHANGELOG " <p>${FWUPD_${TOPIC}_NAME} Changes:</p>") + LIST(APPEND FWUPD_CHANGELOG " <ul>") + FOREACH(CHANGE IN LISTS FWUPD_CHANGELOG_${TOPIC}) + LIST(APPEND FWUPD_CHANGELOG " <li>${CHANGE}</li>") + ENDFOREACH() + LIST(APPEND FWUPD_CHANGELOG " </ul>") + ENDIF() +ENDFOREACH() +STRING(REPLACE ";" "\n" FWUPD_CHANGELOG "${FWUPD_CHANGELOG}") diff --git a/fwupd/metainfo.xml.in b/fwupd/metainfo.xml.in new file mode 100644 index 0000000..6ce34b4 --- /dev/null +++ b/fwupd/metainfo.xml.in @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Copyright 2020 Evan Lojewski <github@meklort.com> --> +<component type="firmware"> + <id>@APP_STREAM_PREFIX@.@TARGET_ID@</id> + <name>BCM5719</name> + <summary>Firmware for the @TARGET_NAME@ BCM5719 NIC</summary> + <branch>oss-firmware</branch> + <description> + <p> + This is an alternate firmware built by the community using only free + software tools. + </p> + </description> + + <provides> + <firmware type="flashed">@FIRMWARE_ID@</firmware> + </provides> + + <url type="homepage">https://github.com/meklort/bcm5719-fw</url> + + <metadata_license>CC0-1.0</metadata_license> + <project_license>BSD-3-Clause</project_license> + <developer_name>Evan Lojewski</developer_name> + + <releases> + <release version="@VERSION_STRING@" date="@VERSION_DATE@" install_duration="120" urgency="low"> + <checksum filename="@TARGET_ID@-@APE_VARIANT@.@VERSION_STRING@.fw" target="content"/> + <description> + @DESCRIPTION@ + </description> + </release> + </releases> + + <categories> + <category>X-Device</category> + </categories> + + <requires> + <!-- Restrict to fwupd >= 1.5.0 --> + <id compare="ge" version="1.5.0">org.freedesktop.fwupd</id> + <client>switch-branch</client> + @HARDWARE_FILTER@ + </requires> + + <custom> + <value key="LVFS::UpdateProtocol">com.broadcom.bcm57xx</value> + <value key="LVFS::VersionFormat">triplet</value> + </custom> + + <!-- these keywords are optional and are used for searching --> + <keywords> + <keyword>bcm5719</keyword> + <keyword>ape</keyword> + <keyword>@TARGET_ID@</keyword> + </keywords> +</component> |