1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
7 SDESC[standard]= Intel and AMD CPUs microcode updates
11 DOWNLOAD_GROUPS= main amd
12 SITES[main]= GITHUB/intel:Intel-Linux-Processor-Microcode-Data-Files:microcode-20191115
13 SITES[amd]= FREELOCAL/sbruno
14 DISTFILE[1]= generated:main
15 DISTFILE[2]= amd64-microcode.20191021.tar.xz:amd
17 SPKGS[standard]= single
19 OPTIONS_AVAILABLE= none
20 OPTIONS_STANDARD= none
22 ONLY_FOR_OPSYS= freebsd dragonfly
27 LICENSE= CUSTOM1:single
28 LICENSE_NAME= CUSTOM1:"Intel Software License Agreement"
29 LICENSE_FILE= CUSTOM1:{{FILESDIR}}/LICENSE
32 FPC_EQUIVALENT= sysutils/devcpu-data
34 RC_SUBR= microcode_update:single
37 ${INSTALL_DATA} ${FILESDIR}/ucode-split.c ${WRKSRC}
38 ${SED} -e 's|%%GH_TAGNAME%%|microcode-20191115|' ${FILESDIR}/Makefile \
40 ${CAT} ${WRKSRC}/intel-ucode/* ${WRKSRC}/intel-ucode-with-caveats/* \
41 > ${WRKSRC}/intel-ucode.bin
44 ${MKDIR} ${STAGEDIR}${PREFIX}/share/cpucontrol \
45 ${STAGEDIR}/boot/firmware
46 ${INSTALL_DATA} ${WRKSRC}/mcodes/* ${STAGEDIR}${PREFIX}/share/cpucontrol
47 (cd ${WRKDIR}/${NAMEBASE}_2 && \
48 ${INSTALL_DATA} microcode_amd.bin microcode_amd_fam1[567]h.bin \
49 ${STAGEDIR}${PREFIX}/share/cpucontrol)
50 ${INSTALL_DATA} ${WRKSRC}/intel-ucode.bin ${STAGEDIR}/boot/firmware
52 [FILE:154:descriptions/desc.single]
53 This port supplies microcode updates for use with cpuctl(4) microcode
54 update facility. These could be used to keep your processor's firmware
59 14b26d27be70774948b8cb582e298f5317263b8b8bb1fe8e41260eae54f531dc 2998063 intel-Intel-Linux-Processor-Microcode-Data-Files-microcode-20191115.tar.gz
60 077426150f52964e829fa31ddd5866e7b902746bea3fcd339b8d5cb761c1039a 22232 amd64-microcode.20191021.tar.xz
63 [FILE:2577:manifests/plist.single]
64 /boot/firmware/intel-ucode.bin
254 microcode_amd_fam15h.bin
255 microcode_amd_fam16h.bin
256 microcode_amd_fam17h.bin
259 [FILE:7134:files/LICENSE]
260 The terms of the software license agreement included with any software you download will control your use of the software.
262 INTEL SOFTWARE LICENSE AGREEMENT
264 IMPORTANT - READ BEFORE COPYING, INSTALLING OR USING.
265 Do not use or load this software and any associated materials (collectively,
266 the "Software") until you have carefully read the following terms and
267 conditions. By loading or using the Software, you agree to the terms of this
268 Agreement. If you do not wish to so agree, do not install or use the Software.
270 LICENSES: Please Note:
271 - If you are a network administrator, the "Site License" below shall
273 - If you are an end user, the "Single User License" shall apply to you.
274 - If you are an original equipment manufacturer (OEM), the "OEM License"
277 SITE LICENSE. You may copy the Software onto your organization's computers
278 for your organization's use, and you may make a reasonable number of
279 back-up copies of the Software, subject to these conditions:
281 1. This Software is licensed for use only in conjunction with Intel
282 component products. Use of the Software in conjunction with non-Intel
283 component products is not licensed hereunder.
284 2. You may not copy, modify, rent, sell, distribute or transfer any part
285 of the Software except as provided in this Agreement, and you agree to
286 prevent unauthorized copying of the Software.
287 3. You may not reverse engineer, decompile, or disassemble the Software.
288 4. You may not sublicense or permit simultaneous use of the Software by
290 5. The Software may include portions offered on terms in addition to those
291 set out here, as set out in a license accompanying those portions.
293 SINGLE USER LICENSE. You may copy the Software onto a single computer for
294 your personal, noncommercial use, and you may make one back-up copy of the
295 Software, subject to these conditions:
297 1. This Software is licensed for use only in conjunction with Intel
298 component products. Use of the Software in conjunction with non-Intel
299 component products is not licensed hereunder.
300 2. You may not copy, modify, rent, sell, distribute or transfer any part
301 of the Software except as provided in this Agreement, and you agree to
302 prevent unauthorized copying of the Software.
303 3. You may not reverse engineer, decompile, or disassemble the Software.
304 4. You may not sublicense or permit simultaneous use of the Software by
306 5. The Software may include portions offered on terms in addition to those
307 set out here, as set out in a license accompanying those portions.
309 OEM LICENSE: You may reproduce and distribute the Software only as an
310 integral part of or incorporated in Your product or as a standalone
311 Software maintenance update for existing end users of Your products,
312 excluding any other standalone products, subject to these conditions:
314 1. This Software is licensed for use only in conjunction with Intel
315 component products. Use of the Software in conjunction with non-Intel
316 component products is not licensed hereunder.
317 2. You may not copy, modify, rent, sell, distribute or transfer any part
318 of the Software except as provided in this Agreement, and you agree to
319 prevent unauthorized copying of the Software.
320 3. You may not reverse engineer, decompile, or disassemble the Software.
321 4. You may only distribute the Software to your customers pursuant to a
322 written license agreement. Such license agreement may be a "break-the-
323 seal" license agreement. At a minimum such license shall safeguard
324 Intel's ownership rights to the Software.
325 5. The Software may include portions offered on terms in addition to those
326 set out here, as set out in a license accompanying those portions.
328 NO OTHER RIGHTS. No rights or licenses are granted by Intel to You, expressly
329 or by implication, with respect to any proprietary information or patent,
330 copyright, mask work, trademark, trade secret, or other intellectual property
331 right owned or controlled by Intel, except as expressly provided in this
334 OWNERSHIP OF SOFTWARE AND COPYRIGHTS. Title to all copies of the Software
335 remains with Intel or its suppliers. The Software is copyrighted and
336 protected by the laws of the United States and other countries, and
337 international treaty provisions. You may not remove any copyright notices
338 from the Software. Intel may make changes to the Software, or to items
339 referenced therein, at any time without notice, but is not obligated to
340 support or update the Software. Except as otherwise expressly provided, Intel
341 grants no express or implied right under Intel patents, copyrights,
342 trademarks, or other intellectual property rights. You may transfer the
343 Software only if the recipient agrees to be fully bound by these terms and if
344 you retain no copies of the Software.
346 LIMITED MEDIA WARRANTY. If the Software has been delivered by Intel on
347 physical media, Intel warrants the media to be free from material physical
348 defects for a period of ninety days after delivery by Intel. If such a defect
349 is found, return the media to Intel for replacement or alternate delivery of
350 the Software as Intel may select.
352 EXCLUSION OF OTHER WARRANTIES. EXCEPT AS PROVIDED ABOVE, THE SOFTWARE IS
353 PROVIDED "AS IS" WITHOUT ANY EXPRESS OR IMPLIED WARRANTY OF ANY KIND
354 INCLUDING WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT, OR FITNESS FOR A
355 PARTICULAR PURPOSE. Intel does not warrant or assume responsibility for the
356 accuracy or completeness of any information, text, graphics, links or other
357 items contained within the Software.
359 LIMITATION OF LIABILITY. IN NO EVENT SHALL INTEL OR ITS SUPPLIERS BE LIABLE
360 FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, LOST PROFITS,
361 BUSINESS INTERRUPTION, OR LOST INFORMATION) ARISING OUT OF THE USE OF OR
362 INABILITY TO USE THE SOFTWARE, EVEN IF INTEL HAS BEEN ADVISED OF THE
363 POSSIBILITY OF SUCH DAMAGES. SOME JURISDICTIONS PROHIBIT EXCLUSION OR
364 LIMITATION OF LIABILITY FOR IMPLIED WARRANTIES OR CONSEQUENTIAL OR INCIDENTAL
365 DAMAGES, SO THE ABOVE LIMITATION MAY NOT APPLY TO YOU. YOU MAY ALSO HAVE
366 OTHER LEGAL RIGHTS THAT VARY FROM JURISDICTION TO JURISDICTION.
368 TERMINATION OF THIS AGREEMENT. Intel may terminate this Agreement at any time
369 if you violate its terms. Upon termination, you will immediately destroy the
370 Software or return all copies of the Software to Intel.
372 APPLICABLE LAWS. Claims arising under this Agreement shall be governed by the
373 laws of California, excluding its principles of conflict of laws and the
374 United Nations Convention on Contracts for the Sale of Goods. You may not
375 export the Software in violation of applicable export laws and regulations.
376 Intel is not obligated under any other agreements unless they are in writing
377 and signed by an authorized representative of Intel.
379 GOVERNMENT RESTRICTED RIGHTS. The Software is provided with "RESTRICTED
380 RIGHTS." Use, duplication, or disclosure by the Government is subject to
381 restrictions as set forth in FAR52.227-14 and DFAR252.227-7013 et seq. or its
382 successor. Use of the Software by the Government constitutes acknowledgment
383 of Intel's proprietary rights therein. Contractor or Manufacturer is Intel
384 2200 Mission College Blvd., Santa Clara, CA 95052.
387 [FILE:505:files/Makefile]
388 # $FreeBSD: head/sysutils/devcpu-data/files/Makefile 470620 2018-05-22 15:09:38Z sbruno $
390 INTEL_UCODE= intel-ucode
395 mkdir -p $(OUTPUT_DIR)
396 cd ${OUTPUT_DIR} && \
398 ../${INTEL_UCODE}/[0-9,a-f][0-9,a-f]-[0-9,a-f][0-9,a-f]-[0-9,a-f][0-9,a-f]; do \
399 ../ucode-split $$file; \
402 # Use the host cc to compile ucode-split in case of cross-compile
403 ucode-split: ucode-split.c
404 cc ucode-split.c -o $@
407 rm -rf $(OUTPUT_DIR) ucode-split
410 [FILE:2227:files/microcode_update.in]
413 # $FreeBSD: head/sysutils/devcpu-data/files/microcode_update.in 459084 2018-01-15 17:05:37Z swills $
416 # PROVIDE: microcode_update
417 # REQUIRE: root mountcritlocal
422 # Add the following line to /etc/rc.conf to enable flow-capture:
423 # microcode_update_enable (bool): Set it to "YES" to update microcode on startup
424 # Set to "NO" by default.
425 # microcode_update_datadir (str): Directory, microcode updates stored in.
426 # Default is "%%DATADIR%%"
427 # microcode_update_cpus (str): A list of cpus to update on startup, or "ALL" for all.
428 # Example: microcode_update_cpus_cpus="0 CPU0"
429 # Set to "ALL" by default.
430 # microcode_update_flags (str): Flags for cpucontrol(8).
434 name="microcode_update"
435 rcvar=microcode_update_enable
437 start_precmd="microcode_update_prepare"
438 start_cmd="microcode_update_start"
439 requires_modules="cpuctl"
441 CMT="/usr/sbin/cpucontrol"
443 microcode_update_prepare()
445 if ! kldstat -q -m cpuctl; then
446 if ! kldload cpuctl > /dev/null 2>&1; then
447 warn "Can't load cpuctl module."
453 microcode_update_start()
455 echo "Updating CPU Microcode..."
456 if [ "${microcode_cpus}" = "ALL" ]; then
457 ncpu=`/sbin/sysctl -n hw.ncpu`
458 cpus=`jot ${ncpu} 0`;
460 cpus=${microcode_cpus}
463 ${CMT} -u ${microcode_update_flags} \
464 -d "${microcode_update_datadir}" /dev/cpuctl${i} 2>&1 | \
465 logger -p daemon.notice -t microcode_update || \
466 (echo "Microcode Update Failed." && exit 1)
468 if [ "${microcode_cpus}" = "ALL" ]; then
469 CPUCONTROL_UPDATED=$(cpucontrol -h 2>&1 | grep -q -- -e; echo $?)
470 if [ ${CPUCONTROL_UPDATED} -ne 0 ]; then
471 echo "Please update your system in order to update CPU microcode."
473 ${CMT} -e /dev/cpuctl0 >/dev/null 2>&1
474 if [ $? -ne 0 ]; then
475 echo "Re-evalulation of CPU flags Failed."
486 : ${microcode_update_enable="NO"}
487 : ${microcode_update_datadir="%%DATADIR%%"}
488 : ${microcode_cpus="ALL"}
489 : ${microcode_update_flags=""}
494 [FILE:5668:files/ucode-split.c]
496 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
498 * Copyright (C) 2018 The FreeBSD Foundation.
500 * Redistribution and use in source and binary forms, with or without
501 * modification, are permitted provided that the following conditions
503 * 1. Redistributions of source code must retain the above copyright
504 * notice, this list of conditions and the following disclaimer.
505 * 2. Redistributions in binary form must reproduce the above copyright
506 * notice, this list of conditions and the following disclaimer in the
507 * documentation and/or other materials provided with the distribution.
509 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
510 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
511 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
512 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
513 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
514 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
515 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
516 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
517 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
518 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
521 * $FreeBSD: head/sysutils/devcpu-data/files/ucode-split.c 470255 2018-05-18 01:28:23Z sbruno $
533 static const size_t bufsize = 65536;
535 /* SDM vol 3 9.11.1 Intel microcode header. */
536 struct microcode_update_header {
537 uint32_t header_version;
538 uint32_t update_revision;
539 uint32_t date; /* BCD mmddyyyy */
540 uint32_t processor_signature;
541 uint32_t checksum; /* Over update data and header */
542 uint32_t loader_revision;
543 uint32_t processor_flags;
546 uint32_t reserved[3];
550 * SDM vol 2A CPUID EAX = 01h Returns Model, Family, Stepping Information.
551 * Caller must free the returned string.
555 format_signature(uint32_t signature)
558 unsigned family, model, stepping;
560 family = (signature & 0xf00) >> 8;
561 model = (signature & 0xf0) >> 4;
562 stepping = signature & 0xf;
563 if (family == 0x06 || family == 0x0f)
564 model += (signature & 0xf0000) >> 12;
566 family += (signature & 0xff00000) >> 20;
567 asprintf(&buf, "%02x-%02x-%02x", family, model, stepping);
574 dump_header(const struct microcode_update_header *hdr)
578 bool platformid_printed;
580 sig_str = format_signature(hdr->processor_signature);
581 printf("header version\t0x%x\n", hdr->header_version);
582 printf("revision\t0x%x\n", hdr->update_revision);
583 printf("date\t\t0x%x\t%04x-%02x-%02x\n", hdr->date,
584 hdr->date & 0xffff, (hdr->date & 0xff000000) >> 24,
585 (hdr->date & 0xff0000) >> 16);
586 printf("signature\t0x%x\t\t%s\n", hdr->processor_signature, sig_str);
587 printf("checksum\t0x%x\n", hdr->checksum);
588 printf("loader revision\t0x%x\n", hdr->loader_revision);
589 printf("processor flags\t0x%x", hdr->processor_flags);
590 platformid_printed = false;
591 for (i = 0; i < 8; i++) {
592 if (hdr->processor_flags & 1 << i) {
593 printf("%s%d", platformid_printed ? ", " : "\t\t", i);
594 platformid_printed = true;
598 printf("datasize\t0x%x\t\t0x%x\n", hdr->data_size,
599 hdr->data_size != 0 ? hdr->data_size : 2000);
600 printf("size\t\t0x%x\t\t0x%x\n", hdr->total_size,
601 hdr->total_size != 0 ? hdr->total_size : 2048);
609 printf("ucode-split [-v] microcode_file\n");
614 main(int argc, char *argv[])
616 struct microcode_update_header hdr;
617 char *buf, *output_file, *sig_str;
624 while ((c = getopt(argc, argv, "v")) != -1) {
639 ifd = open(argv[0], O_RDONLY);
643 buf = malloc(bufsize);
649 rv = read(ifd, &hdr, sizeof(hdr));
652 } else if (rv == 0) {
654 } else if (rv < (ssize_t)sizeof(hdr)) {
655 errx(1, "invalid microcode header");
657 if (hdr.header_version != 1)
658 errx(1, "invalid header version");
663 sig_str = format_signature(hdr.processor_signature);
664 asprintf(&output_file, "%s.%02x", sig_str,
665 hdr.processor_flags & 0xff);
667 if (output_file == NULL)
669 ofd = open(output_file, O_WRONLY | O_CREAT | O_TRUNC, 0600);
674 rv = write(ofd, &hdr, sizeof(hdr));
675 if (rv < (ssize_t)sizeof(hdr))
679 resid = (hdr.total_size != 0 ? hdr.total_size : 2048) -
681 if (resid > 1 << 24) /* Arbitrary chosen maximum size. */
682 errx(1, "header total_size too large");
684 len = resid < bufsize ? resid : bufsize;
685 rv = read(ifd, buf, len);
688 else if (rv < (ssize_t)len)
689 errx(1, "truncated microcode data");
690 if (write(ofd, buf, len) < (ssize_t)len)
695 printf("written to %s\n\n", output_file);