summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* utils: Add pb-console utilJeremy Kerr2013-05-092-0/+50
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pb-udhcpc: Look for more boot optionsJeremy Kerr2013-05-091-2/+82
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* utils/pb-udhcpc: Use command-line format of pb-eventJeremy Kerr2013-05-091-2/+5
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pb-event: move send code to a separate functionJeremy Kerr2013-05-091-30/+36
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* utils/pb-event: handle event data on command lineJeremy Kerr2013-05-091-24/+76
| | | | | | | It'd be nice to avoid using printf just for the \0 characters, so allow parsing events from the command line. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: handle boot_option->device_id entirely within handlerJeremy Kerr2013-05-093-3/+4
| | | | | | | No need for parsers to populate (or forget to populate, in the case of most parsers) opt->device_id, as we should do it on finalise. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/udev: Setup event params from udev propertiesJeremy Kerr2013-05-091-16/+17
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/event: Add event_set_paramJeremy Kerr2013-05-092-2/+27
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/udev: Don't print properties of skipped devicesJeremy Kerr2013-05-091-2/+2
| | | | | | This cleans up the log output a little. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Rework config stateJeremy Kerr2013-05-081-13/+10
| | | | | | | Rather than creating boot options pre-emptively, in two paths, just do it once when we see the menuentry option. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Don't invert option discovery orderJeremy Kerr2013-05-081-1/+1
| | | | | | | | Keep options in the order that we discovered them in; this makes testing a little easier, as the options appear in the list in the same order as the config file. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Don't resend all options to all clientsJeremy Kerr2013-05-071-2/+1
| | | | | | | | | | Currently, when a new UI client connects, we send all boot options to all clients. This results in existing clients getting duplicate add events. Instead, we only want to send existing boot options to the new client. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/event-parser: correctly populate boot option resourcesJeremy Kerr2013-05-071-13/+35
| | | | | | | The user event parser should be populating the discover_boot_option's resources, not the strings in struct boot_option. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/resource.h: Add forward declarationsJeremy Kerr2013-05-071-0/+2
| | | | | | We need to define a few structs for the params of resource functions. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Makefiles: remove -I$(includedir)Jeremy Kerr2013-05-078-8/+0
| | | | | | | | | | | Currently, we include the system include dir in some of our makefiles; this is causing build problems when cross-compiling, as the system include dir may not contain files for the host. The compiler should be searing in the proper system include dir, so just remove the redundant -I. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* configure: Remove -WinlineJeremy Kerr2013-05-071-1/+1
| | | | | | | | | | | | | | | I'm getting the following errors when compiling with --enable-werror: kboot-parser.c: In function 'kboot_process_pair': ./parser-conf.h:50:21: error: inlining failed in call to 'conf_get_pair_equal': call is unlikely and code size would grow [-Werror=inline] kboot-parser.c:65:7: error: called from here [-Werror=inline] Since this is a header function, the inline isn't there for optimisation reasons; the warning is just informing us of a code optimisation decision. Drop -Winline to allow -Werror builds. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/user-event: better event debugging outputJeremy Kerr2013-05-072-10/+22
| | | | | | | | | | | | | | | We don't currently handle conf events very well: user_event remove event: device: /net/eth0 name => (null) image => (null) args => (null) This change prints the event action properly, and prints all event params. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/kboot: Fix boot_option initialisationJeremy Kerr2013-05-061-0/+1
| | | | | | | We're not populating d_opt->option, so are returning invalid boot options from the kboot parser. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/url: fix no-scheme URL parsingJeremy Kerr2013-05-063-7/+17
| | | | | | | | | | | | | | | | | | | | | | | We were incorrectly dropping the first strlen("file://") characters from URLs with no scheme: --- test/urls/data/localpath.test 2013-05-02 17:26:48.826359036 +0800 +++ /tmp/tmp.gn4JsWLw5o 2013-05-02 17:26:50.262364613 +0800 @@ -2,6 +2,6 @@ scheme file host (null) port (null) -path /test/path/to/local/file -dir /test/path/to/local/ +path ath/to/local/file +dir ath/to/local/ file file This change fixes the issue by indicating "no scheme found" by a NULL return from pb_url_find_scheme, and hadling it appropriately. We add a testcase too. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: log unresolved boot optionsJeremy Kerr2013-05-061-0/+3
| | | | | | | These are a bit of a special-case ("why isn't my boot option appearing?"), so add a log message. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: kexec harderJeremy Kerr2013-05-061-0/+15
| | | | | | | | `kexec -e` will just call shutdown, which we've already tried, so it's likely to fail. Add a further fallback to force a kexec with -e -f options. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/user-event: handle initrdsJeremy Kerr2013-05-061-0/+4
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* parsers: populate resolve_resource membersJeremy Kerr2013-05-062-8/+10
| | | | | | We're only dealing with devpath resources at the moment. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: detect unresolvable resourcesJeremy Kerr2013-05-061-2/+11
| | | | | | We don't want to call NULL resolve_resource callbacks. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* cui: Show incoming status messagesJeremy Kerr2013-05-061-5/+13
| | | | | | | Add a callback to handle and display boot status messages from the discover server. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Send boot status messages during boot()Jeremy Kerr2013-05-063-6/+55
| | | | | | | Now what we have protocol support, send status updates during the boot process. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Add discover_server_notify_boot_statusJeremy Kerr2013-05-062-0/+30
| | | | | | Add a function to the server to notify clients of boot status updates. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui: Receive boot status messagesJeremy Kerr2013-05-062-0/+20
| | | | | | | | Add support in the discover client code to handle boot status messages, and pass them to the UI thorugh a new callback ("update_status") in the client_ops. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* protocol: Add boot_status (de-)serialisation functionsJeremy Kerr2013-05-062-0/+84
| | | | | | | Add code to the pb-protocol layer to serialise and deserialise boot_status messages. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib: Add boot_status type & protocol definitionsJeremy Kerr2013-05-062-0/+11
| | | | | | Add an initial definition for boot status messages sent to clients Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/udev: remove unnecessary udevadm referencesJeremy Kerr2013-05-063-3/+0
| | | | | | Since we interact with libudev now, we no longer need to run udevadm. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/url: Add uncommitted data filesJeremy Kerr2013-05-063-0/+21
| | | | | | | Add a couple of data files for test that'd I'd ommitted from an earlier commit. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* configure: More helpful missing libudev messageGeoff Levand2013-05-051-1/+1
| | | | Signed-off-by: Geoff Levand <geoff@infradead.org>
* udev: Revove use of udev_get_sys_pathGeoff Levand2013-05-051-1/+1
| | | | | | | libudev1 changed the symbol udev_get_sys_path to be private, so remove its use in petitboot. Signed-off-by: Geoff Levand <geoff@infradead.org>
* discover: Remove unused 99-petitboot.rules fileGeoff Levand2013-05-032-3/+0
| | | | | | | With the switch of the discover server to use the libudev monitor support a rules file is no longer needed. Signed-off-by: Geoff Levand <geoff@infradead.org>
* discover: Remove empty routine udev_triggerGeoff Levand2013-05-033-7/+0
| | | | | | | | With the switch of the discover server to use the libudev enumeration support the udev_trigger() routine has becone empty and is no longer needed. Signed-off-by: Geoff Levand <geoff@infradead.org>
* discover: Update udev routines to use libudevGeoff Levand2013-05-033-90/+245
| | | | | | | Support for 'RUN+="socket:' in udev rules files has been removed in udev version 183. Update the discover server to use libudev. Signed-off-by: Geoff Levand <geoff@infradead.org>
* discover: Rename struct udev to struct pb_udevGeoff Levand2013-05-033-14/+15
| | | | | | | To avoid symbol clashes with libudev, rename struct udev to struct pb_udev. No functional changes. Signed-off-by: Geoff Levand <geoff@infradead.org>
* test/lib: Add empty list testJeremy Kerr2013-05-031-1/+17
| | | | | | | Check that the list iterators work on empty lists too. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Geoff Levand <geoff@infradead.org>
* lib/list: Fix handling of empty listsJeremy Kerr2013-05-031-5/+6
| | | | | | | | | | | The current list_for_each_entry_safe marco SEGVs on empty lists; the list_entry will give us a NULL tmp on the first iteration. This change removes the use of list_entry, as we're effectively by-passing its NULL return semantics with our own. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Geoff Levand <geoff@infradead.org>
* discover: Add PXE parserJeremy Kerr2013-04-292-1/+80
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Add configuration events & DHCP handlerJeremy Kerr2013-04-295-2/+111
| | | | | | | | | | This change adds a new event type, EVENT_ACTION_CONF. These events supply a new configuration URL that petitiboot should download and parse. With this in place, we can receive DHCP configuration events. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Add configuration methodsJeremy Kerr2013-04-298-9/+26
| | | | | | | | | | | | We'd like to be able to download petitboot configurations from other sources (not just local files), but we'll need some way to indicate to the parsers that a chunk of config data is from a specific source. This change adds "configuration methods". At present, we have only one: CONF_METHOD_LOCAL_FILE. For any incoming configuration data, we only run parsers that have registered themselves with that configuration method. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* parsers: dynamically register parsersJeremy Kerr2013-04-297-30/+39
| | | | | | | | | | | | | | | Currently, we require all parsers to be defined in an array in parsers.c. This change removes this requirement, by introducting a register_parser() macro, which adds a constructor to register the parser with the core parser infrastructure. Because each parser no longer resolves an undefined symbol, we need to use a `ld -r` object for libparser, instead of using libtool, which creates a .a (and hence has no parsers included). Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Handle unresolved resourcesJeremy Kerr2013-04-293-6/+62
| | | | | | | | | | | | This change adds an unresolved resource queue - any unresolved resources discovered by parsers are added to this queue rather than being reported to the clients. When we discover a new device, we try to resolve any resources in the queue against the new device. If resolution succeeds, we can send the option to clients. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Finalise boot options during commitJeremy Kerr2013-04-291-0/+35
| | | | | | | | | | | Once the discover context is committed, we need to turn the resources in struct discover_boot_option into strings in struct boot_option, so that the parser can display & edit the boot option. This may cause assertions if any of the boot options contain unresolved resources, we'll fix this in the next patch. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/device-handler: Initialise existing_device variableJeremy Kerr2013-04-291-1/+1
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Change parsers to emit resources rather than filenamesJeremy Kerr2013-04-2913-361/+177
| | | | | | | | | | | | | | | | | | | | | | | | This change switches the parsers over to populate the resources in discover_boot_option, rather than the string parameters in boot_option. To do this, we need a few things: * Add struct resources to discover_boot_option for the boot_image, initrd and icon data. * Have the parsers populate the resources, rather than the strings. Currently, parsers can all use the devpath resource type. * Add a resolve_resource callback to parsers; this is how the device handler will attempt to resolve resources. * Change load_file to load_url, as we should be only accessing (resolved) resources by URLs. This then allows us to remove the mount map, and associated lookup code, as well as the UUID and label links to devices. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Add URL resourcesJeremy Kerr2013-04-292-0/+13
| | | | | | | URL resources are simple: the URLs are already resolved, so not much to do here. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Add devpath resourcesJeremy Kerr2013-04-293-0/+138
| | | | | | | | | Add a generic resource type, to handle "dev:path"-style file references. This creates a duplicate of is_prefix_ignorecase, which we'll switch over to later. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
OpenPOWER on IntegriCloud