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

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

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