int main(void) { int count = 15; mount("tmpfs", "/dev", "tmpfs", MS_NOSUID, "mode=0755"); mount("sysfs", "/sys", "sysfs", 0, NULL); klog_init(); klog_set_level(8); while (1) { if (!mount_device()) break; if (count--) { sleep(2); dbg("Iago media not found, trying again...\n"); continue; } KLOG_ERROR("Iago", "Couldn't find installation media!\n"); exit(1); /* will result in kernel panic */ } umount("/dev"); umount("/sys"); /* ok, start the real init */ dbg("Installation media mounted, now starting Android init\n"); execl("/init2", "init", NULL); KLOG_ERROR("Iago", "Failed to execl() Android init: %s\n", strerror(errno)); return EXIT_FAILURE; }
static void mount_device_with_defaults( const char *start_dir ) { int rc; rc = msdos_format( RAMDISK_PATH, &rqdata ); rtems_test_assert( rc == 0 ); rtems_resource_snapshot_take( &before_mount ); mount_device( start_dir, NULL ); }
static void mount_device_with_iconv( const char *start_dir, rtems_dosfs_mount_options *mount_opts ) { int rc; rc = msdos_format( RAMDISK_PATH, &rqdata ); rtems_test_assert( rc == 0 ); rtems_resource_snapshot_take( &before_mount ); mount_opts->converter = rtems_dosfs_create_utf8_converter( "CP850" ); rtems_test_assert( mount_opts->converter != NULL ); mount_device( start_dir, mount_opts ); }
void usb_fs_mount(UINT32 nodeid) { int result = -EIO; int hdd_ns = 0; int vol_ns = 0; int i = 0; int j = 0; char dirbuf[sizeof(struct dirent) + 32]; struct dirent *dire = (struct dirent *)dirbuf; char dev_name[16], vol_name[16]; int fd; struct stat st; int devid; UINT32 msg_code = 0; INT32 lun_num; lun_num = usb_get_max_lun(nodeid); #ifdef USB_SUPPORT_HUB struct fs_sto_param fs_param; fs_param.type = MNT_TYPE_USB; fs_param.id = 0; fs_param.partition_id = 0; #endif FS_PRINTF("USB lun_num = %d\n", lun_num); //firstly create all the device and partitions for( i = 0; i< lun_num; ++i) { if(usb_check_lun_ready(nodeid, i)) { result = usb_dev_fs_init(nodeid, i); if(result == 0) { /* usb hdd is ready, we should send message to UI */ int hdd_vol_ns = 0; // how many volume of this hdd mount success hdd_ns++; //loop the /dev try to mount all the device devid = usb_hdd_get_dev(nodeid, i); #ifdef USB_SUPPORT_HUB fs_param.id = devid; #endif fd = fs_opendir("/dev"); while(fs_readdir(fd, dire) > 0) { fs_get_mount_name(MNT_TYPE_USB, devid, 0, dev_name); if((STRLEN(dire->d_name) == 4) && !MEMCMP(&dire->d_name, &dev_name[5], 3)) { STRCPY(dev_name, "/dev/"); strcat(dev_name, dire->d_name); STRCPY(vol_name, "/mnt/"); strcat(vol_name, dire->d_name); //mount the device result = mount_device(dev_name, vol_name); if(result >= 0) { link_device(vol_name, "/c"); #if (SYS_CHIP_MODULE != ALI_S3602) link_device(vol_name, "/r"); #endif vol_ns++; hdd_vol_ns++; #if (defined(FS_MAX_USB_VOLUME_SUPPORT)) if (hdd_vol_ns >= FS_MAX_USB_VOLUME_SUPPORT) break; #elif ((SYS_SDRAM_SIZE == 64) && (defined(M36F_CHIP_MODE)||defined(S3811_CHIP_MODE))) if (hdd_vol_ns >= 4) break; #endif } } } fs_closedir(fd); #if (SYS_CHIP_MODULE == ALI_S3602) int mnt_status = (hdd_vol_ns > 0) ? MNT_MOUNT_OK : MNT_FAILED; #ifdef USB_SUPPORT_HUB FS_NOTICE_MESSAGE(MP_FS_MOUNT, MNT_MSG_PARAM(mnt_status, fs_param.type, fs_param.id)); #else FS_NOTICE_MESSAGE(MP_FS_MOUNT, MNT_MSG_PARAM(mnt_status, MNT_TYPE_USB, 0)); #endif #endif } else { FS_PRINTF("device lun = %d init failed! err = %d\n", i, result); } } } if(hdd_ns == 0) { FS_PRINTF("all the device are inited failed!\n"); #if (SYS_CHIP_MODULE != ALI_S3602) #ifdef USB_SUPPORT_HUB fs_param.msg_code = MNT_NO_PARTITION; msg_code = fs_param.type<<24 | fs_param.id<<16 | fs_param.partition_id<<8 | fs_param.msg_code; #else msg_code = 11; #endif FS_NOTICE_MESSAGE(MP_FS_MOUNT, msg_code); #endif return; } if(vol_ns == 0) { FS_PRINTF("fs mount failed!\n"); #if (SYS_CHIP_MODULE != ALI_S3602) #ifdef USB_SUPPORT_HUB fs_param.msg_code = MNT_FAILED; msg_code = fs_param.type<<24 | fs_param.id<<16 | fs_param.partition_id<<8 | fs_param.msg_code; #else msg_code = 1; #endif FS_NOTICE_MESSAGE(MP_FS_MOUNT, msg_code); #endif return; } #if (SYS_CHIP_MODULE != ALI_S3602) #ifdef USB_SUPPORT_HUB fs_param.msg_code = MNT_MOUNT_OK; msg_code = fs_param.type<<24 | fs_param.id<<16 | fs_param.partition_id<<8 | fs_param.msg_code; #else msg_code = 3; #endif FS_NOTICE_MESSAGE(MP_FS_MOUNT, msg_code); #endif return; }
void sd_fs_mount(UINT32 param) { int result = -EIO; int hdd_ns = 0; int vol_ns = 0; int i = 0; int j = 0; char dirbuf[sizeof(struct dirent) + 32]; struct dirent *dire = (struct dirent *)dirbuf; char dev_name[16], vol_name[16]; int fd; struct stat st; #ifdef USB_SUPPORT_HUB UINT32 msg_code = 0; struct fs_sto_param fs_param; fs_param.type = MNT_TYPE_SD; fs_param.id = 0; fs_param.partition_id = 0; #endif #if (SYS_CHIP_MODULE == ALI_S3602) FS_NOTICE_MESSAGE(MP_FS_MOUNT, MNT_MSG_PARAM(MNT_MOUNT, MNT_TYPE_SD, 0)); // SD_MESSAGE(MP_FS_MOUNT, MNT_MOUNT); #endif //firstly create all the device and partitions //INT32 lun_num = sdio_hdd_get_partition_number(0); result = sdio_hdd_init(0); if(result == 0) hdd_ns++; else FS_PRINTF("device lun = %d init failed! err = %d\n", i, result); if(hdd_ns == 0) { FS_PRINTF("all the device are inited failed!\n"); #if (SYS_CHIP_MODULE == ALI_S3602) FS_NOTICE_MESSAGE(MP_FS_MOUNT, MNT_MSG_PARAM(MNT_FAILED, MNT_TYPE_SD, 0)); // SD_MESSAGE(MP_FS_MOUNT, MNT_FAILED); #else #ifdef USB_SUPPORT_HUB fs_param.msg_code = MNT_NO_PARTITION; msg_code = fs_param.type<<24 | fs_param.id<<16 | fs_param.partition_id<<8 | fs_param.msg_code; #else msg_code = 11; #endif FS_NOTICE_MESSAGE(MP_FS_MOUNT, msg_code); #endif return; } //loop the /dev try to mount all the device fd = fs_opendir("/dev"); while(fs_readdir(fd, dire) > 0) { fs_get_mount_name(MNT_TYPE_SD, 0, 0, dev_name); if((STRLEN(dire->d_name) == 4) && !MEMCMP(&dire->d_name, &dev_name[5], 3)) { STRCPY(dev_name, "/dev/"); strcat(dev_name, dire->d_name); STRCPY(vol_name, "/mnt/"); strcat(vol_name, dire->d_name); //mount the device result = mount_device(dev_name, vol_name); if(result >= 0) { link_device(vol_name, "/c"); #if (SYS_CHIP_MODULE != ALI_S3602) link_device(vol_name, "/r"); #endif vol_ns++; } } } fs_closedir(fd); if(vol_ns == 0) { FS_PRINTF("fs mount failed!\n"); #if (SYS_CHIP_MODULE == ALI_S3602) FS_NOTICE_MESSAGE(MP_FS_MOUNT, MNT_MSG_PARAM(MNT_FAILED, MNT_TYPE_SD, 0)); // SD_MESSAGE(MP_FS_MOUNT, MNT_FAILED); #else #ifdef USB_SUPPORT_HUB fs_param.msg_code = MNT_FAILED; msg_code = fs_param.type<<24 | fs_param.id<<16 | fs_param.partition_id<<8 | fs_param.msg_code; #else msg_code = 1; #endif FS_NOTICE_MESSAGE(MP_FS_MOUNT, msg_code); #endif return; } #if (SYS_CHIP_MODULE == ALI_S3602) FS_NOTICE_MESSAGE(MP_FS_MOUNT, MNT_MSG_PARAM(MNT_MOUNT_OK, MNT_TYPE_SD, 0)); // SD_MESSAGE(MP_FS_MOUNT, MNT_MOUNT_OK); #else #ifdef USB_SUPPORT_HUB fs_param.msg_code = MNT_MOUNT_OK; msg_code = fs_param.type<<24 | fs_param.id<<16 | fs_param.partition_id<<8 | fs_param.msg_code; #else msg_code = 3; #endif FS_NOTICE_MESSAGE(MP_FS_MOUNT, msg_code); #endif return; }
void ide_fs_mount(UINT32 param) { int result = -EIO; int vol_ns = 0; char dirbuf[sizeof(struct dirent) + 32]; struct dirent *dire = (struct dirent *)dirbuf; char dev_name[16], vol_name[16]; int fd; //install the hdd if(ide_hdd_init(0) != 0) { FS_PRINTF("ide hdd init failed!\n"); #if (SYS_CHIP_MODULE == ALI_S3602) FS_NOTICE_MESSAGE(MP_FS_MOUNT, MNT_MSG_PARAM(MNT_FAILED, MNT_TYPE_IDE, 0)); // IDE_MESSAGE(MP_FS_MOUNT, MNT_FAILED); #else FS_NOTICE_MESSAGE(MP_FS_MOUNT, 1+100); #endif return; } #if (SYS_CHIP_MODULE == ALI_S3602) FS_NOTICE_MESSAGE(MP_FS_MOUNT, MNT_MSG_PARAM(MNT_MOUNT, MNT_TYPE_IDE, 0)); // IDE_MESSAGE(MP_FS_MOUNT, MNT_MOUNT); #else FS_NOTICE_MESSAGE(MP_FS_MOUNT, 2+100); #endif //FS_NOTICE_MESSAGE(MP_FS_IDE_MOUNT_NAME, (UINT32)mount_name); //loop the /dev try to mount all the device fd = fs_opendir("/dev"); while(fs_readdir(fd, dire) > 0) { fs_get_mount_name(MNT_TYPE_IDE, 0, 0, dev_name); if((STRLEN(dire->d_name) == 4) && !MEMCMP(&dire->d_name, &dev_name[5], 3)) { STRCPY(dev_name, "/dev/"); strcat(dev_name, dire->d_name); STRCPY(vol_name, "/mnt/"); strcat(vol_name, dire->d_name); //mount the device result = mount_device(dev_name, vol_name); if(result >= 0) { link_device(vol_name, "/c"); #if (SYS_CHIP_MODULE != ALI_S3602) link_device(vol_name, "/r"); #endif vol_ns++; } } } fs_closedir(fd); if(vol_ns == 0) { FS_PRINTF("fs mount failed!\n"); #if (SYS_CHIP_MODULE == ALI_S3602) FS_NOTICE_MESSAGE(MP_FS_MOUNT, MNT_MSG_PARAM(MNT_FAILED, MNT_TYPE_IDE, 0)); // IDE_MESSAGE(MP_FS_MOUNT, MNT_FAILED); #else FS_NOTICE_MESSAGE(MP_FS_MOUNT, 100 + 1); #endif return; } #if (SYS_CHIP_MODULE == ALI_S3602) FS_NOTICE_MESSAGE(MP_FS_MOUNT, MNT_MSG_PARAM(MNT_MOUNT_OK, MNT_TYPE_IDE, 0)); // IDE_MESSAGE(MP_FS_MOUNT, MNT_MOUNT_OK); #else FS_NOTICE_MESSAGE(MP_FS_MOUNT, 3+100); #endif return; }
void sata_fs_mount(UINT32 param) { int result = -EIO; int vol_ns = 0; char dirbuf[sizeof(struct dirent) + 32]; struct dirent *dire = (struct dirent *)dirbuf; char dev_name[16], vol_name[16]; int fd; struct fs_sto_param fs_param; fs_param.type = MNT_TYPE_SATA; fs_param.id = 0; fs_param.partition_id = 0; //install the sata hdd if(sata_hdd_init(0) != 0) { FS_PRINTF("sata hdd init failed!\n"); fs_param.msg_code = MNT_FAILED; PUT_MESSAGE(MP_FS_MOUNT, fs_param); return; } fs_param.msg_code = MNT_MOUNT; PUT_MESSAGE(MP_FS_MOUNT, fs_param); //loop the /dev try to mount all the device fd = fs_opendir("/dev"); while(fs_readdir(fd, dire) > 0) { fs_get_mount_name(MNT_TYPE_SATA, 0, 0, dev_name); if((STRLEN(dire->d_name) == 4) && !MEMCMP(&dire->d_name, &dev_name[5], 3)) { STRCPY(dev_name, "/dev/"); strcat(dev_name, dire->d_name); STRCPY(vol_name, "/mnt/"); strcat(vol_name, dire->d_name); //mount the device result = mount_device(dev_name, vol_name); if(result >= 0) { #if (SYS_CHIP_MODULE != ALI_S3602) #ifdef PVR_MULTI_VOLUME_SUPPORT link_device(vol_name, "/r"); #endif #endif vol_ns++; } } } fs_closedir(fd); if(vol_ns == 0) { FS_PRINTF("fs mount failed!\n"); fs_param.msg_code = MNT_FAILED; PUT_MESSAGE(MP_FS_MOUNT, fs_param); return; } fs_param.msg_code = MNT_MOUNT_OK; PUT_MESSAGE(MP_FS_MOUNT, fs_param); return; }