[Kernelloader-cvs] kernelloader/loader configuration.cpp, 1.5, 1.6 configuration.h, 1.3, 1.4 graphi
Run Linux on the Playstation 2
Brought to you by:
kloader
From: Mega M. <kl...@us...> - 2012-02-06 18:19:02
|
Update of /cvsroot/kernelloader/kernelloader/loader In directory vz-cvs-3.sog:/tmp/cvs-serv3627/loader Modified Files: configuration.cpp configuration.h graphic.cpp loader.c loadermenu.cpp loadermenu.h Log Message: - Devided kernel parameters into video parameters and other kernel parameters in menu. - Support video parameters for framebuffer driver of Linux 2.6 Index: loadermenu.h =================================================================== RCS file: /cvsroot/kernelloader/kernelloader/loader/loadermenu.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** loadermenu.h 27 Apr 2010 23:23:22 -0000 1.3 --- loadermenu.h 6 Feb 2012 18:18:59 -0000 1.4 *************** *** 13,16 **** --- 13,17 ---- #endif int setDefaultConfiguration(void *arg); + void configureVideoParameter(void); #ifdef __cplusplus } Index: loadermenu.cpp =================================================================== RCS file: /cvsroot/kernelloader/kernelloader/loader/loadermenu.cpp,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** loadermenu.cpp 18 Sep 2011 22:28:26 -0000 1.29 --- loadermenu.cpp 6 Feb 2012 18:18:59 -0000 1.30 *************** *** 43,46 **** --- 43,52 ---- } fsDirParam_t; + typedef struct { + const char *commandline; + char *text; + int size; + const char *param; + } kernel_param_t; static fsDirParam_t fsDirParam[MAX_ENTRIES]; *************** *** 276,291 **** /** Default Linux parameter for PAL mode. */ ! const char commandline_pal[] = "crtmode=pal xmode=PAL ramdisk_size=16384"; /** Default Linux parameter for NTSC mode. */ ! const char commandline_ntsc[] = "crtmode=ntsc xmode=NTSC ramdisk_size=16384"; /** Default Linux parameter for VGA mode. */ ! const char commandline_vga60[] = "crtmode=vesa0,60 xmode=VESA,1024x768x24 ramdisk_size=16384"; ! const char commandline_vga72[] = "crtmode=vesa0 xmode=VESA,1024x768x24 ramdisk_size=16384"; ! const char commandline_vga75[] = "crtmode=vesa0,75 xmode=VESA,1024x768x24 ramdisk_size=16384"; ! const char commandline_vga85[] = "crtmode=vesa0,75 xmode=VESA,1024x768x24 ramdisk_size=16384"; /** Default Linux parameter for HDTV mode. */ ! const char commandline_dtv[] = "crtmode=dtv0 xmode=dtv,480p ramdisk_size=16384"; char kernelParameter[MAX_INPUT_LEN]; char pcicType[MAX_INPUT_LEN]; --- 282,301 ---- /** Default Linux parameter for PAL mode. */ ! const char commandline_pal[] = "crtmode=pal xmode=PAL video=ps2fb:pal,640x480-32"; /** Default Linux parameter for NTSC mode. */ ! const char commandline_ntsc[] = "crtmode=ntsc xmode=NTSC video=ps2fb:ntsc,640x448-32"; /** Default Linux parameter for VGA mode. */ ! const char commandline_vga60[] = "crtmode=vesa0,60 xmode=VESA,1024x768x24 video=ps2fb:vesa,1024x768-32@60"; ! const char commandline_vga72[] = "crtmode=vesa0 xmode=VESA,1024x768x24 video=ps2fb:vesa,1024x768-32@72"; ! const char commandline_vga75[] = "crtmode=vesa0,75 xmode=VESA,1024x768x24 video=ps2fb:vesa,1024x768-32@75"; ! const char commandline_vga85[] = "crtmode=vesa0,75 xmode=VESA,1024x768x24 video=ps2fb:vesa,1024x768-32@85"; /** Default Linux parameter for HDTV mode. */ ! const char commandline_dtv[] = "crtmode=dtv0 xmode=dtv,480p video=ps2fb:dtv,720x480-32"; ! /** Default kernel parameter for ramdisk. */ ! const char commandline_ramdisk[] = "ramdisk_size=16384"; char kernelParameter[MAX_INPUT_LEN]; + char videoParameter[MAX_INPUT_LEN]; + char fullKernelParameter[sizeof(kernelParameter) + sizeof(videoParameter)]; char pcicType[MAX_INPUT_LEN]; *************** *** 297,300 **** --- 307,338 ---- static char dnsIP[MAX_INPUT_LEN]; + static kernel_param_t hda1Config = { + "root=/dev/hda1", + kernelParameter, + sizeof(kernelParameter), + NULL, + }; + + static kernel_param_t hda2Config = { + "root=/dev/hda2", + kernelParameter, + sizeof(kernelParameter), + NULL, + }; + + static kernel_param_t hda3Config = { + "root=/dev/hda2", + kernelParameter, + sizeof(kernelParameter), + NULL, + }; + + static kernel_param_t nfsConfig = { + "ip=dhcp root=/dev/nfs nfsroot=%s:/ps2root,tcp", + kernelParameter, + sizeof(kernelParameter), + gatewayIP, + }; + /** Parameter for IOP reset. */ static char s_pUDNL [] __attribute__( ( section( ".data" ), aligned( 1 ) ) ) = "rom0:UDNL rom0:EELOADCNF"; *************** *** 692,696 **** } ! void setDefaultKernelParameter(char *text) { switch(getCurrentMode()) { --- 730,734 ---- } ! void setDefaultVideoParameter(char *text) { switch(getCurrentMode()) { *************** *** 729,732 **** --- 767,782 ---- } + extern "C" { + void configureVideoParameter(void) + { + setDefaultVideoParameter(videoParameter); + } + } + + void setDefaultKernelParameter(char *text) + { + strcpy(text, commandline_ramdisk); + } + int setDefaultKernelParameterMenu(void *arg) { *************** *** 739,742 **** --- 789,812 ---- } + int setParameterMenu(void *arg) + { + kernel_param_t *param = (kernel_param_t *) arg; + + snprintf(param->text, param->size, param->commandline, param->param); + editString(param->text); + + return 0; + } + + int setDefaultVideoParameterMenu(void *arg) + { + char *text = (char *) arg; + + setDefaultVideoParameter(text); + editString(text); + + return 0; + } + #ifdef __cplusplus extern "C" { *************** *** 750,754 **** (void) arg; ! setDefaultKernelParameter(kernelParameter); strcpy(myIP, "192.168.0.10"); strcpy(netmask, "255.255.255.0"); --- 820,824 ---- (void) arg; ! setDefaultVideoParameter(videoParameter); strcpy(myIP, "192.168.0.10"); strcpy(netmask, "255.255.255.0"); *************** *** 860,865 **** --- 930,937 ---- setDefaultConfiguration(NULL); + setDefaultKernelParameter(kernelParameter); addConfigTextItem("KernelParameter", kernelParameter, MAX_INPUT_LEN); + addConfigTextItem("VideoParameter", videoParameter, MAX_INPUT_LEN); addConfigTextItem("ps2linkMyIP", myIP, MAX_INPUT_LEN); addConfigTextItem("ps2linkNetmask", netmask, MAX_INPUT_LEN); *************** *** 1066,1073 **** /* Config menu */ Menu *configMenu = menu->addSubMenu("Configuration Menu"); - configMenu->addItem(menu->getTitle(), setCurrentMenu, menu, getTexBack()); configMenu->addItem("Edit Kernel Parameter", editString, kernelParameter); ! configMenu->addItem("Default Kernel Parameter", setDefaultKernelParameterMenu, kernelParameter); configMenu->addItem("Edit PCIC Type", editString, pcicType); --- 1138,1150 ---- /* Config menu */ Menu *configMenu = menu->addSubMenu("Configuration Menu"); configMenu->addItem(menu->getTitle(), setCurrentMenu, menu, getTexBack()); configMenu->addItem("Edit Kernel Parameter", editString, kernelParameter); ! configMenu->addItem(" Set to initrd", setDefaultKernelParameterMenu, kernelParameter); ! configMenu->addItem(" Set to hda1", setParameterMenu, &hda1Config); ! configMenu->addItem(" Set to hda2", setParameterMenu, &hda2Config); ! configMenu->addItem(" Set to hda3", setParameterMenu, &hda3Config); ! configMenu->addItem(" Set to nfs", setParameterMenu, &nfsConfig); ! configMenu->addItem("Edit Video Parameter", editString, videoParameter); ! configMenu->addItem(" Set to current mode", setDefaultVideoParameterMenu, videoParameter); configMenu->addItem("Edit PCIC Type", editString, pcicType); *************** *** 1235,1239 **** char *getKernelParameter(void) { ! return kernelParameter; } --- 1312,1322 ---- char *getKernelParameter(void) { ! int n; ! strcpy(fullKernelParameter, kernelParameter); ! n = strlen(fullKernelParameter); ! fullKernelParameter[n] = ' '; ! n++; ! strcpy(&fullKernelParameter[n], videoParameter); ! return fullKernelParameter; } Index: graphic.cpp =================================================================== RCS file: /cvsroot/kernelloader/kernelloader/loader/graphic.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** graphic.cpp 27 Apr 2010 23:23:22 -0000 1.18 --- graphic.cpp 6 Feb 2012 18:18:59 -0000 1.19 *************** *** 585,589 **** --- 585,593 ---- int getCurrentMode(void) { + #if 0 return gsGlobal->Mode; + #else + return modeList[currentMode]; + #endif } *************** *** 596,600 **** int numberOfMenuItems; ! addConfigCheckItem("videomode", ¤tMode); gsGlobal = gsKit_init_global(); --- 600,604 ---- int numberOfMenuItems; ! addConfigVideoItem("videomode", ¤tMode); gsGlobal = gsKit_init_global(); Index: configuration.cpp =================================================================== RCS file: /cvsroot/kernelloader/kernelloader/loader/configuration.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** configuration.cpp 19 Dec 2011 23:30:14 -0000 1.5 --- configuration.cpp 6 Feb 2012 18:18:59 -0000 1.6 *************** *** 6,9 **** --- 6,10 ---- #include "fileXio_rpc.h" #include "rom.h" + #include "loadermenu.h" #define MAXIMUM_CONFIG_LENGTH 2048 *************** *** 11,15 **** typedef enum { CLASS_CONFIG_CHECK, ! CLASS_CONFIG_TEXT } configuration_class_type_t; --- 12,17 ---- typedef enum { CLASS_CONFIG_CHECK, ! CLASS_CONFIG_TEXT, ! CLASS_CONFIG_VIDEO, } configuration_class_type_t; *************** *** 36,42 **** public: ! ConfigurationCheckItem(const char *name, int *value):ConfigurationItem(name, CLASS_CONFIG_CHECK), value(value) { ! } int writeData(FILE * fd) { static char text[MAXIMUM_CONFIG_LENGTH]; int len; --- 38,45 ---- public: ! ConfigurationCheckItem(const char *name, int *value):ConfigurationItem(name, CLASS_CONFIG_CHECK), value(value) { ! } ! int writeData(FILE * fd) { static char text[MAXIMUM_CONFIG_LENGTH]; int len; *************** *** 53,56 **** --- 56,83 ---- }; + class ConfigurationVideoModeItem:ConfigurationItem { + protected: + int *value; + + public: + ConfigurationVideoModeItem(const char *name, + int *value):ConfigurationItem(name, CLASS_CONFIG_VIDEO), value(value) { + } + int writeData(FILE * fd) { + static char text[MAXIMUM_CONFIG_LENGTH]; + int len; + + //printf("write: %s=%d 0x%x\n", name, *value, value); + len = snprintf(text, MAXIMUM_CONFIG_LENGTH, "%s=%d\n", name, *value); + return fwrite(text, 1, len, fd); + } + + void readData(const char *buffer) { + //printf("read: %s=%s 0x%x\n", name, buffer, value); + *value = atoi(buffer); + configureVideoParameter(); + } + }; + class ConfigurationTextItem:ConfigurationItem { protected: *************** *** 120,123 **** --- 147,158 ---- } break; + case CLASS_CONFIG_VIDEO: + { + ConfigurationVideoModeItem *item; + + item = (ConfigurationVideoModeItem *) * i; + item->readData(val); + } + break; default: error_printf("Unsupported configuration type."); *************** *** 246,249 **** --- 281,292 ---- } break; + case CLASS_CONFIG_VIDEO: + { + ConfigurationVideoModeItem *item; + + item = (ConfigurationVideoModeItem *) * i; + item->writeData(fd); + } + break; default: error_printf("Unsupported configuration type."); *************** *** 274,277 **** --- 317,330 ---- } + void addConfigVideoItem(const char *name, int *value) + { + ConfigurationVideoModeItem *item; + + item = new ConfigurationVideoModeItem(name, value); + //printf("name %s value 0x%x\n", name, value); + + addConfigurationItem((ConfigurationItem *) item); + } + void addConfigTextItem(const char *name, char *value, int maxlen) { Index: configuration.h =================================================================== RCS file: /cvsroot/kernelloader/kernelloader/loader/configuration.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** configuration.h 14 Nov 2011 22:35:16 -0000 1.3 --- configuration.h 6 Feb 2012 18:18:59 -0000 1.4 *************** *** 23,26 **** --- 23,27 ---- void addConfigTextItem(const char *name, char *value, int maxlen); void addConfigCheckItem(const char *name, int *value); + void addConfigVideoItem(const char *name, int *value); #endif Index: loader.c =================================================================== RCS file: /cvsroot/kernelloader/kernelloader/loader/loader.c,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** loader.c 6 Jan 2012 23:59:46 -0000 1.39 --- loader.c 6 Feb 2012 18:18:59 -0000 1.40 *************** *** 1873,1877 **** struct ps2_bootinfo *bootinfo = (struct ps2_bootinfo *) PS2_BOOTINFO_OLDADDR; register int sp asm("sp"); ! static char commandline[MAX_INPUT_LEN] = ""; uint32_t *patch; uint32_t iopaddr; --- 1873,1877 ---- struct ps2_bootinfo *bootinfo = (struct ps2_bootinfo *) PS2_BOOTINFO_OLDADDR; register int sp asm("sp"); ! static char commandline[2 * MAX_INPUT_LEN] = ""; uint32_t *patch; uint32_t iopaddr; |