A kind of method that customizes linux operating system
Technical field
The present invention relates to the Computer Applied Technology field, relate in particular to the method for customizing of the operating system linux that increases income.
Background technology
Along with the continuous development of computer technology and the progressively expansion of its application, computer operating system has been goed deep into people's life among quietly.As the digital media advertisement player of the information display system of black or white board for writing temporary accounts or records on information issuing system, subway and the public transport of vehicle-mounted computer, the terminal information announce system of Airport information distribution platform, the CATV (cable television) popularized day by day in the automobile industry supporting set-top box, hotel and office building, advertising sector, have the mobile phone of operating system etc.They are all based on certain operating system, and special application program is finished specific actual functional capability in the loading.To these various information equipments that continue to bring out out, if adopt unified operating system obviously can't satisfy the business demand of different industries.Therefore need customize out different operating system according to the customer demand and the objective condition environment of reality.
The customization of operating system is as in the automobile production workshop, the vehicle that same production line can the customized production different model.Industry member has realized producing customization, even and computer operating system is not finished.Customize the paces of making in order to satisfy the ever-increasing demand in market and to accelerate, so become more and more important at the research of linux system custom technology.
Current, a lot of Linux manufacturers all start with from the Linux desktop operating system, system are customized and load relevant application program finish the specific function that the user needs.But this kind method all is to rely on employee's working experience in the past manually to carry out customization work usually.The specific implementation process of this kind method is added the application program that the client needs on the basis that fully understands user's request and systemic-function is understood to desktop operating system, verifies its workability.Afterwards desktop system is carried out cutting, this process mainly comprises the uncorrelated or obsolete software package of goal systems (the rpm bag of unloading, deb bag etc.), delete the file (library file that goal systems can not be used, shared file), the deletion can not use character library, by the compiling kernel delete unwanted driver and unwanted modular program, thereby reduce the size of total system.As seen, this process is complicated and consuming time.In the process of cutting customization work, the cutting personnel will guarantee that client's application program finally can normally move, otherwise cutting is exactly unsuccessful.This has proposed very high requirement to the cutting personnel.The (SuSE) Linux OS its functional (functionality) of this kind method customization, reliability (reliability), availability (usability), maintainable (maintainability) can not satisfy the production requirement of the many kinds of enterprise (variety), high-level efficiency (efficient), extensive (large-scale).So be necessary very much to propose a kind of reliably, easily and fast, the operating system customization instrument that can quantize to produce.
The product that present overseas utilization linux system customizes out is varied, as the customization of various top box of digital machines.In addition, enterprises such as Nokia, Samsung, Motorola and LG also customize out many moneys and use mobile phone of (SuSE) Linux OS or the like.And the Linux industry more is to use the system customization of carrying out based on the Linux desktop operating system, this is because desktop operating system is not only supported Web browser, multimedia player, image processing software instrument etc., its security simultaneously, reliability, customizability are more satisfactory, cheap more many than server on exploitation customization cost simultaneously.So, be reasonable as custom-built system with the Linux desktop operating system.
Take a broad view the home market, the spread all over the country lottery ticket sales machine of various places of the Linux desktop operating system of RedFlag customization; In soft Linux in the application of succeeding of the industrial computer bed system of industry member; The Linux black or white board for writing temporary accounts or records on system towards hotel/office building of acceptance of the bid software also carries out customized development on Linux desktop system basis.More than the explanation of these successful product cases, Linux is not only feasible as the operating system that customizes, and meet market trend.
With regard to domestic Linux manufacturer, the universal method of employing is to carry out manual linux system customization at present.The notion of " craft " is meant already installed Linux desktop operating system is customized, actual demand unwanted software bag is rejected from total system.With NeoShine Desktop 5.0 operating systems is example, has comprised 4674 software packages in the whole erection CD, that is to say that the installation of this cover system need be installed 4674 software packages, and wherein a big chunk software package goal systems can not used.So submit in order to reduce system, the obsolete software package of those goal systems need be deleted.
Suppose a skilled employee, judging whether software package of cutting and carrying out the time that deletion action spent is 2 minutes, comprising concrete manual deletion action (rpm erpmName.rpm), be cropped to 900 bags required cost 3674 * 2=7843 minute from 4674 bags so.More it is disturbing the spended time that this still draws under situation the about time of test not being taken into account.If 30 software packages of every deletion carry out the system testing of Integratively, each test spends 10 minutes (comprising start-up system, part System Functional Test etc.), and the time that is spent is 3674/30 * 10=1225 minute so.As seen the customization of carrying out like this, its efficient are very low.Regrettably, present domestic Linux manufacturer adopts the method for this kind poor efficiency to carry out the customization work of system.
In addition, on the basis that set customizes to software package, the volume amount of the file system of the linux system after the installation is excessive, and often a file system has just occupied good hundreds of million even more storage space.The catalogue that exists under file system has/boot ,/etc ,/media ,/mnt ,/bin ,/sbin ,/proc ,/usr ,/lib, subdirectory structure such as/dev.And being goal systems, a lot of files that comprised in these catalogues can not use.In traditional customization mode, the system customization personnel can rule of thumb customize file system, promptly delete the file that goal systems can not be used.In conjunction with the Linux file system structure of figure below, system works personnel carry out the cutting customization to file system.
Summary of the invention
Related linux operating system method for customizing and system among the present invention solved the problems of above-mentioned manual customization (SuSE) Linux OS, and it has comprised the implication of two aspects:
At first, this device generates the custom-built system file automatically according to user's configuration, and this document is an ISO9660 file system format file.
Secondly, in the burned storage medium of file energy that this system generated, and can be as the applicable operating system true(-)running.
A kind of method that customizes linux operating system provided by the invention comprises that the following step poly-:
1) resolves software package in the origin system software storage, software package in the origin system software storage is classified, make things convenient for the user to choose software package; And provide user configuration information to select for the user.
2) software package of selecting according to the user generates the custom-built system software storage; And the dependence of analysis software parlor, system is relied on and the software package of customization adds in the middle of the custom-built system.
3) generate making LiveCD, InstallCD and the required configuration file of LiveUSB according to user configuration information.
4) based on the principle of work of LiveCD, InstallCD and LiveUSB, compiling makes up and generates corresponding custom-built system file, with the burned storage medium of this custom-built system file or offer user's download.
Wherein, in described step 1), the main method of resolving software packet header that adopts, grouping information in the software packet header is extracted, the text that comprises similar file path in the grouping information, as " application program/the Internet ", with first "/" character string before as first order group name, first "/" character string afterwards is as second level group name, by that analogy.Also from software packet header, take out the associated description information of software package simultaneously, classification results and associated description information are mapped in the database, for the enquiry module inquiry.Finally, these information are presented to the user in brief mode, select, and user's selection result is saved as the xml formatted data for the user.Simultaneously, the user can customize information such as time zone, keyboard layout, user name.This step relates generally to software storage and makes up module and web-based management system.
Wherein, in described step 2) in, the software package of selecting according to the user at first, revise the software storage description document of the software storage description document of origin system, have the software package information that software package and user-selected software package relied on that the user selects earlier in the amended software storage description document simultaneously as custom-built system.Utilize amended software storage description document to generate the custom-built system software storage, this step relates generally to the software package warehouse and makes up module and user customized information analysis module.
Wherein, in described step 3), provide a kind of new pattern, can be before constructing system the part system information of custom-built system in advance.When detailed process is system's execution installation procedure, temporary file system of coming out of meeting carry by initrd.img file decompress(ion), and depositing the configuration file of system's installation process in this file system, therefore, when making up initrd.img, configuration file is wherein made amendment, can realize the injection of user configuration information.For LiveCD, mainly be to utilize the script authoring tool, user configuration information is used as parameter passes to LiveCD establishment instrument, when making up LiveCD, realize the injection of user configuration information.For LiveUSB, can utilize instrument directly to be converted to by the LiveCD compact disc image files, need not its special configuration file of regeneration.Mainly comprise the user in this step and originally put information analysis, the configuration-system module.
Wherein, in described step 4), comprised that mainly the ISO file makes up module, this module is responsible for the configuration file that produced according in the step 3), makes up principle according to the ISO image file and makes up the ISO compact disc image files.This document both can directly offer the user by the Http downloading mode, also can direct burned mobile memory medium in.
Description of drawings
Fig. 1 is architectural configurations of the present invention and call relation synoptic diagram thereof.
Fig. 2 is a fixing disc basic configuration file modification synoptic diagram.
Fig. 3 is a fabrication and installation compact disc image files principle schematic.
Embodiment
For making feature of the present invention and advantage obtain clearer understanding, below in conjunction with accompanying drawing, be described in detail below: as shown in Figure 1, system architecture structure of the present invention and call relation synoptic diagram thereof have been described, be divided into five parts, browser partly is mainly used to present user interface 124, and the user selects oneself to need the content of customization by user interface 124: building mode, the software package that needs, system configuration information etc.Server section mainly provides software package information database 123 and web administration system 122, wherein, software package information database 123 is to make up module 113 by software package warehouse in the constructing system to analyze that the software package header structure produces in the origin system software package warehouses 121, this data-base recording grouping and software package Setup Type etc. under software package name, the software package; The web-based management system is made up of some cgi programs, and its major function is to operate automatic generation user customized information file according to the user.Source operating system is the operating system that complete un-customized is crossed, software storage 121 and system's minimal set 120 mainly are provided, this minimal set is a LFS (Linux from scratch) system, and the module 113 in the constructing system can determine whether a software package should be forced to install according to this minimal set.Compiling constructing system part mainly makes up module 113 by the software package warehouse, user customized information analysis module 112, configuration-system module 111 and ISO file make up module 110, wherein, software storage module 113 is except function as previously mentioned, also will make up the software package warehouse of custom-built system according to the user customized information that web-based management system 122 produces, this module comprises some shell scripts and third party software bag storehouse management instrument, shell script can be according to the configuration file of the software package information correction software package storehouse management instrument in the user customized information, amended configuration file comprises software package that the user selects and the software package information that is relied on thereof, software package storehouse management instrument is created custom-built system software package warehouse automatically according to amended configuration file, simultaneously, dependence between the automatic processing software package of software package storehouse management instrument meeting, thereby the customization of realization software package; User customized information module 112 mainly makes up module 113 by the software package warehouse and configuration-system module 111 is called, and is used for resolving user customized information and generates software package making up the required configuration information of module 113; Configuration-system module 111 mainly is made of some small routines, and these small routines are responsible for call user-customized information analysis module 112 with acquisition user profile, and according to gained information correction CONFIG.SYS; The ISO file makes up the module utilization instrument mkisofs that increases income and makes up the iso9660 file.
With from origin system NeoShine5.0, customize support firefox browser and support that (SuSE) Linux OS (custom-built system) mounting disc of mysql database is that example illustrates concrete enforcement of the present invention below.
In order to customize out the (SuSE) Linux OS of support firfox browser execution and support mysql database, native system needs the necessary gui environment of selective system when customization.Select the Gnome graphical user interface in this example.
In order to ensure the normal operation of firefox, need to add basic network service function in the goal systems.Remove in addition, also need add some systems and move basic software bag in the necessary Base group.Concrete steps are as follows:
Step 1: the software package header is resolved, extracted to the software package that utilizes software storage to make up in 113 pairs of source operating system softwares of module warehouse, and the origin system software package is the RPM bag, comprised the affiliated grouping of software package in the header of this bag.By resolving, we divide set to be divided into seven big classes such as Other, Amusements, Applicatioon, Development, System Environment, UserInterface, Documentation software package.Call the information of minimal set 120 in the origin system, software package also is divided into forces to install and optional installation, forcing the installed software bag is that structure substantially can the requisite software package of operational system.The above these information is deposited in the software package information database 123.The user selects customization mode, software package, system's basic configuration by the user interface in the browser 124, and web-based management system 122 utilizes the JDOM technology to generate software package message file solf.xml and the basic configuration file conf.xml of system in server.Wherein, the java usability of program fragments of generation solft.xml is as follows:
Builder is the object of JDOM resolver SAXBuilder in the above-mentioned code, has encapsulated the method for operating to the xml file in this object, and out2xml () method writes the xml data of doc object representation among the file solf.xml.Above-mentioned code snippet major function is to add " software-package " information in the solf.xml file.
The soft.xml file layout is as follows:
Automatically the method that generates the conf.xml file is similar, and the conf.xml file layout is as follows:
Step 2: user customized information analysis module 112 utilizes the solf.xml in the server that step 1 produces, and the comps.xml file of origin system is made amendment.Main amending method is: at first resolve comps.xml, find the group of id among the comps.xml for " neoshine-packager ", to be present in then group ID in the comps.xml file that software package information among the solft.xml adds custom-built system for " neoshine-packager " and group in, modification process is finished by the java Automatic Program in the module user customized information analysis module 112, and usability of program fragments is as follows:
Builder in the above-mentioned code snippet is the object of JDOM resolver SAXBuilder, it calls the build method just can obtain the pairing analytic tree of xml formatted file, 1t is the software package name array that the file solft.xml of analyzing step one generation obtains, all group in the program pass comps.xml file, when the ID that runs into group is " neoshine-packager " time, all the software package names among the 1t are added among this group.Thereby obtain the comps.xml file of custom-built system, the part fragment is as follows:
Of the input of the comps.xml file of custom-built system as the instrument createrepo that increases income, just can generate the software package warehouse of custom-built system, detailed directions is as follows:
createrepo -g?comps.xml.
The method is exactly according to software package and the package informatin put down in writing in the comps.xml file, generates the software package warehouse catalogue repodata of custom-built system.This method can solve the dependence between software package automatically, and dependency information is recorded in the primary.xml file under the repodata catalogue, utilize the JDOM technology, by analyzing the primary.xml file, the software package that software package relied on that writes down in the comps.xml file is added in the custom-built system, and this process is finished by the java Automatic Program:
In the above-mentioned code, getPackageRequire () method is to utilize foregoing JDOM technology that the primary.xml file is resolved, and return the software software package that software package the relied on set of writing down in the comps.xml file, copy () method is duplicated these software packages and be installed to the custom-built system from origin system software package warehouse 121.
In the install software packet procedures, software package A depends on software package B, and software package B depends on software package A simultaneously.Adopt following method to solve this type of circulation dependence problem:
rpm-qa?A--nodeps
rpm-qa?B--nodeps
Step 3: the initrd.img file that utilizes 111 pairs of configuration-system modules to be replicated in origin system carries out decompress(ion), includes the anaconda catalogue behind the decompress(ion) under/usr/lib/ catalogue.Under/usr/lib/anaconda/ catalogue some * .py files are arranged, these files comprise: timezone.py, and network.py, firewall.py, language.py etc. are respectively applied for the time zone, network, configurations such as fire wall, language.Configuration-system module 111 is delivered to the information in the conf.xml file that is present in server that produces in the step 1 in the corresponding .py file as parameter, realizes the essential information customization of system.Detailed process as shown in Figure 2.And then amended file is packaged into the initrd.img file.
Step 4: utilize the ISO file to make up module 110 and make up the ISO file, Linux adopts the ext3 file system more at present, before installation kit, must create the ext3 file system earlier.Can use/sbin/turn2fs-j order finishes.After creating ram file system, create starter after initrd.img read in internal memory, Linux adopts the grub mode as starter more at present.In internal memory, unload ram file system, for next in internal memory under the catalogue such as compression/etc file vacate enough spaces.Carry out the operation of creating the ISO file afterwards.Detailed process as shown in Figure 3.The ISO form of current popular is ISO9660, and the method that generates this file employing is to use mkisofs (make iso file system) to finish:
mkisofs-b?isolinux/isolinux.bin-no-emul-boot-boot-load-size?4-boot-info-table-l-o/home/userA/user.iso-R-T/home/user
The ISO file makes up module 110 by carrying out above statement, and operation isolinux/isolinux.bin enters the startup leader, generates new boot files according to the boot-info-table specified message afterwards.Thereby come the designated sector block size to carry out system loads by boot-load-size.The software storage that produces according to step 2 generates user.iso installation image file, and this image file promptly is the NeoShine Desktop (SuSE) Linux OS of customization.Afterwards it is deposited in server end and provide interface to use this image file, perhaps it is sent into the burned mobile memory medium of programming system for user's download at browser end.The time of the general cost of building process is 30~40 minutes.Custom build system mode is in the past compared, and this kind mode has improved work efficiency greatly, has saved enterprise cost.
Above-described example has been done detailed explanation to the implementation of various piece of the present invention; but specific implementation form of the present invention is not limited thereto; for the those skilled in the art in present technique field, the various conspicuous change of under the situation of spirit that does not deviate from the method for the invention and claim scope it being carried out is all within protection scope of the present invention.