Commit Graph

97 Commits (a6b7c3e672764858fd294998406ae791f5964b4a)

Author SHA1 Message Date
李国 a6b7c3e672 x86: generate EFI platform bootable images
Add EFI platform bootable images for x86 platforms. These images can
also boot from legacy BIOS platform.

EFI System Partition need to be fat12/fat16/fat32 (not need to load
filesystem drivers), so the first partition of EFI images are not ext4
filesystem any more.

GPT partition table has an alternate partition table, we did not
generate it. This may cause problems when use these images as qemu disk
(kernel can not find rootfs), we pad enough sectors will be ok.

Signed-off-by: 李国 <uxgood.org@gmail.com>
[part_magic_* refactoring, removed genisoimage checks]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
4 years ago
李国 d9228514cc grub2: make some change to add efi platform support
1.generate boot image at Package/install section
2.move boot image to $(STAGING_DIR_IMAGE)/grub2/
3.add efi variant to support efi platform

Signed-off-by: 李国 <uxgood.org@gmail.com>
4 years ago
Paul Spooren 258f070d1a x86: fix missing squashfs and ext4 rootfs images
The previous rework of x86 image creation done in commit cb007a7bf6
("x86: switch image generation to new code") removed images of separate
squashfs and ext4 filesystems which are handy for example in testing
under QEMU.

So this patch adds back creation of those missing rootfs images for ext4
and squashfs based filesystems.

Fixes: cb007a7bf6 ("x86: switch image generation to new code")
Signed-off-by: Paul Spooren <mail@aparcar.org>
[commit subject and description tweaks]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
4 years ago
Paul Spooren 6fcca31fc3 x86: fix padding in images
The previous rework of x86 image creation done in commit  cb007a7bf6
("x86: switch image generation to new code") broke the padding in
images.

 sda: p2 size 212992 extends beyond EOD, enabling native capacity
 sda: p2 size 212992 extends beyond EOD, truncated
 sd 0:0:0:0: [sda] Attached SCSI disk
 SQUASHFS error: squashfs_read_data failed to read block 0x2cc556
 unable to read id index table
 VFS: Cannot open root device "PARTUUID=ac5c9cd8-02" or unknown-block(8,2): error -5
 Please append a correct "root=" boot option; here are the available partitions:
 0800           19761 sda
  driver: sd
   0801           16384 sda1 ac5c9cd8-01

   0802            2865 sda2 ac5c9cd8-02

 Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(8,2)

Tested with x86/64 with Docker (squashfs), qemustart (ext4/squashfs) and
virtualbox (ext4/squashfs).

Ref: FS#2935
Fixes: cb007a7bf6 ("x86: switch image generation to new code")
Suggested-by: Russell Senior <russell@personaltelco.net>
Signed-off-by: Paul Spooren <mail@aparcar.org>
[commit subject and description tweaks]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
4 years ago
Paul Spooren 3f3a754c68 x86/geode: add missing include after rebase
The x86 image generation was refacted via cb007a7bf6 and accidently not
included `geode.mk` when selected as subtarget.

Now the file is included and image compilation for x86/geode works
again.

Thanks to Russell Senior <russell@personaltelco.net> for reporting the
problem and suggesting a patch!

Signed-off-by: Paul Spooren <mail@aparcar.org>
4 years ago
Paul Spooren 30a2488290 x86: allow non gzipped images
The previous image generation code would always gzipped images.

This patch changes the behaviour and only compresses images when
selected in menuconfig.

Signed-off-by: Paul Spooren <mail@aparcar.org>
4 years ago
Paul Spooren 33cc7e763b x86: use qemu-image command from image-commands.mk
The `qemu-image` command converts images to the specified type and
reduces redundant code.

Adaption from Alexander Couzens <lynxis@fe80.eu> work[0].

[0]: https://git.openwrt.org/?p=openwrt/staging/lynxis.git;a=blob;f=target/linux/x86/image/Makefile;h=83b8140b7aefbe708fd09c9c61827e7e39bda8b4;hb=416cccf398e9589e3de386e05b61b1c46cace20d#l51

Signed-off-by: Paul Spooren <mail@aparcar.org>
4 years ago
Paul Spooren cb007a7bf6 x86: switch image generation to new code
This commit introduces few related changes which need to be done in
single commit to keep images buildable between git revisions. In result
it retains all previous image creation possibilities with slight name
change of generated images. Brief summary of the commit:

* Split up image generation recipe to smaller chunks to make it more
  generic and reusable.

* Make iso images x86 specific and drop their definition as root
  filesystem.

* Convert image creation process to generic code specified in image.mk.

* Make geode subtarget inherit features from the main target instead of
  redefining them.

* For subtargets create device definitions with basic packages set.

Signed-off-by: Tomasz Maciej Nowak <tomek_n@o2.pl>
[rebased]
Signed-off-by: Paul Spooren <mail@aparcar.org>
4 years ago
Paul Spooren 5a5df62d95 x86/grub2: move grub2 image creation to package
Let the grub2 package take care of creating installable grub2 images,
this will allow creating grub2 images without first calling x86 image
generation recipe. Also as side effect, since those images are now
shared, it'll reduce the number of calling grub-mkimage.

Signed-off-by: Tomasz Maciej Nowak <tomek_n@o2.pl>
[rebase, adjusted commit title]
Signed-off-by: Paul Spooren <mail@aparcar.org>
4 years ago
Tomasz Maciej Nowak b322243d2f x86: add bootloader upgrade on sysupgrade
Currently bootloader always stays on the same version as when first
written to boot medium (not true if partition layout changed, which will
trigger sysupgrade process to write full disk image). That creates
inconveniences as it always stays with same features or/and bugs. Users
wishing to add support to additional modules or new version, would need
to write the whole image, potentially destroying previous system
configuration. To fix these, this commit adds additional routine to
sysupgrade which upgrades unconditionally the bootloader to the latest
state provided by OpenWrt.

Signed-off-by: Tomasz Maciej Nowak <tomek_n@o2.pl>
4 years ago
Tomasz Maciej Nowak 48873ace4e x86: image: cleanup before creating image
There can be some leftovers from other image recipes, if the same
directory names are used and multiply image types are selected.
Therefore remove directories used in the recipe, before contents for the
image are prepared.

Signed-off-by: Tomasz Maciej Nowak <tomek_n@o2.pl>
4 years ago
John Sommerville 6041eb9547 build: build proper VMDK formats for ESXI 6.5
VMWare ESXI 6.5 and above is not compatible with
subformat=monolithicSparse (The default qemu-img convert -O VMDK option).
Monolithic Sparse vmdk can be imported, but issues occur when running
sysupgrade with new images and other tasks that modify the file system
(issues like Kernel panics, reboot loops, sometimes crashing the Host ESXI
box).

This change creates an additional VMDK output file for ESXI that sets the
subformat to monlithicFlat, and the adapter_type to the SCSI lsilogic
controller.

This change existed back on:
25e36d379e

But it looks like the change was removed when refactoring occurred with:
5f6a2732f892b6229473576d89cc963ae9c97d5d

Signed-off-by: John Sommerville <jsommerville@untangle.com>
4 years ago
Paul Spooren e97113d5e1 x86,tegra,mvebu: image: use common reproducible IMG_PART_SIGNATURE
These targets are currently using more or less same SIGNATURE variable
which provides unique partition ID/signature, so it makes sense to
refactor it out into common IMG_PART_SIGNATURE variable which could be
reused by all targets.

This is another step in the direction of reproducible OpenWrt images.

Signed-off-by: Paul Spooren <mail@aparcar.org>
[split into separate commit, renamed to IMG_PART_SIGNATURE]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
5 years ago
Florian Eckert 33411ee919 target/x86/image: use qemu-img from STAGING_DIR_HOST
The host tool package qemu is build for the target x86. The installed tool
qemu-img is needed to build vdi or vmdk images. In the image Makefile we
use however the host installed qemu-img command and not the tool from the
buildsystem. This commit force to use the already build qemu-img command
from the openwrt toolchain.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
5 years ago
Petr Štetiar a17d9482f5 x86: image: fix small disk space in squashfs overlay
Current squashfs snapshot images are improperly padded by just 128k,
which doesn't correspond with TARGET_ROOTFS_PARTSIZE=128 default config
option, leading to following:

 Filesystem                Size      Used Available Use% Mounted on
 /dev/root                 2.5M      2.5M         0 100% /rom
 /dev/loop0               85.0K      9.0K     71.0K  11% /overlay
 overlayfs:/overlay       85.0K      9.0K     71.0K  11% /

Signed-off-by: Petr Štetiar <ynezz@true.cz>
5 years ago
Petr Štetiar 438a2c5f4a rb532,x86: image: use new IMG_COMBINED and IMG_ROOTFS vars
In `build: image: Add IMG_ROOTFS and IMG_COMBINED variables` we've added
this new variables so switch to them now.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
5 years ago
Petr Štetiar 2109156b79 x86: image: remove TARGET_IMAGES_PAD option and force padding
Currently we're producing unusable x86 combined squashfs images
(18.06.1, 18.06.2 and snapshots) as we don't enable TARGET_IMAGES_PAD,
thus providing very small space for the overlay filesystem, leading to
the following with OpenWrt 18.06.1 r7258-5eb055306f images on x86 QEMU:

 root@(none):/# mount | egrep 'root|overlay'
  /dev/root on /rom type squashfs
  /dev/loop0 on /overlay type ext4
  overlayfs:/overlay on / type overlay

 root@(none):/# df -h | egrep 'root|overlay|Size'
  Filesystem                Size      Used Available Use% Mounted on
  /dev/root                 2.5M      2.5M         0 100% /rom
  /dev/loop0              113.0K      8.0K     97.0K   8% /overlay
  overlayfs:/overlay      113.0K      8.0K     97.0K   8% /

We should rather ensure proper image padding in image generation code
and we shouldn't rely on config options in order to generate usable
images.

So this patch removes TARGET_IMAGES_PAD config option and enforces
padding on combined images.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
5 years ago
Tomasz Maciej Nowak 55b808e0c4 x86: image: add test module to bootloader
It was previously added in 546fced, which was part of "intel-microcode:
load as early as possible" series.
Unfortunately the conditionals added to GRUB config caused error on boot,
because on sysupgrade, bootloader is not updated and is left with old
features/modules. Since this module is needed for early microcode load
and transition to this needs to be done step by step, enable the test
module now, so that every newly created image has it already embedded.

Signed-off-by: Tomasz Maciej Nowak <tomek_n@o2.pl>
5 years ago
Tomasz Maciej Nowak bb0e4f9fb0 build: remove leftovers from previous x86 commits
VBoxManage is not used and the image is created with proper permisions:
0f5d0f6  image: use internal qemu-img for vmdk and vdi images drop host
         dependencies on qemu-utils and VirtualBox

Unreachable config symbols:
9e0759e  x86: merge all geode based subtargets into one

No need to define those symbols since x86_64 is subtarget of x86:
196fb76  x86: make x86_64 a subtarget instead of a standalone target

Unreachable config symbols, so remove GRUB_ROOT:
371b382  x86: remove the xen_domu subtarget

Signed-off-by: Tomasz Maciej Nowak <tomek_n@o2.pl>
5 years ago
John Crispin c6aa4f53e8 Revert "x86: add intel microcode entries to grub config"
This reverts commit 546fced2a2.

Signed-off-by: John Crispin <john@phrozen.org>
6 years ago
Tomasz Maciej Nowak 546fced2a2 x86: add intel microcode entries to grub config
Create initrd enries for x86 images, that'll load intel microcode as
early as possible. To achieve that the test module for grub is enabled
which provides shell-like conditionals. Also restrict the late load of
microcode to AMD processors.

Signed-off-by: Tomasz Maciej Nowak <tomek_n@o2.pl>
6 years ago
Tomasz Maciej Nowak 51e199fbe8 x86: add packages files to image bootfs
Add files to bootfs image from selected as built-in packages, which want
to install files to targets boot file system.

Signed-off-by: Tomasz Maciej Nowak <tomek_n@o2.pl>
6 years ago
Kjel Delaey 8492ad0cc1 x86: add support to set GRUB menu entry title
$ make menuconfig

        Target Images -> Title for the menu entry in GRUB

Signed-off-by: Kjel Delaey <kjel_delaey@hotmail.com>
6 years ago
Stijn Tintel a576ed5437 scripts/gen_image_generic.sh: move from x86/image
The script can also be useful for other targets.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
7 years ago
Felix Fietkau 7887a46f45 build: enable gzipping of images on x86 even if ext4 is disabled
There is lots of padding between the boot partition and the rootfs, so
gzipping is helpful here

Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Philip Prindeville 7fe5963be0 build: allow specifying flow-control to grub on serial console
On the more sophisticated (i.e. deeper FIFO) serial controllers,
flow-control might be needed to avoid dropping output.

Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
7 years ago
Rafał Miłecki 425f958830 x86: image: drop duplicated copy of bzImage into vmlinuz
It's already done once few lines earlier in the Image/Build/iso.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
7 years ago
Rafał Miłecki f5d403488e x86: image: drop unneeded grub call
It appears there isn't any Image/Build/grub/* define so this step looks
redundant.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
7 years ago
Rafał Miłecki 9a267e6a4b x86: image: drop unused ROOTDELAY variable
It's unused since commit 7427007193 ("x86: remove the olpc subtarget,
it has been unmaintained for a long time").

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
7 years ago
Alexandru Ardelean 81a2f9d6f8 target/linux/x86/image: add explicit prefix to grub-mkimage command
In the latest version of grub-mkimage, the prefix option is mandatory.
Not supplying it fails with:
```
Prefix not specified (use the -p option).
```

In grub-2.02-beta2 a DEFAULT_DIRECTORY was defined
in `include/grub/osdep/hostfile_unix.h` as:
```
 #if defined (__NetBSD__)
 /* NetBSD uses /boot for its boot block.  */
 # define DEFAULT_DIRECTORY  "/"GRUB_DIR_NAME
 #else
 # define DEFAULT_DIRECTORY  "/"GRUB_BOOT_DIR_NAME"/"GRUB_DIR_NAME
 #endif
```

Where:
* GRUB_BOOT_DIR_NAME == boot
* GRUB_DIR_NAME == grub

This was used if the -p option was omitted.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
8 years ago
Wilfried Klaebe 81e3c022e0 x86: fix GRUB_ROOT for Xen subtarget
Change grub's root device to xen/xvda,msdos1 for the x86_xen_domu
target so that it will boot without further changes.

Signed-off-by: Wilfried Klaebe <w+lede-project@chaos.in-kiel.de>
[Jo-Philipp Wich: fixed and rebased patch from FS#264, added subject]
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
8 years ago
Felix Fietkau be59b1718d x86: drop the use of block2mtd, use ext4/f2fs as overlay filesystem
Signed-off-by: Felix Fietkau <nbd@nbd.name>
8 years ago
Felix Fietkau eceb6b924a x86: remove obsolete reference to $(PROFILE)
Signed-off-by: Felix Fietkau <nbd@nbd.name>
8 years ago
Felix Fietkau d5ee23ee27 x86: stop relying on hexdump for image build signature
Use perl to generate random number instead.
See https://github.com/freifunk-gluon/gluon/issues/811

Signed-off-by: Felix Fietkau <nbd@nbd.name>
8 years ago
Felix Fietkau 825ef34f15 x86: remove defunct etherboot image building code
Signed-off-by: Felix Fietkau <nbd@nbd.name>
8 years ago
Felix Fietkau 2e5f84fc10 x86: remove legacy script/makefile code for rdc devices
Signed-off-by: Felix Fietkau <nbd@nbd.name>
8 years ago
Felix Fietkau 303a241478 x86: enable grub at_keyboard support for x86_64
Signed-off-by: Felix Fietkau <nbd@nbd.name>
8 years ago
John Crispin 096b3759a9 build: Prevent more gzip timestamps
To improve reproducibility, prevent the inclusion of timestamps
in the gzip header.

Signed-off-by: Reiner Herrmann <reiner@reiner-h.de>

SVN-Revision: 46361
9 years ago
Felix Fietkau 09aad60610 x86: remove bogus bzImage copy that breaks initramfs+no-initramfs builds
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 45114
9 years ago
Felix Fietkau 7427007193 x86: remove the olpc subtarget, it has been unmaintained for a long time
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 45083
9 years ago
Jo-Philipp Wich 02e2548b84 x86: use PARTUUID instead explicitly specifying the device by default
This changes the x86 image generation to match x86_64, using the PARTUUID for
the rootfs instead of explicitly configuring the device.

It unbreaks KVM with VirtIO, which uses /dev/vda2 instead of /dev/sda2.

Tested in QEMU/KVM with VirtIO, VirtualBox and VMware.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>

SVN-Revision: 44966
9 years ago
Felix Fietkau 578aa97f8c x86: disable rts/cts for serial console in grub - fixes net48xx boot issues
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 44753
9 years ago
Felix Fietkau c718d0b10c x86: remove the arbitrary limitation of vmware/virtualbox images to ext4, select TARGET_IMAGES_PAD instead
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 41763
10 years ago
Felix Fietkau f02e3a2a4a x86: try harder to attach block2mtd to fix boot issues on devices with longer delays
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 40444
10 years ago
Imre Kaloz cc49f7c6e9 move most of the x86 image generation options to the main file
Signed-off-by: Imre Kaloz <kaloz@openwrt.org>

SVN-Revision: 39206
11 years ago
Felix Fietkau 09f4018b2e x86: Fix CONFIG_X86_GRUB_SERIAL=""
With

    .config:CONFIG_X86_GRUB_SERIAL=""

which (AFAICT) is the way to tell GRUB not to use a serial console, in

    target/linux/x86/image/Makefile:ifneq ($(CONFIG_X86_GRUB_SERIAL),)

$(CONFIG_X86_GRUB_SERIAL) expands to `""' (a literal double double-quote),
making the condition unconditionally false.

This patch fixes the situation by passing CONFIG_X86_GRUB_SERIAL through
qstrip before testing.

Signed-off-by: Tamas TEVESZ <ice@extreme.hu>

SVN-Revision: 37749
11 years ago
Florian Fainelli 6a4f2922f6 targets: prepare for supporting normal and initramfs images
In order to support both normal images and initramfs, ensure that each
target sets KERNELNAME properly so that the generic kernel building code
can copy the corresponding files over $(KDIR) with the appropriate
extension. Update the various paths to the kernel and wrapper images
from $(LINUX_DIR)/arch/$(ARCH)/boot/$(foo) to $(KDIR)/$(foo).

Signed-off-by: Florian Fainelli <florian@openwrt.org>

SVN-Revision: 37049
11 years ago
Jo-Philipp Wich 7399df1d69 x86: explicitely pass staging directory to grub-mkimage instead of relying on build time defaults (#12821)
SVN-Revision: 35200
11 years ago
Felix Fietkau 46288bf98e x86: use $(strip) for the at_keyboard check
SVN-Revision: 34127
12 years ago
Felix Fietkau 0a9e05fb0e x86: only enable at_keyboard for the generic and kvm_guest subtargets to avoid hangs on alix2 and others (thx, russell)
SVN-Revision: 34126
12 years ago