1## Code Update 2 3#### Redfish Code Update 4 5Currently supported BMC and PNOR update formats are UBI. For code update 6information, please refer to 7[code-update.md](https://github.com/openbmc/docs/blob/master/code-update/code-update.md) 8 9- UBI Format 10 11 For BMC code update, download the system type \*.ubi.mdt.tar image from 12 https://jenkins.openbmc.org/job/latest-master/ and run as follows: 13 14 For Witherspoon system: 15 16 ``` 17 * Code Update with OnReset Policy 18 19 $ cd redfish/update_service/test_redfish_bmc_code_update.robot 20 $ robot -v OPENBMC_HOST:x.x.x.x -v IMAGE_FILE_PATH:<image path>/obmc-phosphor-image-witherspoon.ubi.mtd.tar --include Redfish_Code_Update_With_ApplyTime_OnReset redfish/update_service/test_redfish_bmc_code_update.robot 21 22 * Code Update with Immediate Policy 23 24 $ cd redfish/update_service/test_redfish_bmc_code_update.robot 25 $ robot -v OPENBMC_HOST:x.x.x.x -v IMAGE_FILE_PATH:<image path>/obmc-phosphor-image-witherspoon.ubi.mtd.tar --include Redfish_Code_Update_With_ApplyTime_Immediate redfish/update_service/test_redfish_bmc_code_update.robot 26 ``` 27 28 For host code update, download the system type \*.pnor.squashfs.tar image from 29 https://openpower.xyz/job/openpower-op-build/ and run as follows: 30 31 For Witherspoon system: 32 33 ``` 34 * Code Update with OnReset Policy 35 36 $ cd redfish/update_service/test_redfish_host_code_update.robot 37 $ robot -v OPENBMC_HOST:x.x.x.x -v IMAGE_FILE_PATH:<image path>/witherspoon.pnor.squashfs.tar --include Redfish_Code_Update_With_ApplyTime_OnReset redfish/update_service/test_redfish_host_code_update.robot 38 39 * Code Update with Immediate Policy 40 41 $ cd redfish/update_service/test_redfish_host_code_update.robot 42 $ robot -v OPENBMC_HOST:x.x.x.x -v IMAGE_FILE_PATH:<image path>/witherspoon.pnor.squashfs.tar --include Redfish_Code_Update_With_ApplyTime_Immediate redfish/update_service/test_redfish_host_code_update.robot 43 ``` 44 45#### REST Code Update 46 47Currently supported BMC and PNOR update formats are UBI and non-UBI. For code 48update information, please refer to 49[code-update.md](https://github.com/openbmc/docs/blob/master/code-update/code-update.md) 50 51- UBI Format 52 53 For BMC code update, download the system type \*.ubi.mdt.tar image from 54 https://jenkins.openbmc.org/job/latest-master/ and run as follows: 55 56 For Witherspoon system: 57 58 ``` 59 $ cd extended/code_update/ 60 $ robot -v OPENBMC_HOST:x.x.x.x -v IMAGE_FILE_PATH:<image path>/obmc-phosphor-image-witherspoon.ubi.mtd.tar --include REST_BMC_Code_Update bmc_code_update.robot 61 ``` 62 63 For host code update, download the system type \*.pnor.squashfs.tar image from 64 https://openpower.xyz/job/openpower-op-build/ and run as follows: 65 66 For Witherspoon system: 67 68 ``` 69 $ cd extended/code_update/ 70 $ robot -v OPENBMC_HOST:x.x.x.x -v IMAGE_FILE_PATH:<image path>/witherspoon.pnor.squashfs.tar --include REST_Host_Code_Update host_code_update.robot 71 ``` 72 73- Non-UBI Format 74 75 For BMC code update, download the system type \*all.tar image from 76 https://jenkins.openbmc.org/job/latest-master/ and run as follows: 77 78 For a Zaius system: 79 80 ``` 81 $ cd extended/code_update/ 82 $ robot -v OPENBMC_HOST:x.x.x.x -v FILE_PATH:<image path>/zaius-<date time>.all.tar --include Initiate_Code_Update_BMC update_bmc.robot 83 ``` 84 85 For host code update, download the system type \*.pnor from 86 https://openpower.xyz/job/openpower-op-build/ and run as follows: 87 88 For a Zaius system: 89 90 ``` 91 $ cd extended/ 92 $ robot -v OPENBMC_HOST:x.x.x.x -v PNOR_IMAGE_PATH:<image path>/zaius.pnor test_bios_update.robot 93 ``` 94 95#### Generating Bad Firmware Image for testing 96 97Procedure is to create bad firmware image for BMC and same steps applicable for 98Host image. 99 100- No MANIFEST file 101 102 ``` 103 Command to list the content of the firmware image. 104 105 tar -tvf obmc-phosphor-image-witherspoon-20210516025203.ubi.mtd.tar 106 -rw-r--r-- jenkins-op/jenkins-op 306804 2021-05-15 22:00 image-u-boot 107 -rw-r--r-- jenkins-op/jenkins-op 3039300 2021-05-12 03:32 image-kernel 108 -rw-r--r-- jenkins-op/jenkins-op 19861504 2021-05-15 22:00 image-rofs 109 -rw-r--r-- jenkins-op/jenkins-op 850304 2021-05-15 22:00 image-rwfs 110 -rw-r--r-- jenkins-op/jenkins-op 176 2021-05-15 22:00 MANIFEST 111 -rw-r--r-- jenkins-op/jenkins-op 272 2021-05-15 22:00 publickey 112 -rw-r--r-- jenkins-op/jenkins-op 128 2021-05-15 22:00 image-u-boot.sig 113 -rw-r--r-- jenkins-op/jenkins-op 128 2021-05-15 22:00 image-kernel.sig 114 -rw-r--r-- jenkins-op/jenkins-op 128 2021-05-15 22:00 image-rofs.sig 115 -rw-r--r-- jenkins-op/jenkins-op 128 2021-05-15 22:00 image-rwfs.sig 116 -rw-r--r-- jenkins-op/jenkins-op 128 2021-05-15 22:00 MANIFEST.sig 117 -rw-r--r-- jenkins-op/jenkins-op 128 2021-05-15 22:00 publickey.sig 118 -rw-r--r-- jenkins-op/jenkins-op 128 2021-05-15 22:00 image-full.sig 119 120 Delete MANIFEST file from the tar firmware image. 121 122 tar --delete -vf obmc-phosphor-image-witherspoon-20210516025203.ubi.mtd.tar MANIFEST 123 124 tar -tvf obmc-phosphor-image-witherspoon-20210516025203.ubi.mtd.tar 125 -rw-r--r-- jenkins-op/jenkins-op 306804 2021-05-15 22:00 image-u-boot 126 -rw-r--r-- jenkins-op/jenkins-op 3039300 2021-05-12 03:32 image-kernel 127 -rw-r--r-- jenkins-op/jenkins-op 19861504 2021-05-15 22:00 image-rofs 128 -rw-r--r-- jenkins-op/jenkins-op 850304 2021-05-15 22:00 image-rwfs 129 -rw-r--r-- jenkins-op/jenkins-op 272 2021-05-15 22:00 publickey 130 -rw-r--r-- jenkins-op/jenkins-op 128 2021-05-15 22:00 image-u-boot.sig 131 -rw-r--r-- jenkins-op/jenkins-op 128 2021-05-15 22:00 image-kernel.sig 132 -rw-r--r-- jenkins-op/jenkins-op 128 2021-05-15 22:00 image-rofs.sig 133 -rw-r--r-- jenkins-op/jenkins-op 128 2021-05-15 22:00 image-rwfs.sig 134 -rw-r--r-- jenkins-op/jenkins-op 128 2021-05-15 22:00 MANIFEST.sig 135 -rw-r--r-- jenkins-op/jenkins-op 128 2021-05-15 22:00 publickey.sig 136 -rw-r--r-- jenkins-op/jenkins-op 128 2021-05-15 22:00 image-full.sig 137 138 Command to re-name tar firmware image. 139 140 mv obmc-phosphor-image-witherspoon-20210516025203.ubi.mtd.tar bmc_bad_manifest.ubi.mtd.tar 141 ``` 142 143- No kernel image 144 145 ``` 146 Command to list the content of the firmware image. 147 148 tar -tvf obmc-phosphor-image-witherspoon-20210516025203.ubi.mtd.tar 149 -rw-r--r-- jenkins-op/jenkins-op 306804 2021-05-15 22:00 image-u-boot 150 -rw-r--r-- jenkins-op/jenkins-op 3039300 2021-05-12 03:32 image-kernel 151 -rw-r--r-- jenkins-op/jenkins-op 19861504 2021-05-15 22:00 image-rofs 152 -rw-r--r-- jenkins-op/jenkins-op 850304 2021-05-15 22:00 image-rwfs 153 -rw-r--r-- jenkins-op/jenkins-op 176 2021-05-15 22:00 MANIFEST 154 -rw-r--r-- jenkins-op/jenkins-op 272 2021-05-15 22:00 publickey 155 -rw-r--r-- jenkins-op/jenkins-op 128 2021-05-15 22:00 image-u-boot.sig 156 -rw-r--r-- jenkins-op/jenkins-op 128 2021-05-15 22:00 image-kernel.sig 157 -rw-r--r-- jenkins-op/jenkins-op 128 2021-05-15 22:00 image-rofs.sig 158 -rw-r--r-- jenkins-op/jenkins-op 128 2021-05-15 22:00 image-rwfs.sig 159 -rw-r--r-- jenkins-op/jenkins-op 128 2021-05-15 22:00 MANIFEST.sig 160 -rw-r--r-- jenkins-op/jenkins-op 128 2021-05-15 22:00 publickey.sig 161 -rw-r--r-- jenkins-op/jenkins-op 128 2021-05-15 22:00 image-full.sig 162 163 Delete image-kernel file from the tar firmware image. 164 165 tar --delete -vf obmc-phosphor-image-witherspoon-20210516025203.ubi.mtd.tar image-kernel 166 167 tar -tvf obmc-phosphor-image-witherspoon-20210516025203.ubi.mtd.tar 168 -rw-r--r-- jenkins-op/jenkins-op 306804 2021-05-15 22:00 image-u-boot 169 -rw-r--r-- jenkins-op/jenkins-op 19861504 2021-05-15 22:00 image-rofs 170 -rw-r--r-- jenkins-op/jenkins-op 850304 2021-05-15 22:00 image-rwfs 171 -rw-r--r-- jenkins-op/jenkins-op 176 2021-05-15 22:00 MANIFEST 172 -rw-r--r-- jenkins-op/jenkins-op 272 2021-05-15 22:00 publickey 173 -rw-r--r-- jenkins-op/jenkins-op 128 2021-05-15 22:00 image-u-boot.sig 174 -rw-r--r-- jenkins-op/jenkins-op 128 2021-05-15 22:00 image-kernel.sig 175 -rw-r--r-- jenkins-op/jenkins-op 128 2021-05-15 22:00 image-rofs.sig 176 -rw-r--r-- jenkins-op/jenkins-op 128 2021-05-15 22:00 image-rwfs.sig 177 -rw-r--r-- jenkins-op/jenkins-op 128 2021-05-15 22:00 MANIFEST.sig 178 -rw-r--r-- jenkins-op/jenkins-op 128 2021-05-15 22:00 publickey.sig 179 -rw-r--r-- jenkins-op/jenkins-op 128 2021-05-15 22:00 image-full.sig 180 181 Command to re-name tar firmware image. 182 183 mv obmc-phosphor-image-witherspoon-20210516025203.ubi.mtd.tar bmc_nokernel_image.ubi.mtd.tar 184 ``` 185 186- Invalid key image 187 188 ``` 189 Command to untar the firmware image. 190 191 tar -xvf obmc-phosphor-image-witherspoon-20210516025203.ubi.mtd.tar -C /directory_path/untar_files/ 192 image-u-boot 193 image-kernel 194 image-rofs 195 image-rwfs 196 MANIFEST 197 publickey 198 image-u-boot.sig 199 image-kernel.sig 200 image-rofs.sig 201 image-rwfs.sig 202 MANIFEST.sig 203 publickey.sig 204 image-full.sig 205 206 Change few random characters in public key file that in turn corrupts the public key file. 207 208 Command to tar the firmware image files. 209 210 tar -cvf bmc_invalid_key.ubi.mtd.tar * 211 ``` 212