- board = find_board(board_id);
- if (board == NULL) {
- ERR("unknown/unsupported board id \"%s\"", board_id);
+ if (board_id) {
+ board = find_board(board_id);
+ if (board == NULL) {
+ ERR("unknown/unsupported board id \"%s\"", board_id);
+ return -1;
+ }
+ if (layout_id == NULL)
+ layout_id = board->layout_id;
+
+ hw_id = board->hw_id;
+ hw_rev = board->hw_rev;
+ } else {
+ if (layout_id == NULL) {
+ ERR("flash layout is not specified");
+ return -1;
+ }
+ hw_id = strtoul(opt_hw_id, NULL, 0);
+
+ if (opt_hw_rev)
+ hw_rev = strtoul(opt_hw_rev, NULL, 0);
+ else
+ hw_rev = 1;
+ }
+
+ layout = find_layout(layout_id);
+ if (layout == NULL) {
+ ERR("unknown flash layout \"%s\"", layout_id);