Browse Source

kernel patch cleanup

- move patches to kernel version specific directory
- enable execute bit on md5sum wrapper
- remove wrong include in BSDmakefile
- enable ROOTFS for rb532 device
- add mips specific patch for lib/delay.c typo
Waldemar Brodkorb 15 years ago
parent
commit
18b38b0eb6

+ 0 - 1
BSDmakefile

@@ -26,6 +26,5 @@ _subdir: ${_subdir_dep}
 .  include "${.CURDIR}/prereq.mk"
 .  include "${.CURDIR}/mk/split-cfg.mk"
 .else
-.  include "${.CURDIR}/prereq.mk"
 .  include "${.CURDIR}/Makefile"
 .endif

+ 0 - 1
mk/kernel-build.mk

@@ -9,7 +9,6 @@ KERNEL_IDIR:=$(LINUX_BUILD_DIR)/kernel-ipkg
 
 $(TOOLCHAIN_BUILD_DIR)/linux-$(KERNEL_VERSION)/.patched:
 	$(TRACE) target/$(DEVICE)-kernel-patch
-	$(PATCH) $(TOOLCHAIN_BUILD_DIR)/linux-$(KERNEL_VERSION) ../linux/patches *.patch $(MAKE_TRACE)
 	$(PATCH) $(TOOLCHAIN_BUILD_DIR)/linux-$(KERNEL_VERSION) ../linux/patches/$(KERNEL_VERSION) *.patch $(MAKE_TRACE)
 	$(PATCH) $(TOOLCHAIN_BUILD_DIR)/linux-$(KERNEL_VERSION) ../$(DEVICE)/patches *.patch $(MAKE_TRACE)
 	touch $@

+ 5 - 1
mk/rootfs.mk

@@ -8,7 +8,11 @@ FS_CMDLINE:=$(3)
 endif
 endef
 
-$(eval $(call rootfs_template,ext2-cf,EXT2_CF))
+ifeq ($(ADK_LINUX_MIPS_RB532),y)
+ROOTFS:=	root=/dev/sda2
+endif
+
+$(eval $(call rootfs_template,ext2-cf,EXT2_CF,$(ROOTFS)))
 $(eval $(call rootfs_template,ext2-mmc,EXT2_MMC))
 $(eval $(call rootfs_template,ext2,EXT2))
 $(eval $(call rootfs_template,initramfs,INITRAMFS))

+ 66 - 34
scripts/install.sh

@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/env bash
 if [ $(id -u) -ne 0 ];then
 	printf "Installation is only possible as root\n"
 	exit 1
@@ -55,16 +55,20 @@ else
 fi
 
 cfgfs=1
-while getopts "n" option
+rb532=0
+while getopts "nr" option
 do
 	case $option in
 		n)
-		cfgfs=0
-		;;
+			cfgfs=0
+			;;
+		r)
+			rb532=1
+			;;
 		*)
-		printf "Option not recognized\n"
-		exit 1
-		;;
+			printf "Option not recognized\n"
+			exit 1
+			;;
 	esac
 done
 shift $(($OPTIND - 1))
@@ -84,6 +88,18 @@ else
 		printf "$2 is not a file, Exiting\n"
 		exit 1
 	fi
+	if [ $rb532 -eq 1 ];then
+		if [ -z $3 ];then
+			printf "Please give the kernel as third parameter\n"
+			exit 2
+		fi
+		if [ -f $3 ];then
+			printf "Installing $3 on $1\n"
+		else
+			printf "$3 is not a file, Exiting\n"
+			exit 1
+		fi
+	fi
 	if [ -b $1 ];then
 		printf "Using $1 as CF/USB disk for installation\n"
 		printf "This will destroy all data on $1, are you sure?\n"
@@ -127,7 +143,23 @@ if [ $($sfdisk -l $1 2>/dev/null|grep Empty|wc -l) -ne 4 ];then
 fi
 
 printf "Create partition and filesystem\n"
-if [ $cfgfs -eq 0 ];then
+if [ $rb532 -ne 0 ];then
+	rootpart=${1}2
+	$parted -s $1 mklabel msdos
+	sleep 2
+	maxsize=$(parted $1 -s unit cyl print |awk '/^Disk/ { print $3 }'|sed -e 's/cyl//')
+	rootsize=$(($maxsize-2))
+
+	$parted -s $1 unit cyl mkpart primary ext2 0 1
+	$parted -s $1 unit cyl mkpartfs primary ext2 1 $rootsize
+	$parted -s $1 unit cyl mkpart primary fat32 $rootsize $maxsize
+	$parted -s $1 set 1 boot on
+	$sfdisk --change-id $1 1 27
+	$sfdisk --change-id $1 3 88
+	dd if=$3 of=${1}1
+else
+	rootpart=${1}1
+	if [ $cfgfs -eq 0 ];then
 $sfdisk $1 << EOF
 ,,L
 ;
@@ -135,51 +167,50 @@ $sfdisk $1 << EOF
 ;
 y
 EOF
-
-$mke2fs ${1}1
-
-else
-$parted -s $1 mklabel msdos
-sleep 2
-declare -i maxsize
-maxsize=$(parted $1 -s unit cyl print |awk '/^Disk/ { print $3 }'|sed -e 's/cyl//')
-let rootsize=$maxsize-1
-
-$parted -s $1 unit cyl mkpartfs primary ext2 0 $rootsize
-$parted -s $1 unit cyl mkpart primary fat32 $rootsize $maxsize
-$parted -s $1 set 1 boot on
-$sfdisk --change-id $1 2 88
+		$mke2fs ${rootpart}
+	else
+		$parted -s $1 mklabel msdos
+		sleep 2
+		maxsize=$(parted $1 -s unit cyl print |awk '/^Disk/ { print $3 }'|sed -e 's/cyl//')
+		rootsize=$(($maxsize-1))
+
+		$parted -s $1 unit cyl mkpartfs primary ext2 0 $rootsize
+		$parted -s $1 unit cyl mkpart primary fat32 $rootsize $maxsize
+		$parted -s $1 set 1 boot on
+		$sfdisk --change-id $1 2 88
+	fi
 fi
 
 if [ $? -eq 0 ];then
-	printf "Successfully created partition ${1}1\n"
+	printf "Successfully created partition ${rootpart}\n"
 else
 	printf "Partition creation failed, Exiting.\n"
 	exit 1
 fi
 
-sleep 4
-$tune2fs -c 0 -i 0 ${1}1 >/dev/null
-
+sleep 2
+$tune2fs -c 0 -i 0 ${rootpart} >/dev/null
 if [ $? -eq 0 ];then
-	printf "Successfully disabled filesystem checks on ${1}1\n"
+	printf "Successfully disabled filesystem checks on ${rootpart}\n"
 else	
 	printf "Disabling filesystem checks failed, Exiting.\n"
+	exit 1
 fi	
 
 tmp=$(mktemp -d)
-mount -t ext2 ${1}1 $tmp
+mount -t ext2 ${rootpart} $tmp
 printf "Extracting install archive\n"
 tar -C $tmp -xzpf $2 
 printf "Fixing permissions\n"
 chmod 1777 $tmp/tmp
 chmod 4755 $tmp/bin/busybox
 
-printf "Copying grub files\n"
-mkdir $tmp/boot/grub
-cp /boot/grub/stage1 $tmp/boot/grub
-cp /boot/grub/stage2 $tmp/boot/grub
-cp /boot/grub/e2fs_stage1_5 $tmp/boot/grub
+if [ $rb532 -ne 0 ];then
+	printf "Copying grub files\n"
+	mkdir $tmp/boot/grub
+	cp /boot/grub/stage1 $tmp/boot/grub
+	cp /boot/grub/stage2 $tmp/boot/grub
+	cp /boot/grub/e2fs_stage1_5 $tmp/boot/grub
 
 cat << EOF > $tmp/boot/grub/menu.lst
 serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
@@ -192,13 +223,14 @@ root (hd0,0)
 kernel /boot/kernel root=/dev/sda1 init=/init console=ttyS0,115200 console=tty0 panic=10 rw
 EOF
 
-printf "Installing Grub bootloader\n"
+	printf "Installing Grub bootloader\n"
 $grub --batch --no-curses --no-floppy --device-map=/dev/null >/dev/null << EOF
 device (hd0) $1
 root (hd0,0)
 setup (hd0)
 quit
 EOF
+fi
 
 printf "Creating device nodes\n"
 mknod -m 666 $tmp/dev/null c 1 3

+ 0 - 0
scripts/md5sum


+ 42 - 29
target/Config.in

@@ -128,6 +128,11 @@ config ADK_LINUX_MIPS64_LEMOTE
 	help
 	  Lemote Subnotebook
 
+config ADK_LINUX_MIKROTIK
+	bool "Mikrotik Routerboards"
+	help
+	 Support for Mikrotik Routerboards
+
 config ADK_LINUX_MIPS_WAG54G
 	bool "Linksys WAG54G"
 	select ADK_KERNEL_NETDEVICES
@@ -139,38 +144,10 @@ config ADK_LINUX_MIPS_WAG54G
 	  Linksys WAG54G DSL router with Wireless
 	  TI AR7 platform
 
-config ADK_LINUX_MIPS_RB411
-	bool "Mikrotik Routerboard 411"
-	select ADK_rb411
-	select ADK_KERNEL_NETDEVICES
-	select ADK_KERNEL_NET_PCI
-	select ADK_KERNEL_NETDEV_1000
-	select ADK_KERNEL_NET_ETHERNET
-	help
-	 Support for Mikrotik RB411.
-
-config ADK_LINUX_MIPS_RB433
-	bool "Mikrotik Routerboard 433"
-	select ADK_rb433
-	select ADK_KERNEL_NETDEVICES
-	select ADK_KERNEL_NET_PCI
-	select ADK_KERNEL_NETDEV_1000
-	select ADK_KERNEL_NET_ETHERNET
-	help
-	 Support for Mikrotik RB433.
-
-config ADK_LINUX_MIPS_RB532
-	bool "Mikrotik Routerboard 532"
-	select ADK_rb532
-	select ADK_KERNEL_NETDEVICES
-	select ADK_KERNEL_NET_PCI
-	select ADK_KERNEL_NET_ETHERNET
-	select ADK_KERNEL_MII
-	help
-	 Support for Mikrotik RB532.
 
 config ADK_LINUX_XSCALE_ZAURUS
 	bool "Zaurus SL-C3200"
+	depends on ADK_BROKEN
 	select ADK_zaurus
 	select ADK_DEVICE_NO_FPU
 	help
@@ -263,6 +240,42 @@ config ADK_LINUX_CRIS_QEMU
 
 endchoice
 
+choice
+prompt "Routerboard model"
+default ADK_LINUX_MIPS_RB433
+depends on ADK_LINUX_MIKROTIK
+
+config ADK_LINUX_MIPS_RB411
+	bool "Mikrotik Routerboard 411"
+	select ADK_rb411
+	select ADK_KERNEL_NETDEVICES
+	select ADK_KERNEL_NET_PCI
+	select ADK_KERNEL_NETDEV_1000
+	select ADK_KERNEL_NET_ETHERNET
+	help
+	 Support for Mikrotik RB411.
+
+config ADK_LINUX_MIPS_RB433
+	bool "Mikrotik Routerboard 433"
+	select ADK_rb433
+	select ADK_KERNEL_NETDEVICES
+	select ADK_KERNEL_NET_PCI
+	select ADK_KERNEL_NETDEV_1000
+	select ADK_KERNEL_NET_ETHERNET
+	help
+	 Support for Mikrotik RB433.
+
+config ADK_LINUX_MIPS_RB532
+	bool "Mikrotik Routerboard 532"
+	select ADK_rb532
+	select ADK_KERNEL_NETDEVICES
+	select ADK_KERNEL_NET_PCI
+	select ADK_KERNEL_NET_ETHERNET
+	select ADK_KERNEL_MII
+	help
+	 Support for Mikrotik RB532.
+endchoice
+
 choice
 prompt "Device model"
 default ADK_LINUX_CRIS_FOXBOARD_CLASSIC

+ 2 - 2
target/alix1c/Makefile

@@ -14,11 +14,11 @@ ifeq ($(FS),ext2-cf)
 imageinstall: $(BIN_DIR)/$(ROOTFSTARBALL)
 	@echo
 	@echo "The RootFS tarball is: $(BIN_DIR)/$(ROOTFSTARBALL),"
-	@echo "To install everything to CompactFlash use scripts/install.sh."
+	@echo "To install everything to CompactFlash use scripts/install.sh"
 endif
 ifeq ($(FS),nfsroot)
 imageinstall: $(BIN_DIR)/$(ROOTFSTARBALL)
 	@echo
 	@echo "The RootFS tarball is: $(BIN_DIR)/$(ROOTFSTARBALL),"
-	@echo "To install everything to CompactFlash use scripts/install.sh."
+	@echo 'The nfs root tarball is: ${BIN_DIR}/${ROOTFSTARBALL}'
 endif

+ 0 - 0
target/linux/patches/cygwin-compat.patch → target/linux/patches/2.6.30/cygwin-compat.patch


+ 0 - 0
target/linux/patches/freebsd-compat.patch → target/linux/patches/2.6.30/freebsd-compat.patch


+ 11 - 0
target/linux/patches/2.6.30/mips-delay-fix.patch

@@ -0,0 +1,11 @@
+diff -Nur linux-2.6.30.orig/arch/mips/lib/delay.c linux-2.6.30/arch/mips/lib/delay.c
+--- linux-2.6.30.orig/arch/mips/lib/delay.c	2009-06-10 05:05:27.000000000 +0200
++++ linux-2.6.30/arch/mips/lib/delay.c	2009-06-12 19:11:07.000000000 +0200
+@@ -51,6 +51,6 @@
+ {
+ 	unsigned int lpj = current_cpu_data.udelay_val;
+ 
+-	__delay((us * 0x00000005 * HZ * lpj) >> 32);
++	__delay((ns * 0x00000005 * HZ * lpj) >> 32);
+ }
+ EXPORT_SYMBOL(__ndelay);

+ 0 - 0
target/linux/patches/ocf.patch → target/linux/patches/2.6.30/ocf.patch


+ 0 - 0
target/linux/patches/swconfig.patch → target/linux/patches/2.6.30/swconfig.patch


+ 0 - 0
target/linux/patches/yaffs2.patch → target/linux/patches/2.6.30/yaffs2.patch