Changes in uspace/app/sysinst/sysinst.c [4285f384:c24b0dcb] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/sysinst/sysinst.c
r4285f384 rc24b0dcb 1 1 /* 2 * Copyright (c) 20 25Jiri Svoboda2 * Copyright (c) 2018 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 41 41 #include <errno.h> 42 42 #include <fdisk.h> 43 #include <futil.h>44 43 #include <loc.h> 45 44 #include <stdio.h> … … 50 49 #include <vol.h> 51 50 51 #include "futil.h" 52 52 #include "grub.h" 53 53 #include "rdimg.h" … … 62 62 * in Grub notation). 63 63 */ 64 #define DEFAULT_DEV_0 "devices/\\hw\\sys\\00:01.1\\c0d0" 65 #define DEFAULT_DEV_1 "devices/\\hw\\sys\\00:01.0\\ata1\\c0d0" 64 #define DEFAULT_DEV "devices/\\hw\\sys\\00:01.0\\ata-c1\\d0" 66 65 //#define DEFAULT_DEV "devices/\\hw\\pci0\\00:01.2\\uhci_rh\\usb01_a1\\mass-storage0\\l0" 67 66 /** Volume label for the new file system */ … … 80 79 #define BOOT_BLOCK_IDX 0 /* MBR */ 81 80 82 #define CFG_FILES_SRC "/cfg"83 #define CFG_FILES_DEST MOUNT_POINT "/cfg"84 85 static const char *default_devs[] = {86 DEFAULT_DEV_0,87 DEFAULT_DEV_1,88 NULL89 };90 91 81 static const char *sys_dirs[] = { 92 82 "/cfg", 93 "/data", 94 NULL 83 "/data" 95 84 }; 96 97 /** Check the if the destination device exists.98 *99 * @param dev Disk device100 *101 * @return EOK on success or an error code102 */103 static errno_t sysinst_check_dev(const char *dev)104 {105 service_id_t sid;106 errno_t rc;107 108 rc = loc_service_get_id(dev, &sid, 0);109 if (rc != EOK)110 return rc;111 112 (void)sid;113 return EOK;114 }115 85 116 86 /** Label the destination device. … … 230 200 path = NULL; 231 201 232 /* Copy initial configuration files */233 rc = futil_rcopy_contents(CFG_FILES_SRC, CFG_FILES_DEST);234 if (rc != EOK)235 return rc;236 237 202 return EOK; 238 203 error: … … 279 244 } 280 245 281 rv = asprintf(&path, "%s%s", rdpath, "/cfg/ initvol.sif");246 rv = asprintf(&path, "%s%s", rdpath, "/cfg/volsrv.sif"); 282 247 if (rv < 0) { 283 248 rc = ENOMEM; … … 306 271 printf("Error creating system partition configuration.\n"); 307 272 rc = EIO; 308 goto error;309 }310 311 rc = vol_volumes_sync(volumes);312 if (rc != EOK) {313 printf("Error saving volume confiuration.\n");314 273 goto error; 315 274 } … … 402 361 403 362 printf("sysinst_copy_boot_blocks: block_init.\n"); 404 rc = block_init(sid );363 rc = block_init(sid, 512); 405 364 if (rc != EOK) 406 365 return rc; … … 475 434 } 476 435 477 rc = vol_part_eject(vol, part_id , vef_physical);436 rc = vol_part_eject(vol, part_id); 478 437 if (rc != EOK) { 479 438 printf("Error ejecting volume.\n"); … … 531 490 int main(int argc, char *argv[]) 532 491 { 533 unsigned i; 534 errno_t rc; 535 536 i = 0; 537 while (default_devs[i] != NULL) { 538 rc = sysinst_check_dev(default_devs[i]); 539 if (rc == EOK) 540 break; 541 } 542 543 if (default_devs[i] == NULL) { 544 printf("Cannot determine installation device.\n"); 545 return 1; 546 } 547 548 return sysinst_install(default_devs[i]); 492 const char *dev = DEFAULT_DEV; 493 return sysinst_install(dev); 549 494 } 550 495
Note:
See TracChangeset
for help on using the changeset viewer.