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

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

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

References di_system_is_efi(), and di_system_subarch_analyze().