How do I manually Update the Anaconda stage 1 image?

本文档详细介绍了如何为测试目的构建新的Anaconda stage1映像,包括设置开发环境、修补Anaconda的stage1组件、构建修补后的Anaconda、创建新的RAM磁盘以及制作包含新initrd.img的安装启动光盘。
部署运行你感兴趣的模型镜像

http://kbase.redhat.com/faq/docs/DOC-7273

Thanks to David Cantrell for writing this up.

WHAT IS THE STAGE 1 IMAGE?

The stage 1 image in anaconda confuses a lot of people. We've done a good job making stage 1 and stage 2 appear as a single entity, but they are really separate. The whole job of stage 1 is to load the necessary drivers to find anaconda (which we call the stage 2 image). Stage 2 could be located on a network source (NFS, HTTP, FTP), a local hard drive, or a CD-ROM drive. Stage 1 also takes care of configuring your network interface for installation if you indicate the stage 2 location is a network source.

When a bug is found in stage 1, patching it and testing it requires building a new ramdisk image to boot in to the installation environment. We cannot provide a mechanism like updates.img for several reasons. First, the stage 1 portion of anaconda is responsible for loading updates.img after it loads. Second, the stage 1 portion is basically one static program called /sbin/loader, so the only way to test it is to build a new one.

This document explains one of several ways to build a new stage 1 image for testing purposes. The example platform is Red Hat Enterprise Linux 5, but the techniques apply to Fedora Core 6 and higher.

SETTING UP YOUR DEVELOPMENT SYSTEM

I will assume you are building a new ramdisk image for the same architecture as your workstation. If you are not, you will need to explore other means of building the anaconda SRPM. You must build on the target architecture.

First, set up RPM to build locally:
      mkdir -p ~/rpmbuild/RPMS
      mkdir -p ~/rpmbuild/SRPMS
      mkdir -p ~/rpmbuild/SOURCES
      mkdir -p ~/rpmbuild/BUILD
      mkdir -p ~/rpmbuild/SPECS
      echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros

Next, obtain the anaconda source RPM from the RHEL-5 media and install it. You should not be doing this as root:
      rpm -Uvh anaconda-11.1.2.36-1.src.rpm

Now you are ready to patch anaconda to your liking.

PATCHING ANACONDA'S STAGE 1 COMPONENTS

Extract the source:

      cd ~/rpmbuild/SPECS
      rpmbuild -bp anaconda.spec
RPM may complain about missing dependencies. Install them if you lack them. Anaconda needs a lot of stuff in order to compile.

Patch the source:
      cd ~/rpmbuild/BUILD/anaconda-11.1.2.36

The stage 1 sources are located in the loader2 subdirectory. The stage 1 components also link against libisys which is in the isys subdirectory. Either way, you will want to make patches against this source tree and put the patches in the ~/rpmbuild/SOURCES directory. For this example, we are patching loader2/loader.c:
cd loader2
      cp -a loader.c loader.c.orig
      vim loader.c
      # la la la...making my changes.... :wq
      cd ~/rpmbuild/BUILD
      gendiff anaconda-11.1.2.36/ .orig > ~/rpmbuild/SOURCES/anaconda.patch

Now go and edit ~/rpmbuild/SPECS/anaconda.spec and add anaconda.patch as a patch and make sure it's applied in the %prep section after the %setup macro is run.

BUILDING A PATCHED ANACONDA

Simple, use rpmbuild:
      cd ~/rpmbuild/SPECS
      rpmbuild -ba anaconda.spec

The resulting packages will be written to ~/rpmbuild/RPMS

BUILDING A NEW RAMDISK

First, we need to get the two stage 1 components that matter: loader and init.
      cd ~/rpmbuild/RPMS/
      rpmdev-extract anaconda-runtime-11.1.2.36-1.i386.rpm
      cd anaconda-runtime-11.1.2.36-1
      cp -a usr/lib/anaconda-runtime/loader/init ~/init
      cp -a usr/lib/anaconda-runtime/loader/loader ~/loader

Second, get the ramdisk image that you want to update. For this example, I am updating the pxeboot/initrd.img from the RHEL-5 tree. I have copied the initrd.img file to my home directory:
      cd ~
      mkdir tmp-initrd
      cd tmp-initrd
      gzip -dc ~/initrd.img | cpio -id
      cat ~/init > sbin/init
      cat ~/loader > sbin/loader
      (find . | cpio -c -o | gzip -9) > ~/initrd.img
      cd ~
Now the initrd.img file in my home directory contains the new loader and init binaries. Copying this to the boot server and you are ready to go with a new initrd.img for RHEL-5.

CREATING AN INSTALLATION BOOT CD-ROM WITH YOUR NEW initrd.img

isolinux (not available for Itanium systems, you'll need to use a loop back mount of the ia64 boot.iso) is used for booting the Red Hat Enterprise Linux installation CD. To create your own CD-ROM to boot the installation program, use the following instructions:

Copy the isolinux/ directory from the Red Hat Enterprise Linux CD #1 into a temporary directory (referred to here as path-to-workspace) using the following command:

cp -r path-to-cd/isolinux/ path-to-workspace

Change directories to the path-to-workspace directory you have created:

cd path-to-work-space

Copy the new initrd.img to path-to-workspace

cp ~/initd.img path-to-workspace/isolinux/

Make sure the file(s) you have copied have appropriate permissions:

chmod u+w isolinux/*
Finally, issue the following command to create the ISO image file:

mkisofs -o file.iso -b isolinux.bin -c boot.cat -no-emul-boot \\
-boot-load-size 4 -boot-info-table -R -J -v -T isolinux/

POTENTIAL STUMBLING BLOCKS

Your development workstation may be a different architecture than your target system. If you are using a Thinkpad to prepare a new ramdisk for the Itanium platform, you will be building binaries for the wrong platform. Unfortunately, there is no easy way around this. You must build the binaries on the target platform. If you don't have that sitting in front of you, find one somehow.

At Red Hat, engineers can submit packages to the build system as a scratch build. The package gets built on the desired architecture, but thrown off to the side, which works great for testing purposes.

您可能感兴趣的与本文相关的镜像

Python3.8

Python3.8

Conda
Python

Python 是一种高级、解释型、通用的编程语言,以其简洁易读的语法而闻名,适用于广泛的应用,包括Web开发、数据分析、人工智能和自动化脚本

【SCI一区论文复】基于SLSPC系列的高阶PT-WPT无线电能传输系统研究(Matlab代码实现)内容概要:本文围绕“基于SLSPC系列的高阶PT-WPT无线电能传输系统”的研究展开,结合SCI一区论文复现,提供完整的Matlab代码实现方案。研究聚焦于高阶无线电力传输(WPT)系统的建模、优化与仿真,重点探讨SLSPC拓扑结构在提升传输效率、稳定性及抗干扰能力方面的优势。文中涵盖系统建模、参数设计、性能仿真与结果分析等关键环节,突出理论与实践结合,适用于高水平学术研究与工程应用验证。此外,文档附带丰富的科研资源链接,涵盖多个电力系统、优化算法与仿真技术方向,体现其作为综合性科研辅助资料的价值。; 适合人群:具备电力电子、无线能量传输或自动化等相关背景,从事科研工作的研究生、博士生及高校教师,以及希望复现高水平论文成果的工程技术人员。; 使用场景及目标:①用于复现SCI一区论文中关于高阶PT-WPT系统的理论与仿真结果;②为无线电力传输系统的拓扑选型、参数优化与性能评估提供Matlab仿真支持;③辅助开展电力系统、储能优化、智能算法等方向的交叉研究。; 阅读建议:建议结合提供的网盘资源,下载完整代码与案例进行实操验证,重点关注SLSPC系统建模逻辑与仿真参数设置,同时可拓展学习文档中列举的其他Matlab仿真技术内容,以提升综合科研能力。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值