Build: Use a separate byproduct name for the GRUB disk image (#2424)

The grub-image target no longer conflicts with normal image target.
This unbreaks using CMake with Ninja.

Fixes #2423.
This commit is contained in:
etaIneLp 2020-05-28 04:08:38 -04:00 committed by GitHub
parent 7bc871ca8d
commit 330aecb5d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 7 deletions

View file

@ -16,7 +16,7 @@ add_custom_target(run
add_custom_target(grub-image add_custom_target(grub-image
COMMAND ${CMAKE_COMMAND} -E env "SERENITY_ROOT=${CMAKE_SOURCE_DIR}" ${CMAKE_SOURCE_DIR}/Meta/build-image-grub.sh COMMAND ${CMAKE_COMMAND} -E env "SERENITY_ROOT=${CMAKE_SOURCE_DIR}" ${CMAKE_SOURCE_DIR}/Meta/build-image-grub.sh
BYPRODUCTS ${CMAKE_BINARY_DIR}/_disk_image BYPRODUCTS ${CMAKE_BINARY_DIR}/grub_disk_image
USES_TERMINAL USES_TERMINAL
) )

View file

@ -17,12 +17,12 @@ At present there is no real GPU support so don't expect OpenGL, Vulkan nor accel
## Creating a Serenity GRUB disk image ## Creating a Serenity GRUB disk image
Before creating a Serenity disk image, you need to build the OS as described in the [SerenityOS build instructions](https://github.com/SerenityOS/serenity/blob/master/Documentation/BuildInstructions.md). Follow those instructions up to and including running **make install**. After the OS has built, run **sudo make grub-image** to replace the qemu **_disk_image** file in the Build directory with one that has GRUB2 installed that can be booted on a real PC. Before creating a Serenity disk image, you need to build the OS as described in the [SerenityOS build instructions](https://github.com/SerenityOS/serenity/blob/master/Documentation/BuildInstructions.md). Follow those instructions up to and including running **make install**. After the OS has built, run **sudo make grub-image** to create a new file called **grub_disk_image** that has GRUB2 installed that can be booted on a real PC.
The final step is copying **_disk_image** onto the disk you wish to boot Serenity off using a command such as: The final step is copying **grub_disk_image** onto the disk you wish to boot Serenity off using a command such as:
``` ```
$ sudo dd if=_disk_image of=/dev/sdx bs=8M $ sudo dd if=grub_disk_image of=/dev/sdx bs=8M
``` ```
Replace **/dev/sdx** with the target device. The **bs=8M** argument is optional but will speed up the data transfer. Replace **/dev/sdx** with the target device. The **bs=8M** argument is optional but will speed up the data transfer.

View file

@ -22,12 +22,12 @@ fi
echo "using grub-install at ${grub}" echo "using grub-install at ${grub}"
echo "setting up disk image..." echo "setting up disk image..."
dd if=/dev/zero of=_disk_image bs=1M count="${DISK_SIZE:-800}" status=none || die "couldn't create disk image" dd if=/dev/zero of=grub_disk_image bs=1M count="${DISK_SIZE:-800}" status=none || die "couldn't create disk image"
chown "$SUDO_UID":"$SUDO_GID" _disk_image || die "couldn't adjust permissions on disk image" chown "$SUDO_UID":"$SUDO_GID" grub_disk_image || die "couldn't adjust permissions on disk image"
echo "done" echo "done"
printf "creating loopback device... " printf "creating loopback device... "
dev=$(losetup --find --partscan --show _disk_image) dev=$(losetup --find --partscan --show grub_disk_image)
if [ -z "$dev" ]; then if [ -z "$dev" ]; then
die "couldn't mount loopback device" die "couldn't mount loopback device"
fi fi