|By Nicholas Petreley||
|February 11, 2002 12:00 AM EST||
(LinuxWorld) -- If you're not familiar with the kernel patch and development process, here it is in a nutshell. People modify source files to fix bugs, add or remove features, or adapt to changes in the way the kernel handles certain tasks. They produce patch files by using a utility called diff. diff compares the old source file to the new one and produces a text file from the differences. You can then distribute this text file to others, who can use it to patch their source code with the utility called (what else?) patch.
Incidentally, the tradition for using patch to produce kernel patch files is to add the command line switches
-urN, which tells diff to use the unified output format (which is what everyone on the kernel development team uses), recurse through directories, and keep track of new files that appear in one branch but not another. The full command would be
Until recently, kernel developers submitted their patch files by including them within the body of an email message. Then they sent the message to one or more kernel maintainers and/or the kernel development mailing list. I'm not quite sure how the patch submission process will change now that Linus Torvalds and others are using the Bitkeeper Web-based source management system, but it looks like they'll still rely largely on the diff
Linus or one of the other kernel maintainers merge the various patches into the kernel source tree, make other changes, and then release a collection of patches in one large text file, which is compressed for faster downloads. If you want to apply the patches, you download the file and apply it to the correct version of the kernel source code.
I don't know how others do this, but I keep kernel versions in directories like /usr/src/linux-2.4.18-pre8 to identify the kernel version for that source tree. Then I download the latest patches to the /usr/src directory. For example, I downloaded the Michael Cohen patch file patch-2.4.18-pre8-mjc.bz2 and put it in /usr/src. If I wanted to apply the Michael Cohen patch as is, I would then change to the /usr/src/linux-2.4.18-pre8 directory and run the command:
# bzcat ../patch-2.4.18-pre8-mjc.bz2 | patch -p1 -E --dry-run
Don't type the pound sign (#) - it's the part of the prompt that usually tells you you're logged in as the root user.
-p1 switch tells patch to ignore the first level of directories in the patch file. This can be important, because the maintainers all seem to use their own conventions for the root directory for the kernel source tree, and that directory name gets included in the patch file. For example, if someone keeps the old kernel source in /usr/src/oldkernel and the modified source in
/usr/src/newkernel, then the patch file will contain the two directory names oldkernel and newkernel. If you use the switch
-p0, patch will expect to find the newkernel directory name on your system as part of the full path name (for example, newkernel/drivers/ide/ide-dma.c). If, like me, you named the top directory of the kernel tree something like linux-2.4.18-pre8, patch will fail. The
-p1 switch tells it to ignore that top level and go straight to drivers/ide/ide-dma.c.
-E switch tells patch to go ahead and delete any files that shouldn't exist after the patch. These are generally files that the maintainer moved to another location or deleted because they were no longer needed.
The --dry-run portion of the command tells patch to pretend to apply the patches without actually changing anything. I do this out of habit because it prevents me from making stupid mistakes like changing to the wrong kernel tree before applying the patch. If the patch process produces many error messages, I know I've probably done something wrong. If it looks like everything patched ok, then I run the command again, only for real. That "for real" command is just the same command without the --dry-run:
# bzcat ../patch-2.4.18-pre8-mjc.bz2 | patch -p1 -E
The challengeThe 2.5 branch is still in too transitory a state to tackle with any confidence, so I started with linux-2.4.18-pre8. I figured I'd better take it slow. I've led a rather sedentary lifestyle when it comes to examining the kernel source, so I didn't want to break into a sprint on the first go and risk a heart attack. In other words, I wanted to merge only a handful of changes, not 50 at a shot the way Linus and others do.
I noticed that Michael Cohen had released a large patch against 2.4.18-pre8 that included many interesting features. It merges the code to handle hardware health sensors (so you can view things like the fan speed on your motherboard). It also adds code to make the kernel preemptive. It has other performance enhancing modifications to the kernel and includes several fixes that weren't in the 2.4 branch at the time Cohen posted his patch, such as fixes to the Reiserfs file system.
Thibaut Laurent posted on the kernel development mailing list that there was a minor problem with the file timer.c in Cohen's patch. Thomas Hood pointed out that Cohen's updates to the plug-and-play BIOS code were out of date. Paul P Komkoff Jr posted a set of patches that adds new capabilities for IP net filtering. Finally, I like to add a line to drivers/acpi/hardware/hwsleep.c to force the kernel to shut off the machine. This is not a patch for general use. I only include it because the funky ACPI BIOS tables in ASUS motherboards keep me from being able to shut off my system with the halt command.
I figured it would be a good lesson in patch management if I could apply all of the above fixes and additions to Michael Cohen's patch and produce my own patch from the result.
I downloaded the latest PnP BIOS code for 2.4.18-pre8 by Thomas Hood and began the grunt work of replacing the PnP portions of Cohen's patch with the latest code. The job was tedious, but it was easy because both Cohen's patch and Hood's patch are applied against the same kernel version (2.4.18-pre8). So all I really had to do was find all the sections of Cohen's patch that corresponded to Hood's and make the swap. It was even easier to apply the net filter additions, timer.c fix, and my shutdown kludge.
The result is patch-2.4.18-pre8-np.gz, which you can find at the download section of www.varlinux.org. I'm using that kernel right now, but things are moving so quickly it will probably be well out of date by the time you read this. There's already a linux-2.4.18-pre9 available as I write this and pre9 includes some of the same fixes you'll find in my patch. (It lacks all the added features, however, such as the net filter code, preemptive kernel, etc.)
What's the big deal about merging patches? It was only easy for me because I chose to work with a stable branch of the kernel and patches that were supposed to be applied against the same kernel version.
I tackled the 2.5.4-pre3 kernel source just to see what the differences would be like if I used an unstable branch. I didn't even have to look for patches to apply. It wouldn't compile on my system as is. It broke on ide-dma.c, ide-scsi.c, sg.c, and in other places. I couldn't find any fixes for these problems so I started scanning the code to see if I could fix it myself.
That's when I realized what this kernel development process really needs -- an editor with an integrated cross-reference and source code analysis system.
Perhaps people like Linus Torvalds doesn't need such a program because he knows where every instance of a variable appears in the source tree (I doubt it, since so many of his patches lately leave many files with legacy variables and structures unpatched to work with updates to other parts of the kernel source tree). Alternatively, perhaps he and others have some neat command-line utilities that do the job. I'm not an emacs user, so for all I know emacs has these capabilities (I have no idea if Linus uses emacs anyway).
However, I would want something more powerful than a multi-file editor for a job like this. So I searched Freshmeat and found a few snazzy products that analyze source code, cross reference the source, and let you perform recursive updates in ways that help prevent disaster. Some run on Linux, so I plan to play with one or two.
I'll get back to you on them when I've had time to learn how well they work. In the meantime, unless you're a kernel guru, stay away from the 2.5 branch. Stick to the easy stuff, like I do. Your heart will thank you for it.
In his session at @ThingsExpo, Eric Lachapelle, CEO of the Professional Evaluation and Certification Board (PECB), will provide an overview of various initiatives to certifiy the security of connected devices and future trends in ensuring public trust of IoT. Eric Lachapelle is the Chief Executive Officer of the Professional Evaluation and Certification Board (PECB), an international certification body. His role is to help companies and individuals to achieve professional, accredited and worldw...
Mar. 29, 2017 08:45 AM EDT Reads: 877
In his General Session at 16th Cloud Expo, David Shacochis, host of The Hybrid IT Files podcast and Vice President at CenturyLink, investigated three key trends of the “gigabit economy" though the story of a Fortune 500 communications company in transformation. Narrating how multi-modal hybrid IT, service automation, and agile delivery all intersect, he will cover the role of storytelling and empathy in achieving strategic alignment between the enterprise and its information technology.
Mar. 29, 2017 08:00 AM EDT Reads: 7,411
Microservices are a very exciting architectural approach that many organizations are looking to as a way to accelerate innovation. Microservices promise to allow teams to move away from monolithic "ball of mud" systems, but the reality is that, in the vast majority of organizations, different projects and technologies will continue to be developed at different speeds. How to handle the dependencies between these disparate systems with different iteration cycles? Consider the "canoncial problem" ...
Mar. 29, 2017 06:00 AM EDT Reads: 9,040
The Internet of Things is clearly many things: data collection and analytics, wearables, Smart Grids and Smart Cities, the Industrial Internet, and more. Cool platforms like Arduino, Raspberry Pi, Intel's Galileo and Edison, and a diverse world of sensors are making the IoT a great toy box for developers in all these areas. In this Power Panel at @ThingsExpo, moderated by Conference Chair Roger Strukhoff, panelists discussed what things are the most important, which will have the most profound e...
Mar. 29, 2017 04:00 AM EDT Reads: 15,084
Keeping pace with advancements in software delivery processes and tooling is taxing even for the most proficient organizations. Point tools, platforms, open source and the increasing adoption of private and public cloud services requires strong engineering rigor - all in the face of developer demands to use the tools of choice. As Agile has settled in as a mainstream practice, now DevOps has emerged as the next wave to improve software delivery speed and output. To make DevOps work, organization...
Mar. 29, 2017 03:45 AM EDT Reads: 2,140
My team embarked on building a data lake for our sales and marketing data to better understand customer journeys. This required building a hybrid data pipeline to connect our cloud CRM with the new Hadoop Data Lake. One challenge is that IT was not in a position to provide support until we proved value and marketing did not have the experience, so we embarked on the journey ourselves within the product marketing team for our line of business within Progress. In his session at @BigDataExpo, Sum...
Mar. 29, 2017 03:30 AM EDT Reads: 3,224
Web Real-Time Communication APIs have quickly revolutionized what browsers are capable of. In addition to video and audio streams, we can now bi-directionally send arbitrary data over WebRTC's PeerConnection Data Channels. With the advent of Progressive Web Apps and new hardware APIs such as WebBluetooh and WebUSB, we can finally enable users to stitch together the Internet of Things directly from their browsers while communicating privately and securely in a decentralized way.
Mar. 29, 2017 03:00 AM EDT Reads: 6,077
DevOps is often described as a combination of technology and culture. Without both, DevOps isn't complete. However, applying the culture to outdated technology is a recipe for disaster; as response times grow and connections between teams are delayed by technology, the culture will die. A Nutanix Enterprise Cloud has many benefits that provide the needed base for a true DevOps paradigm.
Mar. 29, 2017 01:15 AM EDT Reads: 2,497
What sort of WebRTC based applications can we expect to see over the next year and beyond? One way to predict development trends is to see what sorts of applications startups are building. In his session at @ThingsExpo, Arin Sime, founder of WebRTC.ventures, will discuss the current and likely future trends in WebRTC application development based on real requests for custom applications from real customers, as well as other public sources of information,
Mar. 29, 2017 01:00 AM EDT Reads: 1,109
In his General Session at 17th Cloud Expo, Bruce Swann, Senior Product Marketing Manager for Adobe Campaign, explored the key ingredients of cross-channel marketing in a digital world. Learn how the Adobe Marketing Cloud can help marketers embrace opportunities for personalized, relevant and real-time customer engagement across offline (direct mail, point of sale, call center) and digital (email, website, SMS, mobile apps, social networks, connected objects).
Mar. 28, 2017 11:15 PM EDT Reads: 3,491
"My role is working with customers, helping them go through this digital transformation. I spend a lot of time talking to banks, big industries, manufacturers working through how they are integrating and transforming their IT platforms and moving them forward," explained William Morrish, General Manager Product Sales at Interoute, in this SYS-CON.tv interview at 18th Cloud Expo, held June 7-9, 2016, at the Javits Center in New York City, NY.
Mar. 28, 2017 09:30 PM EDT Reads: 3,871
With the introduction of IoT and Smart Living in every aspect of our lives, one question has become relevant: What are the security implications? To answer this, first we have to look and explore the security models of the technologies that IoT is founded upon. In his session at @ThingsExpo, Nevi Kaja, a Research Engineer at Ford Motor Company, will discuss some of the security challenges of the IoT infrastructure and relate how these aspects impact Smart Living. The material will be delivered i...
Mar. 28, 2017 09:30 PM EDT Reads: 2,243
SYS-CON Events announced today that Ocean9will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Ocean9 provides cloud services for Backup, Disaster Recovery (DRaaS) and instant Innovation, and redefines enterprise infrastructure with its cloud native subscription offerings for mission critical SAP workloads.
Mar. 28, 2017 08:15 PM EDT Reads: 2,365
Your homes and cars can be automated and self-serviced. Why can't your storage? From simply asking questions to analyze and troubleshoot your infrastructure, to provisioning storage with snapshots, recovery and replication, your wildest sci-fi dream has come true. In his session at @DevOpsSummit at 20th Cloud Expo, Dan Florea, Director of Product Management at Tintri, will provide a ChatOps demo where you can talk to your storage and manage it from anywhere, through Slack and similar services ...
Mar. 28, 2017 07:00 PM EDT Reads: 4,531
SYS-CON Events announced today that Auditwerx will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Auditwerx specializes in SOC 1, SOC 2, and SOC 3 attestation services throughout the U.S. and Canada. As a division of Carr, Riggs & Ingram (CRI), one of the top 20 largest CPA firms nationally, you can expect the resources, skills, and experience of a much larger firm combined with the accessibility and attent...
Mar. 28, 2017 06:15 PM EDT Reads: 514
SYS-CON Events announced today that Linux Academy, the foremost online Linux and cloud training platform and community, will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Linux Academy was founded on the belief that providing high-quality, in-depth training should be available at an affordable price. Industry leaders in quality training, provided services, and student certification passes, its goal is to c...
Mar. 28, 2017 03:45 PM EDT Reads: 4,214
SYS-CON Events announced today that SoftLayer, an IBM Company, has been named “Gold Sponsor” of SYS-CON's 18th Cloud Expo, which will take place on June 7-9, 2016, at the Javits Center in New York, New York. SoftLayer, an IBM Company, provides cloud infrastructure as a service from a growing number of data centers and network points of presence around the world. SoftLayer’s customers range from Web startups to global enterprises.
Mar. 28, 2017 03:00 PM EDT Reads: 2,162
"delaPlex is a software development company. We do team-based outsourcing development," explained Mark Rivers, COO and Co-founder of delaPlex Software, in this SYS-CON.tv interview at 18th Cloud Expo, held June 7-9, 2016, at the Javits Center in New York City, NY.
Mar. 28, 2017 03:00 PM EDT Reads: 9,720
SYS-CON Events announced today that CA Technologies has been named “Platinum Sponsor” of SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY, and the 21st International Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. CA Technologies helps customers succeed in a future where every business – from apparel to energy – is being rewritten by software. From ...
Mar. 28, 2017 02:15 PM EDT Reads: 2,237
SYS-CON Events announced today that Technologic Systems Inc., an embedded systems solutions company, will exhibit at SYS-CON's @ThingsExpo, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Technologic Systems is an embedded systems company with headquarters in Fountain Hills, Arizona. They have been in business for 32 years, helping more than 8,000 OEM customers and building over a hundred COTS products that have never been discontinued. Technologic Systems’ pr...
Mar. 28, 2017 02:15 PM EDT Reads: 3,747