|
@@ -29,6 +29,8 @@
|
29
|
29
|
#include "debug.h"
|
30
|
30
|
#include "fat_disk.h"
|
31
|
31
|
|
|
32
|
+#include "pack_data.h"
|
|
33
|
+
|
32
|
34
|
static uint8_t disk[DISK_BLOCK_COUNT * DISK_BLOCK_SIZE];
|
33
|
35
|
|
34
|
36
|
void fat_disk_init(void) {
|
|
@@ -58,7 +60,8 @@ void fat_disk_init(void) {
|
58
|
60
|
pos += snprintf(readme + pos, 1024 - pos, "\r\n");
|
59
|
61
|
pos += snprintf(readme + pos, 1024 - pos, "Project by Thomas Buck <thomas@xythobuz.de>\r\n");
|
60
|
62
|
pos += snprintf(readme + pos, 1024 - pos, "Licensed under GPLv3.\r\n");
|
61
|
|
- pos += snprintf(readme + pos, 1024 - pos, "Source at https://git.xythobuz.de/thomas/sb-py\r\n");
|
|
63
|
+ pos += snprintf(readme + pos, 1024 - pos, "See included src.tar.xz for sources.\r\n");
|
|
64
|
+ pos += snprintf(readme + pos, 1024 - pos, "Repo at https://git.xythobuz.de/thomas/sb-py\r\n");
|
62
|
65
|
|
63
|
66
|
size_t len = strlen(readme);
|
64
|
67
|
UINT bw;
|
|
@@ -73,6 +76,35 @@ void fat_disk_init(void) {
|
73
|
76
|
}
|
74
|
77
|
}
|
75
|
78
|
|
|
79
|
+ res = f_open(&file, "src.tar.xz", FA_CREATE_ALWAYS | FA_WRITE);
|
|
80
|
+ if (res != FR_OK) {
|
|
81
|
+ debug("error: f_open returned %d", res);
|
|
82
|
+ } else {
|
|
83
|
+ UINT bw;
|
|
84
|
+ UINT len = 0;
|
|
85
|
+ while (1) {
|
|
86
|
+ debug("write %d", len);
|
|
87
|
+ res = f_write(&file, data_tar_xz + len, data_tar_xz_len - len, &bw);
|
|
88
|
+ if (bw == 0) {
|
|
89
|
+ debug("abort");
|
|
90
|
+ break;
|
|
91
|
+ }
|
|
92
|
+ len += bw;
|
|
93
|
+ if (res != FR_OK) {
|
|
94
|
+ debug("error: f_write returned %d", res);
|
|
95
|
+ break;
|
|
96
|
+ }
|
|
97
|
+ if (bw == data_tar_xz_len) {
|
|
98
|
+ break;
|
|
99
|
+ }
|
|
100
|
+ }
|
|
101
|
+
|
|
102
|
+ res = f_close(&file);
|
|
103
|
+ if (res != FR_OK) {
|
|
104
|
+ debug("error: f_close returned %d", res);
|
|
105
|
+ }
|
|
106
|
+ }
|
|
107
|
+
|
76
|
108
|
if (debug_msc_unmount() != 0) {
|
77
|
109
|
debug("error unmounting disk");
|
78
|
110
|
}
|