Rename last_bl_blk to last_blk
PATCH v3 1/3 Rename last_bl_blk to last_blk
Also update the next_bct_blk. Then we have the correct pointer to the next block for the next image write.
---
Changes from v2:
- Add ack from Allen
---
--- src/cbootimage.h | 2 +- src/data_layout.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-)
src/cbootimage.h +1 -1
@@ -95,7 +95,7 @@ typedef struct build_image_context_recu_int8_t *bct;char *bct_filename; -u_int32_t last_bl_blk; +u_int32_t last_blk;u_int32_t bct_size;/* The BCT file size */ u_int32_t boot_data_version;/* The boot data version of BCT */ u_int8_t bct_init;/* The flag for the memory allocation of bct */
src/data_layout.c +2 -1
@@ -552,8 +552,9 @@ write_bootloaders(build_image_context *context) current_blk++; virtual_blk++; } - context->last_bl_blk = current_blk; + context->last_blk = current_blk; } + context->next_bct_blk = context->last_blk +1 ;free (buffer); }
Signature · 1 line
1.8.3.2
PATCH v3 2/3 Add Tegra132 support for the cbootimage utility
In reply to a message not in the archiveThis patch adds support for Tegra132. This are only slight differences between Tegra124 and Tegra132. The command line usage is exactly the same as other platforms like Tegra124.
The structure nvboot_mts_info is added into the bct for Tegra132. So the bootrom and first stage bootloader know where to load the preboot and mts images. Two parse items "Mts=" and "MtsPreboot=" are added to embedded MTS images in BCT image like what we do for bootloader. The syntax is also the same. For example:
MtsPreboot = <preboot_image>,<load_address>,<entry_address>,Complete;
Mts = <mts_image>,<load_address>,<entry_address>,Complete;
The load and entry addresses depned on your board design.
Four files are added in src/t132:
nvbctlib_t132.c - is cloned from nvbctlib_t124.c and adds mts
information getter and setter.nvboot_bct_t132.h - adds mts structure into bct nvboot_sdram_param_t132.h - clone of nvboot_sdram_param_t124.h parse_t132.c - clone of parse_t124.c
---
Changes from v2:
- Amend commit message by Allen's suggestion
Changes from v1:
- Amend commit message
- Add write_image to replace write_mts_image/write_bootloaders
- Minor style fixes
---
--- src/Makefile.am | 12 +- src/cbootimage.c | 9 +- src/cbootimage.h | 13 +- src/data_layout.c | 394 ++++++++---- src/data_layout.h | 5 +- src/parse.c | 63 +- src/parse.h | 77 ++- src/set.c | 22 +- src/set.h | 8 +- src/t132/nvbctlib_t132.c | 1241 ++++++++++++++++++++++++++++++++++++ src/t132/nvboot_bct_t132.h | 438 +++++++++++++ src/t132/nvboot_sdram_param_t132.h | 803 +++++++++++++++++++++++ src/t132/parse_t132.c | 429 +++++++++++++ 13 files changed, 3363 insertions(+), 151 deletions(-) create mode 100644 src/t132/nvbctlib_t132.c create mode 100644 src/t132/nvboot_bct_t132.h create mode 100644 src/t132/nvboot_sdram_param_t132.h create mode 100644 src/t132/parse_t132.c
src/Makefile.am +10 -2
@@ -11,10 +11,12 @@ cbootimage_SOURCES = \ aes_ref.c \ context.c \ parse.c \ + t132/parse_t132.c \ t124/parse_t124.c \ t114/parse_t114.c \ t30/parse_t30.c \ t20/parse_t20.c \ + t132/nvbctlib_t132.c \ t124/nvbctlib_t124.c \ t114/nvbctlib_t114.c \ t30/nvbctlib_t30.c \
@@ -33,7 +35,9 @@ cbootimage_SOURCES = \ t114/nvboot_bct_t114.h \ t114/nvboot_sdram_param_t114.h \ t124/nvboot_bct_t124.h \ - t124/nvboot_sdram_param_t124.h + t124/nvboot_sdram_param_t124.h \ + t132/nvboot_bct_t132.h \ + t132/nvboot_sdram_param_t132.h cbootimage_LDADD = -lm
@@ -45,10 +49,12 @@ bct_dump_SOURCES = \ aes_ref.c \ context.c \ parse.c \ + t132/parse_t132.c \ t124/parse_t124.c \ t114/parse_t114.c \ t30/parse_t30.c \ t20/parse_t20.c \ + t132/nvbctlib_t132.c \ t124/nvbctlib_t124.c \ t114/nvbctlib_t114.c \ t30/nvbctlib_t30.c \
@@ -67,4 +73,6 @@ bct_dump_SOURCES = \ t114/nvboot_bct_t114.h \ t114/nvboot_sdram_param_t114.h \ t124/nvboot_bct_t124.h \ - t124/nvboot_sdram_param_t124.h + t124/nvboot_sdram_param_t124.h \ + t132/nvboot_bct_t132.h \ + t132/nvboot_sdram_param_t132.h
src/cbootimage.c +6 -3
@@ -1,5 +1,5 @@/* -* Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. +* Copyright (c) 2012-2014, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License,
@@ -71,10 +71,11 @@ usage(void)printf (" -gbct Generate the new bct file.\n" );printf (" -o<ODM_DATA> Specify the odm_data(in hex).\n" );printf (" -t|--tegra NN Select target device. Must be one of:\n" ); -printf (" 20, 30, 114, 124.\n" ); +printf (" 20, 30, 114, 124, 132.\n" );printf (" Default: 20. This option is deprecated\n" );printf (" -s|--soc tegraNN Select target device. Must be one of:\n" ); -printf (" tegra20, tegra30, tegra114, tegra124.\n" ); +printf (" tegra20, tegra30, tegra114, tegra124,\n" ); +printf (" tegra132.\n" );printf (" Default: tegra20.\n" );printf (" -u|--update Copy input image data and update bct\n" );printf (" configs into new image file.\n" );
@@ -128,6 +129,8 @@ process_command_line(int argc, char *argv[], build_image_context *context)t114_get_soc_config (context, &g_soc_config); }else if (!strcasecmp ("124" , optarg)) {t124_get_soc_config (context, &g_soc_config); + }else if (!strcasecmp ("132" , optarg)) { +t132_get_soc_config (context, &g_soc_config); }else {printf ("Unsupported chipname!\n" );usage ();
src/cbootimage.h +11 -2
@@ -1,5 +1,5 @@/* -* Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. +* Copyright (c) 2012-2014, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License,
@@ -44,8 +44,11 @@#define BOOTDATA_VERSION_T30 NVBOOT_BOOTDATA_VERSION(0x3, 0x1)#define BOOTDATA_VERSION_T114 NVBOOT_BOOTDATA_VERSION(0x35, 0x1)#define BOOTDATA_VERSION_T124 NVBOOT_BOOTDATA_VERSION(0x40, 0x1) +#define BOOTDATA_VERSION_T132 NVBOOT_BOOTDATA_VERSION(0x13, 0x1) -#define NVBOOT_CONFIG_TABLE_SIZE_MAX 8192 +#define MAX_MTS_SIZE (4 * 1024 * 1024) + +#define NVBOOT_CONFIG_TABLE_SIZE_MAX 8704/* * Enumerations
@@ -55,6 +58,7 @@ typedef enum { file_type_bl =0 , file_type_bct, + file_type_mts, } file_type;/*
@@ -94,6 +98,11 @@ typedef struct build_image_context_recu_int8_t generate_bct;u_int8_t *bct; +char *mts_filename; +u_int32_t mts_load_addr; +u_int32_t mts_entry_point; +u_int32_t mts_attr; +char *bct_filename;u_int32_t last_blk;u_int32_t bct_size;/* The BCT file size */
src/data_layout.c +255 -139
533 lines not on this page · raw message
src/data_layout.h +4 -1
@@ -1,5 +1,5 @@/* -* Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. +* Copyright (c) 2012-2014, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License,
@@ -37,6 +37,9 @@ void destroy_block_list(blk_data_handle);int update_bl (struct build_image_context_rec *context); +int +update_mts_image (build_image_context *context); +void update_context (struct build_image_context_rec *context);
src/parse.c +62 -1
91 lines not on this page · raw message
src/parse.h +76 -1
158 lines not on this page · raw message
src/set.c +21 -1
@@ -1,5 +1,5 @@/* -* Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. +* Copyright (c) 2012-2014, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License,
@@ -123,6 +123,26 @@ set_bootloader(build_image_context *context,return update_bl (context); } +/* +* Processes commands to set a MTS image. +* +* @param context The main context pointer +* @param filename The file name of MTS image +* @param load_addr The load address value for MTS image +* @param entry_point The entry point value for MTS image +* @return 0 and 1 for success and failure +*/ +int +set_mts_image (build_image_context *context, +char *filename, +u_int32_t load_addr, +u_int32_t entry_point) +{ + context->mts_filename = filename; + context->mts_load_addr = load_addr; + context->mts_entry_point = entry_point; +return update_mts_image (context); +}#define DEFAULT () \ default: \ printf("Unexpected token %d at line %d\n", \
src/set.h +7 -1
@@ -1,5 +1,5 @@/* -* Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. +* Copyright (c) 2012-2014, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License,
@@ -36,6 +36,12 @@ set_bootloader(build_image_context *context, u_int32_t entry_point);int +set_mts_image (build_image_context *context, +char *filename, +u_int32_t load_addr, +u_int32_t entry_point); + +int context_set_value (build_image_context *context,parse_token token,void *value);
src/t132/nvbctlib_t132.c new file +1241 -0
1,241 lines not on this page · raw message
src/t132/nvboot_bct_t132.h new file +438 -0
438 lines not on this page · raw message
src/t132/nvboot_sdram_param_t132.h new file +803 -0
370 lines not on this page · raw message
src/t132/parse_t132.c new file +429 -0
429 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.8.3.2
Part of the diff is not shown here. View the raw message.
PATCH v3 3/3 Dump MTS information by bct_dump utility.
In reply to a message not in the archiveThe MTS is only for Tegra132 now.
---
Changes from v2:
- Add ack from Allen
Changes from v1:
- Rename start_block/load_address as start_blk/load_addr
---
--- src/bct_dump.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
src/bct_dump.c +40 -0
@@ -73,6 +73,16 @@ static value_data const bl_values[] = { { token_bl_attribute, "Attributes = ", format_u32_hex8 }, }; +static value_data const mts_values[] = { + { token_mts_info_version,"Version = " , format_u32_hex8 }, + { token_mts_info_start_blk,"Start block = " , format_u32 }, + { token_mts_info_start_page,"Start page = " , format_u32 }, + { token_mts_info_length,"Length = " , format_u32 }, + { token_mts_info_load_addr,"Load address = " , format_u32_hex8 }, + { token_mts_info_entry_point,"Entry point = " , format_u32_hex8 }, + { token_mts_info_attribute,"Attributes = " , format_u32_hex8 }, +}; +/*****************************************************************************/ static void format_u32_hex8 (char const * message,void * data) {
@@ -177,6 +187,7 @@ int main(int argc, char *argv[])u_int32_t bootloaders_used;u_int32_t parameters_used;u_int32_t sdram_used; +u_int32_t mts_used;nvboot_dev_type type;param_types data;int i;
@@ -234,6 +245,35 @@ int main(int argc, char *argv[]) } } +/* Display mts values */ + e = g_soc_config->get_value (token_mts_used, + &mts_used, + context.bct); + +if ((e ==0 ) && (mts_used>0 )) { +int mts_count =sizeof (mts_values) /sizeof (mts_values[0 ]); + +printf ("#\n" +"# These values are set by cbootimage using the\n" +"# mts provided by the Mts=... or MtsPreboot=...\n" +"# configuration option.\n" +"#\n" ); + +for (i =0 ; i < mts_used; ++i) { +for (j =0 ; j < mts_count; ++j) { + e = g_soc_config->get_mts_info (&context, + i, + mts_values[j].id, + &(data.val)); +printf ("# Mts[%d]." , i); + +if (e) + data.val =-1 ; + + mts_values[j].format (mts_values[j].message, &data); + } + } + }/* Display flash device parameters */ e = g_soc_config->get_value(token_num_param_sets, ¶meters_used,
Signature · 1 line
1.8.3.2
Allen Martin
Acked-byRe: [cbootimage PATCH V3 2/3] Add Tegra132 support for the cbootimage utility
In reply to a message not in the archiveQuoted 17 lines · Vince Hsu
This patch adds support for Tegra132. This are only slight differences between Tegra124 and Tegra132. The command line usage is exactly the same as other platforms like Tegra124.
The structure
nvboot_mts_infois added into the bct for Tegra132. So the bootrom and first stage bootloader know where to load the preboot and mts images. Two parse items "Mts=" and "MtsPreboot=" are added to embedded MTS images in BCT image like what we do for bootloader. The syntax is also the same. For example:MtsPreboot = <preboot_image>,<load_address>,<entry_address>,Complete;
Mts = <mts_image>,<load_address>,<entry_address>,Complete;The load and entry addresses depned on your board design.
Four files are added in src/t132:
Quoted 8 lines
nvbctlib_t132.c- is cloned fromnvbctlib_t124.cand adds mts
information getter and setter.nvboot_bct_t132.h- adds mts structure into bctnvboot_sdram_param_t132.h- clone ofnvboot_sdram_param_t124.hparse_t132.c- clone ofparse_t124.cSigned-off-by Vince Hsu <[email protected]>
src/t132/nvboot_sdram_param_t132.h line 803
Quoted 10 lines
src/t132/nvboot_sdram_param_t132.h new file +4
-0+ /* End of generated code by warmboot_code_gen */ +} nvboot_sdram_params; +#endif /* #ifndef INCLUDED_NVBOOT_SDRAM_PARAM_T132_H */ +
whitespace at end of file. I'll fix when I apply.
-Allen
nvpublic
Quoted 6 lines · Vince Hsu
Also update the
next_bct_blk. Then we have the correct pointer to the next block for the next image write.Signed-off-by Vince Hsu <[email protected]>Acked-by Allen Martin <[email protected]>
Whole series applied, version number bumped to 1.4 and v1.4 tag pushed to github.
-Allen
nvpublic