Use syslinux to create a USB flash drive

Source: Internet
Author: User
1. Download syslinux at https://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-4.04.tar.gzto extract menu.c32, vesamenu. c32, and reboot. c32 to the root directory for backup. 2. partitions Command Line: syslinux-mafi U:
3, activate the above-a parameter is to indicate the meaning of activation 4, prepare puppylinux image http://tinycorelinux.net/downloads.html& damn samll Linux & puppy Linux plug-in a segment of VMware can access the Internet (Telnet also OK ), but Google cannot be pinged. Decompress the isofiles to vmlinuzand initrd.gz?core.gz, and place them to the tinycore directory, the core directory, the CDE directory, Puppy directory, Puppy directory, and puppy directory. for configuration of CFG, see isolinux in ISO. CFG settings. 5, prepare winpe image reference this article "teach you how to DIY winpe System", you can change the "beyond all" http://www.360doc.com/content/11/0104/10/1157314_83803846.shtml

Refer to this post to set winpe.

Http://lrxianed.diandian.com/post/2011-04-09/4710715

Decompress winnt. xpe and place it in the root directory,

Decompress the ntdetect. com file and put setupldr. bin in the root directory, and rename setupldr. Bin-> ntldr

Download ltntldr

Ldntldr. bin. tgz

Copy ldntldr. bin to the root directory and change it to ltntldr.

Extract athlon. Im _ to the winpe directory.

Modify winnt. xpe to specify the location of the WIM file:

[SetupData]BootDevice = "ramdisk(0)"BootPath = "\WXPE\System32\"OsLoadOptions = "/minint /fastdetect /rdpath=\WINPE\ATHLON.IM_"

Look at the final directory structure:

The volume in G: \> DIR/A: H drive G is the serial number of the livw.ls volume is the F89A-2FF9 G: \ directory 617 syslinux. 20172013/01/08 <dir> backup2013/01/08 32,256 ldlinux. sys2013/06/21 <dir> Autorun. inf2013/06/21 135 winnt. xpe2006/11/11 47,564 ntdetect. com2003/01/01 297,584 ntldr2008/03/01 1,024 ldntldr2004/08/17 322,730 bootfont. bin2013/06/21 <dir> winpe2013/06/21 <dir> puppy2011/04/19 56,164 menu. c322011/04/19 155,792 vesamenu. c322011/04/19 800 reboot. c322013/06/25 <dir> core2013/06/25 <dir> CDE 10 files 914,666 bytes 6 directories 10,010,624 available bytes

Insert the parsing code of the net. dll file in the driver genie:

# Include <stdio. h> # include <sys/types. h> # include <sys/STAT. h> # include <unistd. h> # include <string. h> # include <stdlib. h ># include <list >#include <string> typedef int uint32; typedef struct {char drvname [0x100]; // The name of each driver package in the original file does not seem to exceed 0x24 uint32 drvlen;} drv_item; /*** about the header structure of the driver file set ** + count * {* + ZIP file name length * + ZIP file name (char array) * + ZIP file length *}*... // count a total * The First zip File Content * Second ZIP file content *... * content of the count ZIP file **/typedef struct {uint32 count; drv_item items [1]; //... // zips 'content} net_drv_head; int main (INT argc, char * argv []) {int fsize = 0; struct stat st; char * bufptr = 0; uint32 drvindex = 0; file * drvf = fopen (argv [1], "rb"); If (! Drvf) Return-1; if (STAT (argv [1], & St) Return-1; printf ("file size: % d \ n", St. st_size); char * drvbuffer = (char *) malloc (St. st_size); If (! Drvbuffer) Return-1; if (St. st_size! = Fread (drvbuffer, 1, St. st_size, drvf) Return-1; mkdir ("zips", 0777); bufptr = drvbuffer; uint32 drvcount = * (uint32 *) bufptr; bufptr + = sizeof (uint32 ); printf ("Driver count: % d \ n", drvcount); net_drv_head * phead = (net_drv_head *) malloc (sizeof (net_drv_head) + sizeof (drv_item) * (drvcount-1 )); phead-> COUNT = drvcount; drv_item * pitem = & phead-> items [0]; for (drvindex = 0; drvindex <drvcount; drvindex ++) {char drvname [0x100] = ""; uint32 drvfilelen = 0; uint32 drvnamelen = * (uint32 *) bufptr; bufptr + = sizeof (uint32); memcpy (drvname, bufptr, drvnamelen); bufptr + = drvnamelen; drvname [drvnamelen] = '\ 0'; drvfilelen = * (uint32 *) bufptr; bufptr + = sizeof (uint32 ); printf ("strlen: % d, STR: % s, filelen: % d \ n", drvnamelen, drvname, drvfilelen); strcpy (pitem-> drvname, "zips/"); strcat (pitem-> drvname, drvname); pitem-> drvlen = drvfilelen; pitem ++;} For (INT I = 0; I <phead-> count; I ++) {printf ("% s, % d \ n", phead-> items [I]. drvname, phead-> items [I]. drvlen); file * zip = fopen (phead-> items [I]. drvname, "WB"); fwrite (bufptr, 1, phead-> items [I]. drvlen, zip); bufptr + = phead-> items [I]. drvlen; fclose (ZIP);} Free (drvbuffer); fclose (drvf); Return 0 ;}

The parsed ZIP files are all placed in the ZIPs folder, and tar will show you.

6. Modify syslinux. cfg.

DEFAULT vesamenu.c32TIMEOUT 300MENU TITLE  MENU COLOR BORDER 30;44 #00000000 #00000000 noneLABEL winpeMENU LABEL [01] start Windows PE.KERNEL /ldntldrAPPEND initrd=/ntldr LABEL puppyMENU LABEL [02] start Wary Puppy Linux.KERNEL /puppy/vmlinuz PMEDIA=usbflashAPPEND initrd=/puppy/initrd.gzLABEL coreMENU LABEL [03] start Tiny Core Linux.KERNEL /core/vmlinuzAPPEND initrd=/core/core.gzLABEL guicoreMENU LABEL [04] start Tiny Core Linux with GUI.KERNEL /core/vmlinuzAPPEND initrd=/core/core.gz cdeLABEL rebootMENU LABEL [05] Reboot.KERNEL /reboot.c32

Complete. Set the USB flash drive to start.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.