Browse Source

optimize foxg20 target

- make cfgfs work, a small busybox fdisk patch needed
- make adkinstall and adkupdate work
Waldemar Brodkorb 14 years ago
parent
commit
86d7ffda38

+ 4 - 14
package/adkinstall/src/adkinstall.foxg20

@@ -3,22 +3,14 @@
 # special script for foxboard netus aka foxg20
 
 if [ -z $1 ];then
-        printf "Please give your root tar archive as first parameter\n"
+        printf "Please give your root tar archive as parameter\n"
         exit 1
 fi
-if [ -z $2 ];then
-	printf "Please give your kernel as second parameter\n"
-	exit 1
-fi
 
 if [ ! -f $1 ];then
 	printf "given root tar archive does not exist\n"
 	exit 1
 fi
-if [ ! -f $2 ];then
-	printf "given kernel does not exist\n"
-	exit 1
-fi
 
 printf "Creating partition scheme\n"
 parted -s /dev/mmcblk0 mklabel msdos
@@ -32,15 +24,12 @@ parted -s /dev/mmcblk0 set 1 boot on
 sfdisk --change-id /dev/mmcblk0 3 88 >/dev/null 2>&1
 sleep 2
 sync
-printf "Installing kernel\n"
-mount -t vfat /dev/mmcblk0p1 /mnt
-cp $2 /mnt/uImage
-sync
-umount /mnt
 printf "Creating ext2 filesystem\n"
 mke2fs /dev/mmcblk0p2 >/dev/null 2>&1
 tune2fs -c0 -i0 /dev/mmcblk0p2 >/dev/null 2>&1
 mount -t ext2 /dev/mmcblk0p2 /mnt
+mkdir /mnt/boot
+mount -t vfat /dev/mmcblk0p1 /mnt/boot
 
 printf "Extracting install archive\n"
 tar -C /mnt -xzpf $1
@@ -52,6 +41,7 @@ fi
 chmod 1777 /mnt/tmp
 chmod 4755 /mnt/bin/busybox
 sync
+umount /mnt/boot
 umount /mnt
 if [ $? -ne 0 ];then
 	printf "Unmounting filesystem failed"

+ 4 - 0
package/base-files/src/sbin/adkupdate

@@ -27,6 +27,8 @@ prepare() {
 	mount -o remount,rw /
 	if [ "$system" == "RB532" ];then
 		mount -t yaffs2 /dev/mtdblock0 /boot
+	elif [ "$system" == "FOXG20" ];then
+		mount -t vfat /dev/mmcblk0p1 /boot
 	fi
 }
 
@@ -78,6 +80,8 @@ sync
 mount -o bind /etc /tmp/.cfgfs/root
 if [ "$system" == "RB532" ];then
 	umount -f /boot
+elif [ "$system" == "FOXG20" ];then
+	umount -f /boot
 fi
 
 echo "Update sucessful. You should reboot now."

+ 14 - 0
package/busybox/patches/003-fdisk-mmc.patch

@@ -0,0 +1,14 @@
+diff -Nur busybox-1.15.2.orig/util-linux/fdisk.c busybox-1.15.2/util-linux/fdisk.c
+--- busybox-1.15.2.orig/util-linux/fdisk.c	2009-10-08 03:04:40.000000000 +0200
++++ busybox-1.15.2/util-linux/fdisk.c	2010-02-23 20:41:01.000000000 +0100
+@@ -2770,7 +2770,9 @@
+ 		for (s = ptname; *s; s++)
+ 			continue;
+ 		if (isdigit(s[-1]))
+-			continue;
++			if (s[-1] != '0')
++				continue;
++		
+ 		sprintf(devname, "/dev/%s", ptname);
+ 		open_list_and_close(devname, 0);
+ 	}

+ 1 - 1
package/cfgfs/Makefile

@@ -9,7 +9,7 @@ PKG_RELEASE:=		1
 PKG_DESCR:=		compressed config filesystem
 PKG_SECTION:=		base
 
-PKG_TARGET_DEPENDS:=	alix wrap foxboard ag241 rb532
+PKG_TARGET_DEPENDS:=	alix wrap foxboard ag241 rb532 foxg20
 
 WRKDIST=		${WRKDIR}/${PKG_NAME}-${PKG_VERSION}
 NO_DISTFILES:=		1

+ 9 - 5
target/foxg20/Makefile

@@ -10,13 +10,17 @@ include $(TOPDIR)/mk/image.mk
 LOADADDR:=	0x20008000
 
 kernel-install: 
-	gzip -v9 < $(LINUX_DIR)/arch/arm/boot/Image > ${BUILD_DIR}/Image.gz
+	gzip -9 < $(LINUX_DIR)/arch/arm/boot/Image > ${BUILD_DIR}/Image.gz
 	mkimage -A arm -O linux -T kernel -C gzip \
 		-a ${LOADADDR} -e ${LOADADDR} -d ${BUILD_DIR}/Image.gz \
-		-n foxg20 $(BIN_DIR)/${ADK_TARGET}-${FS}-kernel
+		-n foxg20 $(TARGET_DIR)/boot/uImage $(MAKE_TRACE)
+	@cp $(TARGET_DIR)/boot/uImage \
+		$(BUILD_DIR)/${ADK_TARGET}-${FS}-kernel
 
 ifeq ($(FS),nfsroot)
 imageinstall: ${BIN_DIR}/${ROOTFSUSERTARBALL}
+	@cp $(BUILD_DIR)/${ADK_TARGET}-${FS}-kernel \
+		$(BIN_DIR)/${ADK_TARGET}-${FS}-kernel
 	@echo 
 	@echo 'Type dhcp via u-boot prompt to load kernel'
 	@echo 'After that type bootm to load the kernel'
@@ -24,10 +28,10 @@ imageinstall: ${BIN_DIR}/${ROOTFSUSERTARBALL}
 endif
 
 ifeq ($(FS),ext2-block)
-imageinstall: $(BIN_DIR)/$(ROOTFSUSERTARBALL)
+imageinstall: $(BIN_DIR)/$(ROOTFSTARBALL)
 	@echo
-	@echo 'The kernel file is: ${BIN_DIR}/${ADK_TARGET}-${FS}-kernel'
-	@echo "The RootFS tarball is: $(BIN_DIR)/$(ROOTFSUSERTARBALL)"
+	@echo "The RootFS tarball is:"
+	@echo "$(BIN_DIR)/$(ROOTFSUSERTARBALL)"
 	@echo 'Before booting from MicroSD card you need to set following u-boot environment variables:'
 	@echo "setenv bootcmd 'mmc init; sleep 1; fatload mmc 0 0x22000000 uimage; bootm 0x22000000'"
 	@echo

+ 40 - 7
target/foxg20/patches/foxg20.patch

@@ -1,6 +1,18 @@
+diff -Nur linux-2.6.32.2.orig/arch/arm/include/asm/setup.h linux-2.6.32.2/arch/arm/include/asm/setup.h
+--- linux-2.6.32.2.orig/arch/arm/include/asm/setup.h	2009-12-18 23:27:07.000000000 +0100
++++ linux-2.6.32.2/arch/arm/include/asm/setup.h	2010-02-23 21:40:33.000000000 +0100
+@@ -18,6 +18,8 @@
+ 
+ #define COMMAND_LINE_SIZE 1024
+ 
++const char *get_system_type(void);
++
+ /* The list ends with an ATAG_NONE node. */
+ #define ATAG_NONE	0x00000000
+ 
 diff -Nur linux-2.6.32.2.orig/arch/arm/Kconfig linux-2.6.32.2/arch/arm/Kconfig
 --- linux-2.6.32.2.orig/arch/arm/Kconfig	2009-12-18 23:27:07.000000000 +0100
-+++ linux-2.6.32.2/arch/arm/Kconfig	2010-02-17 19:41:01.000000000 +0100
++++ linux-2.6.32.2/arch/arm/Kconfig	2010-02-23 21:18:53.000000000 +0100
 @@ -18,6 +18,9 @@
  	select HAVE_KRETPROBES if (HAVE_KPROBES)
  	select HAVE_FUNCTION_TRACER if (!XIP_KERNEL)
@@ -11,9 +23,25 @@ diff -Nur linux-2.6.32.2.orig/arch/arm/Kconfig linux-2.6.32.2/arch/arm/Kconfig
  	help
  	  The ARM series is a line of low-power-consumption RISC chip designs
  	  licensed by ARM Ltd and targeted at embedded applications and
+diff -Nur linux-2.6.32.2.orig/arch/arm/kernel/setup.c linux-2.6.32.2/arch/arm/kernel/setup.c
+--- linux-2.6.32.2.orig/arch/arm/kernel/setup.c	2009-12-18 23:27:07.000000000 +0100
++++ linux-2.6.32.2/arch/arm/kernel/setup.c	2010-02-23 21:29:01.000000000 +0100
+@@ -806,8 +806,12 @@
+ 
+ static int c_show(struct seq_file *m, void *v)
+ {
++	unsigned long n = (unsigned long) v - 1;
+ 	int i;
+ 
++	if (n == 0)
++		seq_printf(m, "system type\t\t: %s\n", get_system_type());
++
+ 	seq_printf(m, "Processor\t: %s rev %d (%s)\n",
+ 		   cpu_name, read_cpuid_id() & 15, elf_platform);
+ 
 diff -Nur linux-2.6.32.2.orig/arch/arm/mach-at91/at91sam9260_devices.c linux-2.6.32.2/arch/arm/mach-at91/at91sam9260_devices.c
 --- linux-2.6.32.2.orig/arch/arm/mach-at91/at91sam9260_devices.c	2009-12-18 23:27:07.000000000 +0100
-+++ linux-2.6.32.2/arch/arm/mach-at91/at91sam9260_devices.c	2010-02-17 19:41:01.000000000 +0100
++++ linux-2.6.32.2/arch/arm/mach-at91/at91sam9260_devices.c	2010-02-23 21:18:53.000000000 +0100
 @@ -454,7 +454,15 @@
  	.sda_is_open_drain	= 1,
  	.scl_pin		= AT91_PIN_PA24,
@@ -32,8 +60,8 @@ diff -Nur linux-2.6.32.2.orig/arch/arm/mach-at91/at91sam9260_devices.c linux-2.6
  static struct platform_device at91sam9260_twi_device = {
 diff -Nur linux-2.6.32.2.orig/arch/arm/mach-at91/board-foxg20.c linux-2.6.32.2/arch/arm/mach-at91/board-foxg20.c
 --- linux-2.6.32.2.orig/arch/arm/mach-at91/board-foxg20.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.32.2/arch/arm/mach-at91/board-foxg20.c	2010-02-17 19:41:01.000000000 +0100
-@@ -0,0 +1,371 @@
++++ linux-2.6.32.2/arch/arm/mach-at91/board-foxg20.c	2010-02-23 21:33:34.000000000 +0100
+@@ -0,0 +1,376 @@
 +/*
 + *  Copyright (C) 2005 SAN People
 + *  Copyright (C) 2008 Atmel
@@ -100,6 +128,11 @@ diff -Nur linux-2.6.32.2.orig/arch/arm/mach-at91/board-foxg20.c linux-2.6.32.2/a
 +/* #define FOX_USART4 */
 +/* #define FOX_USART5 */
 +
++const char *get_system_type(void)
++{
++        return "FoxBoard FOXG20";
++}
++
 +static void __init foxg20_map_io(void)
 +{
 +	/* Initialize processor: 18.432 MHz crystal */
@@ -407,7 +440,7 @@ diff -Nur linux-2.6.32.2.orig/arch/arm/mach-at91/board-foxg20.c linux-2.6.32.2/a
 +MACHINE_END
 diff -Nur linux-2.6.32.2.orig/arch/arm/mach-at91/Kconfig linux-2.6.32.2/arch/arm/mach-at91/Kconfig
 --- linux-2.6.32.2.orig/arch/arm/mach-at91/Kconfig	2009-12-18 23:27:07.000000000 +0100
-+++ linux-2.6.32.2/arch/arm/mach-at91/Kconfig	2010-02-17 19:41:01.000000000 +0100
++++ linux-2.6.32.2/arch/arm/mach-at91/Kconfig	2010-02-23 21:18:53.000000000 +0100
 @@ -333,6 +333,13 @@
  	  Select this if you are using a Eukrea Electromatique's
  	  CPU9G20 Board <http://www.eukrea.com/>
@@ -440,7 +473,7 @@ diff -Nur linux-2.6.32.2.orig/arch/arm/mach-at91/Kconfig linux-2.6.32.2/arch/arm
  	  (8 and 16 bit data bus width).
 diff -Nur linux-2.6.32.2.orig/arch/arm/mach-at91/Makefile linux-2.6.32.2/arch/arm/mach-at91/Makefile
 --- linux-2.6.32.2.orig/arch/arm/mach-at91/Makefile	2009-12-18 23:27:07.000000000 +0100
-+++ linux-2.6.32.2/arch/arm/mach-at91/Makefile	2010-02-17 19:41:01.000000000 +0100
++++ linux-2.6.32.2/arch/arm/mach-at91/Makefile	2010-02-23 21:18:53.000000000 +0100
 @@ -65,6 +65,9 @@
  # AT91SAM9G45 board-specific support
  obj-$(CONFIG_MACH_AT91SAM9G45EKES) += board-sam9m10g45ek.o
@@ -453,7 +486,7 @@ diff -Nur linux-2.6.32.2.orig/arch/arm/mach-at91/Makefile linux-2.6.32.2/arch/ar
  
 diff -Nur linux-2.6.32.2.orig/drivers/mmc/host/at91_mci.c linux-2.6.32.2/drivers/mmc/host/at91_mci.c
 --- linux-2.6.32.2.orig/drivers/mmc/host/at91_mci.c	2009-12-18 23:27:07.000000000 +0100
-+++ linux-2.6.32.2/drivers/mmc/host/at91_mci.c	2010-02-17 19:41:01.000000000 +0100
++++ linux-2.6.32.2/drivers/mmc/host/at91_mci.c	2010-02-23 21:18:53.000000000 +0100
 @@ -461,7 +461,7 @@
  	at91_mci_write(host, AT91_MCI_DTOR, AT91_MCI_DTOMUL_1M | AT91_MCI_DTOCYC);
  	mr = AT91_MCI_PDCMODE | 0x34a;