52 #define DECLARE_HDR(h) \
54 .magic1 = htole32(0xea000000), \
55 .reserved1 = htole32(0x56), \
56 .magic2 = htole32(0xe59ff008), \
57 .reserved3 = htole16(0x1) }
61 #define ALIGN (1 << ALIGN_BITS)
63 #define START_BASE 0xe55b0000
76 #define MAX_BOOT_PROG_LEN (16 * 512)
78 #define ROUND_UP(x) ((x + ALIGN - 1) & ~(ALIGN - 1))
85 while (offset < count) {
86 l =
read(fd, buf + offset, count - offset);
106 while (offset < count) {
107 l =
write(fd, buf + offset, count - offset);
137 size_t aligned_hdr_len, alligned_prog_len;
140 prog_len =
do_read(0, boot_program,
sizeof(boot_program));
146 alligned_prog_len =
ROUND_UP(prog_len);
147 hdr.
copy_size = htole16(aligned_hdr_len + alligned_prog_len);
154 if (
do_write(1, boot_program, prog_len) < 0)
159 prog_len =
do_read(0, boot_program,
sizeof(boot_program));
164 if (
do_write(1, boot_program, prog_len) < 0)