summaryrefslogtreecommitdiffstats
path: root/fwupd/CMakeLists.txt
blob: 8e41194f3d172c621f57fbcf1e6c09c6f4fac4d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
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
)
OpenPOWER on IntegriCloud