Changeset ebb1489 in mainline for uspace/app/sysinst/sysinst.c
- Timestamp:
- 2024-10-13T08:23:40Z (2 months ago)
- Children:
- 0472cf17
- Parents:
- 2a0c827c (diff), b3b79981 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - git-author:
- boba-buba <120932204+boba-buba@…> (2024-10-13 08:23:40)
- git-committer:
- GitHub <noreply@…> (2024-10-13 08:23:40)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/sysinst/sysinst.c
r2a0c827c rebb1489 1 1 /* 2 * Copyright (c) 20 18Jiri Svoboda2 * Copyright (c) 2024 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 41 41 #include <errno.h> 42 42 #include <fdisk.h> 43 #include <futil.h> 43 44 #include <loc.h> 44 45 #include <stdio.h> … … 49 50 #include <vol.h> 50 51 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 "devices/\\hw\\sys\\00:01.0\\ata-c1\\d0" 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" 65 66 //#define DEFAULT_DEV "devices/\\hw\\pci0\\00:01.2\\uhci_rh\\usb01_a1\\mass-storage0\\l0" 66 67 /** Volume label for the new file system */ … … 79 80 #define BOOT_BLOCK_IDX 0 /* MBR */ 80 81 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 NULL 89 }; 90 81 91 static const char *sys_dirs[] = { 82 92 "/cfg", 83 "/data" 93 "/data", 94 NULL 84 95 }; 96 97 /** Check the if the destination device exists. 98 * 99 * @param dev Disk device 100 * 101 * @return EOK on success or an error code 102 */ 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 } 85 115 86 116 /** Label the destination device. … … 200 230 path = NULL; 201 231 232 /* Copy initial configuration files */ 233 rc = futil_rcopy_contents(CFG_FILES_SRC, CFG_FILES_DEST); 234 if (rc != EOK) 235 return rc; 236 202 237 return EOK; 203 238 error: … … 244 279 } 245 280 246 rv = asprintf(&path, "%s%s", rdpath, "/cfg/ volsrv.sif");281 rv = asprintf(&path, "%s%s", rdpath, "/cfg/initvol.sif"); 247 282 if (rv < 0) { 248 283 rc = ENOMEM; … … 271 306 printf("Error creating system partition configuration.\n"); 272 307 rc = EIO; 308 goto error; 309 } 310 311 rc = vol_volumes_sync(volumes); 312 if (rc != EOK) { 313 printf("Error saving volume confiuration.\n"); 273 314 goto error; 274 315 } … … 361 402 362 403 printf("sysinst_copy_boot_blocks: block_init.\n"); 363 rc = block_init(sid , 512);404 rc = block_init(sid); 364 405 if (rc != EOK) 365 406 return rc; … … 490 531 int main(int argc, char *argv[]) 491 532 { 492 const char *dev = DEFAULT_DEV; 493 return sysinst_install(dev); 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]); 494 549 } 495 550
Note:
See TracChangeset
for help on using the changeset viewer.