Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/sysinst/sysinst.c

    r4285f384 rc24b0dcb  
    11/*
    2  * Copyright (c) 2025 Jiri Svoboda
     2 * Copyright (c) 2018 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    4141#include <errno.h>
    4242#include <fdisk.h>
    43 #include <futil.h>
    4443#include <loc.h>
    4544#include <stdio.h>
     
    5049#include <vol.h>
    5150
     51#include "futil.h"
    5252#include "grub.h"
    5353#include "rdimg.h"
     
    6262 * in Grub notation).
    6363 */
    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"
    6665//#define DEFAULT_DEV "devices/\\hw\\pci0\\00:01.2\\uhci_rh\\usb01_a1\\mass-storage0\\l0"
    6766/** Volume label for the new file system */
     
    8079#define BOOT_BLOCK_IDX 0 /* MBR */
    8180
    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 
    9181static const char *sys_dirs[] = {
    9282        "/cfg",
    93         "/data",
    94         NULL
     83        "/data"
    9584};
    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 }
    11585
    11686/** Label the destination device.
     
    230200        path = NULL;
    231201
    232         /* Copy initial configuration files */
    233         rc = futil_rcopy_contents(CFG_FILES_SRC, CFG_FILES_DEST);
    234         if (rc != EOK)
    235                 return rc;
    236 
    237202        return EOK;
    238203error:
     
    279244        }
    280245
    281         rv = asprintf(&path, "%s%s", rdpath, "/cfg/initvol.sif");
     246        rv = asprintf(&path, "%s%s", rdpath, "/cfg/volsrv.sif");
    282247        if (rv < 0) {
    283248                rc = ENOMEM;
     
    306271                printf("Error creating system partition configuration.\n");
    307272                rc = EIO;
    308                 goto error;
    309         }
    310 
    311         rc = vol_volumes_sync(volumes);
    312         if (rc != EOK) {
    313                 printf("Error saving volume confiuration.\n");
    314273                goto error;
    315274        }
     
    402361
    403362        printf("sysinst_copy_boot_blocks: block_init.\n");
    404         rc = block_init(sid);
     363        rc = block_init(sid, 512);
    405364        if (rc != EOK)
    406365                return rc;
     
    475434        }
    476435
    477         rc = vol_part_eject(vol, part_id, vef_physical);
     436        rc = vol_part_eject(vol, part_id);
    478437        if (rc != EOK) {
    479438                printf("Error ejecting volume.\n");
     
    531490int main(int argc, char *argv[])
    532491{
    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);
    549494}
    550495
Note: See TracChangeset for help on using the changeset viewer.