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

148 {
149  char entry[256];
150  int i;
151  int ret;
152 
153  entry[0] = '\0';
154 
155  ret = read_dt_model(entry, sizeof(entry));
156  if (ret)
157  ret = read_cpuinfo(entry, sizeof(entry));
158  if (ret)
159  return "unknown";
160 
161  for (i = 0; map_hardware[i].entry; i++)
162  {
163  if (!strncasecmp(map_hardware[i].entry, entry,
164  strlen(map_hardware[i].entry)))
165  {
166  return( map_hardware[i].ret );
167  }
168  }
169 
170  return "unknown";
171 }
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().

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