Skip to content

Commit 7e9d65f

Browse files
committed
Peer review fixes
1 parent 3eae2f3 commit 7e9d65f

4 files changed

Lines changed: 21 additions & 21 deletions

File tree

config/examples/versal_vmk180_sdcard.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ WOLFBOOT_PARTITION_SIZE=0x4000000
9696
WOLFBOOT_SECTOR_SIZE=0x1000
9797

9898
# ============================================================================
99-
# UART Configuration - UART1 for APU console (matches VMK180 board)
99+
# UART Configuration - UART0 for APU console (matches VMK180 board)
100100
# ============================================================================
101101
CFLAGS_EXTRA+=-DDEBUG_UART_NUM=0
102102

src/disk.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,6 @@
4747
*/
4848
static struct disk_drive Drives[MAX_DISKS] = {0};
4949

50-
/**
51-
* @brief Opens a disk drive and initializes its partitions.
52-
*
53-
* This function opens a disk drive with the specified drive number, reads its
54-
* MBR (Master Boot Record) to identify GPT partitions, and initializes the
55-
* disk_drive structure for further operations.
56-
*
57-
* @param[in] drv The drive number to open (0 to `MAX_DISKS - 1`).
58-
*
59-
* @return The number of partitions found and initialized on success, or -1 if
60-
* the drive cannot be opened or no valid GPT partition table is found.
61-
*/
6250
/**
6351
* @brief Parse MBR partition table entries.
6452
*
@@ -109,6 +97,18 @@ static int disk_open_mbr(struct disk_drive *drive, const uint8_t *mbr_sector)
10997
return drive->n_parts;
11098
}
11199

100+
/**
101+
* @brief Opens a disk drive and initializes its partitions.
102+
*
103+
* This function opens a disk drive with the specified drive number, reads its
104+
* MBR (Master Boot Record) to identify GPT partitions, and initializes the
105+
* disk_drive structure for further operations.
106+
*
107+
* @param[in] drv The drive number to open (0 to `MAX_DISKS - 1`).
108+
*
109+
* @return The number of partitions found and initialized on success, or -1 if
110+
* the drive cannot be opened or no valid GPT partition table is found.
111+
*/
112112
int disk_open(int drv)
113113
{
114114
int r;

src/update_disk.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,8 +382,11 @@ void RAMFUNCTION wolfBoot_start(void)
382382
BENCHMARK_START();
383383
load_off = 0;
384384
do {
385+
uint32_t chunk = os_image.fw_size - load_off;
386+
if (chunk > DISK_BLOCK_SIZE)
387+
chunk = DISK_BLOCK_SIZE;
385388
ret = disk_part_read(BOOT_DISK, cur_part,
386-
IMAGE_HEADER_SIZE + load_off, DISK_BLOCK_SIZE,
389+
IMAGE_HEADER_SIZE + load_off, chunk,
387390
((uint8_t *)load_address) + load_off);
388391
if (ret < 0)
389392
break;

tools/scripts/versal_test.sh

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ trap cleanup EXIT INT TERM
178178

179179
# SD card image configuration
180180
SDCARD_IMG="${SDCARD_IMG:-${WOLFBOOT_ROOT}/sdcard.img}"
181-
SDCARD_SIZE_MB="${SDCARD_SIZE_MB:-1024}"
181+
SDCARD_SIZE_MB="${SDCARD_SIZE_MB:-512}"
182182
SDCARD_BOOT_SIZE_MB="${SDCARD_BOOT_SIZE_MB:-128}"
183183
SDCARD_OFP_SIZE_MB="${SDCARD_OFP_SIZE_MB:-200}"
184184

@@ -220,7 +220,7 @@ get_partition_offset() {
220220
local img="$1" part="$2"
221221
local sector
222222
# Parse sfdisk dump for partition start sector
223-
sector=$(sfdisk -d "$img" 2>/dev/null | grep "^${img}${part}" | sed 's/.*start=\s*\([0-9]*\).*/\1/')
223+
sector=$(sfdisk -d "$img" 2>/dev/null | grep "^${img}${part}" | sed 's/.*start=[[:space:]]*\([0-9]*\).*/\1/')
224224
if [ -z "$sector" ]; then
225225
# Fallback: parse fdisk output
226226
sector=$(fdisk -l "$img" 2>/dev/null | grep "^${img}${part}" | awk '{print $2}')
@@ -591,10 +591,7 @@ case "${1:-}" in
591591
log_info " Partition 3 (OFP_B): Signed Linux FIT image v2 (update)"
592592
log_info " Partition 4 (rootfs): Linux root filesystem"
593593
log_info ""
594-
log_info "Provision SD card:"
595-
log_info " sudo ./tools/scripts/versal_sdcard_provision.sh /dev/sdX"
596-
log_info ""
597-
log_info "Or manually:"
594+
log_info "Provision SD card manually:"
598595
log_info " sudo dd if=$SDCARD_IMG of=/dev/sdX bs=4M status=progress conv=fsync"
599596
log_info " sync"
600597
log_info " sudo mkfs.vfat -F 32 -n BOOT /dev/sdX1"
@@ -621,7 +618,7 @@ case "${1:-}" in
621618
./tools/keytools/sign $SIGN_OPTIONS test-app/image.bin "$PRIVATE_KEY" 2 || { log_error "Signing v2 failed"; exit 1; }
622619
log_ok "Signed test applications: image_v1_signed.bin, image_v2_signed.bin"
623620

624-
# Create SD card image with GPT partitions
621+
# Create SD card image with MBR (DOS) partition table
625622
create_sdcard_image "$SDCARD_IMG" "$SDCARD_SIZE_MB" || exit 1
626623

627624
# Write signed images to partitions (OFP_A=2, OFP_B=3)

0 commit comments

Comments
 (0)