Skip to content

Commit 6f09e00

Browse files
author
Catherine Garabedian
committed
Cleanup
1 parent 5bbc4be commit 6f09e00

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

common/update_kubos.c

+10-3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <mmc.h>
2323
#include <kubos.h>
2424
#include <dfu.h>
25+
DECLARE_GLOBAL_DATA_PTR;
2526

2627
#define UPDATE_COUNT_ENVAR "kubos_updatecount"
2728
#define DEV_ENVAR "kubos_updatedev"
@@ -86,8 +87,12 @@ int update_mmc(char * file, void * load_addr, char * dev_num)
8687
int data_offset = (fit_size + 3) & ~3;
8788
void * data_addr = load_addr + data_offset;
8889

89-
int max_size = gd->start_addr_sp - data_addr - CONFIG_SYS_DFU_DATA_BUF_SIZE;
90-
printf("Max file size: %d\n", max_size);
90+
// U-Boot reserves memory for itself at the end of RAM, while we're loading
91+
// the update file at the beginning.
92+
// So the largest update entity we could possibly allow is the amount of
93+
// space between the two, minus the room needed for the DFU chunk buffer,
94+
// minus a little bit of wiggle room (1K)
95+
int max_size = gd->start_addr_sp - (unsigned long) data_addr - CONFIG_SYS_DFU_DATA_BUF_SIZE - SZ_1K;
9196

9297
// Validate the file
9398
if (!fit_check_format(fit)) {
@@ -108,7 +113,7 @@ int update_mmc(char * file, void * load_addr, char * dev_num)
108113
}
109114

110115
fit_image_name = (char *)fit_get_name(fit, noffset, NULL);
111-
printf("Processing update '%s' :\n", fit_image_name);
116+
printf("Processing update '%s' :", fit_image_name);
112117

113118
// Get the update entity's size and offset
114119
int update_offset, update_size;
@@ -148,6 +153,8 @@ int update_mmc(char * file, void * load_addr, char * dev_num)
148153
continue;
149154
}
150155

156+
printf("\n");
157+
151158
if (fit_image_check_type(fit, noffset,
152159
IH_TYPE_FIRMWARE)) {
153160
ret = dfu_tftp_write(fit_image_name, (unsigned int) data_addr,

include/ext4fs.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ int ext4_write_file(const char *filename, void *buf, loff_t offset, loff_t len,
135135

136136
struct ext_filesystem *get_fs(void);
137137
int ext4fs_open(const char *filename, loff_t *len);
138-
int ext4fs_read(char *buf, loff_t len, loff_t *actread);
138+
int ext4fs_read(char *buf, loff_t offset, loff_t len, loff_t *actread);
139139
int ext4fs_mount(unsigned part_length);
140140
void ext4fs_close(void);
141141
void ext4fs_reinit_global(void);

0 commit comments

Comments
 (0)