Only one RW image is now the default

And if RW B isn't enabled, it's not even linked.

BUG=chrome-os-partner:10881
TEST=on link, should be no B image, and 'sysjump B' should fail
On BDS, still should be A and B images

Signed-off-by: Randall Spangler <rspangler@chromium.org>
Change-Id: Icb2af07881cc7e28b9b877f45824486a22fde8d7
Reviewed-on: https://gerrit.chromium.org/gerrit/26116
This commit is contained in:
Randall Spangler
2012-06-26 09:48:04 -07:00
committed by Gerrit
parent 90afebac64
commit fb123b4838
13 changed files with 58 additions and 30 deletions

View File

@@ -48,16 +48,21 @@ cmd_sign = vbutil_ec --sign $@ \
--signpubkey $(VBOOT_DEVKEYS)/ec_root_key.vbpubk \
$(silent)
cmd_mv = mv $^ $@
cmd_extractab = cd $(out) && \
dump_fmap -x $(PROJECT).bin.tmp RW_SECTION_A RW_SECTION_B $(silent) && \
mv RW_SECTION_A $(PROJECT).A.bin && mv RW_SECTION_B $(PROJECT).B.bin
cmd_copyab = cd $(out) && cp $(PROJECT).A.flat $(PROJECT).A.bin && \
cp $(PROJECT).B.flat $(PROJECT).B.bin
cmd_extractab-y = cd $(out) && \
dump_fmap -x $(PROJECT).bin.tmp RW_SECTION_A $(silent) && \
mv RW_SECTION_A $(PROJECT).A.bin
cmd_extractab-$(CONFIG_RW_B) += && \
dump_fmap -x $(PROJECT).bin.tmp RW_SECTION_B $(silent) && \
mv RW_SECTION_B $(PROJECT).B.bin
cmd_copyab-y = cd $(out) && cp $(PROJECT).A.flat $(PROJECT).A.bin
cmd_copyab-$(CONFIG_RW_B) += && cp $(PROJECT).B.flat $(PROJECT).B.bin
.PHONY: all tests utils
all: $(out)/$(PROJECT).bin utils
dis: $(foreach s,A B RO,$(out)/$(PROJECT).$(s).dis)
dis-y = $(out)/$(PROJECT).RO.dis $(out)/$(PROJECT).A.dis
dis-$(CONFIG_RW_B) += $(out)/$(PROJECT).B.dis
dis: $(dis-y)
utils: $(build-utils) $(host-utils)
@@ -88,11 +93,13 @@ $(out)/%.bin: $(out)/%.bin.tmp
$(out)/%.bin.tmp: $(out)/%.obj
$(call quiet,obj_to_bin,OBJCOPY)
$(if $(sign-y),$(call quiet,sign,SIGN ),)
$(if $(sign-y),$(call quiet,extractab,EXTR_AB), \
$(call quiet,copyab,COPY_AB))
$(if $(sign-y),$(call quiet,extractab-y,EXTR_AB), \
$(call quiet,copyab-y,COPY_AB))
$(out)/%.obj: common/firmware_image.S $(out)/firmware_image.lds \
$(out)/%.RO.flat $(out)/%.A.flat $(out)/%.B.flat
flat-y = $(out)/$(PROJECT).RO.flat $(out)/$(PROJECT).A.flat
flat-$(CONFIG_RW_B) += $(out)/$(PROJECT).B.flat
$(out)/%.obj: common/firmware_image.S $(out)/firmware_image.lds $(flat-y)
$(call quiet,flat_to_obj,CAT )
$(out)/%.dis: $(out)/%.elf

View File

@@ -10,10 +10,13 @@
/* Optional features */
#define CONFIG_CONSOLE_CMDHELP
#define CONFIG_RW_B /* RW firmware A *and* B */
#define CONFIG_SYSTEM_UNLOCKED /* Allow dangerous commands */
#define CONFIG_VBOOT
#define CONFIG_VBOOT_SIG
#ifndef __ASSEMBLER__
enum adc_channel
{
ADC_CH_EC_TEMP = 0, /* EC internal die temperature in degrees K. */
@@ -44,4 +47,6 @@ enum gpio_signal {
void configure_board(void);
#endif /* !__ASSEMBLER__ */
#endif /* __BOARD_H */

View File

@@ -24,6 +24,8 @@
* Once we complete the vboot and autoupdate, we should remove this. */
#define CONFIG_SYSTEM_UNLOCKED
#ifndef __ASSEMBLER__
/* By default, enable all console messages except keyboard */
#define CC_DEFAULT (CC_ALL & ~CC_MASK(CC_KEYSCAN))
@@ -101,4 +103,6 @@ void board_interrupt_host(int active);
/* Auto detect EC i2c host port */
int board_i2c_host_port(void);
#endif /* !__ASSEMBLER__ */
#endif /* __BOARD_H */

View File

@@ -31,6 +31,8 @@
/* Enable the fake developer switch. See crosbug.com/p/8884 */
#define CONFIG_FAKE_DEV_SWITCH
#ifndef __ASSEMBLER__
/* Fan PWM channels */
#define FAN_CH_CPU 0 /* CPU fan */
#define FAN_CH_KBLIGHT 1 /* Keyboard backlight */
@@ -238,4 +240,6 @@ enum board_version {
void configure_board(void);
#endif /* !__ASSEMBLER__ */
#endif /* __BOARD_H */

View File

@@ -31,6 +31,8 @@
* Once we complete the vboot and autoupdate, we should remove this. */
#define CONFIG_SYSTEM_UNLOCKED
#ifndef __ASSEMBLER__
/* By default, enable all console messages except keyboard */
#define CC_DEFAULT (CC_ALL & ~CC_MASK(CC_KEYSCAN))
@@ -105,4 +107,6 @@ void board_interrupt_host(int active);
/* Auto detect EC i2c host port */
int board_i2c_host_port(void);
#endif /* !__ASSEMBLER__ */
#endif /* __BOARD_H */

View File

@@ -13,8 +13,6 @@
/* Size of one firmware image in flash */
#define CONFIG_FW_IMAGE_SIZE (32 * 1024)
#define CONFIG_NO_RW_B
#define CONFIG_FW_RO_OFF 0
#define CONFIG_FW_RO_SIZE CONFIG_FW_IMAGE_SIZE
#define CONFIG_FW_A_OFF CONFIG_FW_IMAGE_SIZE
@@ -27,11 +25,11 @@
#define CONFIG_SECTION_A_OFF CONFIG_FW_A_OFF
#define CONFIG_SECTION_A_SIZE CONFIG_FW_A_SIZE
#define CONFIG_SECTION_B_OFF CONFIG_FW_B_OFF
#ifdef CONFIG_NO_RW_B
#define CONFIG_SECTION_B_SIZE 0
#else /* CONFIG_NO_RW_B */
#ifdef CONFIG_RW_B
#define CONFIG_SECTION_B_SIZE CONFIG_FW_B_SIZE
#endif /* CONFIG_NO_RW_B */
#else /* CONFIG_RW_B */
#define CONFIG_SECTION_B_SIZE 0
#endif /* CONFIG_RW_B */
/* no keys for now */
#define CONFIG_VBOOT_ROOTKEY_OFF (CONFIG_FW_RO_OFF + CONFIG_FW_RO_SIZE)

View File

@@ -1,10 +1,11 @@
/* Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
* Build the full image with 3 copies (Read only, A, B) of the program
* Build the full image with up to 3 copies (Read only, A, B) of the program
*/
#include "board.h"
#include "config.h"
#define FW_FILE(builddir,proj,sect) builddir##/##proj##.##sect##.flat
@@ -20,7 +21,7 @@
.section .image.A, "ax"
.incbin FW_IMAGE(A)
#ifndef CONFIG_NO_RW_B
#ifdef CONFIG_RW_B
/* Read Write firmware copy B */
.section .image.B, "ax"
.incbin FW_IMAGE(B)

View File

@@ -3,6 +3,7 @@
* found in the LICENSE file.
*/
#include "board.h"
#include "config.h"
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
@@ -22,7 +23,7 @@ SECTIONS
*(.image.A)
BYTE(0xEA) /* Mark end explicitly */
} > FLASH =0xff
#ifndef CONFIG_NO_RW_B
#ifdef CONFIG_RW_B
. = ALIGN(CONFIG_FLASH_BANK_SIZE);
.image.B : AT(CONFIG_FLASH_BASE + CONFIG_SECTION_B_OFF) {
*(.image.B)

View File

@@ -6,6 +6,7 @@
#include <stddef.h>
#include <stdint.h>
#include "board.h"
#include "config.h"
#include "version.h"
@@ -150,7 +151,7 @@ const struct _ec_fmap {
.area_flags = FMAP_AREA_STATIC,
},
#ifndef CONFIG_NO_RW_B
#ifdef CONFIG_RW_B
/* Firmware B */
{
.area_name = "RW_SECTION_B",
@@ -178,6 +179,6 @@ const struct _ec_fmap {
.area_size = CONFIG_VBLOCK_SIZE,
.area_flags = FMAP_AREA_STATIC,
},
#endif /* CONFIG_NO_RW_B */
#endif /* CONFIG_RW_B */
}
};

View File

@@ -7,6 +7,7 @@
#include "board.h"
#include "clock.h"
#include "config.h"
#include "console.h"
#include "ec_commands.h"
#include "flash.h"
@@ -294,7 +295,7 @@ static uint32_t get_base(enum system_image_copy_t copy)
return CONFIG_FLASH_BASE + CONFIG_FW_RO_OFF;
case SYSTEM_IMAGE_RW_A:
return CONFIG_FLASH_BASE + CONFIG_FW_A_OFF;
#ifndef CONFIG_NO_RW_B
#ifdef CONFIG_RW_B
case SYSTEM_IMAGE_RW_B:
return CONFIG_FLASH_BASE + CONFIG_FW_B_OFF;
#endif
@@ -311,7 +312,7 @@ static uint32_t get_size(enum system_image_copy_t copy)
return CONFIG_FW_RO_SIZE;
case SYSTEM_IMAGE_RW_A:
return CONFIG_FW_A_SIZE;
#ifndef CONFIG_NO_RW_B
#ifdef CONFIG_RW_B
case SYSTEM_IMAGE_RW_B:
return CONFIG_FW_B_SIZE;
#endif

View File

@@ -5,6 +5,8 @@
/* Verified boot module for Chrome EC */
#include "board.h"
#include "config.h"
#include "console.h"
#include "eoption.h"
#include "host_command.h"

View File

@@ -150,9 +150,7 @@ int vboot_check_signature(void)
CPRINTF("[Image A is invalid]\n");
}
#ifdef CONFIG_NO_RW_B
CPRINTF("[Vboot no image B to check]\n");
#else
#ifdef CONFIG_RW_B
CPRINTF("[%T Vboot check image B...]\n");
ts1 = get_time();
@@ -177,7 +175,9 @@ int vboot_check_signature(void)
default:
CPRINTF("[Image B is invalid]\n");
}
#endif
#else /* CONFIG_RW_B */
CPRINTF("[Vboot no image B to check]\n");
#endif /* CONFIG_RW_B */
bad:
CPRINTF("[Staying in RO mode]\n");

View File

@@ -135,10 +135,10 @@ int main(int argc, char *argv[])
if (comm_init() < 0)
return -3;
#ifndef CONFIG_NO_RW_B
#ifdef CONFIG_RW_B
flash_partition(EC_IMAGE_RW_B, data + CONFIG_FW_B_OFF,
CONFIG_FW_B_OFF, CONFIG_FW_B_SIZE);
#endif /* !CONFIG_NO_RW_B */
#endif /* CONFIG_RW_B */
flash_partition(EC_IMAGE_RW_A, data + CONFIG_FW_A_OFF,
CONFIG_FW_A_OFF, CONFIG_FW_A_SIZE);
flash_partition(EC_IMAGE_RO, data + CONFIG_FW_RO_OFF,