From mboxrd@z Thu Jan 1 00:00:00 1970 From: Albert ARIBAUD Date: Mon, 4 Feb 2013 17:01:20 +0100 Subject: [U-Boot] common/cmd_disk.c doesn't actually define any "commands" In-Reply-To: References: <20130204075343.1565460p912ggt44@crashcourse.ca> <20130204152641.72e869ca@lilith> <20130204100420.36086kek4ftusc0s@crashcourse.ca> <20130204163017.17643abc@lilith> Message-ID: <20130204170120.791778b1@lilith> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Mats, On Mon, 4 Feb 2013 15:42:17 +0000, Mats K?rrman wrote: > Hi Albert, > > Albert ARIBAUD wrote: > > Maybe, but the problem you state is not about cmd_disk (or I am > > missing the point). USB commands are in USB related files, e.g. > > do_usbboot() is in cmd_usb.c, so that's where a conditional should be > > put if you want to compile the command out, rather than in cmd_disk, > > which does not add to the U-Boot commands table at all. > > The cmd_usb file contains all the other USB commands through "do_usb" > and "usbboot" through "do_usbboot" that is just a forward to "common_diskboot". > Maybe the major miss-feature here is that you get usbboot and a bunch > of extra code, just because you want to be able to read USB memories. > This could of course be fixed by revising the ifdefs in cmd_usb etc. > instead but in that case I support Robert in his remark about the file naming ;) Actually there is no way to fulfill your need to make the usbboot command conditionally compiled by modifying cmd_disk, because cmd_disk simply does not define any command -- so you will have to put the conditionals in cmd_usb.c no matter what. Now you may want to also conditionally compile cmd_disk.c only of USB, SCSI or IDE require it, but this you can and should do in the Makefile; remember cmd_disk.c is only useful to provide common_diskboot(), so either you completely compile it, or you don't compile it at all. (now this could be different if we use gcc's -fdata-sections, -ffunction-sections along with ld's --gc-sections, as then we could argue that even if compiled, cmd_disk.c would be linked out if unreferenced.) As for the name, Robert's issue stems from his assumption that a file with cmd_ necessarily declares a listable U-Boot command. I assume that files with cmd_ contain command-related code not necessarily including a listable command -- for instance here, a command execution function which is mapped to a (set of three) listable command(s) elsewhere. > BR // Mats Amicalement, -- Albert.