Thursday, June 30, 2011

On porting the installer (Part 1)...

So as Alpha 2 approaches, I find myself working towards porting the alternate installer/d-i to the pandaboard to support the netboot installer. There's not a lot of documentation that describes the internals of d-i, nor what bits are platform specific.

This is especially true when working towards creating a new subarchitecture since lots of little places have to be touched, kernels usually have to be tweaked, and all other sorts of odds and ins. This post isn't a comprehensive guide to what's necessary, but just little tidbits of what I did, just some random odds and ends.

The first step of any enablement is to have something you can run and boot. The netboot images, as well as the alternate kernel and ramdisk are built out of the debian-installer package. In the debian-installer package, several config files for driving the process are located in build/config/$arch/$subarch. For omap4, we have the following files:

boot/arm/generate-partitioned-filesystem
build/config/armel.cfg
build/config/armel/omap4.cfg
build/config/armel/omap4/cdrom.cfg
build/config/armel/omap4/netboot.cfg

boot/arm/generate-partitioned-filesystem is a shell script that takes a VFAT blob, and spits out a proper MBR and partition table.

build/config/armel.cfg simply is a list subarchitectures to build, and some sane-ish kernel defaults for armel.

build/config/armel/omap4.cfg is also a simple config file which specifies the type of images we're building, and the kernel to use in d-i. This file looks like this:

MEDIUM_SUPPORTED = netboot cdrom

# The version of the kernel to use.
KERNELVERSION := 2.6.38-1309-omap4
# we use non-versioned filenames in the omap kernel udeb
KERNELNAME = vmlinuz
VERSIONED_SYSTEM_MAP =

As a point of clarification, 'cdrom' is a bit of a misdemeanor; it refers to the alternate installer kernel and ramdisk used by alternate images, and not the type of media. Other types of images exist such as 'floppy' and 'hd-install', but these are specialized images, and out of scope for this blog post.

Each file in build/config/armel/omap4/* is a makefile thats called in turn for each image that created. The most interesting of this is the netboot.cfg

MEDIA_TYPE = netboot image
SUBARCH = omap4
TARGET = $(TEMP_INITRD) $(TEMP_KERNEL) omap4
EXTRANAME = $(MEDIUM)
INITRD_FS = initramfs

MANIFEST-INITRD = "netboot initrd"
MANIFEST-KERNEL = "kernel image to netboot"
INSTALL_PATH = $(SOME_DEST)/$(EXTRANAME)

omap4:
 # Make sure our build envrionment is clean
 rm -rf $(INSTALL_PATH)
 mkdir -p $(INSTALL_PATH)

 # Generate uImage/uInitrd
 mkimage -A arm -O linux -T kernel -C none -a 0x80008000 -e 0x80008000 -n "Ubuntu kernel" -d $(TEMP_KERNEL) $(INSTALL_PATH)/uImage
 mkimage -A arm -O linux -T ramdisk -C none -a 0x0 -e 0x0 -n "debian-installer ramdisk" -d $(TEMP_INITRD) $(INSTALL_PATH)/uInitrd

 # Generate boot.scrs
 mkimage -A arm -T script -C none -n "Ubuntu boot script (serial)" -d boot/arm/boot.script-omap4-serial $(INSTALL_PATH)/boot.scr-serial
 mkimage -A arm -T script -C none -n "Ubuntu boot script (framebuffer)" -d boot/arm/boot.script-omap4-fb $(INSTALL_PATH)/boot.scr-fb

 # Create DD'able filesystems
 mkdosfs -C $(INSTALL_PATH)/boot.img-fat-serial 10240
 mcopy -i $(INSTALL_PATH)/boot.img-fat-serial $(INSTALL_PATH)/uImage ::uImage
 mcopy -i $(INSTALL_PATH)/boot.img-fat-serial $(INSTALL_PATH)/uInitrd ::uInitrd
 mcopy -i $(INSTALL_PATH)/boot.img-fat-serial /usr/lib/x-loader/omap4430panda/MLO ::MLO
 mcopy -i $(INSTALL_PATH)/boot.img-fat-serial /usr/lib/u-boot/omap4_panda/u-boot.bin ::u-boot.bin
 cp $(INSTALL_PATH)/boot.img-fat-serial $(INSTALL_PATH)/boot.img-fat-fb
 mcopy -i $(INSTALL_PATH)/boot.img-fat-serial $(INSTALL_PATH)/boot.scr-serial ::boot.scr
 mcopy -i $(INSTALL_PATH)/boot.img-fat-fb $(INSTALL_PATH)/boot.scr-fb ::boot.scr
 boot/arm/generate-partitioned-filesystem $(INSTALL_PATH)/boot.img-fat-fb $(INSTALL_PATH)/boot.img-fb
 boot/arm/generate-partitioned-filesystem $(INSTALL_PATH)/boot.img-fat-serial $(INSTALL_PATH)/boot.img-serial

 # Generate manifests
 update-manifest $(INSTALL_PATH)/uImage "Linux kernel for OMAP Boards"
 update-manifest $(INSTALL_PATH)/uInitrd "initrd for OMAP Boards"
 update-manifest $(INSTALL_PATH)/boot.scr-fb "Boot script for booting OMAP netinstall initrd and kernel from SD card. Uses framebuffer display"
 update-manifest $(INSTALL_PATH)/boot.scr-serial "Boot script for booting OMAP netinstall initrd and kernel from SD card. Uses serial output"
 update-manifest $(INSTALL_PATH)/boot.img-serial "Boot image for booting OMAP netinstall. Uses serial output"
 update-manifest $(INSTALL_PATH)/boot.img-fb "Boot image for booting OMAP netinstall. Uses framebuffer output"

The vast majority of this is fairly straightforward. TARGET represents the targets called by make. There are tasks for creating a vmlinuz and initrd that must be included. The omap4 target then handles specialized handling for the omap4/netboot image.

omap4 requires a VFAT boot partition on the SD card with a proper filesystem and MBR. The contents of the filesystem are straightforward:

MLO - also known as x-loader, a first stage bootloader
u-boot.bin - u-boot binary, second stage bootloader, used to book the kernel
uImage - linux kernel with special uboot header (created with mkimage)
uInitrd - d-i ramdisk with special uboot header
boot.scr - special boot script for u-boot for commands to execute at startup.

MLO and u-boot.bin are copied in from x-loader-omap4-panda and u-boot-linaro-omap4-panda which are listed as build-deps in the control file for d-i. boot.scr is generated from a plain-text file:

fatload mmc 0:1 0x80000000 uImage
fatload mmc 0:1 0x81600000 uInitrd
setenv bootargs vram=32M mem=456M@0x80000000 mem=512M@0xA0000000 fixrtc quiet debian-installer/framebuffer=false console=ttyO2,115200n8
bootm 0x80000000 0x81600000

These are u-boot commands that simply load the uImage/uInitrd into RAM, set the command line, and then boot into it.

When porting the installer, it is mostly a task of putting your subarchitecture name in the right places, then adding the necessary logic in places to spit out an image that boots. This provides a sane base to start working on porting other bits of the installer. When d-i is uploaded to Launchpad, these files end up in http://ports.ubuntu.com/ubuntu-ports/dists/oneiric/main/installer-armel/current/images/

My next blog post will go a bit into udebs, and understanding how d-i does architecture detection, and introducing flash-kernel.

54 comments:

Enna Williams said...

Megaplex Keto Blend Julia Bell is a student of nutrition dedicated to helping people live healthier lives. You can access a free printable weight loss goal setting worksheet and BMR calculator at Free Weight Loss Downloads

keven peterson said...

Zydenafil worries about their manhood, especially when they come to a point in their life when they feel they need to prove something. Most men want to enhance their male organ for sexual purposes

Enna Williams said...

Botanica Pure Keto A sensible and long-term focused weight loss program should therefore target body fat loss instead of concentrating solely on scale weight loss. For successful and long-term weight loss,

Maxwell said...

Boost Xtra You will find various kinds of penile enhancement items available for sale. Natural penile/male

Donald Trump said...

Nature Crave Keto Weight loss is one of the hottest topics ever. Everyone seems to be trying to lose weight nowadays. Most diet programs are about weight loss and body weight is often used as an indicator of fitness progress. But, this is an incorrect approach.

Enna Williams said...

EverStrong XT CBD employ a penile enhancement product because it worked so effectively for one of your friends. The same product simply might not work for your needs, in the same way. Also, some penile enhancement items, such as the pills, don't suit all the men who buy them. Therefore, gather more complete information concerning the product you need to use before actually using it, to ensure that it's not necessary to face any type of health problems afterward.

Wiktor Wilkins said...

SlimPhoria Keto days. On the other hand I've had women sign-up and never even attempt the first training program yielding a

Donald Trump said...

Vital Nutrition Keto Control in being truly healthy, your best option for weight loss is to look at your activity level and the nutritional content of your diet

Donald Trump said...

BioRexin Male Enhancement on the label or advertising. These products are found online as well as offline in locations such as convenience store checkout lines or at gas stations. The ingredients are generally of

Enna Williams said...

Trubodx Keto If you feel that your sexual performance is not what it used to be, you maybe someone who would try out natural male enhancement pills. Often sexual performance has physiological and psychological impact on men sexually, so taking a natural enhancement pill can boost confidence and renew their desire for sex.

Glain Crous said...

Bluoxyn asking yourself, should I take male enhancement pills? Only you can answer that question, but many men around the world are saying yes, every day. Why not give them a try and see what you think, you might be surprised at the results you get. A hard man is good to find, so is a man who can stay that way longer.

Danny Moreson said...

Flash Keto There are so many weight loss programs out there today, it can be difficult and confusing to choose the right one. If you are online like most people are these days, the list of diets and programs is endless, and the pros and cons of each are buried in hype and sales copy. So how do you choose?

Danny Moreson said...

CountDown Keto friend of mine for advice and was told simply - Eat Healthy + Exercise = Weight Loss. It sounded too good to be true. However I gave it a try and it really worked. I decided I wanted to share the way I lost over

Danny Moreson said...

New You Keto I kept overeating, automatically, and never thought about changing my behavior. Yet, I never did become morbidly obese. I simply continued to carry around the extra 25 to 30 pounds that I always had carried around.

Danny Moreson said...

Keto Crush Fat was practically falling off your body just a few weeks ago, and now you're wondering if your scale is broken because no matter what you do, your weight won't budge.

Danny Moreson said...

KSZ Male Enhancement are the next most recognizable male enhancement product after Viagra and Cialis. These products claim to work by increasing the blood flow to the penis and expanding the Corpus Cavernosa tissue of the penis.

Danny Moreson said...

Folinu . In people who are genetically prone to hair loss, DHT or dihydrotestosterone initiates miniaturization of the hair follicles. In time, the hair becomes thinner and the overall volume of your tresses decreases. Eventually, the hair follicle can cease to produce hair completely.

Glain Crous said...

Keto Boost
Life Coach and Author Jana Beutler Holland, M.Ed., is a former English Teacher, Therapist, and Juvenile Probation Officer. After years of working in the fields of Education and Law Enforcement, Jana's interest in helping delinquent youths led naturally into a graduate program in

Glain Crous said...

Prime X Factor -preservation mechanism.

This stress reaction can be made worse when your body produces insulin after you eat sweet foods.

Ben Stokes said...

Viril XL AlphaMAX Pro known fact that most men are not satisfied with their penises or sexual performance. There could be many reasons for this, starting from the size of the penis even to the inability to get or maintain a solid and powerful

Glain Crous said...

BioNatrol Keto Burn of your health. It could be with making money, looking for a new job, or in your relationships. Creating a new habit takes

Danny Moreson said...

Nutriverse Keto the best and highest recommended caffeinated beverage that you can have for your healthy weight loss and quick weight loss journey. Most of them are even decaffeinated! I would recommend that you have 3 - 4 cups of hot green tea per day. Studies have shown an increase in energy levels and metabolisms for subjects who took in certain

Glain Crous said...

Nutriverse keto regulate our blood sugar levels activate an enzyme in fat tissue called lipase. Lipase ignites fat cells to release triglycerides, which is what makes fat cells fat. When they receive a signal from

Glain Crous said...

Al Roker Weight Loss calories to perform it. A trained athlete burns less calories playing their sport than someone who isn't trained in that sport. Solution: Once again, don't allow your body to adapt to a single exercise.

Glain Crous said...

Bluoxyn This is something most men would love to experience, hearing yes, more often than no. So if you are a male looking to increase the size of your male organ you really need the best male enhancement products available.

Danny Moreson said...

Free Cell Keto professional fitness coaching aren't looking to lose weight as much as they'd simply like to feel good about themselves and avoid the pain associated with the social pressures of being overweight. Weight loss isn't their true desire, it

Danny Moreson said...

KGX Keto me. In Neurolinguistic programming and Hypnosis we talk about "Frames": Those reference points

Peterson Martin said...

True Keto Boost After experiencing the initial rapid weight loss, it is too often the case that a lot of dieters who make use of such quick fat reduction products find that they simply start losing hope as their fat loss rate almost always grinds to a snail

Peterson Martin said...

Meta Keto Boost increasing, along with the rates of diseases that have been correlated with higher weights, many people feel that dieting is their only option for good health. Unfortunately, not everyone who wants to reduce is doing it in a healthy way. Weight loss is an industry worth more than $

Danny Moreson said...

InstaHard effects of PAF (platelet aggregation, blood clotting) that have been related to the development of a number of cardiovascular, renal, respiratory and CNS (Central Nervous System) disorders.

Jhony Sanger said...

True Keto Boost Not just fats give a feeling of completion, eating a sufficient sound fat called omega-3 unsaturated fats may bring about your digestion system to smolder fat all the more productively. On the off chance that your weight stays steady, you are most likely taking in similar measure of calories you smolder every day.

Glain Crous said...

Meta Keto Boost This actually has a common name. We in the fitness industry call this the F.I.T.T principle. Beyond these basics which are usually associated with the exercise components of your program there will also be nutritional requirements to any quality weight loss program that fit perfectly into the same acronym:

Keven Robert said...

Nutriverse Keto What gives?

Why did your routine suddenly stop working, and what can you do to push through this weight loss plateau?

Keven Robert said...

Veterans Vitality CBD the most part there are not any side effects when using pain reliever creams, but you can possibly acquire a rash if you have sensitive skin, but the rash should disappear without any type of medication, but if it does want to continue make sure that you call your doctor. If you think that if you use more pain relief cream is going to help more, you are wrong and can actually hurt more than help, it can also cause a superficial burn on the skin if you use to much.

Glain Crous said...

Empowered Boost herbs, make sure that you purchase pills that are advised by your doctor. Most of these natural male enhancement pills do not require doctor's prescription but you do not want to take any risks and suffer in the future.

Jhony Sanger said...

Granite Male Enhancement Many people may be drawn to the composition of male enhancement in stores that are all-natural or that is comprised of herbal products. They may find it easier to trust herbal products than those that are made from synthetic drugs. In fact, more and more people seem to want products that are all-natural or that are organic as opposed to those that are made with

Charlie Louis said...

Eclipse Keto . If you find yourself hungry, add more high fiber foods to the diet, which will make you feel fuller.
Fat Burners Now, rather than expect supplements to burn fat alone, you need to view supplements more as a tool

Glain Crous said...

Thin Zone Keto Cardio Workout #3 to burn fat: Interval training cardio

In a study from Australia that compared 2 cardio workouts to burn fat, subjects doing 3 interval training workouts per week lost a significant amount of belly fat while another group doing 40 minutes of slow cardio per week did not burn belly fat.

Chriss Lain said...

Ultragenik Keto presence of growth hormone. When activated, it causes the release of stored sugar and fat. Snacking in between meals mutes the fat burning effects of this hormone. When the

Jhony Sanger said...

Thunder Testosterone of these products share several common traits including: made from natural ingredients, available without a prescription, improve sexual desire and require regular use for maximum effect.

Shane Ronky said...

Thunder Testosterone If one is not keen on painful and expensive penis surgery (Phalloplasty), fear not as there is a far easier way to enhance your penis and performance. The best natural male enhancers come in the form of

Chriss Lain said...

Instahard Would you tell her she was over weight or needed breast implants? No, but would you want to? Same goes for her. There is nothing

Shane Ronky said...

Ultra Fit Keto . Understanding how to use your core/breathing connection during a workout to affect your oxygen level takes time and mental realization of muscle feeling and changing the stress in shoulders. Fat and sugar are two different types of fuel for the body to burn.

Danny Moreson said...

Cylophin RX controversies, naturally, is regarding whether or not the products designed for male enhancement work. sexual hormones like

Shane Ronky said...

Pro Keto Rx concert with the other hormones of metabolism. In this regulatory role, growth hormone stimulates the use of fat as fuel for the body. It is also known as an anti-aging hormone that is triggered into action by protein and intense exercise. It is even active when you are asleep.

Glain Crous said...

Number One Keto The Turbulence Training fat burning workouts help you burn fat without long, slow cardio sessions or fancy equipment.

Peterson Martin said...

Keto Shred Biotic Immunity Booster The first sensible action is to determine the cause of your hair loss soonest. Hair loss in males can have several causes and underlying reasons. Only after you find out the reason can you choose the best hair loss treatment and product.

Keven Robert said...

Fresh Prime Keto Two handful of nuts a day (about 24 of them) is a great way to eat to keep you full, a good source of Vitamin E, helps keep your heart healthy, and also packed with protein and magnesium to help build muscle

Peterson Martin said...

Cylophin RX This report has revealed that the average white male penis size is 6.2inches long and 3.7 inches in circumference. This report also shows that the average black male penis size is 6.3 inches long and 3.8 inches in circumference. That is only a couple millimeter difference,

Chriss Lain said...

Fresh Prime Keto because you eat less when you are fuller - leading to a calorie burn and some fat loss.

Keven Robert said...

Rapid Keto Prime when the levels drop which is generally in between meals. It works in concert with insulin to maintain stable levels of blood sugar. While insulin lowers blood sugar, glucagon increases the levels of blo

Chriss Lain said...

Reliant Keto
You should be in good cardiovascular and pulmonary health before trying HIIT exercises.
HIIT is also called turbulence training method.

Shane Ronky said...

Viadine Male Enhancement
1. For those who have money to spend, the most popular choice is male enhancement surgery. Different techniques are involved in male enhancement surgery to increase the size of the

Glain Crous said...


Bio Jolt Male Enhancement
may be under the impression that it is not endorsed by pharmacies or by the FDA. They may also have doubts regarding the effectiveness of male enhancement in stores especially for those