|
@@ -12,10 +12,14 @@
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
#include "blkdev.h"
|
|
#include "blkdev.h"
|
|
|
|
|
+#include "fatdetect.h"
|
|
|
#include "fatformat.h"
|
|
#include "fatformat.h"
|
|
|
|
|
+#include "install.h"
|
|
|
#include "io.h"
|
|
#include "io.h"
|
|
|
#include "mm.h"
|
|
#include "mm.h"
|
|
|
#include "process.h"
|
|
#include "process.h"
|
|
|
|
|
+#include "ramfs.h"
|
|
|
|
|
+#include "rootfs.h"
|
|
|
#include "sched.h"
|
|
#include "sched.h"
|
|
|
#include "serial.h"
|
|
#include "serial.h"
|
|
|
#include "vga.h"
|
|
#include "vga.h"
|
|
@@ -24,11 +28,10 @@
|
|
|
#define INSTALL_NAME_MAX 16
|
|
#define INSTALL_NAME_MAX 16
|
|
|
#define INSTALL_CHUNK 32u /* 16 KiB copy buffer */
|
|
#define INSTALL_CHUNK 32u /* 16 KiB copy buffer */
|
|
|
#define INSTALL_DOT_LBA 2048u /* one progress dot per MiB */
|
|
#define INSTALL_DOT_LBA 2048u /* one progress dot per MiB */
|
|
|
|
|
+#define DATA_MIN_SECTORS 2048u /* /data needs at least 1 MiB */
|
|
|
|
|
|
|
|
#define MBR_PART_OFF 0x1BE
|
|
#define MBR_PART_OFF 0x1BE
|
|
|
#define MBR_PART_SIZE 16
|
|
#define MBR_PART_SIZE 16
|
|
|
-#define BOOT_LBA 63u
|
|
|
|
|
-#define ROOTFS_LBA 1088u
|
|
|
|
|
#define PACK_LBA_OFF 0x42
|
|
#define PACK_LBA_OFF 0x42
|
|
|
#define KERNEL_LBA_OFF 0x40
|
|
#define KERNEL_LBA_OFF 0x40
|
|
|
#define KERNEL_SEC_OFF 0x3E
|
|
#define KERNEL_SEC_OFF 0x3E
|
|
@@ -134,11 +137,12 @@ static int check_nebos_image(blk_dev_t *d, unsigned int *used, int *has_esp,
|
|
|
const unsigned char *e = mbr + MBR_PART_OFF;
|
|
const unsigned char *e = mbr + MBR_PART_OFF;
|
|
|
|
|
|
|
|
if (e[0] != 0x80 || e[4] != 0x06 ||
|
|
if (e[0] != 0x80 || e[4] != 0x06 ||
|
|
|
- get32(e + 8) != BOOT_LBA || get32(e + 12) < 1024u)
|
|
|
|
|
|
|
+ get32(e + 8) != NEBOS_BOOT_LBA ||
|
|
|
|
|
+ get32(e + 12) < 1024u)
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (blk_read(d, BOOT_LBA, boot, 1) != 0)
|
|
|
|
|
|
|
+ if (blk_read(d, NEBOS_BOOT_LBA, boot, 1) != 0)
|
|
|
return 0;
|
|
return 0;
|
|
|
if (boot[510] != 0x55 || boot[511] != 0xAA)
|
|
if (boot[510] != 0x55 || boot[511] != 0xAA)
|
|
|
return 0;
|
|
return 0;
|
|
@@ -147,14 +151,15 @@ static int check_nebos_image(blk_dev_t *d, unsigned int *used, int *has_esp,
|
|
|
return 0;
|
|
return 0;
|
|
|
if (get32(boot + PACK_LBA_OFF) != ROOTFS_LBA)
|
|
if (get32(boot + PACK_LBA_OFF) != ROOTFS_LBA)
|
|
|
return 0;
|
|
return 0;
|
|
|
- if (get16(boot + KERNEL_LBA_OFF) != BOOT_LBA + 1u)
|
|
|
|
|
|
|
+ if (get16(boot + KERNEL_LBA_OFF) != NEBOS_KERNEL_LBA)
|
|
|
return 0;
|
|
return 0;
|
|
|
if (get16(boot + KERNEL_SEC_OFF) == 0)
|
|
if (get16(boot + KERNEL_SEC_OFF) == 0)
|
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
|
|
- /* Used length: the end of the highest non-empty partition. Require
|
|
|
|
|
- * the rootfs area to be covered, and reject an entry that claims more
|
|
|
|
|
- * sectors than the source has. */
|
|
|
|
|
|
|
+ /* Used length: the end of the highest OS partition. Partition 4 is
|
|
|
|
|
+ * the persistent data volume: it is not part of the cloned image and
|
|
|
|
|
+ * may legitimately extend to the end of the disk. A source entry may
|
|
|
|
|
+ * not cross into the data area, though. */
|
|
|
for (i = 0; i < 4; i++) {
|
|
for (i = 0; i < 4; i++) {
|
|
|
const unsigned char *e = mbr + MBR_PART_OFF + i * MBR_PART_SIZE;
|
|
const unsigned char *e = mbr + MBR_PART_OFF + i * MBR_PART_SIZE;
|
|
|
unsigned int start, count, end;
|
|
unsigned int start, count, end;
|
|
@@ -168,7 +173,11 @@ static int check_nebos_image(blk_dev_t *d, unsigned int *used, int *has_esp,
|
|
|
if (!count || start > d->total_sectors ||
|
|
if (!count || start > d->total_sectors ||
|
|
|
count > d->total_sectors - start)
|
|
count > d->total_sectors - start)
|
|
|
return 0;
|
|
return 0;
|
|
|
|
|
+ if (start >= NEBOS_DATA_LBA)
|
|
|
|
|
+ continue;
|
|
|
end = start + count;
|
|
end = start + count;
|
|
|
|
|
+ if (end > NEBOS_DATA_LBA)
|
|
|
|
|
+ return 0;
|
|
|
if (end > max_end)
|
|
if (end > max_end)
|
|
|
max_end = end;
|
|
max_end = end;
|
|
|
}
|
|
}
|
|
@@ -263,18 +272,556 @@ static void install_fail(const char *msg, unsigned int lba)
|
|
|
serial_puts(SERIAL_COM1, "\n");
|
|
serial_puts(SERIAL_COM1, "\n");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+static void put16(unsigned char *p, unsigned int v)
|
|
|
|
|
+{
|
|
|
|
|
+ p[0] = (unsigned char)v;
|
|
|
|
|
+ p[1] = (unsigned char)(v >> 8);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static void put32(unsigned char *p, unsigned int v)
|
|
|
|
|
+{
|
|
|
|
|
+ p[0] = (unsigned char)v;
|
|
|
|
|
+ p[1] = (unsigned char)(v >> 8);
|
|
|
|
|
+ p[2] = (unsigned char)(v >> 16);
|
|
|
|
|
+ p[3] = (unsigned char)(v >> 24);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static void copy_bytes(unsigned char *dst, const unsigned char *src,
|
|
|
|
|
+ unsigned int n)
|
|
|
|
|
+{
|
|
|
|
|
+ unsigned int i;
|
|
|
|
|
+
|
|
|
|
|
+ for (i = 0; i < n; i++)
|
|
|
|
|
+ dst[i] = src[i];
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static void zero_bytes(unsigned char *dst, unsigned int n)
|
|
|
|
|
+{
|
|
|
|
|
+ unsigned int i;
|
|
|
|
|
+
|
|
|
|
|
+ for (i = 0; i < n; i++)
|
|
|
|
|
+ dst[i] = 0;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static int str_eq(const char *a, const char *b)
|
|
|
|
|
+{
|
|
|
|
|
+ unsigned int i = 0;
|
|
|
|
|
+
|
|
|
|
|
+ while (a[i] && b[i] && a[i] == b[i])
|
|
|
|
|
+ i++;
|
|
|
|
|
+ return a[i] == '\0' && b[i] == '\0';
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/* The persistent data volume is recognised by its fixed LBA and label. */
|
|
|
|
|
+static int detect_data_partition(blk_dev_t *d, const unsigned char *mbr,
|
|
|
|
|
+ unsigned char *entry)
|
|
|
|
|
+{
|
|
|
|
|
+ const unsigned char *e = mbr + MBR_PART_OFF + 3 * MBR_PART_SIZE;
|
|
|
|
|
+ unsigned int start, count;
|
|
|
|
|
+ fat_fs_t fs;
|
|
|
|
|
+
|
|
|
|
|
+ if (!mbr_is_fat_type(e[4]))
|
|
|
|
|
+ return 0;
|
|
|
|
|
+ start = get32(e + 8);
|
|
|
|
|
+ count = get32(e + 12);
|
|
|
|
|
+ if (start != NEBOS_DATA_LBA || count < DATA_MIN_SECTORS)
|
|
|
|
|
+ return 0;
|
|
|
|
|
+ if (start > d->total_sectors || count > d->total_sectors - start)
|
|
|
|
|
+ return 0;
|
|
|
|
|
+ if (fat_mount(d, start, &fs) != 0)
|
|
|
|
|
+ return 0;
|
|
|
|
|
+ if (!str_eq(fs.label, "NEBOSDATA"))
|
|
|
|
|
+ return 0;
|
|
|
|
|
+ if (entry)
|
|
|
|
|
+ copy_bytes(entry, e, MBR_PART_SIZE);
|
|
|
|
|
+ return 1;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/* Detect and, when absent, create the data partition. The caller owns the
|
|
|
|
|
+ * target MBR buffer and writes it last. `created` says whether the entry is
|
|
|
|
|
+ * new (and therefore whether the MBR must be rewritten). */
|
|
|
|
|
+static int ensure_data_partition(blk_dev_t *d, const unsigned char *mbr,
|
|
|
|
|
+ unsigned char *entry, int *created)
|
|
|
|
|
+{
|
|
|
|
|
+ unsigned int sectors, type = 0;
|
|
|
|
|
+
|
|
|
|
|
+ *created = 0;
|
|
|
|
|
+ if (detect_data_partition(d, mbr, entry)) {
|
|
|
|
|
+ io_putstr("install: /data partition present; keeping it\n");
|
|
|
|
|
+ return 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (d->total_sectors <= NEBOS_DATA_LBA ||
|
|
|
|
|
+ d->total_sectors - NEBOS_DATA_LBA < DATA_MIN_SECTORS) {
|
|
|
|
|
+ io_putstr("install: target is too small for a /data partition\n");
|
|
|
|
|
+ return 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ sectors = d->total_sectors - NEBOS_DATA_LBA;
|
|
|
|
|
+ io_putstr("install: creating /data partition (");
|
|
|
|
|
+ put_size(sectors);
|
|
|
|
|
+ io_putstr(")...\n");
|
|
|
|
|
+ /* The installer's format path owns the disks through format_busy, and
|
|
|
|
|
+ * the FAT loop releases the BKL per chunk. Dropping it entirely (as
|
|
|
|
|
+ * `format` does) avoids the format_progress sleeps holding it. */
|
|
|
|
|
+ bkl_unlock();
|
|
|
|
|
+ if (fat_format_partition(d, NEBOS_DATA_LBA, sectors, "NEBOSDATA",
|
|
|
|
|
+ &type) != 0) {
|
|
|
|
|
+ bkl_lock();
|
|
|
|
|
+ io_putstr("install: /data format failed\n");
|
|
|
|
|
+ return 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ bkl_lock();
|
|
|
|
|
+
|
|
|
|
|
+ zero_bytes(entry, MBR_PART_SIZE);
|
|
|
|
|
+ entry[1] = 0xFE;
|
|
|
|
|
+ entry[2] = 0xFF;
|
|
|
|
|
+ entry[3] = 0xFF;
|
|
|
|
|
+ entry[4] = (type == 32) ? 0x0C : ((type == 16) ? 0x0E : 0x01);
|
|
|
|
|
+ entry[5] = 0xFE;
|
|
|
|
|
+ entry[6] = 0xFF;
|
|
|
|
|
+ entry[7] = 0xFF;
|
|
|
|
|
+ put32(entry + 8, NEBOS_DATA_LBA);
|
|
|
|
|
+ put32(entry + 12, sectors);
|
|
|
|
|
+ *created = 1;
|
|
|
|
|
+ io_putstr("install: /data FAT");
|
|
|
|
|
+ format_putdec(type);
|
|
|
|
|
+ io_putstr(", ");
|
|
|
|
|
+ put_size(sectors);
|
|
|
|
|
+ io_putchar('\n');
|
|
|
|
|
+ return 1;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static blk_dev_t *resolve_target(const char *name)
|
|
|
|
|
+{
|
|
|
|
|
+ blk_dev_t *found = 0;
|
|
|
|
|
+ unsigned int i;
|
|
|
|
|
+
|
|
|
|
|
+ if (!str_eq(name, "auto")) {
|
|
|
|
|
+ found = blk_find(name);
|
|
|
|
|
+ if (!found) {
|
|
|
|
|
+ io_putstr("install: unknown target '");
|
|
|
|
|
+ io_putstr(name);
|
|
|
|
|
+ io_putstr("'\n");
|
|
|
|
|
+ list_devices();
|
|
|
|
|
+ }
|
|
|
|
|
+ return found;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ for (i = 0; i < blk_dev_count; i++) {
|
|
|
|
|
+ blk_dev_t *d = &blk_devs[i];
|
|
|
|
|
+
|
|
|
|
|
+ if (!d->present || d->kind == BLK_FLOPPY ||
|
|
|
|
|
+ d->kind == BLK_USB)
|
|
|
|
|
+ continue;
|
|
|
|
|
+ if (!check_nebos_image(d, 0, 0, 0))
|
|
|
|
|
+ continue;
|
|
|
|
|
+ if (found) {
|
|
|
|
|
+ io_putstr("install: auto found more than one NebOS disk; "
|
|
|
|
|
+ "name the target explicitly\n");
|
|
|
|
|
+ return 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ found = d;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!found)
|
|
|
|
|
+ io_putstr("install: auto found no installed NebOS disk\n");
|
|
|
|
|
+ return found;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static int ask_continue(blk_dev_t *target, int have_data)
|
|
|
|
|
+{
|
|
|
|
|
+ int k;
|
|
|
|
|
+
|
|
|
|
|
+ if (have_data) {
|
|
|
|
|
+ io_putstr("install: this replaces the OS on ");
|
|
|
|
|
+ io_putstr(target->name);
|
|
|
|
|
+ io_putstr("; files on /data are kept. Continue? (y/n) ");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ io_putstr("install: this destroys all data on ");
|
|
|
|
|
+ io_putstr(target->name);
|
|
|
|
|
+ io_putstr("? (y/n) ");
|
|
|
|
|
+ }
|
|
|
|
|
+ vga_fb_flush();
|
|
|
|
|
+
|
|
|
|
|
+ /* The confirmation loop yields so the kworker can poll the USB HID
|
|
|
|
|
+ * keyboard. */
|
|
|
|
|
+ io_set_raw_keyboard(1);
|
|
|
|
|
+ for (;;) {
|
|
|
|
|
+ k = io_poll_key_with_hw();
|
|
|
|
|
+ if (k == 'y' || k == 'Y') {
|
|
|
|
|
+ io_set_raw_keyboard(0);
|
|
|
|
|
+ io_putchar('\n');
|
|
|
|
|
+ return 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (k == 'n' || k == 'N') {
|
|
|
|
|
+ io_set_raw_keyboard(0);
|
|
|
|
|
+ io_putstr("aborted\n");
|
|
|
|
|
+ return 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ process_sleep_ms(10);
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/* Write `bytes` from p at lba, padding the final partial sector with
|
|
|
|
|
+ * zeros. Chunks release the BKL like the rest of the installer. */
|
|
|
|
|
+static int write_region(blk_dev_t *d, unsigned int lba,
|
|
|
|
|
+ const unsigned char *p, unsigned int bytes,
|
|
|
|
|
+ const char *what)
|
|
|
|
|
+{
|
|
|
|
|
+ unsigned int full = bytes / 512u, off = 0, n;
|
|
|
|
|
+
|
|
|
|
|
+ while (off < full) {
|
|
|
|
|
+ n = full - off;
|
|
|
|
|
+ if (n > INSTALL_CHUNK)
|
|
|
|
|
+ n = INSTALL_CHUNK;
|
|
|
|
|
+ if (write_chunk(d, lba + off, p + off * 512u, n) != 0) {
|
|
|
|
|
+ install_fail(what, lba + off);
|
|
|
|
|
+ return -1;
|
|
|
|
|
+ }
|
|
|
|
|
+ off += n;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (bytes % 512u) {
|
|
|
|
|
+ unsigned int rem = bytes % 512u, i;
|
|
|
|
|
+
|
|
|
|
|
+ for (i = 0; i < rem; i++)
|
|
|
|
|
+ copy_buf[i] = p[full * 512u + i];
|
|
|
|
|
+ for (; i < 512u; i++)
|
|
|
|
|
+ copy_buf[i] = 0;
|
|
|
|
|
+ if (write_chunk(d, lba + full, copy_buf, 1) != 0) {
|
|
|
|
|
+ install_fail(what, lba + full);
|
|
|
|
|
+ return -1;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return 0;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static int verify_region(blk_dev_t *d, unsigned int lba,
|
|
|
|
|
+ const unsigned char *p, unsigned int bytes,
|
|
|
|
|
+ const char *what)
|
|
|
|
|
+{
|
|
|
|
|
+ unsigned int off = 0, sum = sum_bytes(0, p, bytes), vsum = 0, n;
|
|
|
|
|
+
|
|
|
|
|
+ while (off + 512u <= bytes) {
|
|
|
|
|
+ n = (bytes - off) / 512u;
|
|
|
|
|
+ if (n > INSTALL_CHUNK)
|
|
|
|
|
+ n = INSTALL_CHUNK;
|
|
|
|
|
+ if (read_chunk(d, lba + off / 512u, copy_buf, n) != 0) {
|
|
|
|
|
+ install_fail("target read-back failed",
|
|
|
|
|
+ lba + off / 512u);
|
|
|
|
|
+ return -1;
|
|
|
|
|
+ }
|
|
|
|
|
+ vsum = sum_bytes(vsum, copy_buf, n * 512u);
|
|
|
|
|
+ off += n * 512u;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (off < bytes) {
|
|
|
|
|
+ if (read_chunk(d, lba + off / 512u, copy_buf, 1) != 0) {
|
|
|
|
|
+ install_fail("target read-back failed",
|
|
|
|
|
+ lba + off / 512u);
|
|
|
|
|
+ return -1;
|
|
|
|
|
+ }
|
|
|
|
|
+ vsum = sum_bytes(vsum, copy_buf, bytes - off);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (vsum != sum) {
|
|
|
|
|
+ install_fail(what, 0);
|
|
|
|
|
+ return -1;
|
|
|
|
|
+ }
|
|
|
|
|
+ return 0;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/* Shared P1/P2 writer for `install self` and the network install path. */
|
|
|
|
|
+static int write_os_image(blk_dev_t *d, const void *kernel,
|
|
|
|
|
+ unsigned int ksize, const struct rootfs_hdr *hdr,
|
|
|
|
|
+ const void *pack, unsigned int psize,
|
|
|
|
|
+ int ensure_data)
|
|
|
|
|
+{
|
|
|
|
|
+ unsigned char boot[512], mbr[512], data_entry[MBR_PART_SIZE];
|
|
|
|
|
+ unsigned int used = 0, ksectors;
|
|
|
|
|
+ int has_esp = 0, created = 0;
|
|
|
|
|
+
|
|
|
|
|
+ if (!d || !d->present || d->kind == BLK_FLOPPY || !kernel || !ksize ||
|
|
|
|
|
+ !hdr || !pack || !psize)
|
|
|
|
|
+ return -1;
|
|
|
|
|
+ if (hdr->version != ROOTFS_VERSION || hdr->pack_bytes != psize) {
|
|
|
|
|
+ io_putstr("install: bad rootfs header\n");
|
|
|
|
|
+ return -1;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (hdr->flags & ~ROOTFS_FLAG_GZIP) {
|
|
|
|
|
+ io_putstr("install: unsupported rootfs flags\n");
|
|
|
|
|
+ return -1;
|
|
|
|
|
+ }
|
|
|
|
|
+ ksectors = (ksize + 511u) / 512u;
|
|
|
|
|
+ if (ksectors == 0 ||
|
|
|
|
|
+ ksectors > ROOTFS_LBA - NEBOS_KERNEL_LBA) {
|
|
|
|
|
+ io_putstr("install: kernel does not fit partition 1\n");
|
|
|
|
|
+ return -1;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (psize + ROOTFS_HDR_SIZE > ROOTFS_SECTORS * 512u) {
|
|
|
|
|
+ io_putstr("install: rootfs does not fit partition 2\n");
|
|
|
|
|
+ return -1;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!check_nebos_image(d, &used, &has_esp, mbr)) {
|
|
|
|
|
+ io_putstr("install: target is not an installed NebOS disk\n");
|
|
|
|
|
+ io_putstr("install: run `install <target> <source>` from USB first\n");
|
|
|
|
|
+ return -1;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (blk_read(d, NEBOS_BOOT_LBA, boot, 1) != 0) {
|
|
|
|
|
+ io_putstr("install: cannot read the target boot sector\n");
|
|
|
|
|
+ return -1;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (format_busy && process_is_alive(format_owner_pid)) {
|
|
|
|
|
+ io_putstr("install: another format/install is in progress\n");
|
|
|
|
|
+ return -1;
|
|
|
|
|
+ }
|
|
|
|
|
+ format_owner_pid = current_proc()->pid;
|
|
|
|
|
+ format_busy = 1;
|
|
|
|
|
+
|
|
|
|
|
+ /* Prepare the data partition before touching P1/P2: a format failure
|
|
|
|
|
+ * then leaves the old OS bootable. */
|
|
|
|
|
+ if (ensure_data &&
|
|
|
|
|
+ !ensure_data_partition(d, mbr, data_entry, &created))
|
|
|
|
|
+ goto fail;
|
|
|
|
|
+
|
|
|
|
|
+ io_putstr("install: writing rootfs...\n");
|
|
|
|
|
+ if (write_chunk(d, ROOTFS_LBA, hdr, 1) != 0 ||
|
|
|
|
|
+ write_region(d, ROOTFS_LBA + 1u, (const unsigned char *)pack,
|
|
|
|
|
+ psize, "rootfs write failed") != 0)
|
|
|
|
|
+ goto fail;
|
|
|
|
|
+ io_putstr("install: writing kernel...\n");
|
|
|
|
|
+ if (write_region(d, NEBOS_KERNEL_LBA, (const unsigned char *)kernel,
|
|
|
|
|
+ ksize, "kernel write failed") != 0)
|
|
|
|
|
+ goto fail;
|
|
|
|
|
+
|
|
|
|
|
+ /* The installed boot sector carries only the NebOS header fields. */
|
|
|
|
|
+ zero_bytes(boot + 0x0B, 0x3E - 0x0B);
|
|
|
|
|
+ put16(boot + KERNEL_SEC_OFF, ksectors);
|
|
|
|
|
+ if (write_chunk(d, NEBOS_BOOT_LBA, boot, 1) != 0) {
|
|
|
|
|
+ install_fail("boot sector write failed", NEBOS_BOOT_LBA);
|
|
|
|
|
+ goto fail;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (ensure_data && created) {
|
|
|
|
|
+ copy_bytes(mbr + MBR_PART_OFF + 3 * MBR_PART_SIZE,
|
|
|
|
|
+ data_entry, MBR_PART_SIZE);
|
|
|
|
|
+ if (write_chunk(d, 0, mbr, 1) != 0) {
|
|
|
|
|
+ install_fail("MBR write failed", 0);
|
|
|
|
|
+ goto fail;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ {
|
|
|
|
|
+ int fr;
|
|
|
|
|
+
|
|
|
|
|
+ bkl_pause();
|
|
|
|
|
+ fr = blk_flush(d);
|
|
|
|
|
+ bkl_resume();
|
|
|
|
|
+ if (fr != 0)
|
|
|
|
|
+ io_putstr("install: cache flush failed; verifying anyway\n");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ io_putstr("install: verifying...\n");
|
|
|
|
|
+ if (verify_region(d, ROOTFS_LBA, (const unsigned char *)hdr,
|
|
|
|
|
+ ROOTFS_HDR_SIZE, "rootfs header verify failed") != 0 ||
|
|
|
|
|
+ verify_region(d, ROOTFS_LBA + 1u, (const unsigned char *)pack,
|
|
|
|
|
+ psize, "rootfs verify failed") != 0 ||
|
|
|
|
|
+ verify_region(d, NEBOS_KERNEL_LBA, (const unsigned char *)kernel,
|
|
|
|
|
+ ksize, "kernel verify failed") != 0)
|
|
|
|
|
+ goto fail;
|
|
|
|
|
+ if (read_chunk(d, NEBOS_BOOT_LBA, copy_buf, 1) != 0) {
|
|
|
|
|
+ install_fail("boot sector read-back failed", NEBOS_BOOT_LBA);
|
|
|
|
|
+ goto fail;
|
|
|
|
|
+ }
|
|
|
|
|
+ {
|
|
|
|
|
+ unsigned int i;
|
|
|
|
|
+
|
|
|
|
|
+ for (i = 0; i < 512u; i++) {
|
|
|
|
|
+ if (copy_buf[i] != boot[i]) {
|
|
|
|
|
+ install_fail("boot sector verify failed",
|
|
|
|
|
+ NEBOS_BOOT_LBA);
|
|
|
|
|
+ goto fail;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (created) {
|
|
|
|
|
+ if (read_chunk(d, 0, copy_buf, 1) != 0) {
|
|
|
|
|
+ install_fail("MBR read-back failed", 0);
|
|
|
|
|
+ goto fail;
|
|
|
|
|
+ }
|
|
|
|
|
+ {
|
|
|
|
|
+ unsigned int i;
|
|
|
|
|
+
|
|
|
|
|
+ for (i = 0; i < 512u; i++) {
|
|
|
|
|
+ if (copy_buf[i] != mbr[i]) {
|
|
|
|
|
+ install_fail("MBR verify failed", 0);
|
|
|
|
|
+ goto fail;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (created)
|
|
|
|
|
+ vfs_remount_device(d);
|
|
|
|
|
+
|
|
|
|
|
+ format_busy = 0;
|
|
|
|
|
+ io_putstr("install: verified; ");
|
|
|
|
|
+ put_size(used);
|
|
|
|
|
+ io_putstr(" image written to ");
|
|
|
|
|
+ io_putstr(d->name);
|
|
|
|
|
+ if (ensure_data)
|
|
|
|
|
+ io_putstr(", /data kept");
|
|
|
|
|
+ io_putchar('\n');
|
|
|
|
|
+ serial_puts(SERIAL_COM1, "install: image written\n");
|
|
|
|
|
+ return 0;
|
|
|
|
|
+
|
|
|
|
|
+fail:
|
|
|
|
|
+ format_busy = 0;
|
|
|
|
|
+ io_putstr("install: image update failed\n");
|
|
|
|
|
+ serial_puts(SERIAL_COM1, "install: image update failed\n");
|
|
|
|
|
+ return -1;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static int install_self(const char *target_name)
|
|
|
|
|
+{
|
|
|
|
|
+ struct vfs_file kf;
|
|
|
|
|
+ struct vfs_mount *km = 0;
|
|
|
|
|
+ const void *pack = 0;
|
|
|
|
|
+ unsigned int psize = 0;
|
|
|
|
|
+ int gz = 0, r;
|
|
|
|
|
+ struct rootfs_hdr hdr;
|
|
|
|
|
+ blk_dev_t *target;
|
|
|
|
|
+ unsigned char mbr[512];
|
|
|
|
|
+ int have_data = 0;
|
|
|
|
|
+
|
|
|
|
|
+ if (vfs_load_file("/ramfs/install/kernel.bin", &kf, &km) != 0) {
|
|
|
|
|
+ io_putstr("install: /ramfs/install/kernel.bin is missing\n");
|
|
|
|
|
+ io_putstr("install: the floppy/lite pack has no running kernel image\n");
|
|
|
|
|
+ return -1;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!ramfs_boot_image(&pack, &psize, &gz) || !pack || !psize) {
|
|
|
|
|
+ io_putstr("install: no boot-time rootfs image is retained\n");
|
|
|
|
|
+ vfs_release_file(km, &kf);
|
|
|
|
|
+ return -1;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!gz) {
|
|
|
|
|
+ io_putstr("install: the running pack was replaced at runtime (raw)\n");
|
|
|
|
|
+ io_putstr("install: use `make net-install` to persist it\n");
|
|
|
|
|
+ vfs_release_file(km, &kf);
|
|
|
|
|
+ return -1;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (psize + ROOTFS_HDR_SIZE > ROOTFS_SECTORS * 512u) {
|
|
|
|
|
+ io_putstr("install: running rootfs is too large for partition 2\n");
|
|
|
|
|
+ vfs_release_file(km, &kf);
|
|
|
|
|
+ return -1;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ target = resolve_target(target_name);
|
|
|
|
|
+ if (!target) {
|
|
|
|
|
+ vfs_release_file(km, &kf);
|
|
|
|
|
+ return -1;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!target->present || target->kind == BLK_FLOPPY ||
|
|
|
|
|
+ target->total_sectors == 0) {
|
|
|
|
|
+ io_putstr("install: target is not usable\n");
|
|
|
|
|
+ vfs_release_file(km, &kf);
|
|
|
|
|
+ return -1;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!check_nebos_image(target, 0, 0, mbr)) {
|
|
|
|
|
+ io_putstr("install: target is not an installed NebOS disk\n");
|
|
|
|
|
+ io_putstr("install: run `install <target> <source>` from USB first\n");
|
|
|
|
|
+ vfs_release_file(km, &kf);
|
|
|
|
|
+ return -1;
|
|
|
|
|
+ }
|
|
|
|
|
+ have_data = detect_data_partition(target, mbr, 0);
|
|
|
|
|
+
|
|
|
|
|
+ io_putstr("install: source running image, kernel ");
|
|
|
|
|
+ put_size((kf.size + 511u) / 512u);
|
|
|
|
|
+ io_putstr(", rootfs ");
|
|
|
|
|
+ put_size((psize + 511u) / 512u);
|
|
|
|
|
+ io_putstr(gz ? " gzip" : " raw");
|
|
|
|
|
+ io_putchar('\n');
|
|
|
|
|
+ io_putstr("install: target ");
|
|
|
|
|
+ io_putstr(target->name);
|
|
|
|
|
+ if (target->model[0]) {
|
|
|
|
|
+ io_putstr(" (");
|
|
|
|
|
+ io_putstr(target->model);
|
|
|
|
|
+ io_putchar(')');
|
|
|
|
|
+ }
|
|
|
|
|
+ io_putchar('\n');
|
|
|
|
|
+ if (!ask_continue(target, have_data)) {
|
|
|
|
|
+ vfs_release_file(km, &kf);
|
|
|
|
|
+ return -1;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ zero_bytes((unsigned char *)&hdr, sizeof(hdr));
|
|
|
|
|
+ copy_bytes((unsigned char *)hdr.magic, (const unsigned char *)ROOTFS_MAGIC,
|
|
|
|
|
+ 7);
|
|
|
|
|
+ hdr.version = ROOTFS_VERSION;
|
|
|
|
|
+ hdr.pack_bytes = psize;
|
|
|
|
|
+ hdr.pack_csum = sum_bytes(0, (const unsigned char *)pack, psize);
|
|
|
|
|
+ hdr.flags = ROOTFS_FLAG_GZIP;
|
|
|
|
|
+
|
|
|
|
|
+ r = write_os_image(target, kf.data, kf.size, &hdr, pack, psize, 1);
|
|
|
|
|
+ vfs_release_file(km, &kf);
|
|
|
|
|
+ if (r == 0) {
|
|
|
|
|
+ io_putstr("install: done; /data kept or created.\n");
|
|
|
|
|
+ serial_puts(SERIAL_COM1, "install: self done\n");
|
|
|
|
|
+ }
|
|
|
|
|
+ return r;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+int install_ram_image(const char *target, const void *kernel,
|
|
|
|
|
+ unsigned int ksize, const void *rootfs,
|
|
|
|
|
+ unsigned int rsize)
|
|
|
|
|
+{
|
|
|
|
|
+ const struct rootfs_hdr *hdr;
|
|
|
|
|
+ const unsigned char *pack;
|
|
|
|
|
+ unsigned int psize;
|
|
|
|
|
+ blk_dev_t *d;
|
|
|
|
|
+
|
|
|
|
|
+ if (!rootfs || rsize < ROOTFS_HDR_SIZE) {
|
|
|
|
|
+ io_putstr("install: rootfs image too short\n");
|
|
|
|
|
+ return -1;
|
|
|
|
|
+ }
|
|
|
|
|
+ hdr = (const struct rootfs_hdr *)rootfs;
|
|
|
|
|
+ if (hdr->magic[0] != 'N' || hdr->magic[1] != 'B' ||
|
|
|
|
|
+ hdr->magic[2] != 'R' || hdr->magic[3] != 'O' ||
|
|
|
|
|
+ hdr->magic[4] != 'O' || hdr->magic[5] != 'T' ||
|
|
|
|
|
+ hdr->magic[6] != '1' || hdr->version != ROOTFS_VERSION) {
|
|
|
|
|
+ io_putstr("install: bad rootfs image\n");
|
|
|
|
|
+ return -1;
|
|
|
|
|
+ }
|
|
|
|
|
+ psize = hdr->pack_bytes;
|
|
|
|
|
+ if (!psize || psize > rsize - ROOTFS_HDR_SIZE ||
|
|
|
|
|
+ !(hdr->flags & ROOTFS_FLAG_GZIP)) {
|
|
|
|
|
+ io_putstr("install: bad rootfs length or encoding\n");
|
|
|
|
|
+ return -1;
|
|
|
|
|
+ }
|
|
|
|
|
+ d = resolve_target(target);
|
|
|
|
|
+ if (!d) {
|
|
|
|
|
+ io_putstr("install: no network install target\n");
|
|
|
|
|
+ return -1;
|
|
|
|
|
+ }
|
|
|
|
|
+ pack = (const unsigned char *)rootfs + ROOTFS_HDR_SIZE;
|
|
|
|
|
+ io_putstr("install: net update to ");
|
|
|
|
|
+ io_putstr(d->name);
|
|
|
|
|
+ io_putstr(" (kernel ");
|
|
|
|
|
+ put_size((ksize + 511u) / 512u);
|
|
|
|
|
+ io_putstr(", rootfs ");
|
|
|
|
|
+ put_size((psize + 511u) / 512u);
|
|
|
|
|
+ io_putstr(")\n");
|
|
|
|
|
+ return write_os_image(d, kernel, ksize, hdr, pack, psize, 0);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
void program_install_main(const char *arg)
|
|
void program_install_main(const char *arg)
|
|
|
{
|
|
{
|
|
|
char target_name[INSTALL_NAME_MAX], source_name[INSTALL_NAME_MAX];
|
|
char target_name[INSTALL_NAME_MAX], source_name[INSTALL_NAME_MAX];
|
|
|
- char source_dev[INSTALL_NAME_MAX];
|
|
|
|
|
|
|
+ char source_dev[INSTALL_NAME_MAX], target_dev[INSTALL_NAME_MAX];
|
|
|
blk_dev_t *target, *source;
|
|
blk_dev_t *target, *source;
|
|
|
blk_dev_t src_copy, dst_copy;
|
|
blk_dev_t src_copy, dst_copy;
|
|
|
unsigned char *image = 0;
|
|
unsigned char *image = 0;
|
|
|
|
|
+ unsigned char target_mbr[512], data_entry[MBR_PART_SIZE];
|
|
|
unsigned int image_pages = 0;
|
|
unsigned int image_pages = 0;
|
|
|
int have_copies = 0;
|
|
int have_copies = 0;
|
|
|
unsigned int used, i, j, lba, sum, vsum;
|
|
unsigned int used, i, j, lba, sum, vsum;
|
|
|
int has_esp = 0, explicit_source = 0;
|
|
int has_esp = 0, explicit_source = 0;
|
|
|
- int k;
|
|
|
|
|
|
|
+ int data_created = 0;
|
|
|
|
|
|
|
|
if (format_busy && process_is_alive(format_owner_pid)) {
|
|
if (format_busy && process_is_alive(format_owner_pid)) {
|
|
|
io_putstr("install: another format/install is in progress\n");
|
|
io_putstr("install: another format/install is in progress\n");
|
|
@@ -283,7 +830,7 @@ void program_install_main(const char *arg)
|
|
|
format_busy = 0;
|
|
format_busy = 0;
|
|
|
|
|
|
|
|
if (!arg) {
|
|
if (!arg) {
|
|
|
- io_putstr("install: usage install <target> [source]\n");
|
|
|
|
|
|
|
+ io_putstr("install: usage install <target> [source|self]\n");
|
|
|
list_devices();
|
|
list_devices();
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -306,18 +853,18 @@ void program_install_main(const char *arg)
|
|
|
while (arg[i] == ' ')
|
|
while (arg[i] == ' ')
|
|
|
i++;
|
|
i++;
|
|
|
if (!target_name[0] || arg[i]) {
|
|
if (!target_name[0] || arg[i]) {
|
|
|
- io_putstr("install: usage install <target> [source]\n");
|
|
|
|
|
|
|
+ io_putstr("install: usage install <target> [source|self]\n");
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- target = blk_find(target_name);
|
|
|
|
|
- if (!target) {
|
|
|
|
|
- io_putstr("install: unknown target '");
|
|
|
|
|
- io_putstr(target_name);
|
|
|
|
|
- io_putstr("'\n");
|
|
|
|
|
- list_devices();
|
|
|
|
|
|
|
+ if (str_eq(source_name, "self")) {
|
|
|
|
|
+ install_self(target_name);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ target = resolve_target(target_name);
|
|
|
|
|
+ if (!target)
|
|
|
|
|
+ return;
|
|
|
if (target->kind == BLK_FLOPPY) {
|
|
if (target->kind == BLK_FLOPPY) {
|
|
|
io_putstr("install: a floppy is too small for the image\n");
|
|
io_putstr("install: a floppy is too small for the image\n");
|
|
|
return;
|
|
return;
|
|
@@ -328,6 +875,9 @@ void program_install_main(const char *arg)
|
|
|
io_putstr(" is not present\n");
|
|
io_putstr(" is not present\n");
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
+ for (i = 0; i + 1 < sizeof(target_dev) && target->name[i]; i++)
|
|
|
|
|
+ target_dev[i] = target->name[i];
|
|
|
|
|
+ target_dev[i] = '\0';
|
|
|
|
|
|
|
|
source = find_source(target, explicit_source ? source_name : 0, &used);
|
|
source = find_source(target, explicit_source ? source_name : 0, &used);
|
|
|
if (!source) {
|
|
if (!source) {
|
|
@@ -378,28 +928,16 @@ void program_install_main(const char *arg)
|
|
|
source_dev[i] = source->name[i];
|
|
source_dev[i] = source->name[i];
|
|
|
source_dev[i] = '\0';
|
|
source_dev[i] = '\0';
|
|
|
|
|
|
|
|
- io_putstr("install: this destroys all data on ");
|
|
|
|
|
- io_putstr(target->name);
|
|
|
|
|
- io_putstr("? (y/n) ");
|
|
|
|
|
- vga_fb_flush();
|
|
|
|
|
|
|
+ {
|
|
|
|
|
+ int have_data = 0;
|
|
|
|
|
|
|
|
- /* The confirmation loop yields so the kworker can poll the USB HID
|
|
|
|
|
- * keyboard. The copy then releases the BKL per chunk; do not run
|
|
|
|
|
- * lsusb (a bus rescan) while an install is in progress. */
|
|
|
|
|
- io_set_raw_keyboard(1);
|
|
|
|
|
- for (;;) {
|
|
|
|
|
- k = io_poll_key_with_hw();
|
|
|
|
|
- if (k == 'y' || k == 'Y')
|
|
|
|
|
- break;
|
|
|
|
|
- if (k == 'n' || k == 'N') {
|
|
|
|
|
- io_set_raw_keyboard(0);
|
|
|
|
|
- io_putstr("aborted\n");
|
|
|
|
|
|
|
+ if (blk_read(target, 0, target_mbr, 1) == 0)
|
|
|
|
|
+ have_data = detect_data_partition(target, target_mbr, 0);
|
|
|
|
|
+ if (have_data)
|
|
|
|
|
+ io_putstr("install: /data partition found; keeping it\n");
|
|
|
|
|
+ if (!ask_continue(target, have_data))
|
|
|
return;
|
|
return;
|
|
|
- }
|
|
|
|
|
- process_sleep_ms(10);
|
|
|
|
|
}
|
|
}
|
|
|
- io_set_raw_keyboard(0);
|
|
|
|
|
- io_putchar('\n');
|
|
|
|
|
|
|
|
|
|
/* The prompt yielded; another command may have rescanned the block
|
|
/* The prompt yielded; another command may have rescanned the block
|
|
|
* devices or started a format. Re-find both by name and take a
|
|
* devices or started a format. Re-find both by name and take a
|
|
@@ -411,7 +949,7 @@ void program_install_main(const char *arg)
|
|
|
format_owner_pid = current_proc()->pid;
|
|
format_owner_pid = current_proc()->pid;
|
|
|
format_busy = 1;
|
|
format_busy = 1;
|
|
|
|
|
|
|
|
- target = blk_find(target_name);
|
|
|
|
|
|
|
+ target = blk_find(target_dev);
|
|
|
source = blk_find(source_dev);
|
|
source = blk_find(source_dev);
|
|
|
if (!target || !source || source == target ||
|
|
if (!target || !source || source == target ||
|
|
|
!target->present || !source->present) {
|
|
!target->present || !source->present) {
|
|
@@ -455,16 +993,16 @@ void program_install_main(const char *arg)
|
|
|
for (i = 0; i < sizeof(sector0); i++)
|
|
for (i = 0; i < sizeof(sector0); i++)
|
|
|
image[i] = sector0[i];
|
|
image[i] = sector0[i];
|
|
|
/* LBA 1..62 are the unused zero gap (partition 1 starts at 63). */
|
|
/* LBA 1..62 are the unused zero gap (partition 1 starts at 63). */
|
|
|
- for (i = sizeof(sector0); i < BOOT_LBA * 512u; i++)
|
|
|
|
|
|
|
+ for (i = sizeof(sector0); i < NEBOS_BOOT_LBA * 512u; i++)
|
|
|
image[i] = 0;
|
|
image[i] = 0;
|
|
|
- sum = sum_bytes(0, sector0, sizeof(sector0));
|
|
|
|
|
|
|
+ sum = 0;
|
|
|
|
|
|
|
|
io_putstr("install: reading source");
|
|
io_putstr("install: reading source");
|
|
|
vga_fb_flush();
|
|
vga_fb_flush();
|
|
|
|
|
|
|
|
/* Keep the BKL here: the USB source must stay active across all
|
|
/* Keep the BKL here: the USB source must stay active across all
|
|
|
* chunks. The target writes below release it per chunk. */
|
|
* chunks. The target writes below release it per chunk. */
|
|
|
- for (lba = BOOT_LBA; lba < used; lba += INSTALL_CHUNK) {
|
|
|
|
|
|
|
+ for (lba = NEBOS_BOOT_LBA; lba < used; lba += INSTALL_CHUNK) {
|
|
|
unsigned int n = used - lba;
|
|
unsigned int n = used - lba;
|
|
|
|
|
|
|
|
if (n > INSTALL_CHUNK)
|
|
if (n > INSTALL_CHUNK)
|
|
@@ -479,6 +1017,20 @@ void program_install_main(const char *arg)
|
|
|
}
|
|
}
|
|
|
io_putchar('\n');
|
|
io_putchar('\n');
|
|
|
|
|
|
|
|
|
|
+ /* The data partition is prepared before the target is touched. It is
|
|
|
|
|
+ * outside the cloned P1..P3 range; an existing one is left untouched. */
|
|
|
|
|
+ if (blk_read(&dst_copy, 0, target_mbr, 1) != 0)
|
|
|
|
|
+ zero_bytes(target_mbr, sizeof(target_mbr));
|
|
|
|
|
+ if (!ensure_data_partition(&dst_copy, target_mbr, data_entry,
|
|
|
|
|
+ &data_created))
|
|
|
|
|
+ goto fail;
|
|
|
|
|
+ copy_bytes(image, sector0, 512);
|
|
|
|
|
+ copy_bytes(image + MBR_PART_OFF + 3 * MBR_PART_SIZE, data_entry,
|
|
|
|
|
+ MBR_PART_SIZE);
|
|
|
|
|
+ /* Include the final MBR (with the merged data entry) and the zero gap
|
|
|
|
|
+ * in the checksum. `sum` currently covers BOOT_LBA..used. */
|
|
|
|
|
+ sum = sum_bytes(0, image, NEBOS_BOOT_LBA * 512u) + sum;
|
|
|
|
|
+
|
|
|
io_putstr("install: writing target");
|
|
io_putstr("install: writing target");
|
|
|
for (lba = 1; lba < used; lba += INSTALL_CHUNK) {
|
|
for (lba = 1; lba < used; lba += INSTALL_CHUNK) {
|
|
|
unsigned int n = used - lba;
|
|
unsigned int n = used - lba;
|
|
@@ -536,6 +1088,8 @@ void program_install_main(const char *arg)
|
|
|
vfs_remount_device(&dst_copy);
|
|
vfs_remount_device(&dst_copy);
|
|
|
format_busy = 0;
|
|
format_busy = 0;
|
|
|
io_putstr("install: done; remove the install medium and reboot.\n");
|
|
io_putstr("install: done; remove the install medium and reboot.\n");
|
|
|
|
|
+ io_putstr(data_created ? "install: created /data on partition 4.\n"
|
|
|
|
|
+ : "install: kept the existing /data partition.\n");
|
|
|
serial_puts(SERIAL_COM1, "install: done\n");
|
|
serial_puts(SERIAL_COM1, "install: done\n");
|
|
|
return;
|
|
return;
|
|
|
|
|
|