Strip internal LiteX checksum header off of BMC firmware downloads

parent 3f79e73c
......@@ -22,6 +22,8 @@ LOG_MODULE_REGISTER(flash_filesystem, LOG_LEVEL_DBG);
#include "kestrel.h"
#include "flash_filesystem.h"
extern const struct flash_area *flash_map;
extern const int flash_map_entries;
......@@ -63,7 +65,7 @@ int initialize_flash_filesystem(void)
if (rc < 0) {
printk("FAIL: unable to find flash area %u: %d\n",
id, rc);
return;
return -1;
}
printk("Area %u at 0x%x on %s for %u bytes\n",
......@@ -81,10 +83,10 @@ int initialize_flash_filesystem(void)
rc = fs_mount(mp);
if (rc < 0) {
printk("FAIL: mount id %u at %s: %d\n",
(unsigned int)mp->storage_dev, mp->mnt_point,
printk("FAIL: mount id %lu at %s: %d\n",
(uintptr_t)mp->storage_dev, mp->mnt_point,
rc);
return;
return -1;
}
printk("%s mount: %d\n", mp->mnt_point, rc);
......@@ -148,7 +150,7 @@ int write_firmware_to_flash(const char* device_name, int partition_number, const
}
}
if (!result) {
result = flash_area_write(flash_area, (add_litex_header)?0x8:0x0, data, length);
result = flash_area_write(flash_area, (add_litex_header)?LITEX_HEADER_LENGTH_BYTES:0x0, data, length);
}
if (result < 0) {
LOG_INF("Write failed!");
......@@ -156,4 +158,4 @@ int write_firmware_to_flash(const char* device_name, int partition_number, const
}
return 0;
}
\ No newline at end of file
}
......@@ -6,8 +6,10 @@
#ifndef _FLASH_FILESYSTEM_H
#define _FLASH_FILESYSTEM_H
#define LITEX_HEADER_LENGTH_BYTES 0x8
int initialize_flash_filesystem(void);
int write_firmware_to_flash(const char* device_name, int partition_number, const uint8_t* data, size_t length, int add_litex_header);
#endif // _FLASH_FILESYSTEM_H
\ No newline at end of file
#endif // _FLASH_FILESYSTEM_H
......@@ -14,6 +14,8 @@ LOG_MODULE_REGISTER(webportal, LOG_LEVEL_DBG);
#include "simple_pwm.h"
#include "sbe_fsi.h"
#include "flash_filesystem.h"
#include "webportal.h"
#include "redfish.h"
......@@ -78,7 +80,7 @@ static int static_file_##name##_handler(struct mg_connection *conn, void *cbdata
uint8_t* embedded_file_fpga_firmware_raw_pointer = (uint8_t*)((uintptr_t)BMCSPIFLASH_BASE + 0x0);
size_t embedded_file_fpga_firmware_raw_length = 0x800000;
uint8_t* embedded_file_bmc_firmware_raw_pointer = (uint8_t*)((uintptr_t)BMCSPIFLASH_BASE + 0x800000);
uint8_t* embedded_file_bmc_firmware_raw_pointer = (uint8_t*)((uintptr_t)BMCSPIFLASH_BASE + 0x800000 + LITEX_HEADER_LENGTH_BYTES);
size_t embedded_file_bmc_firmware_raw_length = 0x400000;
uint8_t* embedded_file_pnor_firmware_raw_pointer = (uint8_t*)((uintptr_t)HOSTSPIFLASH_BASE);
size_t embedded_file_pnor_firmware_raw_length = 0x4000000;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment