/**linux/init/main.c**Copyright(C)1991,1992LinusTorvalds**GK2/5/95-ChangedtosupportmountingrootfsviaNFS*Addedinitrd&ch ange_root:Werner Almesberger&HansLermen,Feb'96*Moanearlyifgccisold,avoidingboguskernels-PaulGortmaker,May'96*Simplifiedstartingofinit:Michae lA.Griffith<grif@acm.org>*/#define__KERNEL_SYSCALLS__#include<linux/config.h>#include<linux/proc_fs.h>#include<lin ux/unistd.h>#include<linu x/ctype.h>#include<linux/delay.h>#include<linux/utsname.h>#include<linux/ioport.h>#include<linux/init.h>#include<linux /smp_lock.h>#include<linux/blk.h>#include<linux/hdreg.h>#include<asm/io.h>#include<asm/bugs.h>#ifdefCONFIG_PCI# include<linux/pci.h>#endif#ifdef CONFIG_DIO#include<linux/dio.h>#endif#ifdefCONFIG_ZORRO#include<linux/zorro.h>#endif#ifdefCONFIG_MTRR#include<asm/ mtrr.h>#endif#ifdefCONFIG_APM#include<linux/apm_bios.h>#endif/**Versionsofgccolderthanthatlistedbelowmayact uallycompile*andlinkokay,buttheendprodu ctcanhavesubtleruntimebugs.*Toavoidassociatedbogusbugreports,weflatlyrefusetocompile*withagccthatisknowntobetoo oldfromtheverybeginning.*/#if__GNUC__<2||(__GNUC__==2&&__GNUC_MINOR__<6)#errorsorry,yourGCCistooold.Itbui ldsincorrectkernels.#endifexternchar_s t ext,_ etext;externchar*linux_banner;externintconsole_loglevel;staticintinit(void*);externintbdflush(void*);externi ntkswapd(void*);externvoidkswapd_setup(void);externvoidinit_IRQ(void);externvoidinit_modules(void);exter nlongconsole_init(long,long);externvoidsock_ini t(void);externvoiduidcache_init(void);externvoidmca_init(void);externvoidsbus_init(void);externvoidpowerma c_init(void);externvoidsysctl_init(void);externvoidfilescache_init(void);externvoidsignals_init(void) ;e xternvoiddevice_setup(void);externvoidbinfmt_setu p(void);externvoidfree_initmem(void);externvoidfilesystem_setup(void);#ifdefCONFIG_ARCH_ACORNexternvoidec ard_init(void);#endifexternvoidsmp_setup(char*str,int*ints);#ifdef__i386__externvoidioapic_pirq_setu p(char*str,int*ints);externvoidioapic_setup(char* s t r, int*ints);#endifexternvoidno_scroll(char*str,int*ints);externvoidkbd_reset_setup(char*str,int*ints);exte rnvoidpanic_setup(char*str,int*ints);externvoidbmouse_setup(char*str,int*ints);externvoidmsmouse_s e t up(char*str,int*ints);externvoidconsole_setup(char*str, int*ints);#ifdefCONFIG_PRINTERexternvoidlp_setup(char*str,int*ints);#endif#ifdefCONFIG_JOY_AMIGAextern voidjs_am_setup(char*str,int*ints);#endif#ifdefCONFIG_JOY_ANALOGexternvoidjs_an_setup(char*str,in t*ints);#endif#ifdefCONFIG_JOY_ASSASINexternvoidjs_as_setup( char*str,int*ints);#endif#ifdefCONFIG_JOY_CONSOLEexternvoidjs_console_setup(char*str,int*ints);#endi f#ifdefCONFIG_JOY_DB9externvoidjs_db9_setup(char*str,int*ints);#endif#ifdefCONFIG_JOY_TURBOGRAFX externvoidjs_tg_setup(char*str,int*ints);#endi f #i fd efCONFIG_JO Y_LIGHTNINGexternvoidjs_l4_setup(char*str,int*ints);#endifexternvoideth_setup(char*str,int*ints);#i fdefCONFIG_ARCNET_COM20020externvoidcom20020_setup(char*str,int*ints);#endif#ifdefCONFIG_ARCNET _RIM_Iexternvoidarcrimi_setup(char*str,int*in t s ) ;# e n d i f#ifdefCONF IG_ARCNET_COM90xxIOexternvoidcom90io_setup(char*str,int*ints);#endif#ifdefCONFIG_ARCNET_COM90xxex ternvoidcom90xx_setup(char*str,int*ints);#endif#ifdefCONFIG_DECNETexternvoiddecnet_setup(char* str,int*ints);#endif#ifdefCONFIG_BLK_DEV_XDext e r n v o i dx d_ s etup(char* str,int*ints);externvoidxd_manual_geo_init(char*str,int*ints);#endif#ifdefCONFIG_BLK_DEV_IDEexte rnvoidide_setup(char*);#endif#ifdefCONFIG_PARIDE_PDexternvoidpd_setup(char*str,int*ints);#end if#ifdefCONFIG_PARIDE_PFexternvoidpf_setup(ch ar * s t r , i n t * i n t s );#endif# ifdefCONFIG_PARIDE_PTexternvoidpt_setup(char*str,int*ints);#endif#ifdefCONFIG_PARIDE_PGexternvo idpg_setup(char*str,int*ints);#endif#ifdefCONFIG_PARIDE_PCDexternvoidpcd_setup(char*str,int* ints);#endifexternvoidfloppy_setup(char*str,in t * i n t s ) ;ex t e r n v o i dst_setu p(char*str,int*ints);externvoidst0x_setup(char*str,int*ints);externvoidadvansys_setup(char*str ,int*ints);externvoidtmc8xx_setup(char*str,int*ints);externvoidt128_setup(char*str,int*ints );externvoidpas16_setup(char*str,int*ints);exte r n v o i d g ener i c _ N C R 5 380_setu p(char*str,int*intr);externvoidgeneric_NCR53C400_setup(char*str,int*intr);externvoidgeneric_N CR53C400A_setup(char*str,int*intr);externvoidgeneric_DTC3181E_setup(char*str,int*intr);ext ernvoidaha152x_setup(char*str,int*ints);externv oi d a h a 1 5 4 2 _ s e t u p ( c h a r*str,in t*ints);externvoidgdth_setup(char*str,int*ints);externvoidaic7xxx_setup(char*str,int*ints);e xternvoidAM53C974_setup(char*str,int*ints);externvoidBusLogic_Setup(char*str,int*ints);ext ernvoidncr53c8xx_setup(char*str,int*ints);extern v o i d e a t a2 x _ s e t u p ( c h ar*str,i nt*ints);externvoidu14_34f_setup(char*str,int*ints);externvoidfdomain_setup(char*str,int*int s);externvoidibmmca_scsi_setup(char*str,int*ints);externvoidin2000_setup(char*str,int*int s);externvoidNCR53c406a_setup(char*str,int*ints);e x t e r n v o i dw d 7 0 0 0 _ s e t up(char* str,int*ints);externvoiddc390_setup(char*str,int*ints);externvoidscsi_luns_setup(char*str,i nt*ints);externvoidscsi_logging_setup(char*str,int*ints);externvoidsound_setup(char*str,i nt*ints);externvoidreboot_setup(char*str,int*ints) ; e x t e r n v o i d v i d e o _ se tu p(char* str,int*ints);#ifdefCONFIG_CDU31Aexternvoidcdu31a_setup(char*str,int*ints);#endifCONFIG_CD U31A#ifdefCONFIG_BLK_DEV_PS2externvoided_setup(char*str,int*ints);externvoidtp720_setup( char*str,int*ints);#endifCONFIG_BLK_DEV_PS2#ifdefC ON F I G _ M C D e xt e r n vo id m c d _setup( char*str,int*ints);#endifCONFIG_MCD#ifdefCONFIG_MCDXexternvoidmcdx_setup(char*str,int*ints );#endifCONFIG_MCDX#ifdefCONFIG_SBPCDexternvoidsbpcd_setup(char*str,int*ints);#endifCONF IG_SBPCD#ifdefCONFIG_AZTCDexternvoidaztcd_setup(cha r * s t r , in t * i n t s) ;# e n d i fCONFIG_ AZTCD#ifdefCONFIG_CDU535externvoidsonycd535_setup(char*str,int*ints);#endifCONFIG_CDU535# ifdefCONFIG_GSCDexternvoidgscd_setup(char*str,int*ints);#endifCONFIG_GSCD#ifdefCONFIG_C M206externvoidcm206_setup(char*str,int*ints);#endif C O N F I G _ C M 2 0 6 # if d ef CO N FI G_OPTCD externvoidoptcd_setup(char*str,int*ints);#endifCONFIG_OPTCD#ifdefCONFIG_SJCDexternvoidsjc d_setup(char*str,int*ints);#endifCONFIG_SJCD#ifdefCONFIG_ISP16_CDIexternvoidisp16_setup (char*str,int*ints);#endifCONFIG_ISP16_CDI#ifdefCON F I G _ B L K _ DE V _R A Msta t ic v oidramdis k_start_setup(char*str,int*ints);staticvoidload_ramdisk(char*str,int*ints);staticvoidpro mpt_ramdisk(char*str,int*ints);staticvoidramdisk_size(char*str,int*ints);#ifdefCONFIG_ BLK_DEV_INITRDstaticvoidno_initrd(char*s,int*ints);# e n d i f # en d i f C O NFIG _BL K _DEV_RAM# i fdefCONFIG_ISDN_DRV_ICNexternvoidicn_setup(char*str,int*ints);#endif#ifdefCONFIG_ISDN_DR V_HISAXexternvoidHiSax_setup(char*str,int*ints);#endif#ifdefCONFIG_DIGIEPCAexternvoide pca_setup(char*str,int*ints);#endif#ifdefCONFIG_ISDN _ D R V _PC BI Te xt e r n void pcbit_setup( char*str,int*ints);#endif#ifdefCONFIG_ATARIMOUSEexternvoidatari_mouse_setup(char*str,in t*ints);#endif#ifdefCONFIG_DMASOUNDexternvoiddmasound_setup(char*str,int*ints);#endif# ifdefCONFIG_ATARI_SCSIexternvoidatari_scsi_setup(ch ar * s t r,i n t* i n t s);#endifexternvoid stram_swap_setup(char*str,int*ints);externvoidwd33c93_setup(char*str,int*ints);externvo idgvp11_setup(char*str,int*ints);externvoidncr53c7xx_setup(char*str,int*ints);#ifdefC ONFIG_MAC_SCSIexternvoidmac_scsi_setup(char*str,int*i n ts );#e nd i f #ifdefCONFIG_CYCLADESe xternvoidcy_setup(char*str,int*ints);#endif#ifdefCONFIG_DIGIexternvoidpcxx_setup(char* str,int*ints);#endif#ifdefCONFIG_RISCOM8externvoidriscom8_setup(char*str,int*ints);#e ndif#ifdefCONFIG_SPECIALIXexternvoidspecialix_setup( cha r*str , int*ints);#endif#ifdefCON F IG_DMASCCexternvoiddmascc_setup(char*str,int*ints);#endif#ifdefCONFIG_BAYCOM_PARexter nvoidbaycom_par_setup(char*str,int*ints);#endif#ifdefCONFIG_BAYCOM_SER_FDXexternvoidb aycom_ser_fdx_setup(char*str,int*ints);#endif#ifdefCO NFI G _BA YCOM_SER_HDXexternvoidbayco m_ser_hdx_setup(char*str,int*ints);#endif#ifdefCONFIG_SOUNDMODEMexternvoidsm_setup(ch ar*str,int*ints);#endif#ifdefCONFIG_ADBMOUSEexternvoidadb_mouse_setup(char*str,int*in ts);#endif#ifdefCONFIG_WDTexternvoidwdt_setup(char*str , i nt *ints);#endif#ifdefCONFIG_PAR P ORTexternvoidparport_setup(char*str,int*ints);#endif#ifdefCONFIG_PLIPexternvoidplip_ setup(char*str,int*ints);#endif#ifdefCONFIG_HFMODEMexternvoidhfmodem_setup(char*str,i nt*ints);#endif#ifdefCONFIG_IP_PNPexternvoidip_auto_config_setup(char*str,int*ints);#end if#ifdefCONFIG_ROOT_NFSexternvoidnfs_root_setup(char*str,int*ints);#endif#ifdefCONFI G_FTAPEexternvoidftape_setup(char*str,int*ints);#endif#ifdefCONFIG_MDA_CONSOLEexternv oidmdacon_setup(char*str,int*ints);#endif#ifdefCONFIG_LTPCexternvoidltpc_setup(char*str, int*ints);#endif#ifdefined(CONFIG_SYSVIPC)externvoidipc_init(void);#endif#ifdefined( CONFIG_QUOTA)externvoiddquot_init_hash(void);#endif#ifdefCONFIG_MD_BOOTexternvoidmd_s etup(char*str,int*ints)__init;#endif/**Bootcommand-linearguments*/#defineMAX_INIT_ARGS8#d efineMAX_INIT_ENVS8externvoidtime_init(void);staticunsignedlongmemory_start=0;stati cunsignedlongmemory_end=0;introws,cols;#ifdefCONFIG_BLK_DEV_RAMexternintrd_doload;/* 1 = loadramdisk,0=don'tload*/externintrd_prompt;/*1=promptforramdisk,0=don'tprompt*/externin trd_size;/*Sizeoftheramdisk(s)*/externintrd_image_start;/*startingblock#ofimage*/#i fdefCONFIG_BLK_DEV_INITRDkdev_treal_root_dev;#endif#endifintroot_mountflags=MS_RDONL Y;char*execute_command=NULL;staticchar*argv_init[MAX_ I NIT_ARGS+2]={"init",NULL,};staticcha r*envp_init[MAX_INIT_ENVS+2]={"HOME=/","TERM=linux",NULL,};char*get_options(char*st r,int*ints){char*cur=str;inti=1;while(cur&&(*cur=='-'||isdigit(*cur))&&i<=10){ints[i ++]=simple_strtol(cur,NULL,0);if((cur=strchr(cur,',') ) != NU LL)cur++;}ints[0]=i-1;return(cur) ;}staticvoid__initprofile_setup(char*str,int*ints){if(ints[0]>0)prof_shift=(unsign edlong)ints[1];elseprof_shift=2;}staticstructdev_name_struct{constchar*name;constint num;}root_dev_name s [] __ initdata={#ifdefCONFIG_ROOT_ NF S{"n f s ", 0 x00ff},#endif#ifdefCONFIG_BLK _DEV_IDE{"hda",0x0300},{"hdb",0x0340},{"hdc",0x1600},{"hdd",0x1640},{"hde",0x2100} ,{"hdf",0x2140},{"hdg",0x2200},{"hdh",0x2240},{"hdi",0x3800},{"hdj",0x3840},{"hdk",0 x3900},{"hdl", 0x3 940}, # e ndif#ifdefCONFIG_BLK_DEV_SD{"sda" , 0 x 0 8 0 0 } ,{"sdb",0x0810},{"sdc",0x0 820},{"sdd",0x0830},{"sde",0x0840},{"sdf",0x0850},{"sdg",0x0860},{"sdh",0x0870},{" sdi",0x0880},{"sdj",0x0890},{"sdk",0x08a0},{"sdl",0x08b0},{"sdm",0x08c0},{"sdn",0x08 d0},{"sdo",0 x08e0}, { "s d p " ,0x08f0},#endif#ifd e f C ONFIG_ATARI_A C S I { " a d a",0x1c00},{"adb",0x1c10 },{"adc",0x1c20},{"add",0x1c30},{"ade",0x1c40},#endif#ifdefCONFIG_BLK_DEV_FD{"fd", 0x0200},#endif#ifdefCONFIG_MD_BOOT{"md",0x0900},#endif#ifdefCONFIG_BLK_DEV_XD{"xda", 0x0d00},{" x db ",0x0d 4 0 } , # e n dif#ifdefCONFIG_B LK _DEV_RAM{"ram",0x0 1 0 0 } , #endif#ifdefCONFIG_BLK_ DEV_SR{"scd",0x0b00},#endif#ifdefCONFIG_MCD{"mcd",0x1700},#endif#ifdefCONFIG_CDU53 5{"cdu535",0x1800},{"sonycd",0x1800},#endif#ifdefCONFIG_AZTCD{"aztcd",0x1d00},#endif #ifdefCON F IG _ CM206{" c m 2 0 6 c d ",0x2000},#endi f# ifdefCONF I G_GS CD{"gs c d " , 0 x1000},#endif#ifdefCON FIG_SBPCD{"sbpcd",0x1900},#endif#ifdefCONFIG_BLK_DEV_PS2{"eda",0x2400},{"edb",0x24 40},#endif#ifdefCONFIG_PARIDE_PD{"pda",0x2d00},{"pdb",0x2d10},{"pdc",0x2d20},{"pdd", 0x2d30},# e n dif#ifde fC ON F I G _ P ARIDE_PCD{"pc d ",0x2e00 } , # e ndif # i fd efC O N F I G_PARIDE_PF{"pf",0x2f00 },#endif#ifCONFIG_APBLOCK{"apblock",APBLOCK_MAJOR<<8},#endif#ifCONFIG_DDV{"ddv",D DV_MAJOR<<8},#endif{NULL,0}};kdev_t__initname_to_kdev_t(char*line){intbase=0;if(strn cmp(line , "/dev / ",5)= = 0){ s t r u c tdev_name_s t ruct*de v = r o ot _ d e v_ n a m e s;l i n e + = 5;do{intlen=strlen(de v->name);if(strncmp(line,dev->name,len)==0){line+=len;base=dev->num;break;}dev++; }while(dev->name);}returnto_kdev_t(base+simple_strtoul(line,NULL,base?10:16));}stati cvoid__initr o o t_ d e v _ s e tu p ( c h a r *line,int *n um){RO O T _ DE V= nam e _ to _ k d ev_ t ( l i ne);}/**Listofkernelc ommandlineparameters.Thefirsttablelistsparameters*whicharesubjecttovaluesparsing( leadingnumbersareconvertedto*anarrayofintsandchoppedoffthestring),thesecondtablecont ains*thefewe x c e p tio n s w hic h ob e y theirowns yn taxru l e s. * / s t r u c t k e r n e l _ par a m { c onstchar*str;void(*s etup_func)(char*,int*);};staticstructkernel_paramcooked_params[]__initdata={/*FIX ME:makePNPjustbecomereserve_setup*/#ifndefCONFIG_KERNEL_PNP_RESOURCE{"reserve=",rese rve_setup} , # e l s e { "r e s e r ve=" , p np_reserve _ setup } , #e nd i f { " pro f i l e = " , p rofi le _setup},#ifdef__SMP_ _{"nosmp",smp_setup},{"maxcpus=",smp_setup},#ifdefCONFIG_X86_IO_APIC{"noapic",ioa pic_setup},{"pirq=",ioapic_pirq_setup},#endif#endif#ifdefCONFIG_BLK_DEV_RAM{"ramdisk _start=",r a m d i s k _ st a r t _ s e tup } , {"load_ra m disk = " , lo ad _ ram di s k},{ " p r o m pt_r a m disk=",prompt_ramdi sk},{"ramdisk=",ramdisk_size},{"ramdisk_size=",ramdisk_size},#ifdefCONFIG_BLK_DEV _INITRD{"noinitrd",no_initrd},#endif#endif#ifdefCONFIG_FB{"video=",video_setup},#end if{"pani c = " , p a n ic_s e t u p }, { "c o n sole=",c o nsol e _s e t u p}, #i fd e f C ON F I G _ VG A_CO N S OLE{"no-scroll",no_ scroll},#endif#ifdefCONFIG_MDA_CONSOLE{"mdacon=",mdacon_setup},#endif#ifdefCONFIG _VT{"kbd-reset",kbd_reset_setup},#endif#ifdefCONFIG_BUGi386{"no-hlt",no_halt},{"no38 7",no_38 7 } , {" r e boo t= " , r e bo o t_ se tup},#endif# i f d e f C ON F I G _IN E T { " e t h e r = " ,eth_setup},#endif#ifdef CONFIG_ARCNET_COM20020{"com20020=",com20020_setup},#endif#ifdefCONFIG_ARCNET_RIM_ I{"arcrimi=",arcrimi_setup},#endif#ifdefCONFIG_ARCNET_COM90xxIO{"com90io=",com90io_s etup},# e n d i f # i f de fC O N F I G _ A R CNET_COM90xx{"c o m 9 0 x x = " ,com90xx_ s e t u p } ,# e ndif#ifdefCONFIG_DECNET{" decnet=",decnet_setup},#endif#ifdefCONFIG_PRINTER{"lp=",lp_setup},#endif#ifdefCO NFIG_JOY_AMIGA{"js_am=",js_am_setup},#endif#ifdefCONFIG_JOY_ANALOG{"js_an=",js_an_se tup},#e n d i f # i f d e fCONFIG_J O Y _ ASSASIN{" j s_as = " , j s _ as_setup},#en d i f # ifd efCONFIG_JOY_CONSOLE{"js_ console=",js_console_setup},{"js_console2=",js_console_setup},{"js_console3=",js _console_setup},#endif#ifdefCONFIG_JOY_DB9{"js_db9=",js_db9_setup},{"js_db9_2=",js_d b9_setu p } , { " j s_db9_3=",js_ d b9_setup},#end i f # i f defCONFIG_JOY_TUR B O GR AF X{"js_tg=",js_tg_setup}, {"js_tg_2=",js_tg_setup},{"js_tg_3=",js_tg_setup},#endif#ifdefCONFIG_SCSI{"max_s csi_luns=",scsi_luns_setup},{"scsi_logging=",scsi_logging_setup},#endif#ifdefCONFIG_ JOY_LIG H T N I N G{" j s_l4=",js_ l 4 _setup},# e ndi f # i f d efCONFIG _ S C S I_ADVAN S Y S { "advansys=",advansys_set up},#endif#ifdefined(CONFIG_BLK_DEV_HD){"hd=",hd_setup},#endif#ifdefCONFIG_CHR_D EV_ST{"st=",st_setup},#endif#ifdefCONFIG_BUSMOUSE{"bmouse=",bmouse_setup},#endif#ifd efCONFIG _ M S_BU S M OUS E {"msmou s e=",msmo u se_s e t u p } ,#endi f # i fd e f C ONFIG_S C S I_SEAGATE{"st0x=",st0x_s etup},{"tmc8xx=",tmc8xx_setup},#endif#ifdefCONFIG_SCSI_T128{"t128=",t128_setup}, #endif#ifdefCONFIG_SCSI_PAS16{"pas16=",pas16_setup},#endif#ifdefCONFIG_SCSI_GENERIC_ NCR5380 { " n cr5 380=", g e neric_ N C R5380_ s e tup} , { " n cr53c 4 0 0 =" , g e n e r i c_NCR5 3 C 400_setup},{"ncr53c400a =",generic_NCR53C400A_setup},{"dtc3181e=",generic_DTC3181E_setup},#endif#ifdefCO NFIG_SCSI_AHA152X{"aha152x=",aha152x_setup},#endif#ifdefCONFIG_SCSI_AHA1542{"aha1542 = " ,aha1 5 4 2_s e tup } , # e n dif#ifd e f CO NFI G_ SCSI _ G D T H{"g d t h=", g dt h _ s e t up},#e n dif#ifdefCONFIG_SCSI_AI C7XXX{"aic7xxx=",aic7xxx_setup},#endif#ifdefCONFIG_SCSI_BUSLOGIC{"BusLogic=",Bus Logic_Setup},#endif#ifdefCONFIG_SCSI_NCR53C8XX{"ncr53c8xx=",ncr53c8xx_setup},#endif#i fdefCO N F IG _ SCSI _ EA T A {" eata= " ,ea t a2 x _ setu p } , # endi f #ifde f C ONF I G _ S CSI_U 1 4_34F{"u14-34f=",u14_34 f_setup},#endif#ifdefCONFIG_SCSI_AM53C974{"AM53C974=",AM53C974_setup},#endif#ifd efCONFIG_SCSI_NCR53C406A{"ncr53c406a=",NCR53c406a_setup},#endif#ifdefCONFIG_SCSI_FUTU RE_DOM A I N { " fdom a i n= " ,f domai n _ set u p } , #end i f # ifdef C ONFIG_ S C SI _ IN 2 000{" i n 2000=",in2000_setup},# endif#ifdefCONFIG_SCSI_7000FASST{"wd7000=",wd7000_setup},#endif#ifdefCONFIG_SCSI _IBMMCA{"ibmmcascsi=",ibmmca_scsi_setup},#endif#ifdefined(CONFIG_SCSI_DC390T)&&!defin ed(CONF I G _ S CSI_D C 3 9 0 T_ NOGEN S U PP ) { " t m s c si m = " ,dc3 9 0 _setup}, # e n di f #ifdef C ONFIG_BLK_DEV_XD{"xd=" ,xd_setup},{"xd_geo=",xd_manual_geo_init},#endif#ifdefined(CONFIG_BLK_DEV_FD)||d efined(CONFIG_AMIGA_FLOPPY)||defined(CONFIG_ATARI_FLOPPY){"floppy=",floppy_setup},#en dif#if d ef C O NFIG_B L K _ D E V_PS2 { " e da = " ,e d _ se t u p },{" edb=",ed_ s e t u p} , {"tp72 0 =",tp720_setup},#endif #ifdefCONFIG_CDU31A{"cdu31a=",cdu31a_setup},#endifCONFIG_CDU31A#ifdefCONFIG_MCD{ "mcd=",mcd_setup},#endifCONFIG_MCD#ifdefCONFIG_MCDX{"mcdx=",mcdx_setup},#endifCONFIG_ MCDX#i f d e f C ONFIG_ S BP C D { "sbp c d = " , sb p c d _ s e t u p },#e ndifCONFIG _ S B PC D # ifdef C ONFIG_AZTCD{"aztcd=",a ztcd_setup},#endifCONFIG_AZTCD#ifdefCONFIG_CDU535{"sonycd535=",sonycd535_setup}, #endifCONFIG_CDU535#ifdefCONFIG_GSCD{"gscd=",gscd_setup},#endifCONFIG_GSCD#ifdefCONFI G_CM20 6 { " c m 206=", c m 2 0 6_ s etu p } , #en difC O N F I G _C M20 6#ifdefCONFIG_OP T CD{"o p tcd=",optcd_setup},#en difCONFIG_OPTCD#ifdefCONFIG_SJCD{"sjcd=",sjcd_setup},#endifCONFIG_SJCD#ifdefCONF IG_ISP16_CDI{"isp16=",isp16_setup},#endifCONFIG_ISP16_CDI#ifdefCONFIG_SOUND_OSS{"soun d=",so u n d _ s e t up}, # e n d if # ifd e fCONFIG_IS D N _ D RV _IC N{"icn=",icn_set u p},#e n dif#ifdefCONFIG_ISDN_D RV_HISAX{"hisax=",HiSax_setup},{"HiSax=",HiSax_setup},#endif#ifdefCONFIG_ISDN_DR V_PCBIT{"pcbit=",pcbit_setup},#endif#ifdefCONFIG_ATARIMOUSE{"atamouse=",atari_mouse_s etup}, # e n d i f # ifde f C O N FI G _D M A SO U N D {"dma s o u n d = ",d masound_setup},# e ndif# i fdefCONFIG_ATARI_SCSI{ "atascsi=",atari_scsi_setup},#endif#ifdefCONFIG_STRAM_SWAP{"stram_swap=",stram_s wap_setup},#endif#ifdefined(CONFIG_A4000T_SCSI)||defined(CONFIG_WARPENGINE_SCSI)\||de fined( C O N F I G _A4091 _ S C SI ) || d e f i ned ( C ONFI G _ M V M E 16 x_SCSI)\||define d (CONF I G_BVME6000_SCSI){"53c7 xx=",ncr53c7xx_setup},#endif#ifdefined(CONFIG_A3000_SCSI)||defined(CONFIG_A2091_ SCSI)\||defined(CONFIG_GVP11_SCSI){"wd33c93=",wd33c93_setup},#endif#ifdefined(CONFIG_ GVP11_SC S I ) { "gvp11=",gv p1 1 _ s e tu p } , # e n d i f # i f d e fC ONFIG_MAC_SCSI{" m ac538 0 =",mac_scsi_setup},#en dif#ifdefCONFIG_CYCLADES{"cyclades=",cy_setup},#endif#ifdefCONFIG_DIGI{"digi=",p cxx_setup},#endif#ifdefCONFIG_DIGIEPCA{"digiepca=",epca_setup},#endif#ifdefCONFIG_RIS COM8{"ri s c o m 8 =",ri s com8 _ set u p } , # e n d i f# i f d e f C O N F IG_DMASCC{"dmas c c =",dm a scc_setup},#endif#ifde fCONFIG_SPECIALIX{"specialix=",specialix_setup},#endif#ifdefCONFIG_BAYCOM_PAR{"b aycom_par=",baycom_par_setup},#endif#ifdefCONFIG_BAYCOM_SER_FDX{"baycom_ser_fdx=",bay com_ser_ f d x_ s e tup } ,#e n d i f# i fde f C O N F I G _ B A Y C O M _ S E R _ HDX{"baycom_s e r_hdx= " ,baycom_ser_hdx_setup} ,#endif#ifdefCONFIG_SOUNDMODEM{"soundmodem=",sm_setup},#endif#ifdefCONFIG_WDT{"w dt=",wdt_setup},#endif#ifdefCONFIG_PARPORT{"parport=",parport_setup},#endif#ifdefCONF IG_PLIP{" p l ip = ",pli p _ s e t u p } ,# en dif # i f d e f C O NFIG _ H F M ODEM{"hfmode m =",hfm o dem_setup},#endif#ifde fCONFIG_FTAPE{"ftape=",ftape_setup},#endif#ifdefCONFIG_MD_BOOT{"md=",md_setup},# endif#ifdefCONFIG_ADBMOUSE{"adb_buttons=",adb_mouse_setup},#endif#ifdefCONFIG_LTPC{"l tpc=",ltp c _ se t up}, # e n d i f { 0 , 0 } } ; s t a t i c s t ruc t k e r n e l _ p aramraw_p arams[]__ initdata={{"root=",root_ dev_setup},#ifdefCONFIG_ROOT_NFS{"nfsroot=",nfs_root_setup},{"nfsaddrs=",ip_aut o_config_setup},#endif#ifdefCONFIG_IP_PNP{"ip=",ip_auto_config_setup},#endif#ifdefCON FIG_PCI{" p c i=" ,pc i _ s e t u p } ,# e n di f # i f d e f C O N F I G_ P A R I D E _PD{"pd. ",pd_setu p},#endif#ifdefCONFIG_PAR IDE_PCD{"pcd.",pcd_setup},#endif#ifdefCONFIG_PARIDE_PF{"pf.",pf_setup},#endif#i fdefCONFIG_PARIDE_PT{"pt.",pt_setup},#endif#ifdefCONFIG_PARIDE_PG{"pg.",pg_setup},#en dif#ifdef C O NFIG _ A P M{ " a pm= ",ap m _se t u p },# e n d i f{0 , 0 } }; # i fd e f C ONFIG_BLK _DEV_RAMstaticvoid__initra mdisk_start_setup(char*str,int*ints){if(ints[0]>0&&ints[1]>=0)rd_image_start=in ts[1];}staticvoid__initload_ramdisk(char*str,int*ints){if(ints[0]>0&&ints[1]>=0)rd_do load=ints[ 1 ]&1; } s t a t i c void_ _ i ni t p r o m pt _ ra m d isk(c h a r*s t r , i n t *ints){i f(ints[0]>0&&ints[1]>=0)rd _prompt=ints[1]&1;}staticvoid__initramdisk_size(char*str,int*ints){if(ints[0]>0 &&ints[1]>=0)rd_size=ints[1];}#endifstaticint__initchecksetup(char*line){inti,ints[11] ;#ifdefCON FIG _ B L K _ D E V _ I D E/ * i d e d r i v e r n e e ds t he b a s i cs tri n g , r ath e rtha npre-processedvalues*/if(!s trncmp(line,"ide",3)||(!strncmp(line,"hd",2)&&line[2]!='=')){ide_setup(line);re turn1;}#endiffor(i=0;raw_params[i].str;i++){intn=strlen(raw_params[i].str);if(!strncmp (line,raw_ p a r a m s [ i ] . s t r , n ) ){ ra w _ p a ra m s [ i ].setup_ fu nc(li n e + n, N U L L ) ; return1;}}for(i=0;cooked_p arams[i].str;i++){intn=strlen(cooked_params[i].str);if(!strncmp(line,cooked_par ams[i].str,n)){cooked_params[i].setup_func(get_options(line+n,ints),ints);return1;}}re turn0;}/*t h i s s h o u l d b e a p p r o x 2 B o * o M i p st o st a r t ( not e i ni t i a lsh i f t ) , a n d w i llstillworkevenifinitiall ytoolarge,itwilljusttakeslightlylonger*/unsignedlongloops_per_sec=(1<<12);/*Thi sisthenumberofbitsofprecisionfortheloops_per_second.Eachbittakesonaverage1.5/HZseconds .This(lik e t h e o r i g i n a l ) i s a l i tt l e b e t t er tha n 1%* / #d ef ineLPS_PREC 8 v o i d _ _ i nitcalibrate_delay(void ) { unsignedlongticks,loopbit;intlps_precision=LPS_PREC;loops_per_sec=(1<<12);prin tk("Calibratingdelayloop...");while(loops_per_sec<<=1){/*waitfor"startof"clocktick*/ti cks=jiff i e s ; w h i l e (t i c k s= = j if f i e s) / *not h ing * /;/ *G o . . * /t i c k s = ji f f i e s ; _ _ delay(loops_per_sec);tic ks=jiffies-ticks;if(ticks)break;}/*Doabinaryapproximationtogetloops_per_second settoequaloneclock(uptolps_precisionbits)*/loops_per_sec>>=1;loopbit=loops_per_sec;whi le(lps_ p r e c i s i o n -- && ( l o o p b i t> > = 1 ) ) { loo p s _ p er_ s e c| =loo p bit;ti c k s=j i f f i es;while(ticks==jiffies) ;ticks=jiffies;__delay(loops_per_sec);if(jiffies!=ticks)/*longerthan1tick*/loo ps_per_sec&=~loopbit;}/*finally,adjustloopspersecondintermsofsecondsinsteadofclocks*/l oops_p e r _s e c * = H Z ; / * R o u n d t h e va l u e a n d pr int i t*/ p r in tk ( "%lu. % 02 l uB o goM I P S \ n",(loops_per_sec+2500) /500000,((loops_per_sec+2500)/5000)%100);}/**Thisisasimplekernelcommandlinepar singfunction:itparses*thecommandline,andfillsinthearguments/environmenttoinit*asapprop riate. A n y c m d - l i n e o p t i on i s t a k e n t o b eane n v ironm ent *v a ri a bleifitco n t a i n s t h echaracter'='.**Thisro u tinealsochecksforoptionsmeantforthekernel.*Theseoptionsarenotgiventoinit-theya reforinternalkerneluseonly.*/staticvoid__initparse_options(char*line){char*next;intarg s,env s ; if ( ! * l i n e ) r et u r n; a r g s = 0 ; e n vs= 1;/ * TER Mi ssetto'l i n u x'by d e f a u l t * / n ext=line;while((line=ne xt)!=NULL){if((next=strchr(line,''))!=NULL)*next++=0;/**checkforkerneloptionsf irst..*/if(!strcmp(line,"ro")){root_mountflags|=MS_RDONLY;continue;}if(!strcmp(line,"r w")){ r o o t _ mo u n t f l a g s & = ~ M S _ R D O N L Y ; co nt i n u e ; } if(!s t rc m p(line , "d e b u g ") ) { console_loglevel=10;cont inue;}if(!strncmp(line,"init=",5)){line+=5;execute_command=line;/*IncaseLILOis goingtobootuswithdefaultcommandline,*itprepends"auto"beforethewholecmdlinewhichmakes*t heshe l l t h i n k i t s h o u l d e x ecut e a s c ri ptw it h suc hn am e .*S o weigno r e a l l a r g u m e n t s entered_before_init=... [MJ]*/args=0;continue;}if(checksetup(line))continue;/**Thencheckifit'sanenviro nmentvariableor*anoption.*/if(strchr(line,'=')){if(envs>=MAX_INIT_ENVS)break;envp_init [++en v s ] = l i ne ; } e lse { i f ( a r g s > = M A X _ I NI T _A R G S)brea k ;arg v _ i ni t [ + + a r g s ] = l i ne;}}argv_init[args+1]=N ULL;envp_init[envs+1]=NULL;}externvoidsetup_arch(char**,unsignedlong*,unsigned long*);#ifndef__SMP__/**Uniprocessoridlethread*/intcpu_idle(void*unused){for(;;)idle() ;}#de f i n e s m p _ i n it ( ) d o{ } whi l e ( 0 ) #el s e /* *M ul t i p r oces s or i dle t h r ead i s i n a r ch/...*/externintcpu_idle (void*unused);/*Calledbybootprocessortoactivatetherest.*/staticvoid__initsmp_ init(void){/*Getotherprocessorsintotheirbootupholdingpatterns.*/smp_boot_cpus();smp_th reads _ r e a d y = 1 ; s m p _ c o m m e n c e ( ) ; } # e ndifex te rnvoidin i ti a liz e _ s ec o n d a r y ( v o id);/**Activatethefirstpro cessor.*/asmlinkagevoid__initstart_kernel(void){char*command_line;#ifdef__SM P__staticintboot_cpu=1;/*"current"hasbeensetup,weneedtoloaditnow*/if(!boot_cpu)initial ize_s e co n d a r y ( ) ; bo ot _ c p u =0 ; # e n d if/ * * In te r ru p ts a re s t i l l d i s a b l e d . Do n e c e ssarysetups,then*enablethe m*/printk(linux_banner);setup_arch(&command_line,&memory_start,&memory_end); memory_start=paging_init(memory_start,memory_end);trap_init();init_IRQ();sched_init(); time_ i n i t ( ) ; p ar s e _ o p t i o n s( c o m m an d_ l in e) ; /**H A CKA L E R T ! T h i s i s ea r l y . W e ' reenablingtheconsolebefore* we'vedonePCIsetupsetc,andconsole_init()mustbeawareof*this.Butwedowantoutpute arly,incasesomethinggoeswrong.*/memory_start=console_init(memory_start,memory_end);#if defCON F I G _ M O D U L E S i nit _ mo d u l e s () ;#en difif( p rof _ s h i f t ) { p r o f_ b uff er=( u n signedint * )m e mory_start;/*o nlytextisprofiled*/prof_len=(unsignedlong)&_etext-(unsignedlong)&_stext;prof _len>>=prof_shift;memory_start+=prof_len*sizeof(unsignedint);memset(prof_buffer,0,prof _len*si z e o f ( u n s i g n e d i nt )) ; }m emo ry_s t a r t=kme m _ c a c h e _ i n i t(mem o r y _ s t a r t,memory_e n d); s ti();calibrat e _delay();#ifdefCONFIG_BLK_DEV_INITRDif(initrd_start&&!initrd_below_start_ok &&initrd_start<memory_start){printk(KERN_CRIT"initrdoverwritten(0x%08lx<0x%08lx)-""dis ablingit . \ n " , i n i t r d _ st ar t , m e mor y_ start ) ;i n i t r d _ s t a rt = 0 ;}#en d i f m e m _ i nit(memory _ star t , memory_end) ; kmem_cache_sizes_init();#ifdefCONFIG_PROC_FSproc_root_init();#endifuidcache _init();filescache_init();dcache_init();vma_init();buffer_init();signals_init();inode_ init(); f i l e _ t a b l e _ i ni t ( ) ; #i fdef i n e d ( C O N F I G _ S Y S V I P C) ipc _ in i t ( ) ; # e n d i f #ifdefine d (CO NF I G _ Q U OTA)dquo t _init_hash();#endifcheck_bugs();printk("POSIXconformancetestingbyUNIFIX

" );/**Wecountontheinitialthreadgoingok*Likeidlersinitisanunlockedkernelthread,whichwill *makesys c a l l s ( a n d t h u s b e l o c k e d) .* /sm p _ i n i t ( ) ; k e r n e l _t hr e a d ( i n i t , N U L L , C LONE_FS| C LONE_ FILE S | CLONE_SI GHAND);current->need_resched=1;cpu_idle(NULL);}#ifdefCONFIG_BLK_DEV_INITRD staticintdo_linuxrc(void*shell){staticchar*argv[]={"linuxrc",NULL,};close(0);close(1); close(2 ); s e t s i d ( ) ; ( v o i d ) op e n( "/ d e v / co n s o l e ",O _RDWR , 0 ) ; ( vo i d ) d u p( 0 ) ; ( v oid)dup(0 ) ;returnex e cve(sh e ll ,argv,envp_init);}staticvoid__initno_initrd(char*s,int*ints){mount_initrd =0;}#endifstructtask_struct*child_reaper=&init_task;/**Ok,themachineisnowinitialized.No neoft h e d e v i c e s* h a ve b e e n t o u c h e d y e t , b u t t h e CPUsub s y s t em i s u p a n d * r u n nin g , andmemorya n dprocess m anage m entw orks.**Nowwecanfinallystartdoingsomerealwork..*/staticvoid__initdo_basic _setup(void){#ifdefCONFIG_BLK_DEV_INITRDintreal_root_mountflags;#endif/**Telltheworldth atwe' r e g o i n g to b e t h e gr i m * r e ap e ro f i n n o cento r p h a n e d c hi l d r e n . * * W e d o n ' t w a ntpeopleto h avetomak e i n correct* assumptionsaboutwhereinthetaskarraythis*canbefound.*/child_reaper=curren t;#ifdefined(CONFIG_MTRR)/*DothisafterSMPinitialization*//**Weshouldprobablycreatesomea rchit e c t u r e - d e p e n d e n t " f i x u p a f t e r *ever yth i n g i s u p "s t y l e f u n c t ionw he r e t h iswouldbel o ngb e tter*t h a nininit/ main.c..*/mtrr_init();#endif#ifdefCONFIG_SYSCTLsysctl_init();#endif/**O k,atthispointallCPU'sshouldbeinitialized,so*wecanstartlookingintodevices..*/#ifdefCONFI G_PCI p c i _ in i t ( ) ; # en d i f # i f de f C O N FIG _S B U S s b u s _ i n i t ( ) ; # e n d i f #ifde f ined ( C ONFIG_PPC ) p o wermac_ i n it();#end if#ifdefCONFIG_MCAmca_init();#endif#ifdefCONFIG_ARCH_ACORNecard_init(); #endif#ifdefCONFIG_ZORROzorro_init();#endif#ifdefCONFIG_DIOdio_init();#endif/*Networkin giniti a l i z a t io n ne e d s a p r o c ess c on t e x t * / s o c k_ i n i t ( ) ; / * L a u nc h b d f lush f r o m h e re,instead o ftheold s y scallway.* /kernel_thread(bdflush,NULL,CLONE_FS|CLONE_FILES|CLONE_SIGHAND);/*Star tthebackgroundpageoutdaemon.*/kswapd_setup();kernel_thread(kswapd,NULL,CLONE_FS|CLONE_F ILES|C L O N E _ S I GH A N D ) ; # i f C O NF IG_ AP 1 0 0 0 / * S t a rt t he a s y n c p a g i ngd a e m on . */ { e x t ernintasyn c d(voi d * ) ;kernel_thr ead(asyncd,NULL,CLONE_FS|CLONE_FILES|CLONE_SIGHAND);}#endif#ifdefCONFI G_BLK_DEV_INITRDreal_root_dev=ROOT_DEV;real_root_mountflags=root_mountflags;if(initrd_s tart&& m ou n t _ i n i t r d ) r o o t _ m o u n t f l a g s & = ~ MS _ R D O N LY ; e l s e m o un t _i n itrd=0 ;# e n d i f/*Setupde vic es. . */device_setu p();/*..executableformats..*/binfmt_setup();/*..filesystems..*/filesy stem_setup();/*Mounttherootfilesystem..*/mount_root();#ifdefCONFIG_UMSDOS_FS{/*Whenmou ntingau m s d o s f s a s r o o t , w e d e t e c t t h e p seu d o _ r o o t ( / l in u x) a nd i n i t i aliseithe r e . p seudo_rootisd e f i nedinfs/umsdos /inode.c*/externstructinode*pseudo_root;if(pseudo_root!=NULL){current ->fs->root=pseudo_root->i_sb->s_root;current->fs->pwd=pseudo_root->i_sb->s_root;}}#end if#ifde fCONFI G _ B L K _ D E V _ I NI T RD r o o t _ m o u ntf l a g s = r e a l_ r o o t _ m o u ntflags;if( mou n t_initrd&&ROOT_DEV!=real_root _dev&&MAJOR(ROOT_DEV)==RAMDISK_MAJOR&&MINOR(ROOT_DEV)==0){interror;in ti,pid;pid=kernel_thread(do_linuxrc,"/linuxrc",SIGCHLD);if(pid>0)while(pid!=wait(&i)) ;if(MAJO R ( rea l _r o o t _ d e v ) ! = R A M D I S K _MA J O R ||M I N O R ( re a l _ root _ d e v)!=0){erro r =ch a nge_root(real_root_dev,"/in it rd");if(error)printk(KERN_ERR"Changerootto/initrd:""error%d

",error );}}#endif}staticintinit(void*unused){lock_kernel();do_basic_setup();/**Ok,wehavecom pletedthe i n i t i alb o o t u p, a n d * w e 'r e e s s en tia l l y u p a n d r un n i n g . G e t ridofthe*init m em s egmentsandstarttheuser-mode st u ff..*/free_initmem();unlock_kernel();if(open("/dev/console",O_RDWR, 0)<0)printk("Warning:unabletoopenaninitialconsole.

");(void)dup(0);(void)dup(0);/** Wetryeach o f t h e s e unt i l o n e s u c ce e d s . * * T h e B our n e s h el l canbe u s e d insteadofinitif w ea r e*tryingtorecoverareallybro k en machine.*/if(execute_command)execve(execute_command,argv_init,envp _init);execve("/sbin/init",argv_init,envp_init);execve("/etc/init",argv_init,envp_i nit);execv e (" / b i n / i nit " , a rgv _ i n i t ,env p _ i nit ) ; e x e c v e ( "/ b i n / s h",argv_init,env p _ i nit);panic("Noinitfound.Tryp a s singinit=optiontokernel.");}/**linux/init/main.c**Copyright(C)1991 ,1992LinusTorvalds**GK2/5/95-ChangedtosupportmountingrootfsviaNFS*Addedinitrd&chan ge_root:Wer n er A lm e s be r g er & H a n s L er m e n , F eb ' 9 6 * M oane a r lyi f g c c i sold,avoidingbogus k e r nels-PaulGortmaker,May'96*S i m p lifiedstartingofinit:MichaelA.Griffith<grif@acm.org>*/#define__KE RNEL_SYSCALLS__#include<linux/config.h>#include<linux/proc_fs.h>#include<linux/un istd.h>#incl u de< l i n u x /c typ e . h > # i n c l u de< l i n u x/ de l a y.h >#i n c l u de<linux/utsname.h># i n c l ude<linux/ioport.h>#inclu d e < linux/init.h>#include<linux/smp_lock.h>#include<linux/blk.h>#incl ude<linux/hdreg.h>#include<asm/io.h>#include<asm/bugs.h>#ifdefCONFIG_PCI#include< li n ux/pci.h> #endi f # i f de f C ON F I G _ D I O # i n c l ud e <l i n ux/d i o . h > # e nd if#ifdefCONFIG_ZORRO# i nc l ude<linux/zorro.h>#endif# if d efCONFIG_MTRR#include<asm/mtrr.h>#endif#ifdefCONFIG_APM#include< linux/apm_bios.h>#endif/**Versionsofgccolderthanthatlistedbelowmayactuallycompil e * and linkoka y , butt he e n d p r o d uc t c a n h a v e s u b t le r un t ime b ug s .* To avoidassociatedbogusbugr eports,weflatlyrefusetocompi l e * withagccthatisknowntobetoooldfromtheverybeginning.*/#if__GNUC__< 2||(__GNUC__==2&&__GNUC_MINOR__<6)#errorsorry,yourGCCistooold.Itbuildsincorrect k erne l s .#endi f externcha r _ s t e x t , _ e t ex t; e x t e r nc h ar * l i n ux _ b a nner;externintconsole_logle vel;staticintinit(void*);ext e r n intbdflush(void*);externintkswapd(void*);externvoidkswapd_setup (void);externvoidinit_IRQ(void);externvoidinit_modules(void);externlongconsole _i n it ( l o n g,lo n g );externvo i d s o c k _i n it( v oid) ; e x te r n v o id u idc ache_init(void);externvoidm c a _init(void);externvoidsbus_i n it (void);externvoidpowermac_init(void);externvoidsysctl_init(voi d);externvoidfilescache_init(void);externvoidsignals_init(void);externvoiddevi c e_ set u p (voi d) ; externvoidb infm t _ se t u p ( v o i d ) ;e xt e r n vo id free_initmem(void);externvoidf i l e system_setup(void);#ifdefCONFI G_ARCH_ACORNexternvoidecard_init(void);#endifexternvoidsmp_set up(char*str,int*ints);#ifdef__i386__externvoidioapic_pirq_setup(char*str,int* i nt s ) ; e xte rnv o i dioapic_setup ( c h a r * st r ,i n t * in ts); # e n d ifexternvoidno_scroll(char*str,int * i nts);externvoidkbd_reset_setup( char*str,int*ints);externvoidpanic_setup(char*str,int*ints);e xternvoidbmouse_setup(char*str,int*ints);externvoidmsmouse_setup(char*str,int *i n t s );ex ter n v oidconsole_set up (c h a r *s t r , in t*i n t s ) ;# ifdefCONFIG_PRINTERexternvoidlp_set u p ( char*str,int*ints);#endif#ifdef CONFIG_JOY_AMIGAexternvoidjs_am_setup(char*str,int*ints);#en dif#ifdefCONFIG_JOY_ANALOGexternvoidjs_an_setup(char*str,int*ints);#endif#if defCON FIG _JO Y_ A SSASINexternvoi d j s _ as _ se t u p(c h a r * s tr ,int*ints);#endif#ifdefCONFIG_JOY_CON S O LEexternvoidjs_console_setup(ch ar*str,int*ints);#endif#ifdefCONFIG_JOY_DB9externvoidjs_db9_ setup(char*str,int*ints);#endif#ifdefCONFIG_JOY_TURBOGRAFXexternvoidjs_tg_s etup(c ha r*st r , i nt*ints);#endif# i f d ef C O N F I G_ J O Y _ L I G HTNINGexternvoidjs_l4_setup(char*str,in t * ints);#endifexternvoideth_setup( char*str,int*ints);#ifdefCONFIG_ARCNET_COM20020externvoidco m20020_setup(char*str,int*ints);#endif#ifdefCONFIG_ARCNET_RIM_Iexternvoida rcrimi_setup ( c h ar*str,int*ints);# en d if #i f d ef CO N F I G_ARCNET_COM90xxIOexternvoidcom90io_setup( c h ar*str,int*ints);#endif#ifdefCON FIG_ARCNET_COM90xxexternvoidcom90xx_setup(char*str,int*int s);#endif#ifdefCONFIG_DECNETexternvoiddecnet_setup(char*str,int*ints);#en dif#ifdefCONF I G _BLK_DEV_XDexternvoid x d _setup( ch ar *str,int*ints);externvoidxd_manual_geo_init( c har*str,int*ints);#endif#ifdefCO NFIG_BLK_DEV_IDEexternvoidide_setup(char*);#endif#ifdefCON FIG_PARIDE_PDexternvoidpd_setup(char*str,int*ints);#endif#ifdefCONFIG_PA RIDE_PFextern v o idpf_setup(char*str,int * in ts ); # endif#ifdefCONFIG_PARIDE_PTexternvoidpt_setup(ch a r *str,int*ints);#endif#ifdefCONFI G_PARIDE_PGexternvoidpg_setup(char*str,int*ints);#endif#i fdefCONFIG_PARIDE_PCDexternvoidpcd_setup(char*str,int*ints);#endifextern voidfloppy_s e t up(char*str,int*ints);ext e r n v oi dst_setup(char*str,int*ints);externvoidst0x_setup ( c har*str,int*ints);externvoidadva nsys_setup(char*str,int*ints);externvoidtmc8xx_setup(char *str,int*ints);externvoidt128_setup(char*str,int*ints);externvoidpas16_s etup(char*st r , int*ints);externvoidgener ic_ NCR5380_setup(char*str,int*intr);externvoidgeneric_N C R 53C400_setup(char*str,int*intr);e xternvoidgeneric_NCR53C400A_setup(char*str,int*intr);ext ernvoidgeneric_DTC3181E_setup(char*str,int*intr);externvoidaha152x_setu p(char*str,in t * ints);externvoidaha1542_setup(char*str,int*ints);externvoidgdth_setup(char*str,in t * ints);externvoidaic7xxx_setup(cha r*str,int*ints);externvoidAM53C974_setup(char*str,int*i nts);externvoidBusLogic_Setup(char*str,int*ints);externvoidncr53c8xx_s etup(char*str , i nt*ints);externvoideata2x_setup(char*str,int*ints);externvoidu14_34f_setup(char*st r , int*ints);externvoidfdomain_setup( char*str,int*ints);externvoidibmmca_scsi_setup(char*st r,int*ints);externvoidin2000_setup(char*str,int*ints);externvoidNCR53c 406a_setup(c h a r *str,int*ints);externvoidwd7000_setup(char*str,int*ints);externvoiddc390_setup(cha r * s tr,int*ints);externvoidscsi_luns_s etup(char*str,int*ints);externvoidscsi_logging_setup( char*str,int*ints);externvoidsound_setup(char*str,int*ints);externvoi dreboot_setup ( c h ar*str,int*ints);externvoidvideo_setup(char*str,int*ints);#ifdefCONFIG_CDU31Aextern v o idcdu31a_setup(char*str,int*ints);# endifCONFIG_CDU31A#ifdefCONFIG_BLK_DEV_PS2externvoid ed_setup(char*str,int*ints);externvoidtp720_setup(char*str,int*ints) ;#endifCONFIG_ B L K_ DEV_PS2#ifdefCONFIG_MCDexternvoidmcd_setup(char*str,int*ints);#endifCONFIG_MCD#if d e f CONFIG_MCDXexternvoidmcdx_setup(char *str,int*ints);#endifCONFIG_MCDX#ifdefCONFIG_SBPCDe xternvoidsbpcd_setup(char*str,int*ints);#endifCONFIG_SBPCD#ifdefCON FIG_AZTCDexter n v o id aztcd_setup(char*str,int*ints);#endifCONFIG_AZTCD#ifdefCONFIG_CDU535externvoidson y c d 535_setup(char*str,int*ints);#endifCO NFIG_CDU535#ifdefCONFIG_GSCDexternvoidgscd_setup(c har*str,int*ints);#endifCONFIG_GSCD#ifdefCONFIG_CM206externvoidcm2 06_setup(char* s t r , in t*ints);#endifCONFIG_CM206#ifdefCONFIG_OPTCDexternvoidoptcd_setup(char*str,int*int s ) ;#endifCONFIG_OPTCD#ifdefCONFIG_SJCDe xternvoidsjcd_setup(char*str,int*ints);#endifCONFI G_SJCD#ifdefCONFIG_ISP16_CDIexternvoidisp16_setup(char*str,int*int s);#endifCONF I G _ I S P1 6_CDI#ifdefCONFIG_BLK_DEV_RAMstaticvoidramdisk_start_setup(char*str,int*ints);sta t i c voidload_ramdisk(char*str,int*ints);st aticvoidprompt_ramdisk(char*str,int*ints);staticv oidramdisk_size(char*str,int*ints);#ifdefCONFIG_BLK_DEV_INITRDsta ticvoidno_init r d ( c h a r*s,int*ints);#endif#endifCONFIG_BLK_DEV_RAM#ifdefCONFIG_ISDN_DRV_ICNexter nv oidicn_ s e t up(char*str,int*ints);#endif#ifdefCONF IG_ISDN_DRV_HISAXexternvoidHiSax_setup(char*str, int*ints);#endif#ifdefCONFIG_DIGIEPCAexternvoidepca_setup(char*s tr,int*ints);#e n d i f # i f defCONFIG_ISDN_DRV_PCBITexte r nvoidpcbit_setup(char*str,int*ints);#endif #i f d e fC ON FIG _ A T ARIMOUSEexternvoidatari_mouse_setup(ch ar*str,int*ints);#endif#ifdefCONFIG_DMASOUNDext ernvoiddmasound_setup(char*str,int*ints);#endif#ifdefCONFIG_ATA RI_SCSIexternvoi d a t a r i _ scsi_setup(char*str,int*int s) ; #endifexternvoidstram_swap_setup(char*st r ,in t *i n ts ) ; e x t e rnvoidwd33c93_setup(char*str,int*ints); externvoidgvp11_setup(char*str,int*ints);exter nvoidncr53c7xx_setup(char*str,int*ints);#ifdefCONFIG_MAC_SCSIe xternvoidmac_scs i _ se t u p ( c har*str,int*ints);#end if#i fde fC ONFIG_CYCLADESexternvoidcy_setup(c ha r * s tr , i nt * i nts); # e ndif#ifdefCONFIG_DIGIexternvoidpcxx_set up(char*str,int*ints);#endif#ifdefCONFIG_RISCO M8externvoidriscom8_setup(char*str,int*ints);#endif#ifdefCONF IG_SPECIALIXexter n v o i d s p e c ia lix_setup(char*st r ,int*int s) ; #end if#ifdefCONFIG_DMA SCCex t er nvo iddm ascc_ set up ( ch a r * s tr,int*ints);#endif#ifdefCONFIG_BAYCOM_ PARexternvoidbaycom_par_setup(char*str,int*int s);#endif#ifdefCONFIG_BAYCOM_SER_FDXexternvoidbaycom_ser_fdx _setup(char*str,in t *int s ) ; # e n dif # i fdefCONFIG_ B A Y CO M_S E R_ HDX ex ternvoidbaycom_se r _h dx_ setup( c h ar*str, i n t *i n t s ) ;# e n dif#ifdefCONFIG_SOUNDMODEMexternvoidsm_s etup(char*str,int*ints);#endif#ifdefCONFIG_AD BMOUSEexternvoidadb_mouse_setup(char*str,int*ints);#endif#if defCONFIG_WDTexte r n voidw d t _ s e t u p(c ha r*str,int* int s ) ; # en dif#i fd efCONFIG_PARPORT e x ter n voidp ar p ort_ s etup( c ha r * s tr,i n t *ints);#endif#ifdefCONFIG_PLIPexternvoi dplip_setup(char*str,int*ints);#endif#ifdefC ONFIG_HFMODEMexternvoidhfmodem_setup(char*str,int*ints);#en dif#ifdefCONFIG_IP _ P NP e xt e r n v oi d ip_ a uto_config_set u p( ch a r * str,int*ints);#endif# i f de f CO N FIG_RO O T_NF S ex t ernvo i d n fs_r o ot_setup(char*str,int*ints);#endif#ifdef CONFIG_FTAPEexternvoidftape_setup(char*str, int*ints);#endif#ifdefCONFIG_MDA_CONSOLEexternvoidmdacon_se tup(char*str,int*i n ts);#e n d i f #i fd e f CO NFIG_LTPCexter n v oi d ltpc_setup(char*str,int* in ts ) ;# e nd if#i f defined( C ON F I G _ S YSV I PC)exter n vo i dipc_init(void);#endif#ifdefi ned(CONFIG_QUOTA)externvoiddquot_init_hash (void);#endif#ifdefCONFIG_MD_BOOTexternvoidmd_setup(char*s tr,int*ints)__init ; # en d if / * * B o ot co mm and-lineargument s * /# defineMAX_INIT_ARGS8#defineMA X _I N I T_E NVS 8 e xt e rnvo i dtim e _ i nit ( void);s t a t i c u nsignedlongmemory_start=0;s taticunsignedlongmemory_end=0;introws,cols ;#ifdefCONFIG_BLK_DEV_RAMexternintrd_doload;/*1=loadramdis k,0=don'tload*/exte r nint r d _ p r o m pt;/*1=promptforramdi sk, 0=don'tprompt*/externintrd_size;/ * Si ze oft h era md i sk(s ) */ e x t ern i n trd_im a g e _ s t a rt;/*startingblock#ofimage* /#ifdefCONFIG_BLK_DEV_INITRDkdev_treal_ro ot_dev;#endif#endifintroot_mountflags=MS_RDONLY;char*exec ute_command=NULL;st a t i cc h a r * a r g v_init[MAX_INIT_ARGS+2 ]= { "init",NULL,};staticchar*envp_init[MA X _I NI T_ EN V S+ 2 ]={ " HO M E = /", " TERM=li n u x " , N U LL ,};char*get_options(char *str,int*ints){char*cur=str;inti=1;while( cur&&(*cur=='-'||isdigit(*cur))&&i<=10){ints[i++]=simple_ strtol(cur,NULL,0); i f(( c u r = s t rchr(cur,','))!=NULL)cu r ++ ; }ints[0]=i-1;return(cur);}staticvoid__in it p ro f il e_ s e tup ( c h a r*s t r,int*ints ) { i f ( in ts[0]>0)prof_shift=(unsi gnedlong)ints[1];elseprof_shift=2;}stati cstructdev_name_struct{constchar*name;constintnum;}root_ dev_names[]__initdat a = { # i f d e fCONFIG_ROOT_NFS{"nfs",0x0 0f f },#endif#ifdefCONFIG_BLK_DEV_IDE{"hda",0x030 0 }, { " hd b ",0x0 3 4 0 },{ " hdc",0x160 0 } , { " h d d",0x1640},{"hde",0x210 0},{"hdf",0x2140},{"hdg",0x2200},{"hdh", 0x2240},{"hdi",0x3800},{"hdj",0x3840},{"hdk",0x3900},{"h dl",0x3940}, # endif# i f d e f C O N FIG_BLK_DEV_SD{"sda",0x0800} , {"sdb",0x0810},{"sdc",0x0820},{"sdd",0x0830},{" s de " , 0x 0 8 4 0} , { " sd f ",0x0850}, { " s d g " , 0 x0860},{"sdh",0x0870},{ "sdi",0x0880},{"sdj",0x0890},{"sdk",0x0 8a0},{"sdl",0x08b0},{"sdm",0x08c0},{"sdn",0x08d0},{"sdo" ,0x08e0},{ " s d p ",0x0 8 f 0 } , # endif#ifdefCONFIG_ATARI_ACSI{"ada",0x1c00},{"adb",0x1c10},{"adc",0x1c20},{"add", 0 x1 c 3 0} ,{ " a d e ",0 x 1c40},#end i f# i f d e f CONFIG_BLK_DEV_FD{"fd" ,0x0200},#endif#ifdefCONFIG_MD_BOOT{"md ",0x0900},#endif#ifdefCONFIG_BLK_DEV_XD{"xda",0x0d00},{" xdb",0x0d 4 0 } , # endif # i f d e f CONFIG_BLK_DEV_RAM{"ram",0x0100},#endif#ifdefCONFIG_BLK_DEV_SR{"scd",0x0b00},#endi f# if d e f CON F I G_ M CD{"mcd",0x170 0 } , # e ndif#ifdefCONFIG_CDU53 5{"cdu535",0x1800},{"sonycd",0x1800},# endif#ifdefCONFIG_AZTCD{"aztcd",0x1d00},#endif#ifdefCON FIG_CM206 { "c m 2 06cd" , 0 x 2 0 0 0},#endif#ifdefCONFIG_GSCD{"gscd",0x1000},#endif#ifdefCONFIG_SBPCD{"sbpcd",0x1900},#en d i f # i f de f C ON F IG_BLK_DEV_ P S2 { " e d a",0x2400},{"edb",0x24 40},#endif#ifdefCONFIG_PARIDE_PD{"pda" ,0x2d00},{"pdb",0x2d10},{"pdc",0x2d20},{"pdd",0x2d30},# endif#ifd ef C ONFIG_P A R I D E _PCD{"pcd",0x2e00},#endif#ifdefCONFIG_PARIDE_PF{"pf",0x2f00},#endif#ifCONFIG_APBLOCK{"ap b l o c k", A P BL O CK_MAJOR<<8} , #e n d i f #ifCONFIG_DDV{"ddv",DD V_MAJOR<<8},#endif{NULL,0}};kdev_t__i nitname_to_kdev_t(char*line){intbase=0;if(strncmp(line, "/dev/", 5 ) = =0){stru c t d e v_name_struct*dev=root_dev_names;line+=5;do{intlen=strlen(dev->name);if(strncmp(line,dev-> n a m e , le n ) == 0 ){line+=len;ba s e = d e v->num;break;}dev++;} while(dev->name);}returnto_kdev_t(bas e+simple_strtoul(line,NULL,base?10:16));}staticvoid__in itroot_d e v _setup(ch ar * line,int*num){ROOT_DEV=name_to_kdev_t(line);}/**Listofkernelcommandlineparameters.Thefirstta b l e l i st s p a r ameters*wh ic har e s u b jecttovaluesparsing(le adingnumbersareconvertedto*anarrayof intsandchoppedoffthestring),thesecondtablecontains*the fewexcep t i o nswhicho beytheirownsyntaxrules.*/structkernel_param{constchar*str;void(*setup_func)(char*,int*);};statics t r u c t k e r ne l _paramco ok e d_ p a r a m s []__initdata={/*FIXME :makePNPjustbecomereserve_setup*/#if ndefCONFIG_KERNEL_PNP_RESOURCE{"reserve=",reserve_setu p},#els e { " r eserve=" ,pnp_reserve_setup},#endif{"profile=",profile_setup},#ifdef__SMP__{"nosmp",smp_setup},{"maxcpus=", s m p _ set up } ,#ifdef C O NFI G_ X 8 6 _ I O _APIC{"noapic",ioapic _setup},{"pirq=",ioapic_pirq_setup} ,#endif#endif#ifdefCONFIG_BLK_DEV_RAM{"ramdisk_start= ",ramdisk _s tart_set up},{"load_ramdisk=",load_ramdisk},{"prompt_ramdisk=",prompt_ramdisk},{"ramdisk=",ramdisk_size},{"ra m d i s k _ s iz e =",ra m d is k_ s i z e } , # i fdefCONFIG_BLK_DEV_IN ITRD{"noinitrd",no_initrd},#endif#e ndif#ifdefCONFIG_FB{"video=",video_setup},#endif{"pan ic=",pan i c _ setup}, { "console=",console_setup},#ifdefCONFIG_VGA_CONSOLE{"no-scroll",no_scroll},#endif#ifdefCONFIG_MDA_CONS O LE {" m da c on=", m d a c o n _ s e tu p } , # endif#ifdefCONFIG_VT {"kbd-reset",kbd_reset_setup},#endi f#ifdefCONFIG_BUGi386{"no-hlt",no_halt},{"no387",no_3 87},{"r e b o ot=",reb oot_setup},#endif#ifdefCONFIG_INET{"ether=",eth_setup},#endif#ifdefCONFIG_ARCNET_COM20020{"com20020=",c o m 2 00 2 0_ s etup } , # e ndi f # i f d e f C O NFIG_ARCNET_RIM_I{" arcrimi=",arcrimi_setup},#endif#ifd efCONFIG_ARCNET_COM90xxIO{"com90io=",com90io_setup}, #endif# i f d efCONFIG _ ARCNET_COM90xx{"com90xx=",com90xx_setup},#endif#ifdefCONFIG_DECNET{"decnet=",decnet_setup},#endif#ifdefCO NFI G_P R I NTE R { " l p =" , l p _ s et u p },#endif#ifdefCONFI G_JOY_AMIGA{"js_am=",js_am_setup},# endif#ifdefCONFIG_JOY_ANALOG{"js_an=",js_an_setup},# endif#i f d e fCONFIG_ J OY_ASSASIN{"js_as=",js_as_setup},#endif#ifdefCONFIG_JOY_CONSOLE{"js_console=",js_console_setup},{"js_console2=" , j s _ c o n s o l e _ s e t u p} ,{ " j s_console3=",js_con sole_setup},#endif#ifdefCONFIG_JOY _DB9{"js_db9=",js_db9_setup},{"js_db9_2=",js_db9_se tup},{" j s _ d b9_3=", j s_db9_setup},#endif#ifdefCONFIG_JOY_TURBOGRAFX{"js_tg=",js_tg_setup},{"js_tg_2=",js_tg_setup},{"js_tg_3=",js_tg_s e t u p } , # e n d i f # i f d e f C O N FIG_SCSI{"max_scsi_ luns=",scsi_luns_setup},{"scsi_log ging=",scsi_logging_setup},#endif#ifdefCONFIG_JOY_L IGHTNIN G { " js_l4=", j s_l4_setup},#endif#ifdefCONFIG_SCSI_ADVANSYS{"advansys=",advansys_setup},#endif#ifdefined(CONFIG_BLK_DEV_HD){"hd= " , hd _ s e tu p } , # e n d i f # i f d efCONFIG_CHR_DEV_ST {"st=",st_setup},#endif#ifdefCONF IG_BUSMOUSE{"bmouse=",bmouse_setup},#endif#ifdefCON FIG_MS_ B U SMOUSE{" m smouse=",msmouse_setup},#endif#ifdefCONFIG_SCSI_SEAGATE{"st0x=",st0x_setup},{"tmc8xx=",tmc8xx_setup},#endif#ifdefC O N FIG _ S C SI _ T 1 2 8 { "t 1 2 8 = ",t128_setup},#endi f#ifdefCONFIG_SCSI_PAS16{"pas16=" ,pas16_setup},#endif#ifdefCONFIG_SCSI_GENERIC_NCR5 380{"nc r 5 3 80=",gen e ric_NCR5380_setup},{"ncr53c400=",generic_NCR53C400_setup},{"ncr53c400a=",generic_NCR53C400A_setup},{"dtc3181e=",ge n e ric _ D T C 31 8 1 E _s et u p} , # endif#ifdefCONFIG_ SCSI_AHA152X{"aha152x=",aha152x_s etup},#endif#ifdefCONFIG_SCSI_AHA1542{"aha1542=",a ha1542_ s e tup},#en d if#ifdefCONFIG_SCSI_GDTH{"gdth=",gdth_setup},#endif#ifdefCONFIG_SCSI_AIC7XXX{"aic7xxx=",aic7xxx_setup},#endif#ifdef C O N FI G_ S CSI _ BUS LOG I C { " B usLogic=",BusLogic_ Setup},#endif#ifdefCONFIG_SCSI_N CR53C8XX{"ncr53c8xx=",ncr53c8xx_setup},#endif#ifd efCONFI G _ S CSI_EAT A { "eata=",eata2x_setup},#endif#ifdefCONF I G _SCSI_U14_34F{"u14-34f=",u14_34f_setup},#endif#ifdefCONFIG_SCSI_AM53C974{"A M 5 3 C9 74= " , AM 5 3C974 _ s e t u p},#endif#ifdefCONF IG_SCSI_NCR53C406A{"ncr53c406a=" ,NCR53c406a_setup},#endif#ifdefCONFIG_SCSI_FUTURE _DOMAIN { " f domain= " ,fdomain_setup},#endif#ifdefCONFIG_SCSI _ I N 2000{"in2000=",in2000_setup},#endif#ifdefCONFIG_SCSI_7000FASST{"wd7000=",wd 7 0 00 _s etup}, # endif # i f d efCONFIG_SCSI_IBMMCA {"ibmmcascsi=",ibmmca_scsi_setu p},#endif#ifdefined(CONFIG_SCSI_DC390T)&&!defined (CONFI G _ S CSI_DC39 0 T_NOGENSUPP){"tmscsim=",dc390_setup},# e n d if#ifdefCONFIG_BLK_DEV_XD{"xd=",xd_setup},{"xd_geo=",xd_manual_geo_init},#end i f#ifdefined ( CONFI G _ B LK_DEV_FD)||defined( CONFIG_AMIGA_FLOPPY)||defined(C ONFIG_ATARI_FLOPPY){"floppy=",floppy_setup},#end if#ifde f C O NFIG_BL K _ DEV_PS2{"eda=",ed_setup},{"edb=",ed_se t u p } ,{"tp720=",tp720_setup},#endif#ifdefCONFIG_CDU31A{"cdu31a=",cdu31a_setup},#e ndifCONFIG_CDU31A# i f d e fCONFIG_MCD{"mcd=", mcd_setup},#endifCONFIG_MCD#ifd efCONFIG_MCDX{"mcdx=",mcdx_setup},#endifCONFIG_M CDX#if d e f C ONFIG_S B PCD{"sbpcd=",sbpcd_setup},#endifCONFIG_ S BP CD#ifdefCONFIG_AZTCD{"aztcd=",aztcd_setup},#endifCONFIG_AZTCD#ifdefCONFIG_CDU 5 35{"sonycd535=",so n y c d535_setup},#endifCO NFIG_CDU535#ifdefCONFIG_GSCD{" gscd=",gscd_setup},#endifCONFIG_GSCD#ifdefCONFIG _CM2 06 { " c m206=", c m206_setup},#endifCONFIG_CM206#ifdefCON F I G _ OPTCD{"optcd=",optcd_setup},#endifCONFIG_OPTCD#ifdefCONFIG_SJCD{"sjcd=",sjcd_ s etup},#endifCONFIG _ S J C D#ifdefCONFIG_ISP16 _CDI{"isp16=",isp16_setup},#en difCONFIG_ISP16_CDI#ifdefCONFIG_SOUND_OSS{"soun d=",s o u n d _ setup}, # endif#ifdefCONFIG_ISDN_DRV_ICN{"icn=",i c n_ s etup},#endif#ifdefCONFIG_ISDN_DRV_HISAX{"hisax=",HiSax_setup},{"HiSax=",HiSax _ setup},#endif#ifde f C O N FIG_ISDN_DRV_PCBIT{ "pcbit=",pcbit_setup},#endif#i fdefCONFIG_ATARIMOUSE{"atamouse=",atari_mouse_s etup} , # e n dif#ifde f CONFIG_DMASOUND{"dmasound=",dmasound_se t u p } ,#endif#ifdefCONFIG_ATARI_SCSI{"atascsi=",atari_scsi_setup},#endif#ifdefCONFIG _STRAM_SWAP{"stram_ s w a p=",stram_swap_setu p},#endif#ifdefined(CONFIG_A40 00T_SCSI)||defined(CONFIG_WARPENGINE_SCSI)\||d efined( C O N FIG_A40 9 1_SCSI)||defined(CONFIG_MVME16x_SCSI)\|| d e f i ned(CONFIG_BVME6000_SCSI){"53c7xx=",ncr53c7xx_setup},#endif#ifdefined(CONFIG_A 3000_SCSI)||defined ( C O NFIG_A2091_SCSI)\||d efined(CONFIG_GVP11_SCSI){"wd 33c93=",wd33c93_setup},#endif#ifdefined(CONFIG _GVP 1 1 _ S C S I){"gvp 1 1=",gvp11_setup},#endif#ifdefCONFIG_MAC_ S C S I {"mac5380=",mac_scsi_setup},#endif#ifdefCONFIG_CYCLADES{"cyclades=",cy_setup}, #endif#ifdefCONFIG_ D I GI{"digi=",pcxx_setup },#endif#ifdefCONFIG_DIGIEPCA {"digiepca=",epca_setup},#endif#ifdefCONFIG_RI SCOM 8 { " r i scom8=", riscom8_setup},#endif#ifdefCONFIG_DMASCC{ " dm a scc=",dmascc_setup},#endif#ifdefCONFIG_SPECIALIX{"specialix=",specialix_setup} ,#endif#ifdefCONFIG _ B AYCOM_PAR{"baycom_par= ",baycom_par_setup},#endif#i fdefCONFIG_BAYCOM_SER_FDX{"baycom_ser_fdx=",b aycom _ s e r _ fdx_setu p},#endif#ifdefCONFIG_BAYCOM_SER_HDX{"ba y c o m _ ser_hdx=",baycom_ser_hdx_setup},#endif#ifdefCONFIG_SOUNDMODEM{"soundmodem=",sm _setup},#endif#ifde f C ONFIG_WDT{"wdt=",wdt_s etup},#endif#ifdefCONFIG_PAR PORT{"parport=",parport_setup},#endif#ifdefCO NFIG_PL I P {"plip=" , plip_setup},#endif#ifdefCONFIG_HFMODEM{" h fmo d em=",hfmodem_setup},#endif#ifdefCONFIG_FTAPE{"ftape=",ftape_setup},#endif#ifde fCONFIG_MD_BOOT{"md = " ,md_setup},#endif#ifde fCONFIG_ADBMOUSE{"adb_button s=",adb_mouse_setup},#endif#ifdefCONFIG_LTPC {"ltpc= " , l tpc_setu p },#endif{0,0}};staticstructkernel_paramra w _ p a rams[]__initdata={{"root=",root_dev_setup},#ifdefCONFIG_ROOT_NFS{"nfsroot=",nf s _root_setup},{"nfs a d drs=",ip_auto_config_s etup},#endif#ifdefCONFIG_IP_ PNP{"ip=",ip_auto_config_setup},#endif#ifdef CONFIG_ P C I {"pci=", pci_setup},#endif#ifdefCONFIG_PARIDE_PD{" p d." , pd_setup},#endif#ifdefCONFIG_PARIDE_PCD{"pcd.",pcd_setup},#endif#ifdefCONFIG_P A RIDE_PF{"pf.",pf_s e t up},#endif#ifdefCONFIG_ PARIDE_PT{"pt.",pt_setup},# endif#ifdefCONFIG_PARIDE_PG{"pg.",pg_setup} ,#endif# i f defCONFI G _APM{"apm=",apm_setup},#endif{0,0}};#ifdef C O N FIG_BLK_DEV_RAMstaticvoid__initramdisk_start_setup(char*str,int*ints){if(ints[0 ] >0&&ints[1]>=0)rd _ i m age_start=ints[1];}stat icvoid__initload_ramdisk(ch ar*str,int*ints){if(ints[0]>0&&ints[1]>=0)r d_doload = i n ts[1]&1 ; }staticvoid__initprompt_ramdisk(char*str, i nt* i nts){if(ints[0]>0&&ints[1]>=0)rd_prompt=ints[1]&1;}staticvoid__initramdisk_siz e (char*str,int*int s ) { if(ints[0]>0&&ints[1]>= 0)rd_size=ints[1];}#endifst aticint__initchecksetup(char*line){inti,in ts[11];# i f d efCONFIG _ BLK_DEV_IDE/*idedriverneedsthebasicstring, r a t h erthanpre-processedvalues*/if(!strncmp(line,"ide",3)||(!strncmp(line,"hd",2)&&l ine[2]!='=')){ide _ s e tup(line);return1;}#endi ffor(i=0;raw_params[i].str ;i++){intn=strlen(raw_params[i].str);if(!s trncmp(l i n e ,raw_par a ms[i].str,n)){raw_params[i].setup_func(li n e+n , NULL);return1;}}for(i=0;cooked_params[i].str;i++){intn=strlen(cooked_params[i]. str);if(!strncmp( l i n e,cooked_params[i].str,n )){cooked_params[i].setup_ func(get_options(line+n,ints),ints);retur n1;}}retu r n 0 ;}/*thi s shouldbeapprox2Bo*oMipstostart(noteinitial s h if t ),andwillstillworkevenifinitiallytoolarge,itwilljusttakeslightlylonger*/unsigne dlongloops_per_se c = ( 1<<12);/*Thisisthenumber ofbitsofprecisionfortheloo ps_per_second.Eachbittakesonaverage1.5/H Zseconds.T h i s (liket h e original)isalittlebetterthan1%*/#defineLPS _P R E C 8void__initcalibrate_delay(void){unsignedlongticks,loopbit;intlps_precision=LPS _PREC;loops_per_s e c = (1<<12);printk("Calibrat ingdelayloop...");while(lo ops_per_sec<<=1){/*waitfor"startof"clock tick*/tick s = j iffies; w hile(ticks==jiffies)/*nothing*/;/*Go..*/ti c k s= j iffies;__delay(loops_per_sec);ticks=jiffies-ticks;if(ticks)break;}/*Doabinaryap proximat i ontogetl o o ps_per_secondsettoequalon eclock(uptolps_precisionbi ts)*/loops_per_sec>>=1;loopbit=loops_pe r_sec;while ( l p s_prec i si on--&&(loopbit>>=1)){loops_per_sec|=loopb it ; t i cks=jiffies;while(ticks==jiffies);ticks=jiffies;__delay(loops_per_sec);if(jiffi es!=tic k s ) /*long e r t han1tick*/loops_per_sec&= ~loopbit;}/*finally,adjust loopspersecondintermsofsecondsinsteado fclocks*/loo p s _ per_se c *= HZ;/*Roundthevalueandprintit*/printk("%lu . % 02 l uBogoMIPS

",(loops_per_sec+2500)/500000,((loops_per_sec+2500)/5000)%100);}/**T hisisasimplekern e l c ommandlineparsingfunction: itparses*thecommandline,a ndfillsinthearguments/environmenttoin it*asappropri a t e .Anycmd - l ineoptionistakentobeanenvironment*variabl ei f i tcontainsthecharacter'='.**Thisroutinealsochecksforoptionsmeantforthekernel.*The seoptionsarenotg i v e ntoinit-theyareforinternal kerneluseonly.*/staticvoi d__initparse_options(char*line){char* next;intargs, e n v s;if(!* li ne)return;args=0;envs=1;/*TERMissetto'lin u x 'b y default*/next=line;while((line=next)!=NULL){if((next=strchr(line,''))!=NULL)*ne xt++=0;/**checkf or k erneloptionsfirst..*/if(!s trcmp(line,"ro")){root_mo untflags|=MS_RDONLY;continue;}if(!st rcmp(line,"rw" ) ) { root_mo u n tflags&=~MS_RDONLY;continue;}if(!strcmp(l in e , "debug")){console_loglevel=10;continue;}if(!strncmp(line,"init=",5)){line+=5;exe cute_command=li n e ; /*IncaseLILOisgoingtobootus withdefaultcommandline,*i tprepends"auto"beforethewholecmdline whichmakes*th e s h e llthink it shouldexecuteascriptwithsuchname.*Soweign o r e a llargumentsentered_before_init=...[MJ]*/args=0;continue;}if(checksetup(line))con tinue;/**Thench e c k ifit'sanenvironmentvariable or*anoption.*/if(strchr(l ine,'=')){if(envs>=MAX_INIT_ENVS)br eak;envp_init [ + + e n vs]=lin e ; }else{if(args>=MAX_INIT_ARGS)break;argv_i ni t [ ++args]=line;}}argv_init[args+1]=NULL;envp_init[envs+1]=NULL;}externvoidsetup_ar c h(char**,unsig n e d long*,unsignedlong*);#ifnde f__SMP__/**Uniprocessorid lethread*/intcpu_idle(void*unused){ for(;;)idle( ) ;} # d e f inesmp _i nit()do{}while(0)#else/**Multiprocessorid l e t h readisinarch/...*/externintcpu_idle(void*unused);/*Calledbybootprocessortoactiva t etherest.*/st a t i c void__initsmp_init(void){/* Getotherprocessorsintothe irbootupholdingpatterns.*/smp_boot_ cpus();smp_ t h r e a ds _ ready = 1 ; smp_commence();}#endifexternvoidinitializ e_s e condary(void);/**Activatethefirstprocessor.*/asmlinkagevoid__initstart_kernel(vo i d){char*comma n d _ line;#ifdef__SMP__staticintb oot_cpu=1;/*"current"hasb eensetup,weneedtoloaditnow*/if(!boo t_cpu)initia l i z e_ s e conda ry( );boot_cpu=0;#endif/**Interruptsarestill d i s a b led.Donecessarysetups,then*enablethem*/printk(linux_banner);setup_arch(&command_ l ine,&memory_ s t a r t,&memory_end);memory_start= paging_init(memory_start, memory_end);trap_init();init_IRQ(); sched_init() ; t i m e _ i nit() ; p a rse_options(command_line);/**HACKALERT!Th is i s early.We'reenablingtheconsolebefore*we'vedonePCIsetupsetc,andconsole_init()mustbe awareof*this . B u t wedowantoutputearly,incaseso methinggoeswrong.*/memory _start=console_init(memory_start,me mory_end);#ifde f C O N F IG_M ODU LESinit_modules();#endifif(prof_shift){pr o f _ b uffer=(unsignedint*)memory_start;/*onlytextisprofiled*/prof_len=(unsignedlong)&_e text-(unsig n ed l o ng)&_stext;prof_len>>=prof_s hift;memory_start+=prof_l en*sizeof(unsignedint);memset(prof_ buffer,0,prof_le n *s i zeof ( u n signedint));}memory_start=kmem_cache_ini t (me m ory_start,memory_end);sti();calibrate_delay();#ifdefCONFIG_BLK_DEV_INITRDif(init r d_start&&!i n i t r d_below_start_ok&&initrd_sta rt<memory_start){printk(KE RN_CRIT"initrdoverwritten(0x%08lx<0 x%08lx)-""disab l i n g i t .

", initrd_start,memory_start);initrd_start=0; } # e ndifmem_init(memory_start,memory_end);kmem_cache_sizes_init();#ifdefCONFIG_PROC_F S proc_root_i n i t ( );#endifuidcache_init();file scache_init();dcache_init( );vma_init();buffer_init();signals_ init();inode_ini t ( ) ; file _ t able_init();#ifdefined(CONFIG_SYSVIPC)ipc_ i n i t ();#endif#ifdefined(CONFIG_QUOTA)dquot_init_hash();#endifcheck_bugs();printk("PO S IXconforman c e t estingbyUNIFIX

");/**Wecount ontheinitialthreadgoingok* Likeidlersinitisanunlockedkernelthr ead,whichwill*mak e s y s c al ls (andthusbelocked).*/smp_init();kernel_thre a d ( i nit,NULL,CLONE_FS|CLONE_FILES|CLONE_SIGHAND);current->need_resched=1;cpu_idle(NU L L);}#ifdef C O N F IG _ BLK _D E V_INITRDstaticintdo_ linuxrc(void*shell){static char*argv[]={"linuxrc",NULL,};close (0);close(1);close ( 2 ) ; s e ts id();(void)open("/dev/console",O_RDWR,0);( v o i d )dup(0);(void)dup(0);returnexecve(shell,argv,envp_init);}staticvoid__initno_init rd(char* s ,i n t * i nt s ) { m ou n t _ i nitrd=0;}#endifst ructtask_struct*child_reap er=&init_task;/**Ok,themachineisnow initialized.Noneoft h e d e v ic es*havebeentouchedyet,buttheCPUsubsystemis u p a n d*running,andmemoryandprocessmanagementworks.**Nowwecanfinallystartdoingsomereal work. . */ sta ti c vo i d _ _i n i t d o _b a s i c_setup(void) {#ifdefCONFIG_BLK_DEV_INIT RDintreal_root_mountflags;#endif/** Tellthewo r ld t hatwe'r e g o i n g tobethegrim*reaperofinnocentorphanedchildr e n . * *Wedon'twantpeopletohavetomakeincorrect*assumptionsaboutwhereinthetaskarraythis * canb e f o u n d.*/child_re a p er = c u r r en t ;#ifdefined (CONFIG_MTRR)/*Dothisafter SMPinitialization*//**Weshouldproba blycreat es o m e a rc hitec t u r e - dependent"fixupafter*everythingisup"stylef unc t ionwherethiswouldbelongbetter*thanininit/main.c..*/mtrr_init();#endif#ifdefCONF I G_S Y SC T L sysctl_init();#en d if/ * * O k , atthispoin tallCPU'sshouldbeinitializ ed,so*wecanstartlookingintodevices.. */#if d e f C O N F I G _P CIpci _ i n i t();#endif#ifdefCONFIG_SBUSsbus_init();#en d i f # ifdefined(CONFIG_PPC)powermac_init();#endif#ifdefCONFIG_MCAmca_init();#endif#i f d ef C ON F IG_ARCH_ACORNecard_init ( ) ; # e n d i f#ifdef CONFIG_ZORROzorro_init();# endif#ifdefCONFIG_DIOdio_init();#end if/ *N et w orki ngin i tializ a t ionneedsaprocesscontext*/sock_init();/*La u nch b dflushfromhere,insteadoftheoldsyscallway.*/kernel_thread(bdflush,NULL,CLONE_FS | C L O NE _ FILES|CLONE_SIGHAND);/*St a r t t h e b ackgrou ndpageoutdaemon.*/kswapd_s etup();kernel_thread(kswapd,NULL,CLON E_F S | C L O N E _ FIL ES| CLONE _ S I GHAND);#ifCONFIG_AP1000/*Starttheasyncpag i n g d aemon.*/{externintasyncd(void*);kernel_thread(asyncd,NULL,CLONE_FS|CLONE_FILES | CL O N E _SIGHAND);}#endif#ifdefCON F I G _ B L K _DEV_IN ITRDreal_root_dev=ROOT_DEV ;real_root_mountflags=root_mountflag s;i f( i n i t r d _ s t a r t& & mount _ i n itrd)root_mountflags&=~MS_RDONLY;elsemou n t _ initrd=0;#endif/*Setupdevices..*/device_setup();/*..executableformats..*/binfmt _se t u p();/*..filesystems..*/file s y s t e m _ s etup( );/*Mounttherootfilesystem. .*/mount_root();#ifdefCONFIG_UMSDOS_ FS{ / * W h e n m o u n t i n g a u m sdos f s a sr oot,wedetectthepseudo_root(/linux)and i nit ialiseithere.pseudo_rootisdefinedinfs/umsdos/inode.c*/externstructinod e*pseudo_r o o t ; if(pseudo_root!=NULL){curren t -> f s - > root= pseudo_root->i_sb->s_root;c urrent->fs->pwd=pseudo_root->i_sb-> s_r o o t ; } } # e n d i f # i fd ef C ONFIG _ B L K _DEV_INITRDroot_mountflags=real_root _ m o u n tflags;if(mount_initrd&&ROOT_DEV!=real_root_dev&&MAJOR(ROOT_DEV)==R AMD ISK_MAJO R&& M INOR(ROOT_DEV)==0){interror; i n t i , p id;pid =kernel_thread(do_linuxrc,"/ linuxrc",SIGCHLD);if(pid>0)while(p id!= wa i t ( & i ) ) ; i f( M A J OR ( r eal_r o o t _ dev)!=RAMDISK_MAJOR||MINOR(real_roo t _ d e v)!=0){error=change_root(real_root_dev,"/initrd");if(error)printk(K ER N_ E R R" C ha n ge r o o tto/initrd:""error%d

",err o r );} } #e n di f}staticintinit(void*unused){ lock_kernel();do_basic_setup();/* *Ok,w e h a v e c o m pl e t e d t h e i n it ialb o o t u p ,and*we'reessentiallyupandrunning. G etr i dofthe*initmemsegmentsandstarttheuser-modestuff..*/free_initmem(); u n l oc k _kerne l ( ) ; i f(open("/dev/console",O_RDW R ,0)< 0 ) p r in t k("Warning:unabletoopenanini tialconsole.

");(void)dup(0);(vo id)du p ( 0 ) ; /* * W e t r y e a c hof t h e seunt i l o n e succeeds.**TheBourneshellcanbeus e d i n steadofinitifweare*tryingtorecoverareallybrokenmachine.*/if(execut e_ c o m mand ) e x ecv e ( e xecute_command,argv_init,e n vp _ i n it ) ; e x ec v e("/sbin/init",argv_init,e nvp_init);execve("/etc/init",arg v _ i ni t ,e n v p _ i n i t ) ; e x e c v e (" / b i n/ini t " , a r gv_init,envp_init);execve("/bin / s h " , argv_init,envp_init);panic("Noinitfound.Trypassinginit=optiontoke rn e l . ") ; }/**l i n u x / init/main.c**Copyright(C) 1 9 91 , 1 9 9 2 L i n us T o r valds**GK2/5/95-Changedto supportmountingrootfsviaNFS*Adde di nitr d& c h a n g e _ r o o t : W e r n e rAl m e sberge r & H a nsLermen,Feb'96*Moanearlyifgcc i sol d ,avoidingboguskernels-PaulGortmaker,May'96*Simplifiedstartingofin it : M i c h a el A .Gri f f i th<grif@acm.org>*/#define _ _ KE R N E L _ S Y S CAL L S _ _#include<linux/config.h >#include<linux/proc_fs.h>#incl u d e<li n ux/ u nis t d . h > # i n clu de < l i n u x/ctyp e . h > #include<linux/delay.h>#includ e < l i n ux/utsname.h>#include<linux/ioport.h>#include<linux/init.h>#incl ud e < l in ux /sm p _ l o c k .h>#include<linux/blk.h># i n c lud e < l i nux/hdr e g.h>#include<asm/io.h>#i nclude<asm/bugs.h>#ifdefCONFIG _ P C I # in cl u d e < l i n u x /pci . h > # e n d if # i f d efCON F I G _ DIO#include<linux/dio.h>#endi f# i f d efCONFIG_ZORRO#include<linux/zorro.h>#endif#ifdefCONFIG_MTRR#inc l u d e < a s m /m trr. h > # endif#ifdefCONFIG_APM#include<l i n ux / apm _ b i o s .h>#endif/**Versionsofgc colderthanthatlistedbelowmayac t u a ll y c o mp i le * a n d l i n k ok a y , b u t th e e n dprodu c t c a nh avesubtleruntimebugs.*Toavo i da s s ociatedbogusbugreports,weflatlyrefusetocompile*withagccthatiskno w n t o b e t o o ol d f r o m t h everybeginning.*/#if__GNUC__< 2 | | ( _ _G N UC__== 2&&__GNUC_MINOR__<6)#err orsorry,yourGCCistooold.Itbui l d si nco r r e c t k e rn e ls . # e n d if e x t e r n ch a r _ stext, _ e t e x t;externchar*linux_banner;ex te rnintconsole_loglevel;staticintinit(void*);externintbdflush(void* ) ;ex te rn i n t k s w a p d ( void*);externvoidkswapd_ s etup ( v oi d );exte r n v oidinit_IRQ(void);extern voidinit_modules(void);exter n l o n gc o n s o l e _ i n i t ( l o n g,l o n g ) ; e x ter n v o i d sock_i n i t ( v oid);externvoiduidcache_init(void);externvoidmca_init(void);externvoidsbus_init(void);externvo i d po w e rm ac _i n i t ( v o id);externvoidsysctl_init ( vo i d ) ; e xter n voidf ilescache_init(void);ext ernvoidsignals_init(void);e x t e r n voi d de v i c e_ s etu p ( v o i d ) ;e x t e rnv oi d b infmt_se t u p ( v oid);externvoidfree_initmem(void);externvoidfilesystem_setup(void);#ifdefCONFIG_ARCH_ACORNext er n v o i d e c a r d _ i n i t ( void);#endifexternvoidsmp_se t u p ( c ha r * s t r,i n t*ints);#ifdef__i386__ex ternvoidioapic_pirq_setup( c h ar * s t r ,i n t * i n t s ) ; e x t e rn v o i d i o ap i c _ s e t u p ( char*st r , i n t *ints);#endifexternvoidno_scroll(char*str,int*ints);externvoidkbd_reset_setup(char*str,int * i n t s ) ; ex t e r n v o i d p a n i c_setup(char*str,int*ints ) ; e x t e rn vo idb m o u s e_setup(char*str,int*int s);externvoidmsmouse_set up ( c h ar * s t r , in t *i n t s);e x t e r n vo id c on sole _ s e t up(char*st r ,i n t*ints);#ifdefCONFIG_PRINTERexternvoidlp_setup(char*str,int*ints);#endif#ifdefCONFIG_J O Y_ A M I GAex t er n v o i d j s _ a m _ s etup(char*str,int*ints) ; # e nd i f # i f d e f CON F I G_JOY_ANALOGexternvoidjs _an_setup(char*str,int* i n t s ) ; # e n d i f # i fd ef C O N F I G_J O Y _ A S S A SI N e x te r n v o i d js_as_setu p ( c har*str,int*ints);#endif#ifdefCONFIG_JOY_CONSOLEexternvoidjs_console_setup(char*str, i n t* i n t s ) ; # e n d if # i f d e f C O N F I G _JOY_DB9externvoidj s _ d b 9_ s e t u p( c h a r * s t r ,int*ints);#endif#ifdefC ONFIG_JOY_TURBOGRAFXe xt e r n v oi dj s _ tg _ se t u p ( c h ar * s t r,i n t* i n t s ) ; # e n d i f # i f defCO NF IG_ J O Y _ LIGHTNINGexternvoidjs_l4_setup(char*str,int*ints);#endifexternvoideth_setup(char* s t r , int *i n t s ) ; #if de f C O N F I G _ A R C NET_COM20020exte r n v o i d c o m 2 0 020 _ s e t u p ( c har*str,int*ints);#endif #ifdefCONFIG_ARCNE T_ R I M_ I e x t er n v o i d ar c r im i_s e t u p ( c h a r * s t r , i n t * i n t s ) ; # e ndif#ifdefC ON FIG_ARCNET_COM90xxIOexternvoidcom90io_setup(char*str,int*ints);#endif#ifdefCONFIG _ ARCN E T_ C OM9 0 xx ex t e rn v o i d c om 9 0 x x_setup(char*st r , i n t * i n t s ) ; #en d i f # i f d e fCONFIG_DECNETexternvoid decnet_setup( cha r * s t r , i nt *i n ts ) ;# e n d i f # i f d e f C O N F I G _B LK _ DEV _ X D e x t e r n vo i d xd_setup(ch ar * str,int*ints);externvoidxd_manual_geo_init(char*str,int*ints);#endif#ifdefCONFI G _B L K_ D E V_ IDE e x t e r n v o i d i d e _ s e t u p ( c har*);#end i f # i f d e f C O N F I G_ PA R I D E _ P De xternvoidpd_setup(char*s tr,int* i n ts ) ; # e nd i f # i fd e f CO N F IG _ P A R I DE _ P F ex t e r n v o i d p f _ s e t u p ( ch a r * s t r , i n t*ints);#endif # ifdefCONFIG_PARIDE_PTexternvoidpt_setup(char*str,int*ints);#endif#ifdefCONFIG_ P ARI D E_P G ext e r n v o i dp g _ s e t u p ( c h a r * s t r , i n t * i n t s ) ; # e n d i f # if d e f C O N F I G _P A R I DE_PCDexternvoidpcd_set up(cha r * s t r ,i n t* i n ts); # e n d i fe x te r nv o i d f l op p y _ s e t up ( c h a r *s t r , i n t * i n t s ) ; e xternvoidst_se t u p(char*str,int*ints);externvoidst0x_setup(char*str,int*ints);externvoidadvan s ys _ se t up (c ha r * s t r , in t * i n t s ) ; e x t e r n v o i d t m c 8 x x _ s et u p ( c h a r * s t r , i n t * i n t s) ; externvoidt128_setup(ch ar*s t r , i n t * in t s ) ; ext e r n v o i d p as1 6_ s e t u p( ch a r * s t r , i n t * i n t s ) ; e x t ern v o i d g e n e ric_NCR5380_set u p(char*str,int*intr);externvoidgeneric_NCR53C400_setup(char*str,int*intr);e x t er n vo i d g e ner i c _ N C R 5 3 C 4 0 0 A _ s e tup (c ha r *st r, int * i n t r ) ; e x t e r n v o i d g e ne r i c _ D TC3181E_setup(char*str ,in t * i n t r ) ; e x te r n v o idaha152 x _s etup ( c h ar * s t r,i nt *in t s ) ; e x t e r nvoi d a h a 1 5 4 2 _ s etup(char*str, i n t*ints);externvoidgdth_setup(char*str,int*ints);externvoidaic7xxx_setup(ch a r * st r ,i n t *int s ) ; e xt er n v o i d A M 5 3 C 9 7 4 _setup(c h a r * s t r ,i n t * i n ts ) ; e xt e rn v oi dB usLogic_Setup(char*str ,i n t *i n t s); ex t ernvoi d n c r 5 3c8xx _ s e t u p ( c h a r * s t r , i n t * i n t s ) ; e x t e r n v o i de a t a 2 x _ s etup(char*str,i nt *ints);externvoidu14_34f_setup(char*str,int*ints);externvoidfdomain_setu p ( c h ar * st r, i nt * i n t s) ; e x te r nv o i di b m m c a _ sc si _ s e t u p( c h a r * s t r , i n t * i n t s ) ; e x t e r nvoidin2000_setup(cha r * s t r, i n t * i n t s ) ; e x ter n v o i d N C R 5 3 c 4 0 6 a _s e t u p ( c h a r * s t r , i n t * i n ts ) ; e x t e r n v o i d w d 7000_se t up(char*s t r,int*ints);externvoiddc390_setup(char*str,int*ints);externvoidscsi_lun s _ s et u p(c h a r * s t r , i n t * i n t s ) ; e xt e r n v oi d s c s i _ l o gg i n g _ s e t up( c h a r * s t r, in t *in t s ) ;externvoidsound_set u p ( c h a r * s tr, i n t * in t s ) ; e x te r n v o i d re b o ot _ s etu p ( c h a r * s t r ,in t * i n ts ) ; e x t e r n v o i d v ideo_s et up(char*s t r ,int*ints);#ifdefCONFIG_CDU31Aexternvoidcdu31a_setup(char*str,int*ints ) ;# e ndif C O N F I G _C D U3 1 A # i f d e fC O NF I G _B L K_DE V_PS 2 ex t e r n v o i d e d_ s e t u p ( c h a r * s t r , i nt*ints);externvoid t p 7 20 _ s e t u p ( c h a r*s t r ,i n t * i n t s ) ; # e n di f C O N F I G _ B L K _ D E V _ P S 2 # if d e fC O N F I G _M C D e x t e r nvoidmcd_setup(ch a r *str,int*ints);#endifCONFIG_MCD#ifdefCONFIG_MCDXexternvoidmcdx_setup ( c h a r* s tr , i n t * i nts) ; # e n d i f C O N F I G _M C D X#ifde f CON FI G _ SB P CDe x t e r n v o i d s b p cd _ s e t u p(char*str,int*ints ) ;# e n di f C ONFIG_ S BP C D # i f d e f C O N F I G _A Z T C D e x t e r nv o i d a z t c d _ s et u p ( c h ar * s t r, i n t * i n t s);#endifCONFIG_A Z T C D#ifdefCONFIG_CDU535externvoidsonycd535_setup(char*str,int*ints);#en d ifC O NF I G_ C D U 5 3 5#if d ef C O N F IG_G S C D e xt e r n v oi d g s cd _ s e t u p ( c h a r * s t r , i n t* i n t s ) ;#e ndifCONFIG_GSCD#if d e f C O N F I G _ CM 2 06e x te r nv o i d cm 2 0 6 _ s e t u p ( c h a r * s t r , i n t * i n t s ) ; # e nd i f C O N F I G _ C M 2 0 6 # i f defCONFIG _ OPTCDex t e r nvoidoptcd_setup(char*str,int*ints);#endifCONFIG_OPTCD#ifdefCONFIG_ S JC D exte r n v o i d s j c d _ s e t u p ( c h a r* str , i n t * i n t s ); # e n d i f C O N FI G _ S J CD# i f def C ONF I G _ IS P16_CDIexternvoid i sp 1 6 _ s e t u p ( c h a r * st r , i n t * i n t s ) ; # e n d i f C O N F I G _I S P 1 6 _ C D I # i f d e f C O N FI G_ B LK _ D EV _ R A M staticvoidramdisk_ s t a rt_setup(char*str,int*ints);staticvoidload_ramdisk(char*str,int*in t s); s tat i c v o i d p r om p t _ r a md i s k( c har* s t r ,int* i nts ) ;s t a t i c v o i d ra m d i s k _ s i z e ( c h ar * s tr,int*ints);#if d e f C O NF I G _ B L K _ D E V _ I N I T R D s t a t ic v o i d n o _ i ni t r d ( c h a r * s , i nt* i n t s ) ; # e n d i f # e n d i f C O N F I G_BLK_DEV_RAM#ifde f C O NFIG_ISDN_DRV_ICNexternvoidicn_setup(char*str,int*ints);#endif#if d e f CO N FI G _ I S D N _ D R V _ H I S A X e x tern v o i d HiS a x _s etup ( c h ar * s t r , i n t* i n ts) ; # e n d i f # i fd e f CONFIG_DIGIEPCAe x t e r n v oi d ep c a_ s e t u p ( c ha r * s t r , i n t * i n t s ) ; # e n d i f # i f d e f C O NF I G _I S D N _ D R V _ P C B I T e x t e r n v oidpcbit_setup(cha r * str,int*ints);#endif#ifdefCONFIG_ATARIMOUSEexternvoidatari_mouse_ s e tu p (ch a r * s t r , i n t * i n t s );# e n dif#i f defCONFI G _ D M A S O U N D e x t er nvo i d d m a s o u nd _ se tup (ch ar*str,int*int s ) ; # e n d i f# i f d e f C O NF I G _ A T A R I _ S C S I e x te rn vo i d a t a r i _ s csi _ s e t u p ( c h a r * s tr , i n t *i n t s ) ; # endifexternvoidstr a m _swap_setup(char*str,int*ints);externvoidwd33c93_setup(char*str,in t *in t s) ; e x t e r n v o i d g v p 1 1 _ se t u p ( char*st r , i nt * i n t s); e x t e r n v o i d n c r 53 c 7 x x _ s e t u p ( c h a r *str,int*ints ) ; #i f d e fC O N FI G _ M AC _ S C S I e x te r n v o i d m a c _ s c s i _ s e t up ( c h a r * str , i nt* i n t s ) ; # e n d i f #i f d e f CONFIG_CYCL A DESext e r nvoidcy_setup(char*str,int*ints);#endif#ifdefCONFIG_DIGIexternvoid p cx x _se t u p ( c h a r * s t r, i nt* i nts ) ; # e n d i f # i f d ef C O N F I G _ R I SC O M 8 e x t er n v o i d ris c o m 8 _ s e t u p ( char*str,int *i n t s ) ; # en d i f # i fd ef C O N FI G _ S PEC I A L I X e x te r nv o i d s p e c ia l i x _ s e t u p ( c h a r *s t r , i n t * i n t s ) ; #endif#ifde f CON F I G _ DMASCCexternvoiddmascc_setup(char*str,int*ints);#endif#ifdefCONFIG _ B A YC O M _ P A R e x t e r n v o i db a y c o m _ p ar _ s e t up ( ch a r * s t r , i n t * i n t s ) ; # e n d i f # i fde fC ONF I G _ B A Y CO M_SER_FDXex te rn v o id b a y c o m_ s e r _ f dx _se t u p (c h a r * s t r , i n t * i n t s ) ; # e n d i f # if d e f C ONF I G _ B A Y COM _ S E R _ HD X externvoidbaycom _ s er_hdx_setup(char*str,int*ints);#endif#ifdefCONFIG_SOUNDMODEMexter n v o i ds m _ s e t u p ( c h a r *s t r , i n t * i n t s ) ; # e n d i f # i f d e f C O N F I G _ A DB M O US E e x t e r n v o i d a d b _ m o u s e_ s et up(char*s tr , i n t * i n ts ) ; # e n d if # i f d e f C O N F I G _ W DT e x t e r n v o i d w d t _ se t u p ( c h a r * st r,i nt *i nt s ) ; # e n d i f # ifdefCONFIG_PARP O R Texternvoidparport_setup(char*str,int*ints);#endif#ifdefCONFIG_PLI P e x ter n v o i d p l i p _ s e tu p ( c h a r * s t r , i n t * i n t s ) ; #end i f # i f d e f C O N F I G _ H FM O D E M e x t e r n v o id h f m o d em _setup(c ha r * s t r, i nt * i n t s ) ;#e n di f # if d e f C O N F I G _ I P_ P N Pe xt e r n v o i d i p _a u to _ c o n fi g _s e t u p (c h a r * s t r ,int*ints);#en d i f #ifdefCONFIG_ROOT_NFSexternvoidnfs_root_setup(char*str,int*ints);# e nd i f # i f d e f C O N F I G _ FT A PE ex t ern v oid f tap e _ se t u p ( c h a r * s tr , i nt *i n t s ) ; # e n d i f # i f de f C O N F I G_ M D A_CONSO LE e x t e r n v oi d m d ac o n _s e t u p ( c h a r * s t r , i n t * i n t s ) ; # e n d if# i f d e f C O N F I G _LT P C e x t e r n v o i d l t p c _ s etup(char*str , i n t*ints);#endif#ifdefined(CONFIG_SYSVIPC)externvoidipc_init(void);# e n d i f # i f d e f i n e d ( C O N F I G _ Q U OT A )ex t ern v oid d q uo t _ i n i t _ h a s h ( v o i d ) ; # e n d i f # i f d e f C O N F I G _M D _ B OOT exter nv o i d m d _ s e tu p ( c h a r * s t r , i n t * i nt s) __ i n i t ; # e nd if / * * B o ot c o m m a n d - l in ear g u me nt s * / # d e f i n e M AX_INIT_ARGS 8 # d efineMAX_INIT_ENVS8externvoidtime_init(void);staticunsignedlongmemor y_ st a r t = 0 ; s t a t i c u ns ig ne d l o n g m e m o r y _ e n d = 0 ; i nt r o w s , c o l s; #i f d e f C O N F I G _ B L K_ D E V _ R A M e x t e r n in tr d_d ol oa d ; / * 1 = l o ad r a md i s k , 0 =d o n ' t l o a d*/ e xt e r n i n t r d _ p ro m p t ; / * 1 = p r om p t fo r r a m d i s k , 0= d o n ' t pr ompt*/exte r n i ntrd_size;/*Sizeoftheramdisk(s)*/externintrd_image_start;/*startingb lo ck# o f i m a g e * / # i f d e f C O N FIG _ B LK _ D EV _ I NI T R D k d e v _ t re a l _ r o o t _ d e v ; # e n d i f# en d i f i n tro o t _ m o u n t f l a g s= MS _R D ON LY ; c ha r * e x e cu t e _ c o mm a nd = N U L L ;s t a t icc h a r * a rgv _ i n i t [ M A X_ I N I T _ A RGS + 2 ] = { "in i t " , N U LL,};sta t i c char*envp_init[MAX_INIT_ENVS+2]={"HOME=/","TERM=linux",NULL,};char*ge t _opti o n s ( c h a r * s t r , i n t * i n t s ) { c h a r * c u r = s t r ; i n ti = 1 ; w h i l e ( c u r & & ( * c ur= = ' - ' | |i s d i g i t ( * cu r)) & & i < = 1 0 ){ in ts [ i + +]= s i m p l e _ s t r t o l ( c u r ,N U L L , 0); i f ( ( cur = s t r ch r ( c u r , ', ' ) ) ! = N U L L ) c u r + + ; } in t s [ 0 ] =i - 1 ; re t u r n(cur);}staticvoid__initprofile_setup(char*str,int*ints){if(ints[0]>0)p r o f_sh i f t = ( u n s i g n e d l on g) i nt s [ 1] ; e l s e p r o f _ s h i f t = 2 ;} s t a t i c s tru c t d e v _ n a m e_ s t r uct{ c o n s t c h a r* n a m e ; co n s t i n t n u m; } roo t _ d ev_ n am e s [ ]_ _ ini t d a t a= { # i f d efC O N F I G _ R O O T _ NF S { "nf s " , 0 x 0 0 f f } ,#e n d i f # i f d efCONFIG_BLK_DEV_IDE{"hda",0x0300},{"hdb",0x0340},{"hdc",0x1600},{"hdd",0x16 40},{" h d e " , 0 x 2 1 0 0} , {" hdf ",0 x 2 1 4 0 } ,{ " h dg", 0 x22 0 0 } , { " h d h " ,0 x 2 2 4 0},{ "hd i " , 0x 3 8 0 0 } , { " h d j " , 0 x 3 8 4 0 } , {" hd k " , 0 x 3 90 0 } , {" h d l " , 0 x 3 9 4 0 } , # e n d i f # i f d ef C O N F I G _ B L K _ DEV _ S D { " s d a " , 0 x 0 8 0 0 } , { " s db " , 0 x 0 8 1 0 },{"sdc",0x0820},{"sdd",0x0830},{"sde",0x0840},{"sdf",0x0850},{"sdg",0x0860 },{"sdh " , 0 x 0 8 7 0 } , { " s d i " , 0 x 08 8 0 } , { " s d j " , 0 x 0 8 90 } , { " s d k " , 0 x 0 8a0} , { " s d l" , 0 x 0 8 b 0 } ,{ " s d m ",0 x 08 c 0 }, { " s dn ", 0 x 08 d0 } , { " s d o " , 0 x0 8e 0 } , { " s d p" , 0 x 0 8 f 0 } , # e ndi f # i fd e f C O N F I G _ A T A R I _ A C S I { " a da " , 0 x 1 c 0 0 } , { " adb",0x1c10},{"adc",0x1c20},{"add",0x1c30},{"ade",0x1c40},#endif#ifdefCON FIG_BLK_ D E V _ F D { " f d " , 0 x 0 2 00 } , # e n di f# i f de f C O N FI G _ M D _B O O T { " m d" , 0x 090 0 } , #e n d i f # i f d e f C O N FI G _ B L K _ D E V _X D{ "x d a " , 0 x 0 d00} ,{ " x db", 0 x 0 d 40 } , # e n d i f # i f d e f C O N F I G _ B L K _ D E V _ R A M{" r a m " , 0 x 0 1 0 0 } , #e nd i f # i f d e fC ONFIG_BLK_DEV_SR{"scd",0x0b00},#endif#ifdefCONFIG_MCD{"mcd",0x1700},#e n dif#ifdef C O N F I G _ C D U 5 3 5 { " c d u 5 3 5 " , 0 x 1 8 0 0 } , { " s o n y c d " , 0 x1 8 0 0 } , # e n d i f# i f d ef C O N F I G _ A Z T C D { "a z t c d ", 0 x 1 d 0 0 }, # en d if # i f de f C O N F I G _ C M 2 06 {" c m2 0 6 c d ", 0x 2 00 0 }, # e n di f # i f d e f C O N F I G _ G S C D { " g s cd " , 0 x 1 0 0 0 } , # e n d i f#ifdefCONFIG_SBPCD{"sbpcd",0x1900},#endif#ifdefCONFIG_BLK_DEV_PS2{"e da",0x2400} , { " e d b " , 0 x 2 4 40 } , # e n di f # i fd efC O N FI G _PA R I DE _ P D { " p da " , 0 x 2d 0 0 } , { " p d b " , 0 x 2 d1 0 } , { " p d c " , 0 x 2d 2 0 } ,{ " p d d ", 0 x 2 d 3 0} , # en d i f # i f d e f C O N F I G _ P A R I D E_ P C D { " pc d " , 0x 2 e 0 0} ,# en d i f # i f de f C O N FI G _ P A R I D E _ P F { " pf",0x2f00},#endif#ifCONFIG_APBLOCK{"apblock",APBLOCK_MAJOR<<8},#e n dif#ifCONFI G _ D D V { " d d v " , D D V _ M A J O R <<8 } , # e n d i f{ N U L L , 0 } } ; k d e v _ t _ _ i n i t n a m e _ to_ k de v _ t ( c ha r* l i n e ) { i n t b a s e = 0 ;i f( s t rn c m p (l i n e, " / d e v / " , 5 ) == 0 ) { s tr u c t d e v _ na m e_ s t ruc t * d ev = r o o t_d e v _ n a m e s;l i n e + = 5 ; d o {i n t l e n = strlen(dev->name);if(strncmp(line,dev->name,len)==0){line+=len; b ase=dev->num;b r e a k ; } d e v + + ; } w hi l e ( de v - > n am e ) ; } re t urn t o _ k dev _ t ( b a se+ s i m p l e _ st r t o u l ( l i n e , N U L L, b a s e ? 1 0 : 1 6 ) ); } s t a t i c v o i d__ i n i t r o o t_d e v _ s e t u p( c h a r*l i n e , i n t * n u m ) { R O O T _ D EV = n a m e _ t o _ k d e v _t ( l i n e ) ; }/ * * L i s t o fkernelcommandlineparameters.Thefirsttablelistsparameters*whi c haresubjecttova l u e s p a r s i n g ( l e a d i n g n u m b e r s a r e c o n v e r te d t o *an a r r a y of i n t s a n d c h o pp e d o f f t h e s t r i n g ) ,t h e s e c on dt ab le c ont a i n s* t h e fe w e x c e p t i o n s w h i c h obey t h e i r o w n s y n t a xr u le s . * / st r u c t k e rn e l _p a r a m{ c o nst c h a r * s t r ;void(*setup_func)(char*,int*);};staticstructkernel_paramco o ked_params[]__ini t d a t a = { / * F I X M E : m a k e PN P j u s tb e c o m e r e s e rv e_ s e t u p * / # i f n d e f C O N F I G _ K E R NE L _ P N P _ RES O U RC E { "re s erv e= " , r e se r v e_s et u p } , #e l s e {" r e s e r v e = " , pn p _ r e s e r v e _ s e t u p } , # end i f { " p r o f i l e = " , p r o f i l e _ s et up } , # i f d e f__SMP__{"nosmp",smp_setup},{"maxcpus=",smp_setup},#ifdef C ONFIG_X86_IO_APIC{ " n o a p i c" , i o a p i c_ s e tu p } , { " p i r q = ", i o a p i c _ p i r q _ se tu p } , # e n d i f # e n d i f# ifd e f C O N F IG _ B L K _ D EV_ RAM{ "r am d is k_ s ta r t = " , r a m d i s k _ s t a r t _ s e t u p}, {" l o a d _ ra m d i s k = " , l o a d _ ra m d i s k } , { "p ro mp t _ r a m dis k= " , p r o m p t _ramdisk},{"ramdisk=",ramdisk_size},{"ramdisk_size=",ra mdisk_size},#ifdefC O N F I G _ B L K _ D E V _ IN I T R D{ " n o i n i t r d " ,no _ i n i t rd } , # en d i f # e n d i f# i f d e f C O N F I G_ F B{ " v id e o = " , v ide o_set up }, # en d i f { " p an i c = " , p a n i c _ s e t u p } , { " co n s o l e =" , c o n s o l e _ s e t u p } , # i f d efC ON F I G _ V G A _ C ON SOLE { " n o - s c r o l l",no_scroll},#endif#ifdefCONFIG_MDA_CONSOLE{"mdacon = " ,mdacon_setup},#endi f # i f d e f C O N F I G _ V T{ " k b d - r ese t " , k b d_ res e t_ s e t up } ,#e nd i f # i f d e f C O N F I G _ BU G i 3 8 6 { " n o -hl t",n o_halt }, { "no3 8 7 " , n o _ 3 8 7} ,{" r e b oo t= ",r e bo o t _ s e t u p } , # e n dif # i f d e f C ON F I G _ I N E T { " e t h e r=" , e t h _ se t up }, # e n d i f # ifdefCONFIG_ARCNET_COM20020{"com20020=",com20020_s e tup},#endif#ifdefCONFI G _ A R C N E T _ RI M _ I { " ar c r i m i = " , a rcr i m i_ s e t u p } , # e n d i f # ifd e fCO N F I G _A R C N E T _ C O M 9 0x x I O {" com9 0io=",c o m 9 0io _ s e tup } ,# e n d i f # i f d e f C O N F I G _ A R C N E T _ C O M90 x x { " c o m 9 0x x = " , co m 9 0 x x _ set u p } , # e n d i f # if def CO N F I G _ D E C N E T{"decnet=",decnet_setup},#endif#ifdefCONFIG _ P RINTER{"lp=",lp_setup},# e n d i f # i f de f C O NF I G _ J O Y _ AMI G A { " j s _ a m = " , js_ a m _ s e t u p } , # e nd if# if d e f C O N F I G _ J O Y _ A N A LOG{ "js_an=", j s _ a n_ se t u p } ,#en d i f # i f d e f CO N F I G _ J O Y _ A S S A S I N { " j s _a s= ", j s _ a s _ s e t up } , # e n d i f # i f d e f C O N FI G_ J O Y_ C O N S O L E {" j s_console=",js_console_setup},{"js_consol e 2 =",js_console_setup},{"js_ c o n s o l e 3 = " , j s _ c o n s o le _ s e t u p } , # en d i f # i f de f CO N F I G _ JOY _ D B 9 { " j s _ d b 9 = " , js _ d b 9 _ s e tup },{"js_db9_ 2 = " , j s _ d b 9 _ setup },{ "j s _ d b 9 _ 3 = " , j s _ d b 9 _ s e t u p } , # e n d i f #if d e fC ON F I G _ J O Y_ T U RB OGR A F X{ "j s _ t g =" , j s _ t g _ s e t up } , {"js_tg_2=",js_tg_setup},{"js_tg_3= " , j s_tg_setup},#endif#ifdefCONFI G _ S C S I { " ma x _s cs i _ l u n s=" ,s c s i _ l u n s _ s e t u p } , { " s c s i _ l o g g i n g= " , s cs i _ l o g g i n g_se tup} ,#endif#ifde f C O NFI G_J O Y_ L I G H T NI N G{ " js _l4 = " ,j s _ l 4_ s e t u p } , # e n d i f# i f d e f C O N F I G _ S C S I _ A DV A N S Y S { " a d v an s ys =" , a d v a n s y s _set u p },#endif#ifdefined(CONFIG_ B L K _ D EV_HD){"hd=",hd_setup},#endif#ifd e f C O N F I G _ C H R _ D E V _ S T { " s t = " , s t _ s e t u p}, # e n d if # i f d efC O N F IG _ B U S M O U S E {" b m o u s e=" ,bm ouse_setup},#e ndif # i fd e f C ON F IG _M S_ B U S MO U S E { " m s m ou se = " , m s m o u s e _ s etu p } ,# e n d i f # i f d e fC O N F I G_ S C S I _ S E A G A TE {" st 0 x = " , s t 0 x_setu p } ,{"tmc8xx=",tmc8x x _ s e tup},#endif#ifdefCONFIG_SCSI_T128{"t128= " , t 1 2 8 _ s e t u p } , #e n d i f #if d e f C O N F I G _ S C S I _ P A S 1 6 {" p a s 1 6 = " , p a s1 6 _ s e t u p } , # end i f #i fdefCONFIG_SCSI_ G E NER I C _ N CR 5 380{" n c r 5 3 8 0 =" ,ge n e r ic _ N C R 5 3 8 0 _s e t u p }, { " n c r 5 3 c 4 0 0= " ,g e ne r ic _ N C R 5 3C 40 0_ s e tu p } , { " n c r 5 3 c 4 00a=",gene r i c _ N C R5 3 C 4 0 0A_setup},{"dtc3181e=",generic_DTC3181E_setup}, # e n d i f # i f d e f CO N F I G _ S C S I _ A HA 1 5 2 X { "a h a 1 5 2x = " , a h a152 x_ se t u p} , #e n d i f # i fde fCO NFIG_SCSI_AHA1542{ "a h a 1 54 2 = ", ah a 1 5 42_se t u p } , # en di f# i f d e f C O N F I G _ S C SI _ G DTH { "gdt h = " , g dt h _ s e t u p } ,# e n d i f # i f d ef C O N F I G _ S C S I _AIC7XXX{"aic7xxx=",aic7xxx_setup},#endif#ifdefCONFIG_SCSI_BUSLOGIC{" B u s L o g i c = " , B u s Lo g i c_Set u p } , #en d i f # i f d e f C O NF I G _ S C S I _ NC R 5 3 C8 X X { " n c r53c8x x=",ncr53c8xx_setup} ,#e n d i f# i f d e fCON F IG_SC S I _ E A T A { " e a t a = " ,e a t a 2 x _ s e t u p } , # e nd i f # i f d e fC O N F I G _ S CS I _ U 1 4 _ 3 4 F { " u1 4 - 3 4 f = " , u 1 4 _34f_setup},#endif#ifdefCONFIG_SCSI_AM53C974{"AM53C974=",AM53C974_set u p } , # e n d i f # i f d e f CO NF I G _ S C S I _ N C R 5 3 C 4 06 A{ " n c r 5 3c 4 0 6a =", N C R5 3c 4 0 6a _s e t up},#endif#ifdefCONFIG_ S C S I _ F U TU R E _ D OM AIN{ " f dom a i n =" ,f d o ma i n _ s et u p } , # e nd i f#i f def C O N F IG _ SC SI _I N 2 000 { " i n2 0 0 0 = ", i n 2 0 0 0 _ s e t u p },#endif#ifdefCONFIG_SCSI_7000FASST{"wd7000=",wd7000_setup},#endif#if d e f C O N F I G _ S C S I_ I B M M C A{ " i b m mca s c s i = " , i b m m c a _ s c si_set up } ,# e nd i f#i f d e fined(CONFIG_SCSI_DC390T )& & ! d e f i n e d ( C ONFI G _ S C S I _ DC39 0 T _ N O G ENS U P P ){"t mscs i m = ", d c3 90_ s et u p } , # e n d i f#i f d e f CON F I G _ B L K _ D EV _ X D { " x d =",xd_setup},{"xd_geo=",xd_manual_geo_init},#endif#ifdefined(CONFIG_ B L K _ D E V _ F D ) | | d e fi n e d (C O N F I G _ A M I G A _FL O P P Y ) | | d ef ined(CON F I G _A T A R I_ FLOPPY){"floppy=",floppy_s e tup } , #e n d i f# i f d e f C O N F I G_B L K_D E V_PS2 { " e da= " , e d _s e t up } , { "ed b = " , e d _ s e t u p}, { " tp 7 2 0 = " , t p 7 20 _ s e t u p } , # e n d if#ifdefCONFIG_CDU31A{"cdu31a=",cdu31a_setup},#endifCONFIG_CDU31A#if d e f C O N F I G _ M C D { "m c d =" , m c d _s e t u p } , # e n d i fC O NFI G_M C D #i fd e f C O N F I G _ M CDX{"mcdx=",mcdx_setup},#end i f C ON F I G _M C D X # i f d e f C O N FI G _ S B PCD{ " s b p cd=" , sbp c d _s e t up } , # en d i f CO N F I G _ S BP C D # i f d e fC O N F I G _A Z T C D { " a z t c d = " ,aztcd_setup},#endifCONFIG_AZTCD#ifdefCONFIG_CDU535{"sonycd535=",son y c d 5 3 5 _ s e t u p } , # e nd i f C O NF I G _ C DU 5 3 5 # i fd e fCO N F I G _ G S C D {" g sc d = " , g s cd_setup},#endifCONFIG_GSCD#i fd e f C O N FI G _ C M 2 0 6 { " c m2 06= " , c m 2 0 6 _ s e tu p }, # e ndi fC O NF I G _ C M 2 0 6 # i f d e f C O N F I G _O P T CD {"opt c d = " , o p t c d _ se t u p } , # endifCONFIG_OPTCD#ifdefCONFIG_SJCD{"sjcd=",sjcd_setup},#endifCONFIG_ S J C D # i f d e f C O N F I G _ IS P 16 _ C D I{ " i s p 1 6 =" , i s p 1 6 _ se t u p }, # en d if C O N F I G_ISP16_CDI#ifdefCONFIG_SOUND_ OSS { " s o u n d = ", s o u nd_ se t u p} ,#e n d if # i f def C O N F I G _ ISDN _ D R V _ IC N{" i c n = " , i c n _ s e t u p} ,# en d i f # if d e f C ON F I G _ I S D N _DRV_HISAX{"hisax=",HiSax_setup},{"HiSax=",HiSax_setup},#endif#ifdef C O N F I G _ I S D N _ D R V _ P C BI T { " p cbi t = ", p cb i t_s e t u p } , # e nd if # i f d e f C O NFIG_ATARIMOUSE{"atamouse=",atar i_mo u s e _ s e t u p }, # e n d if #ifd e f CO NFIG _ DMA S O UN D { " dmas o u n d= " , d ma s o u n d_ s et u p }, #en di f # if d e f C O N FI G _ AT A R I _ S C S I{"atascsi=",atari_scsi_se t up},#endif#ifdefCONFIG_STRAM_SWAP{"stram_ s w a p = " , s t r a m _ s w a p _s e tup} , #endif # i fde f i ned( C O NF I G_A 4 0 0 0 T _ S CSI)||defined(CONFIG_WARPENGINE_S CSI)\|| d e f i n e d ( C O N F I G _A4 0 9 1 _ S C S I ) | |d e fi n e d (C O NF I G _ MV M E1 6 x _S CS I ) \ | | d ef i n ed( C O NF IG_ BV M E 60 0 0 _ S C S I ) { " 5 3 c7xx=",ncr53c7xx_setup},#endif#ifdefined(CONFIG_A3000_SCSI)||defined ( C O N F I G _ A 2 0 9 1 _ S C S I ) \ | | de f i n e d (CON FI G_G VP 1 1 _ SC S I ) { " wd 3 3 c 93=",wd33c93_setup},#endif#ifdefine d(CONFIG_G V P 1 1 _ S C S I ) { " g v p 11= ",g v p 1 1 _s e t up } , #e n d i f #if d ef C O NF IG _ M A C_S C S I { " mac5 380= " , m a c_ s c si _ s e t u p } ,# endif#ifdefCONFIG_CYCLADES{"cyclades=",cy_setup},#endif#ifdefCONFIG_ D I G I { " d i gi = " , p c x x _ s e t u p} , # e n d i f #ifd e fCON F I G _D I G I EP C A { " digiepca=",epca_setup},#endif#ifdefC ONFIG_RISCOM8{ " ris c o m8 = " , r i sc o m 8 _ setu p } , # e n d i f # i f de f CON FI G _ DM AS C C { " d m a s c c = ",d m a s cc _se t u p} , # e n d i f # i f defCONFIG_SPECIALIX{"specialix=",specialix_setup},#endif#ifdefCONFIG _ B A Y C O M _ PA R {" b ay c om _ p ar = " , bayco m_ par _s et u p } , # e n d i f # i f defCONFIG_BAYCOM_SER_FDX{"baycom_ser_ fdx=",baycom_ser_fd x _ s e t u p } , # e n d i f #if d e f C O N FIG _ B A Y CO M _ S ER _H DX { "bay c o m _ s e r_h dx= ", b a y c o m _ s er _ h d x _ s e t u p},#endif#ifdefCONFIG_SOUNDMODEM{"soundmodem=",sm_setup},#endif#ifde f C O N F I G _ W D T{ " w d t = " , wd t _ s et u p } ,# e nd if #i f d e f C O N F I G _ P A R PORT{"parport=",parport_setup},#endif# ifdefCONFIG_PLIP{"plip= ", pl ip _ s e t u p },# e n d if#if d e f CON FIG _H F MO D EM{" h f m o dem=" , h fm od em _ se t u p} , # e n d i f # i fdefCONFIG_FTAPE{"ftape=",ftape_setup},#endif#ifdefCONFIG_MD_BOOT{"md = " , m d _ s e t u p } ,# e nd i f# i f de f C O N F I G _ A D B M O U SE { " a d b _ b u t t ons=",adb_mouse_setup},#endif#ifdefCONFI G_LTPC{"ltpc=",ltpc_setup} , #e n d i f{0 ,0 } } ; s t a ti c s t ruct k e rn e l_ par a m r a w _ p a r ams [ ]_ _ in i t da t a ={ { " r o o t = " , r oot_dev_setup},#i fdefCONFIG_ROOT_NFS{"nfsroot=",nfs_root_setup },{"nfs a d d r s = " , i p _ a u t o_ c on f ig _ s e t u p } , #e n d if # if d e f C O N F I G _IP_PNP{"ip=",ip_auto_config_setup},#endif #ifdefCONFIG_PCI{"pci=",pci_se t up } , # end i f#if d ef C O NF I G_P ARID E_P D {"p d . " ,pd_ s e t u p} , #e n d i f # i f d e f C O N F I G_PARIDE_P CD{"pcd.",pcd_setup},#endif#ifdefCONFIG_PARIDE_PF{"pf.",pf_ se t u p } , # e n d i f #i f de f C O N F IG _ P A R I D E _ PT { "p t . ", p t _ s e t up},#endif#ifdefCONFIG_PARIDE_PG{"pg.",pg_s etup},#endif#ifdefCONFIG_APM{"apm = " , a p m _ s e t up},# e n d i f { 0 , 0 } } ; #if defCO N F I G_ B LK_ D EV_ R A Ms t a t i c v o i d _ _ i nitr amdisk_start_setup(char*str,int*ints){if(ints[0]>0&&ints[1]>=0)rd_i m a g e _ s t a r t = in ts [ 1] ; } st a t i c v o i d _ _ i ni t loa d _ r a m d isk(char*str,int*ints){if(ints[0]>0&&ints[1] >=0)rd_doload=ints[1]&1;}staticvoid_ _ i n i t p ro m pt _ r amd is k ( c h a r*st r , in t *in t s ) { if ( i n t s [ 0 ] > 0 & & i n t s [ 1 ] > =0) rd_prompt=ints[1]&1;}staticvoid__initramdisk_size(char*str,int*ints) { i f ( i n t s [ 0 ]>0 & &i n t s[ 1 ] >= 0 )r d _s i ze = i nt s [ 1 ] ; } # endifstaticint__initchecksetup(char*line){int i,ints[11];#ifdefCONFIG_BLK_DEV_IDE/*ided r ive r n e e d s t h e ba si c st r i ng,r a t h er t h a n pr e -pr oc e s s e d v a l u e s * /if (!strncmp(line,"ide",3)||(!strncmp(line,"hd",2)&&line[2]!='=')){ide_s e t u p ( l i n e ) ; r et u rn 1 ; } #e n d i f f o r ( i= 0 ;r a w _ p a r a m s[i].str;i++){intn=strlen(raw_params[i].str);i f(!strncmp(line,raw_params[i].str,n)){raw_par am s [ i ]. s e t u p _fu n c ( l i n e +n , NU LL); retu r n1 ;} } f or ( i = 0 ; c ooked_params[i].str;i++){intn=strlen(cooked_params[i].str);if(!strncmp(li n e , c o o k e d _ p a r a m s [ i]. s t r , n ) ) { c o o k e d _ p a r a m s [ i].setup_func(get_options(line+n,ints),ints);re turn1;}}return0;}/*thisshouldbeapprox2Bo*oMipstost a r t( n o t ei niti al s h if t ) , a ndwi ll s t i l l w o r k e v e n i f initiallytoolarge,itwilljusttakeslightlylonger*/unsignedlongloops_per_sec=( 1 < < 1 2 ) ; / * T h i s i s t h e nu m be r of b it s o f p r e c i s i o nfortheloops_per_second.Eachbittakesonaverage1.5 /HZseconds.This(liketheoriginal)isalittlebetterthan1% * / # d e f i n e L PS _ PRE C 8 vo id__ i n i tc a l i br a t e _ d e lay(void){unsignedlongticks,loopbit;intlps_precision=LPS_PREC;loops_per_sec= ( 1 << 1 2 ) ; p r i n t k ( " C a l i b r a t i n g d e l a y l o o p . . . ");while(loops_per_sec<<=1){/*waitfor"startof"clo cktick*/ticks=jiffies;while(ticks==jiffies)/*nothing*/;/ * G o . . * /tick s =jiffie s ; __ d e l a y ( l o o p s _ p er_sec);ticks=jiffies-ticks;if(ticks)break;}/*Doabinaryapproximationtogetloops _ p e r _ s e c o n d s e t t oe q ual o necl o c k ( u p t ol p s _precisionbits)*/loops_per_sec>>=1;loopbit=loops_p er_sec;while(lps_precision--&&(loopbit>>=1)){loops_per_sec | = l oo p b i t ; t i cks=ji ff i e s ; wh i l e ( t i c ks==jiffies);ticks=jiffies;__delay(loops_per_sec);if(jiffies!=ticks)/*longerthan 1 t i c k * / l o o p s _ p e r _ se c & = ~l o o p b i t ; } /* f inally,adjustloopspersecondintermsofsecondsinsteado fclocks*/loops_per_sec*=HZ;/*Roundthevalueandprintit*/printk ( " %l u . % 02 l uBo g oM I P S \ n ", ( l o o p s _ per_sec+2500)/500000,((loops_per_sec+2500)/5000)%100);}/**Thisisasimplekernelcomma n d l i ne p a r s i n g f u n c t i o n : i t p a r s e s* t h ecommandline,andfillsinthearguments/environmenttoini t*asappropriate.Anycmd-lineoptionistakentobeanenvironment*varia b l e i f i t c o n t a i n s t h e c h a r a c t e r'='.**Thisroutinealsochecksforoptionsmeantforthekernel.*Theseoptionsarenotgiventoin i t -th e y a r e f o r i n t e r n a l k e r n e l u s e only.*/staticvoid__initparse_options(char*line){char*n ext;intargs,envs;if(!*line)return;args=0;envs=1;/*TERMissetto'lin u x 'b y d efau l t * / n e x t = l i n e;while((line=next)!=NULL){if((next=strchr(line,''))!=NULL)*next++=0;/**checkforkernelop t i o ns f i r s t . . */ i f ( ! s t r c m p ( l ine,"ro")){root_mountflags|=MS_RDONLY;continue;}if(!strc mp(line,"rw")){root_mountflags&=~MS_RDONLY;continue;}if(!strcmp(line , "d e b u g " )) { con s o l e_loglevel=10;continue;}if(!strncmp(line,"init=",5)){line+=5;execute_command=line;/*IncaseLI L O is g o i n g t o b o o t u s w i t hd efaultcommandline,*itprepends"auto"beforethewholecmdlinewh ichmakes*theshellthinkitshouldexecuteascriptwithsuchname.*Soweignorealla r g u m e n t s e n tered_before_init=...[MJ]*/args=0;continue;}if(checksetup(line))continue;/**Thencheckifit'sanenvir o n m e n t v a r i a b l e o r*anoption.*/if(strchr(line,'=')){if(envs>=MAX_INIT_ENVS)brea >