libdebian-installer
Functions
Subarchitecture detection

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

Referenced by di_system_subarch_analyze_guess().

140 {
141  char entry[256];
142  int i;
143  int ret;
144 
145  entry[0] = '\0';
146 
147  ret = read_dt_model(entry, sizeof(entry));
148  if (ret)
149  ret = read_cpuinfo(entry, sizeof(entry));
150  if (ret)
151  return "unknown";
152 
153  for (i = 0; map_hardware[i].entry; i++)
154  {
155  if (!strncasecmp(map_hardware[i].entry, entry,
156  strlen(map_hardware[i].entry)))
157  {
158  return( map_hardware[i].ret );
159  }
160  }
161 
162  return "unknown";
163 }
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().

166 {
167  struct utsname sysinfo;
168  size_t uname_release_len, i;
169 
170  /* Attempt to determine subarch based on kernel release version */
171  uname(&sysinfo);
172  uname_release_len = strlen(sysinfo.release);
173 
174  for (i = 0; supported_generic_subarches[i] != NULL; i++)
175  {
176  size_t subarch_len = strlen (supported_generic_subarches[i]);
177  if (!strncmp(sysinfo.release+uname_release_len-subarch_len,
178  supported_generic_subarches[i],
179  subarch_len))
180  {
181  return supported_generic_subarches[i];
182  }
183  }
184 
185  /* If we get here, try falling back on the normal detection method */
186  return di_system_subarch_analyze();
187 }