Commit 2aae096c authored by longpanda's avatar longpanda
Browse files

1. change some directory structure for the build script

2. add build script and document
   see DOC/BuildVentoyFromSource.txt for detail
parent 96541797
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -49,7 +49,7 @@ initrd_info *g_initrd_img_list = NULL; ...@@ -49,7 +49,7 @@ initrd_info *g_initrd_img_list = NULL;
initrd_info *g_initrd_img_tail = NULL; initrd_info *g_initrd_img_tail = NULL;
int g_initrd_img_count = 0; int g_initrd_img_count = 0;
int g_valid_initrd_count = 0; int g_valid_initrd_count = 0;
int g_filt_dot_underscore_file = 0;
static grub_file_t g_old_file; static grub_file_t g_old_file;
char g_img_swap_tmp_buf[1024]; char g_img_swap_tmp_buf[1024];
...@@ -618,6 +618,11 @@ static int ventoy_img_name_valid(const char *filename, grub_size_t namelen) ...@@ -618,6 +618,11 @@ static int ventoy_img_name_valid(const char *filename, grub_size_t namelen)
{ {
grub_size_t i; grub_size_t i;
if (g_filt_dot_underscore_file && filename[0] == '.' && filename[1] == '_')
{
return 0;
}
for (i = 0; i < namelen; i++) for (i = 0; i < namelen; i++)
{ {
if (filename[i] == ' ' || filename[i] == '\t') if (filename[i] == ' ' || filename[i] == '\t')
...@@ -938,6 +943,7 @@ static grub_err_t ventoy_cmd_list_img(grub_extcmd_context_t ctxt, int argc, char ...@@ -938,6 +943,7 @@ static grub_err_t ventoy_cmd_list_img(grub_extcmd_context_t ctxt, int argc, char
grub_device_t dev = NULL; grub_device_t dev = NULL;
img_info *cur = NULL; img_info *cur = NULL;
img_info *tail = NULL; img_info *tail = NULL;
const char *strdata = NULL;
char *device_name = NULL; char *device_name = NULL;
char buf[32]; char buf[32];
img_iterator_node *node = NULL; img_iterator_node *node = NULL;
...@@ -955,6 +961,12 @@ static grub_err_t ventoy_cmd_list_img(grub_extcmd_context_t ctxt, int argc, char ...@@ -955,6 +961,12 @@ static grub_err_t ventoy_cmd_list_img(grub_extcmd_context_t ctxt, int argc, char
return grub_error(GRUB_ERR_BAD_ARGUMENT, "Must clear image before list"); return grub_error(GRUB_ERR_BAD_ARGUMENT, "Must clear image before list");
} }
strdata = ventoy_get_env("VTOY_FILT_DOT_UNDERSCORE_FILE");
if (strdata && strdata[0] == '1' && strdata[1] == 0)
{
g_filt_dot_underscore_file = 1;
}
device_name = grub_file_get_device_name(args[0]); device_name = grub_file_get_device_name(args[0]);
if (!device_name) if (!device_name)
{ {
......
...@@ -40,6 +40,34 @@ GRUB_MOD_LICENSE ("GPLv3+"); ...@@ -40,6 +40,34 @@ GRUB_MOD_LICENSE ("GPLv3+");
static install_template *g_install_template_head = NULL; static install_template *g_install_template_head = NULL;
static int ventoy_plugin_control_entry(VTOY_JSON *json, const char *isodisk)
{
VTOY_JSON *pNode = NULL;
VTOY_JSON *pChild = NULL;
(void)isodisk;
if (json->enDataType != JSON_TYPE_ARRAY)
{
debug("Not array %d\n", json->enDataType);
return 0;
}
for (pNode = json->pstChild; pNode; pNode = pNode->pstNext)
{
if (pNode->enDataType == JSON_TYPE_OBJECT)
{
pChild = pNode->pstChild;
if (pChild->enDataType == JSON_TYPE_STRING && pChild->pcName && pChild->unData.pcStrVal)
{
ventoy_set_env(pChild->pcName, pChild->unData.pcStrVal);
}
}
}
return 0;
}
static int ventoy_plugin_theme_entry(VTOY_JSON *json, const char *isodisk) static int ventoy_plugin_theme_entry(VTOY_JSON *json, const char *isodisk)
{ {
const char *value; const char *value;
...@@ -136,6 +164,7 @@ static int ventoy_plugin_auto_install_entry(VTOY_JSON *json, const char *isodisk ...@@ -136,6 +164,7 @@ static int ventoy_plugin_auto_install_entry(VTOY_JSON *json, const char *isodisk
static plugin_entry g_plugin_entries[] = static plugin_entry g_plugin_entries[] =
{ {
{ "control", ventoy_plugin_control_entry },
{ "theme", ventoy_plugin_theme_entry }, { "theme", ventoy_plugin_theme_entry },
{ "auto_install", ventoy_plugin_auto_install_entry }, { "auto_install", ventoy_plugin_auto_install_entry },
}; };
......
#!/bin/bash
VT_DIR=$PWD/../../..
rm -rf $VT_DIR/GRUB2/INSTALL
rm -rf $VT_DIR/GRUB2/PXE
mkdir -p $VT_DIR/GRUB2/INSTALL
mkdir -p $VT_DIR/GRUB2/PXE
make install
PATH=$PATH:$VT_DIR/GRUB2/INSTALL/bin/:$VT_DIR/GRUB2/INSTALL/sbin/
net_modules_legacy="net tftp http"
all_modules_legacy="date drivemap blocklist ext2 xfs ventoy chain read halt iso9660 linux16 test true sleep reboot echo video_colors video_cirrus video_bochs vga vbe video_fb font video gettext extcmd terminal linux minicmd help configfile tr trig boot biosdisk disk ls tar squash4 password_pbkdf2 all_video png jpeg part_msdos fat exfat ntfs loopback gzio normal udf gfxmenu gfxterm gfxterm_background gfxterm_menu"
net_modules_uefi="efinet net tftp http"
all_modules_uefi="blocklist ventoy test ext2 xfs read halt sleep serial terminfo png password_pbkdf2 gcry_sha512 pbkdf2 part_gpt part_msdos ls tar squash4 loopback part_apple minicmd diskfilter linux relocator jpeg iso9660 udf hfsplus halt acpi mmap gfxmenu video_colors trig bitmap_scale gfxterm bitmap font fat exfat ntfs fshelp efifwsetup reboot echo configfile normal terminal gettext chain priority_queue bufio datetime cat extcmd crypto gzio boot all_video efi_gop efi_uga video_bochs video_cirrus video video_fb gfxterm_background gfxterm_menu"
if [ "$1" = "uefi" ]; then
all_modules="$net_modules_uefi $all_modules_uefi"
grub-mkimage -v --directory "$VT_DIR/GRUB2/INSTALL/lib/grub/x86_64-efi" --prefix '(,msdos2)/grub' --output "$VT_DIR/INSTALL/EFI/BOOT/grubx64_real.efi" --format 'x86_64-efi' --compression 'auto' $all_modules_uefi 'fat' 'part_msdos'
else
all_modules="$net_modules_legacy $all_modules_legacy"
grub-mkimage -v --directory "$VT_DIR/GRUB2/INSTALL/lib/grub/i386-pc" --prefix '(,msdos2)/grub' --output "$VT_DIR/INSTALL/grub/i386-pc/core.img" --format 'i386-pc' --compression 'auto' $all_modules_legacy 'fat' 'part_msdos' 'biosdisk'
fi
grub-mknetdir --modules="$all_modules" --net-directory=$VT_DIR/GRUB2/PXE --subdir=grub2 --locales=en@quot || exit 1
if [ "$1" = "uefi" ]; then
rm -f $VT_DIR/GRUB2/NBP/core.efi
cp -a $VT_DIR/GRUB2/PXE/grub2/x86_64-efi/core.efi $VT_DIR/GRUB2/NBP/core.efi || exit 1
rm -f $VT_DIR/INSTALL/grub/x86_64-efi/normal.mod
cp -a $VT_DIR/GRUB2/PXE/grub2/x86_64-efi/normal.mod $VT_DIR/INSTALL/grub/x86_64-efi/normal.mod || exit 1
else
rm -f $VT_DIR/GRUB2/NBP/core.0
cp -a $VT_DIR/GRUB2/PXE/grub2/i386-pc/core.0 $VT_DIR/GRUB2/NBP/core.0 || exit 1
rm -f $VT_DIR/INSTALL/grub/i386-pc/boot.img
cp -a $VT_DIR/GRUB2/INSTALL/lib/grub/i386-pc/boot.img $VT_DIR/INSTALL/grub/i386-pc/boot.img || exit 1
fi
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment