libdebian-installer
Functions
Di_system_subarch

Functions

const char * di_system_subarch_analyze (void)
 
const char * di_system_subarch_analyze_guess (void)
 

Detailed Description

Function Documentation

◆ di_system_subarch_analyze()

const char* di_system_subarch_analyze ( void  )

Returns a string describing the current subarchitecture, e.g. "powermac_newworld".

References di_system_is_efi().

Referenced by di_system_subarch_analyze_guess().

177 {
178  char entry[256];
179  int i;
180  int ret;
181 
182  entry[0] = '\0';
183 
184  ret = read_dt_model(entry, sizeof(entry));
185  if (ret)
186  ret = read_cpuinfo(entry, sizeof(entry));
187  if (ret)
188  return "generic";
189 
190  for (i = 0; map_hardware[i].entry; i++)
191  {
192  if (!strncasecmp(map_hardware[i].entry, entry,
193  strlen(map_hardware[i].entry)))
194  {
195  return( map_hardware[i].ret );
196  }
197  }
198 
199  return "generic";
200 }

◆ di_system_subarch_analyze_guess()

const char* di_system_subarch_analyze_guess ( void  )

Return a string with a best-guess of the current subarchitecture

Only present on armel currently, and is a stub on all other architectures

References di_system_is_efi(), and di_system_subarch_analyze().

203 {
204  struct utsname sysinfo;
205  size_t uname_release_len, i;
206 
207  /* If we detect EFI firmware, bail out early here */
208  if (di_system_is_efi())
209  return "efi";
210 
211  /* Attempt to determine subarch based on kernel release version */
212  uname(&sysinfo);
213  uname_release_len = strlen(sysinfo.release);
214 
215  for (i = 0; supported_generic_subarches[i] != NULL; i++)
216  {
217  size_t subarch_len = strlen (supported_generic_subarches[i]);
218  if (!strncmp(sysinfo.release+uname_release_len-subarch_len,
219  supported_generic_subarches[i],
220  subarch_len))
221  {
222  return supported_generic_subarches[i];
223  }
224  }
225 
226  /* If we get here, try falling back on the normal detection method */
227  return di_system_subarch_analyze();
228 }
const char * di_system_subarch_analyze(void)
Definition: subarch-arm-linux.c:176
int di_system_is_efi(void)
Definition: efi.c:27