I know this patch is pretty rough. It's just meant as an example of what I'd like to be able to do with buildrom. It is a patch which enables most of buildrom to succeed building for 64-bit.
When I use Linux-As-Bootloader, I want to use a 64-bit kernel so that any patches I have to do for my hardware only need to be done for one architecture.
A while ago I did a wiki page http://linuxbios.org/index.php/Tyan_S2892_Build_Tutorial outlining how to use buildrom to put the 64-bit kernel in the ROM.
I wanted to fit it into the new buildrom architecture, but I ran into a few problems:
1. There's not a clear way to add architectures for targets (Especially since it really only makes sense for 64-bit)
a. I think that the same configuration variable should be used for the target architecture for the kernel and uClibc b. We could add a suffix to every default configuration file (e.g., defconfig-serengeti_cheetah-i386 or defconfig-serengeti_cheetah-x86_64
2. It would be nice to be able to set the ROM size if you have a larger one than comes standard with the platform
I think that buildrom is the way to go and I like the make menuconfig.
In order to make the 64-bit kernel fit as I configured it, I excluded kexec from the ROM and included a statically-linked kexec on the boot drive, so it was nice to be able to remove the kexec tools from the image.
As soon as we decide the best way, I'll clean it up and add serengeti_cheetah-x86_64 support and tyan_s2892-x86_64 support.
Thanks,
Myles
On 26/10/07 13:58 -0600, Myles Watson wrote:
When I use Linux-As-Bootloader, I want to use a 64-bit kernel so that any patches I have to do for my hardware only need to be done for one architecture.
This looks pretty good. I'm not really sure if I understand why you would need a 64 bit kernel for a LAB, but I'm all for making it possible.
- There's not a clear way to add architectures for targets (Especially
since it really only makes sense for 64-bit)
There configuration options in the platform configs that related to this, but only on a very high end level. It wouldn't be too difficult to do what you are suggesting, though.
a. I think that the same configuration variable should be used for the target architecture for the kernel and uClibc
Agreed - you *could* do 64 bit kernel / 32 bit uclibc, but why?
b. We could add a suffix to every default configuration file (e.g., defconfig-serengeti_cheetah-i386 or defconfig-serengeti_cheetah-x86_64
Thats fine - I don't have any problem with that.
- It would be nice to be able to set the ROM size if you have a larger
one than comes standard with the platform
This is hard to do in v2, and I'm not sure how we could get around it, because it would involve in-place SED fu and other such things that I'm not 100% sure we want to be doing (and supporting). This would be easier for v3, and if its not easier for v3, now is the time to make it easier.
Comments below:
diff -urN buildrom-devel.org/packages/kernel/kernel.inc buildrom-devel/packages/kernel/kernel.inc --- buildrom-devel.org/packages/kernel/kernel.inc 2007-10-25 16:06:51.000000000 -0600 +++ buildrom-devel/packages/kernel/kernel.inc 2007-10-25 16:50:04.000000000 -0600 @@ -41,25 +41,26 @@ @ touch $@
$(KERNEL_SRC_DIR)/.config: $(KERNEL_STAMP_DIR)/.patched
- @ echo $(KERNEL_CONFIG) @ cat $(KERNEL_CONFIG) | sed -e s:^CONFIG_LOCALVERSION=.*:CONFIG_LOCALVERSION="$(ROM_VERSION)": > $(KERNEL_SRC_DIR)/.config
What are we echoing here?
-$(KERNEL_SRC_DIR)/arch/i386/boot/bzImage: $(KERNEL_SRC_DIR)/.config +$(KERNEL_SRC_DIR)/arch/$(UCLIBC_ARCH)/boot/bzImage: $(KERNEL_SRC_DIR)/.config
Throughout, I'll vote for LAB_ARCH or TARGET_ARCH over UCLIBC_ARCH.
@ echo "Building kernel..."
- @ $(MAKE) -C $(KERNEL_SRC_DIR) ARCH=i386 \
- @ $(MAKE) -C $(KERNEL_SRC_DIR) ARCH=$(UCLIBC_ARCH) \ KERNEL_CC="$(CC)" KERNEL_LD="$(LD)" > $(KERNEL_BUILD_LOG) 2>&1
-$(OUTPUT_DIR)/bzImage: $(KERNEL_SRC_DIR)/arch/i386/boot/bzImage +$(OUTPUT_DIR)/bzImage: $(KERNEL_SRC_DIR)/arch/$(UCLIBC_ARCH)/boot/bzImage @ install -d $(OUTPUT_DIR) @ install -m 0644 $< $@
-$(OUTPUT_DIR)/vmlinux: $(KERNEL_SRC_DIR)/arch/i386/boot/bzImage +$(OUTPUT_DIR)/vmlinux: $(KERNEL_SRC_DIR)/arch/$(UCLIBC_ARCH)/boot/bzImage @ install -d $(OUTPUT_DIR) @ install -m 0644 $(KERNEL_SRC_DIR)/vmlinux $@
$(KERNEL_STAMP_DIR)/.headers: $(KERNEL_SRC_DIR)/.config $(STAGING_DIR)/host/bin/unifdef @ echo "Installing kernel headers..." @( export PATH=$(PATH):$(STAGING_DIR)/host/bin; \
- $(MAKE) -C $(KERNEL_SRC_DIR) ARCH=i386 \
- $(MAKE) -C $(KERNEL_SRC_DIR) ARCH=$(UCLIBC_ARCH) \ INSTALL_HDR_PATH=$(STAGING_DIR)/ headers_install > $(KERNEL_INSTALL_LOG) 2>&1) @ touch $@
diff -urN buildrom-devel.org/packages/kernel/serengeti_cheetah-kernel.mk buildrom-devel/packages/kernel/serengeti_cheetah-kernel.mk --- buildrom-devel.org/packages/kernel/serengeti_cheetah-kernel.mk 2007-10-24 12:05:13.000000000 -0600 +++ buildrom-devel/packages/kernel/serengeti_cheetah-kernel.mk 2007-10-25 16:59:06.000000000 -0600 @@ -2,10 +2,10 @@
KERNEL_URL=http://kernel.org/pub/linux/kernel/v2.6/ KERNEL_SOURCE=linux-$(KERNEL_VERSION).tar.bz2 -KERNEL_CONFIG=$(PACKAGE_DIR)/kernel/conf/defconfig-serengeti_cheetah +KERNEL_CONFIG=$(PACKAGE_DIR)/kernel/conf/defconfig-serengeti_cheetah-x86_64
This obviously would need to be addressed as discussed above.
-#TINY_DIR=$(PACKAGE_DIR)/kernel/patches/tiny -#KERNEL_PATCHES += $(shell ls $(TINY_DIR)/*.patch) +TINY_DIR=$(PACKAGE_DIR)/kernel/patches/tiny-2.6.18.1 +KERNEL_PATCHES += $(shell ls $(TINY_DIR)/*.patch)
This seems to be your local stuff - we would want to make sure that this gets fixed right - tiny should match the kernel in question.
$(SOURCE_DIR)/$(KERNEL_SOURCE):
<snip defconfig>
diff -urN buildrom-devel.org/packages/uclibc/uclibc.mk buildrom-devel/packages/uclibc/uclibc.mk --- buildrom-devel.org/packages/uclibc/uclibc.mk 2007-10-24 15:16:38.000000000 -0600 +++ buildrom-devel/packages/uclibc/uclibc.mk 2007-10-26 08:48:56.000000000 -0600 @@ -26,13 +26,14 @@ @ touch $@
$(UCLIBC_SRC_DIR)/.config: $(UCLIBC_STAMP_DIR)/.unpacked
- @ cp $(PACKAGE_DIR)/uclibc/conf/defconfig $(UCLIBC_SRC_DIR)/.config
- @ cp $(PACKAGE_DIR)/uclibc/conf/defconfig-$(UCLIBC_ARCH) $(UCLIBC_SRC_DIR)/.config
$(UCLIBC_SRC_DIR)/lib/libc.a: $(UCLIBC_SRC_DIR)/.config @ echo "Building uclibc..."
- @ echo $(UCLIBC_ARCH) @ ( unset CFLAGS; unset LDFLAGS; \ $(MAKE) -C $(UCLIBC_SRC_DIR) TARGET_ARCH="$(UCLIBC_ARCH)" \
- CC="$(CC) $(CROSS_CFLAGS)" LD="$(LD) $(CROSS_LDFLAGS)" \
- CC="$(CC)" LD="$(LD)" \
Hmm - does uclibc do the right thing w.r.t flags now? If now, we'll need an ifdef to set teh right CC and LD flags.
Jordan