Skip to content

Commit

Permalink
support for latest snapshot FreeBSD 13.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ventoy committed Jan 1, 2021
1 parent 041ccb7 commit 6434e45
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 6 deletions.
Binary file modified INSTALL/ventoy/ventoy_unix.cpio
Binary file not shown.
2 changes: 2 additions & 0 deletions Unix/pack_unix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ VENTOY_PATH=$PWD/../

rm -f ventoy_unix.cpio

mv ./ventoy_unix/DragonFly ./
find ./ventoy_unix | cpio -o -H newc>ventoy_unix.cpio
mv ./DragonFly ./ventoy_unix/

echo '======== SUCCESS ============='

Expand Down
Binary file modified Unix/ventoy_unix.cpio
Binary file not shown.
Binary file modified Unix/ventoy_unix/DragonFly/sbin/init
Binary file not shown.
Binary file modified Unix/ventoy_unix/FreeBSD/geom_ventoy_ko/13.x/32/geom_ventoy.ko.xz
Binary file not shown.
Binary file modified Unix/ventoy_unix/FreeBSD/geom_ventoy_ko/13.x/64/geom_ventoy.ko.xz
Binary file not shown.
17 changes: 14 additions & 3 deletions Unix/ventoy_unix_src/DragonFly/oinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,20 +157,31 @@ static void ventoy_init(char **argv_orig)
vdebug("[VTOY] step 7: switch root ...\n");
error = chdir("/new_root");
if (error)
goto chroot_failed;
{
printf("[VTOY] chdir /new_root failed %d\n", error);
goto chroot_failed;
}

error = chroot_kernel("/new_root");
if (error)
goto chroot_failed;
{
printf("[VTOY] chroot_kernel /new_root failed %d\n", error);
goto chroot_failed;
}

error = chroot("/new_root");
if (error)
goto chroot_failed;
{
printf("[VTOY] chroot /new_root failed %d\n", error);
goto chroot_failed;
}

vdebug("[VTOY] step 8: now run /sbin/init ...\n");
execv("/sbin/init", __DECONST(char **, argv_orig));

/* We failed to exec /sbin/init in the chroot, sleep forever */
chroot_failed:
printf("[VTOY] ################### DEAD ################\n");
while(1) {
sleep(3);
};
Expand Down
10 changes: 7 additions & 3 deletions Unix/ventoy_unix_src/DragonFly/walk_disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,13 @@ int prepare_dmtable(void)
fread(&desc, 1, sizeof(desc), fIn);

vdebug("[VTOY] disksize:%lu part1size:%lu chunkcount:%u\n", desc.disk_size, desc.part1_size, desc.img_chunk_count);

find_disk_by_size(desc.part1_size, NULL, &count, disk);
vdebug("[VTOY] find disk by part1 size: %d %s\n", count, disk);

for (i = 0; count <= 0 && i < 10; i++)
{
sleep(2);
find_disk_by_size(desc.part1_size, NULL, &count, disk);
vdebug("[VTOY] find disk by part1 size, i=%d, count=%d, %s\n", i, count, disk);
}

if (count == 0)
{
Expand Down

0 comments on commit 6434e45

Please sign in to comment.