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

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().

156 {
157  char entry[256];
158  int i;
159  int ret;
160 
161  entry[0] = '\0';
162 
163  ret = read_dt_model(entry, sizeof(entry));
164  if (ret)
165  ret = read_cpuinfo(entry, sizeof(entry));
166  if (ret)
167  return "unknown";
168 
169  for (i = 0; map_hardware[i].entry; i++)
170  {
171  if (!strncasecmp(map_hardware[i].entry, entry,
172  strlen(map_hardware[i].entry)))
173  {
174  return( map_hardware[i].ret );
175  }
176  }
177 
178  return "unknown";
179 }
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_subarch_analyze().

182 {
183  struct utsname sysinfo;
184  size_t uname_release_len, i;
185 
186  /* Attempt to determine subarch based on kernel release version */
187  uname(&sysinfo);
188  uname_release_len = strlen(sysinfo.release);
189 
190  for (i = 0; supported_generic_subarches[i] != NULL; i++)
191  {
192  size_t subarch_len = strlen (supported_generic_subarches[i]);
193  if (!strncmp(sysinfo.release+uname_release_len-subarch_len,
194  supported_generic_subarches[i],
195  subarch_len))
196  {
197  return supported_generic_subarches[i];
198  }
199  }
200 
201  /* If we get here, try falling back on the normal detection method */
202  return di_system_subarch_analyze();
203 }
const char * di_system_subarch_analyze(void)
Definition: subarch-arm-linux.c:155