Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
ventoy committed Sep 2, 2020
1 parent d678e54 commit 9a8d4d0
Show file tree
Hide file tree
Showing 17 changed files with 569 additions and 10 deletions.
26 changes: 22 additions & 4 deletions IMG/cpio/ventoy/hook/arch/ventoy-disk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,32 @@ fi

ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace"

blkdev_num=$($VTOY_PATH/tool/dmsetup ls | grep ventoy | sed 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1:\2/')
vtDM=$(ventoy_find_dm_id ${blkdev_num})
vtlog "blkdev_num=$blkdev_num vtDM=$vtDM ..."

while [ -n "Y" ]; do
if [ -b /dev/$vtDM ]; then
break
else
sleep 0.3
fi
done

if [ -n "$1" ]; then
blkdev_num=$($VTOY_PATH/tool/dmsetup ls | grep ventoy | sed 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1:\2/')
vtDM=$(ventoy_find_dm_id ${blkdev_num})

vtlog "ln -s /dev/$vtDM $1"
ln -s /dev/$vtDM "$1"
else
vtLABEL=$($BUSYBOX_PATH/blkid /dev/$vtDM | $SED 's/.*LABEL="\([^"]*\)".*/\1/')
vtlog "vtLABEL is $vtLABEL"

if [ -z "$vtLABEL" ]; then
vtLABEL=$($SED "s/.*label=\([^ ]*\)/\1/" /proc/cmdline)
vtlog "vtLABEL is $vtLABEL from cmdline"
fi

ln -s /dev/$vtDM "/dev/disk/by-label/$vtLABEL"
fi

# OK finish
set_ventoy_hook_finish

5 changes: 4 additions & 1 deletion IMG/cpio/ventoy/hook/arch/ventoy-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@ if $GREP -q '^"$mount_handler"' /init; then

vthookfile=/hooks/archiso

if [ -e /hook/miso ]; then
if [ -e /hooks/miso ]; then
vthookfile=/hooks/miso
$SED "/^\"\$mount_handler\"/i\ $BUSYBOX_PATH/sh $VTOY_PATH/hook/arch/ventoy-disk.sh \"\$misodevice\"" -i /init
elif [ -e /hooks/artix ]; then
vthookfile=/hooks/artix
$SED "/^\"\$mount_handler\"/i\ $BUSYBOX_PATH/sh $VTOY_PATH/hook/arch/ventoy-disk.sh \"\$artixdevice\"" -i /init
else
$SED "/^\"\$mount_handler\"/i\ $BUSYBOX_PATH/sh $VTOY_PATH/hook/arch/ventoy-disk.sh \"\$archisodevice\"" -i /init
fi
Expand Down
3 changes: 3 additions & 0 deletions INSTALL/CreatePersistentImg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ while [ -n "$1" ]; do
elif [ "$1" = "-l" ]; then
shift
label=$1
elif [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
print_usage
exit 0
else
print_usage
exit 1
Expand Down
12 changes: 8 additions & 4 deletions INSTALL/Ventoy2Disk.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
#!/bin/sh

if [ -f ./ventoy/version ]; then
curver=$(cat ./ventoy/version)
fi

echo ''
echo '***********************************************************'
echo '* Ventoy2Disk Script *'
echo '* longpanda admin@ventoy.net *'
echo '***********************************************************'
echo '**********************************************'
echo " Ventoy: $curver"
echo " longpanda admin@ventoy.net"
echo " https://www.ventoy.net"
echo '**********************************************'
echo ''

OLDDIR=$PWD
Expand Down
2 changes: 1 addition & 1 deletion INSTALL/grub/grub.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@ function ventoy_iso_busybox_ver {
#special process for deepin-live iso
if [ "$vt_chosen_size" = "403701760" ]; then
if vt_str_begin $vt_chosen_path "/deepin-live"; then
if vt_str_str $vt_chosen_path "/deepin-live"; then
set ventoy_busybox_ver=64
fi
elif vt_str_begin $vt_volume_id "PHOTON_"; then
Expand Down
6 changes: 6 additions & 0 deletions INSTALL/ventoy_pack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@ zip -r ventoy-${curver}-windows.zip $tmpdir/

rm -rf $tmpdir

cd ../LiveCD
sh livecd.sh
cd $CurDir

mv ../LiveCD/ventoy*.iso ./

if [ -e ventoy-${curver}-windows.zip ] && [ -e ventoy-${curver}-linux.tar.gz ]; then
echo -e "\n ============= SUCCESS =================\n"
else
Expand Down
4 changes: 4 additions & 0 deletions License/license-tinycore.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
tinycore follows the GPL-v2 License (see gpl-2.0.txt)

Ventoy does not modify its source code, only its binraries are used.

5 changes: 5 additions & 0 deletions LiveCD/GRUB/embed.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

search -f /EFI/VentoyLiveCD -s root
configfile ($root)/EFI/boot/grub.cfg


3 changes: 3 additions & 0 deletions LiveCD/ISO/EFI/VentoyLiveCD
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
VentoyLiveCD

https://www.ventoy.net
17 changes: 17 additions & 0 deletions LiveCD/ISO/EFI/boot/grub.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

set timeout=3
set default=LiveCD

clear

menuentry 'Ventoy xxx LiveCD' --id=LiveCD {
linux /EFI/boot/vmlinuz quiet loglevel=0 superuser rdinit=/ventoy/init.sh
initrd /EFI/ventoy/ventoy.gz /EFI/boot/core.gz /EFI/boot/modules.gz newc:ventoy.tar.gz:/EFI/ventoy/ventoy-xxx-linux.tar.gz
boot
}

menuentry 'Ventoy xxx LiveCD (Debug Mode)' {
linux /EFI/boot/vmlinuz loglevel=10 multivt superuser rdinit=/ventoy/init.sh
initrd /EFI/ventoy/ventoy.gz /EFI/boot/core.gz /EFI/boot/modules.gz newc:ventoy.tar.gz:/EFI/ventoy/ventoy-xxx-linux.tar.gz
boot
}
34 changes: 34 additions & 0 deletions LiveCD/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

Ventoy LiveCD is Tinycore distro + Ventoy linux install package.


vmlinuz and core.gz are downloaded from:
http://www.tinycorelinux.net/11.x/x86/release/distribution_files/

MD5SUM:
0fd08c73e84b26aabbd0d12006d64855 core.gz
a9c2e2abbf464517e681234fb4687aa1 vmlinuz



VTOY/ventoy/tcz/*/tcz are downloaded from:
http://distro.ibiblio.org/tinycorelinux/11.x/x86/tcz/

MD5SUM:
b6153a469d1d56e1e6895c6812a344cd dosfstools.tcz
29a4585d38b34ad58f8a7cb2d09e065f glib2.tcz
6812067a60165aee3cbcc07a75b6b1f4 libffi.tcz
5120e0c9ee65f936dea8cb6a0a0a1ddd liblvm2.tcz
92909db8fb3c4333a2a4a325ffbf4b50 ncursesw.tcz
e2bb47c9da2abab62fa794d69aba97c0 parted.tcz
0e6dfbebe816062a81aff6d3e5e7719b readline.tcz
3cf996373ab01be269ea0efaf17ce0cd udev-lib.tcz


VTOY/ventoy/drivers/*.ko
build kernel
http://www.tinycorelinux.net/11.x/x86/release/src/kernel/
config-5.4.3-tinycore
linux-5.4.3-patched.txz
disable a wireless lan driver to avoid compile error

43 changes: 43 additions & 0 deletions LiveCD/VTOY/ventoy/disksize.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef unsigned long long UINT64;

int GetHumanReadableGBSize(UINT64 SizeBytes)
{
int i;
int Pow2 = 1;
double Delta;
double GB = SizeBytes * 1.0 / 1000 / 1000 / 1000;

for (i = 0; i < 12; i++)
{
if (Pow2 > GB)
{
Delta = (Pow2 - GB) / Pow2;
}
else
{
Delta = (GB - Pow2) / Pow2;
}

if (Delta < 0.05)
{
return Pow2;
}

Pow2 <<= 1;
}

return (int)GB;
}

int main(int argc, char **argv)
{
UINT64 value = strtoul(argv[1], NULL, 10);

printf("%d", GetHumanReadableGBSize(value * 512));

return 0;
}
12 changes: 12 additions & 0 deletions LiveCD/VTOY/ventoy/init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

cat /ventoy/modlist | while read line; do
if [ -e /ventoy/drivers/${line}.ko ]; then
insmod /ventoy/drivers/${line}.ko
fi
done

sleep 5

echo "sh /ventoy/profile.sh" >> /root/.profile
exec /init
27 changes: 27 additions & 0 deletions LiveCD/VTOY/ventoy/modlist
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
scsi_transport_sas
mptbase
mptscsih
mptsas
yurex
ezusb
parport
uss720
usb4604
usb3503
sisusbvga
usb251xb
pi3usb30532
usb-otg-fsm
usb-conn-gpio
ulpi
ums-realtek
xhci-hcd
xhci-pci
xhci-plat-hcd
usbip-core
usbip-host
vhci-hcd
cdc-wdm
cdc-acm
usblp
megaraid_sas
22 changes: 22 additions & 0 deletions LiveCD/VTOY/ventoy/profile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh

cd /
tar -xf ventoy.tar.gz

cd /ventoy
mkdir mnt
for i in $(ls tcz/*.tcz); do
mount $i mnt
cp -a mnt/* /
umount mnt
done

ldconfig /usr/local/lib /usr/lib /lib

#workaround for swapon
rm -f /sbin/swapon
echo '#!/bin/sh' > /sbin/swapon
chmod +x /sbin/swapon

sh /ventoy/ventoy.sh

Loading

0 comments on commit 9a8d4d0

Please sign in to comment.