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".

160 {
161  char entry[256];
162  int i;
163  int ret;
164 
165  /* If we detect EFI firmware, bail out early here */
166  if (di_system_is_efi())
167  return "efi";
168 
169  entry[0] = '\0';
170 
171  ret = read_dt_model(entry, sizeof(entry));
172  if (ret)
173  ret = read_cpuinfo(entry, sizeof(entry));
174  if (ret)
175  return "generic";
176 
177  for (i = 0; map_hardware[i].entry; i++)
178  {
179  if (!strncasecmp(map_hardware[i].entry, entry,
180  strlen(map_hardware[i].entry)))
181  {
182  return( map_hardware[i].ret );
183  }
184  }
185 
186  return "generic";
187 }
int di_system_is_efi(void)
Definition: efi.c:27

References di_system_is_efi().

Referenced by di_system_subarch_analyze_guess().

◆ 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

190 {
191  struct utsname sysinfo;
192  size_t uname_release_len, i;
193 
194  /* If we detect EFI firmware, bail out early here */
195  if (di_system_is_efi())
196  return "efi";
197 
198  /* Attempt to determine subarch based on kernel release version */
199  uname(&sysinfo);
200  uname_release_len = strlen(sysinfo.release);
201 
202  for (i = 0; supported_generic_subarches[i] != NULL; i++)
203  {
204  size_t subarch_len = strlen (supported_generic_subarches[i]);
205  if (!strncmp(sysinfo.release+uname_release_len-subarch_len,
206  supported_generic_subarches[i],
207  subarch_len))
208  {
209  return supported_generic_subarches[i];
210  }
211  }
212 
213  /* If we get here, try falling back on the normal detection method */
214  return di_system_subarch_analyze();
215 }
const char * di_system_subarch_analyze(void)
Definition: subarch-arm-linux.c:159

References di_system_is_efi(), and di_system_subarch_analyze().