]>
git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/installer/hw.h
1 /*#############################################################################
3 # IPFire - An Open Source Firewall Distribution #
4 # Copyright (C) 2014 IPFire development team #
6 # This program is free software: you can redistribute it and/or modify #
7 # it under the terms of the GNU General Public License as published by #
8 # the Free Software Foundation, either version 3 of the License, or #
9 # (at your option) any later version. #
11 # This program is distributed in the hope that it will be useful, #
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
14 # GNU General Public License for more details. #
16 # You should have received a copy of the GNU General Public License #
17 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
19 #############################################################################*/
26 #define DESTINATION_MOUNT_PATH "/harddisk"
27 #define SOURCE_MOUNT_PATH "/cdrom"
28 #define SOURCE_TEST_FILE SOURCE_MOUNT_PATH "/" DISTRO_SNAME "-" DISTRO_VERSION ".media"
30 #define HW_MAX_DISKS 32
31 #define STRING_SIZE 1024
34 #define HW_PATH_BOOT "/boot"
35 #define HW_PATH_BOOT_EFI "/boot/efi"
36 #define HW_PATH_DATA "/var"
38 #define HW_PART_TYPE_NORMAL 0
39 #define HW_PART_TYPE_RAID1 1
41 #define HW_PART_TABLE_MSDOS 0
42 #define HW_PART_TABLE_GPT 1
45 #define HW_FS_REISERFS 1
47 #define HW_FS_EXT4_WO_JOURNAL 3
51 #define HW_FS_DEFAULT HW_FS_EXT4
53 #define RAID_METADATA "1.0"
55 #define SERIAL_BAUDRATE 115200
57 #define BYTES2MB(x) ((x) / 1024 / 1024)
58 #define MB2BYTES(x) ((unsigned long long)(x) * 1024 * 1024)
62 char arch
[STRING_SIZE
];
64 // Enabled if we should install in EFI mode
70 unsigned long long size
;
72 char description
[STRING_SIZE
];
73 char vendor
[STRING_SIZE
];
74 char model
[STRING_SIZE
];
80 struct hw_destination
{
85 const struct hw_disk
* disk1
;
86 const struct hw_disk
* disk2
;
89 char part_bootldr
[DEV_SIZE
];
90 char part_boot
[DEV_SIZE
];
91 char part_boot_efi
[DEV_SIZE
];
92 char part_swap
[DEV_SIZE
];
93 char part_root
[DEV_SIZE
];
95 int part_boot_efi_idx
;
99 unsigned long long size
;
100 unsigned long long size_bootldr
;
101 unsigned long long size_boot
;
102 unsigned long long size_boot_efi
;
103 unsigned long long size_swap
;
104 unsigned long long size_root
;
107 struct hw
* hw_init();
108 void hw_free(struct hw
* hw
);
110 int hw_mount(const char* source
, const char* target
, const char* fs
, int flags
);
111 int hw_umount(const char* target
);
113 char* hw_find_source_medium(struct hw
* hw
);
115 struct hw_disk
** hw_find_disks(struct hw
* hw
, const char* sourcedrive
);
116 void hw_free_disks(struct hw_disk
** disks
);
117 unsigned int hw_count_disks(const struct hw_disk
** disks
);
118 struct hw_disk
** hw_select_disks(struct hw_disk
** disks
, int* selection
);
119 struct hw_disk
** hw_select_first_disk(const struct hw_disk
** disks
);
121 struct hw_destination
* hw_make_destination(struct hw
* hw
, int part_type
, struct hw_disk
** disks
,
124 unsigned long long hw_memory();
126 int hw_create_partitions(struct hw_destination
* dest
, const char* output
);
127 int hw_create_filesystems(struct hw_destination
* dest
, const char* output
);
129 int hw_mount_filesystems(struct hw_destination
* dest
, const char* prefix
);
130 int hw_umount_filesystems(struct hw_destination
* dest
, const char* prefix
);
132 int hw_destroy_raid_superblocks(const struct hw_destination
* dest
, const char* output
);
133 int hw_setup_raid(struct hw_destination
* dest
, const char* output
);
134 int hw_stop_all_raid_arrays(const char* output
);
136 int hw_install_bootloader(struct hw
* hw
, struct hw_destination
* dest
, const char* output
);
137 int hw_write_fstab(struct hw_destination
* dest
);
139 char* hw_find_backup_file(const char* output
, const char* search_path
);
140 int hw_restore_backup(const char* output
, const char* backup_path
, const char* destination
);
142 int hw_start_networking(const char* output
);
146 #endif /* HEADER_HW_H */