migrate detect_kernel