r1959 - in trunk

dslinux_amadeus at dslinux.in-berlin.de dslinux_amadeus at dslinux.in-berlin.de
Fri Oct 5 17:51:16 CEST 2007


Author: amadeus
Date: 2007-10-05 17:51:11 +0200 (Fri, 05 Oct 2007)
New Revision: 1959

Log:
Change DLDI makefile to output a second NDS file with some big applications included for extra GBA memory.

Modified: trunk/user/madplay/Makefile
===================================================================
--- trunk/user/madplay/Makefile	2007-10-05 14:24:00 UTC (rev 1958)
+++ trunk/user/madplay/Makefile	2007-10-05 15:51:11 UTC (rev 1959)
@@ -33,10 +33,8 @@
 all: $(EXEC)
 
 # This is the rule that build the mad player.
-# madplay is executed from RAM (non-XIP), because of speed.
 $(EXEC): $(OBJS)
 	$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)
-	$(CROSS)flthdr -r $@
 
 # The romfs target is also phony. It is used to copy your app
 # into the DSLinux filesystem image.

Modified: trunk/user/pixil/packages/viewml/Makefile
===================================================================
--- trunk/user/pixil/packages/viewml/Makefile	2007-10-05 14:24:00 UTC (rev 1958)
+++ trunk/user/pixil/packages/viewml/Makefile	2007-10-05 15:51:11 UTC (rev 1959)
@@ -32,6 +32,7 @@
 	rm -rf .compiled
 
 install: $(VIEWML_DIR)/src/viewml
+	$(CROSS)flthdr -z viewml/src/viewml
 	cp ./viewml/src/viewml $(INSTALL_DIR)/bin
 
 .PHONY: all clean install

Modified: trunk/user/pixil/scripts/platforms/dslinux/nxstart.sh
===================================================================
--- trunk/user/pixil/scripts/platforms/dslinux/nxstart.sh	2007-10-05 14:24:00 UTC (rev 1958)
+++ trunk/user/pixil/scripts/platforms/dslinux/nxstart.sh	2007-10-05 15:51:11 UTC (rev 1959)
@@ -13,7 +13,8 @@
 /usr/pixil/sbin/clserver &
 
 # Start the Nano-X server
-/usr/bin/nano-X -p &
+# (use PATH to search for the executable)
+nano-X -p &
 
 # Make sure that the server is calibrated
 # /usr/bin/nxcal -d /etc/pixil.calibrate

Modified: trunk/vendors/Nintendo/DLDI/Makefile
===================================================================
--- trunk/vendors/Nintendo/DLDI/Makefile	2007-10-05 14:24:00 UTC (rev 1958)
+++ trunk/vendors/Nintendo/DLDI/Makefile	2007-10-05 15:51:11 UTC (rev 1959)
@@ -4,16 +4,16 @@
 
 include $(LINUX_CONFIG)
 
-ROMFSIMG = $(IMAGEDIR)/romfs.img
-ELFIMAGE = $(IMAGEDIR)/image.elf
-FATFS	 = media
+ROMFSIMG := $(IMAGEDIR)/romfs.img
+ELFIMAGE := $(IMAGEDIR)/image.elf
+FATFS	 := media
+OPTDIR	 := opt
 
+ROMFS_DIRS := boot dev proc sbin $(FATFS)/linux $(OPTDIR) tmp 
 
-ROMFS_DIRS = boot dev proc sbin $(FATFS)/linux
+FS_DIRS := etc/rc.d home lib usr/bin usr/games usr/lib usr/share/udhcpc var/tmp var/run
 
-FS_DIRS = etc/rc.d home lib usr/bin usr/games usr/lib usr/share/udhcpc var/tmp var/run
-
-DEVICES = \
+DEVICES := \
 	tty,c,5,0      console,c,5,1      cua0,c,5,64      cua1,c,5,65  \
 	\
 	mem,c,1,1      kmem,c,1,2         null,c,1,3 \
@@ -50,63 +50,93 @@
 	\
 	zero,c,1,5     random,c,1,8       urandom,c,1,9
 
-
+.PHONY: clean
 clean:
 
+.PHONY: romfs
+	# The purpose of this target is to create a basic romfs infrastructure.
 romfs:
+	# create directories in romfs
 	-rm -r $(ROMFSDIR)
-	[ -d $(ROMFSDIR)/$$i ] || mkdir -p $(ROMFSDIR)
+	[ -d $(ROMFSDIR) ] || mkdir -p $(ROMFSDIR)
 	for i in $(ROMFS_DIRS); do \
 		[ -d $(ROMFSDIR)/$$i ] || mkdir -p $(ROMFSDIR)/$$i; \
 	done
+	# create device nodes
 	for i in $(DEVICES); do \
 		touch $(ROMFSDIR)/dev/@$$i; \
 	done
 	# these permissions are needed for openpty and family to work
 	# on non-ptmx ptys
 	chmod 620 $(ROMFSDIR)/dev/@[pt]ty[pqrsPQRS][0-9a-f],*
+	# create directories which will be symlinked to Flashcard
 	for i in $(FS_DIRS); do \
 		[ -d $(ROMFSDIR)/$(FATFS)/linux/$$i ] || mkdir -p $(ROMFSDIR)/$(FATFS)/linux/$$i; \
 	done
+	# create symlinks to Flashcard
 	$(ROMFSINST) -s $(FATFS)/linux/var /var
 	$(ROMFSINST) -s $(FATFS)/linux/lib /lib
 	$(ROMFSINST) -s $(FATFS)/linux/usr /usr
 	$(ROMFSINST) -s $(FATFS)/linux/usr/bin /bin
 	$(ROMFSINST) -s $(FATFS)/linux/home /home
 	$(ROMFSINST) -s $(FATFS)/linux/etc /etc
+	# copy some DLDI specific files to romfs
 	$(ROMFSINST) /boot/rc
 	$(ROMFSINST) /boot/inittab
 	$(ROMFSINST) /$(FATFS)/linux/etc/issue
+	# copy some Nintendo specific files to romfs
 	$(ROMFSINST) $(NDS_COMMON)/rc.common /$(FATFS)/linux/etc/rc.common
 	$(ROMFSINST) $(NDS_COMMON)/rc.defaults /$(FATFS)/linux/etc/rc.defaults
 	for f in $(NDS_COMMON)/rc.d/*; do \
 		[ -d $$f ] || $(ROMFSINST) $$f /$(FATFS)/linux/etc/rc.d/ ; \
 	done
-
+	# copy the default DHCPD script
 	$(ROMFSINST) -p +x $(NDS_COMMON)/default.script /usr/share/udhcpc/default.script
+	# create version information
 	echo "$(VERSIONSTR) -- " `date` > $(ROMFSDIR)/etc/version
+	# make sure that empty directories are not removed
 	for i in `find $(ROMFSDIR)/$(FATFS)/linux -type d -empty` ; do touch $$i/.keep; done
-image:
-	[ -d $(IMAGEDIR) ] || mkdir -p $(IMAGEDIR)
-	[ -d $(IMAGEDIR)/linux ] || mkdir -p $(IMAGEDIR)/linux
-	$(CROSS_COMPILE)flthdr -z $(ROMFSDIR)/bin/*
-	mkdir -p $(ROMFSDIR)/tmp
-	rm -r $(ROMFSDIR)/bin
+
+.PHONY: finishrom
+	# This target is called as first step to create an image.
+	# The romfs is populated and has to be finished.
+finishrom:
+	# remove the symlink to $(FATFS)/linux/usr/bin where all these applications are now
+	rm $(ROMFSDIR)/bin
+	# create a new empty bin directory
 	mkdir $(ROMFSDIR)/bin
+	# Copy busybox symlinks to internal RAM.
 	-for i in `sort $(ROOTDIR)/user/busybox/busybox.links` ; do\
 		j=`basename $$i` ; \
 		mv $(ROMFSDIR)/$(FATFS)/linux/usr/bin/$$j $(ROMFSDIR)/bin ; \
 	done
+	# Copy files to internal RAM. These files are needed to boot and mount the flashcard.
 	-mv $(ROMFSDIR)/$(FATFS)/linux/usr/bin/busybox $(ROMFSDIR)/bin
-	-mv $(ROMFSDIR)/$(FATFS)/linux/usr/bin/mount $(ROMFSDIR)/bin
-	-mv $(ROMFSDIR)/$(FATFS)/linux/usr/bin/sh $(ROMFSDIR)/bin
 	-mv $(ROMFSDIR)/$(FATFS)/linux/usr/bin/login $(ROMFSDIR)/bin
 	-mv $(ROMFSDIR)/$(FATFS)/linux/usr/bin/init $(ROMFSDIR)/bin
 	-mv $(ROMFSDIR)/$(FATFS)/linux/usr/bin/autologin $(ROMFSDIR)/bin
-	$(CROSS_COMPILE)flthdr -Z $(ROMFSDIR)/bin/*
+	# If we have external RAM, we can spend some of our precious internal RAM
+        # to speed up some applications.
+	-cp -p $(ROMFSDIR)/$(FATFS)/linux/usr/bin/nano-X $(ROMFSDIR)/$(OPTDIR)
+	-cp -p $(ROMFSDIR)/$(FATFS)/linux/usr/bin/madplay $(ROMFSDIR)/$(OPTDIR)
+
+.PHONY: setupimage
+	# Setup the basic image directories
+setupimage: finishrom
+	# create the image directory
+	[ -d $(IMAGEDIR) ] || mkdir -p $(IMAGEDIR)
+	# create the linux directory for the flashcard
+	[ -d $(IMAGEDIR)/linux ] || mkdir -p $(IMAGEDIR)/linux
 	-rm -r $(IMAGEDIR)/linux
+	# move the files for the flashcard out of the romfs
 	mv $(ROMFSDIR)/$(FATFS)/linux $(IMAGEDIR)
-	genromfs -v -V "ROMdisk" -f $(ROMFSIMG) -d $(ROMFSDIR)
+
+.PHONY: dslinux dslinuxm
+	# dslinux(m) builds the image from the romfs.
+	# In the (m) version, the $(OPTDIR) is included.
+dslinux-y := -x /$(OPTDIR)
+dslinux dslinuxm: setupimage
+	genromfs -v -V "ROMdisk" -f $(IMAGEDIR)/$@.img -d $(ROMFSDIR) $($@-y)
 	BSS=`$(CROSS_COMPILE)objdump --headers $(ROOTDIR)/$(LINUXDIR)/linux | \
 	grep .bss` && \
 	BSSADDR=`set -- $${BSS} ; echo 0x$${4}` && \
@@ -114,14 +144,19 @@
 	ADDR=`echo $${BSSADDR} $${BSSSIZE} | \
 	perl -ane 'printf "0x%x\n",hex($$F[0]) + hex($$F[1])' ` && \
 	echo "BSS=$${BSSADDR},$${BSSSIZE} ADDR=$${ADDR}" && \
-	$(CROSS_COMPILE)objcopy --add-section=.romfs=$(ROMFSIMG) \
+	$(CROSS_COMPILE)objcopy --add-section=.romfs=$(IMAGEDIR)/$@.img \
 	--adjust-section-vma=.romfs=$${ADDR} --no-adjust-warnings \
 	--set-section-flags=.romfs=alloc,load,data   \
-	$(ROOTDIR)/$(LINUXDIR)/linux $(ELFIMAGE) 2> /dev/null && \
-	$(CROSS_COMPILE)objcopy -O binary $(ELFIMAGE) $(IMAGEDIR)/arm9.bin && \
-	ndstool -c $(IMAGEDIR)/dslinux.nds -9 $(IMAGEDIR)/arm9.bin \
+	$(ROOTDIR)/$(LINUXDIR)/linux $(IMAGEDIR)/$@.elf 2> /dev/null && \
+	$(CROSS_COMPILE)objcopy -O binary $(IMAGEDIR)/$@.elf $(IMAGEDIR)/arm9.bin && \
+	ndstool -c $(IMAGEDIR)/$@.nds -9 $(IMAGEDIR)/arm9.bin \
 		-r9 0x02000000 -e9 0x02000000  \
 		-7 $(ROOTDIR)/$(LINUXDIR)/arch/arm/mach-nds/arm7.bin \
 	       	-r7 0x03800000 -e7 0x03800000  \
-		-b $(NDS_COMMON)/tux.bmp "DSLinux;Port of Linux;to the DS!" && \
-	( cd $(IMAGEDIR); tar -cvzf dslinux-dldi.tgz linux dslinux.nds ) ;
+		-b $(NDS_COMMON)/tux.bmp "DSLinux;Port of Linux;to the DS!"
+
+.PHONY: image
+	# master command for image generation. Delegates all of the hard stuff to
+	# other targets and collect the results.
+image:	dslinux dslinuxm
+	( cd $(IMAGEDIR); tar -cvzf dslinux-dldi.tgz linux dslinux.nds dslinuxm.nds) ;

Modified: trunk/vendors/Nintendo/common/rc.common
===================================================================
--- trunk/vendors/Nintendo/common/rc.common	2007-10-05 14:24:00 UTC (rev 1958)
+++ trunk/vendors/Nintendo/common/rc.common	2007-10-05 15:51:11 UTC (rev 1959)
@@ -13,7 +13,8 @@
 	echo "to create /etc/rc.conf to customise your dslinux installation."
 fi
 
-PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
+# /opt is BEFORE /usr/bin to speed up some applications
+PATH=/bin:/sbin:/opt:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
 export PATH
 
 # create /etc/passwd if it doesn't exist




More information about the dslinux-commit mailing list