Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(873)

Unified Diff: src/scripts/build_image

Issue 1594020: Replace "mount -o loop" with explict losetup use in build_image. (Closed)
Patch Set: Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scripts/build_image
diff --git a/src/scripts/build_image b/src/scripts/build_image
index d52d1debefe18ce1bfe62954453dc35c119103cb..5aa7c75d8f0386b4d60547ca4c3f36601065148b 100755
--- a/src/scripts/build_image
+++ b/src/scripts/build_image
@@ -71,6 +71,7 @@ BOARD_ROOT="${FLAGS_build_root}/${BOARD}"
LOOP_DEV=
STATEFUL_LOOP_DEV=
+ESP_LOOP_DEV=
# What cross-build are we targeting?
. "${BOARD_ROOT}/etc/make.conf.board_setup"
@@ -127,6 +128,8 @@ cleanup_stateful_fs_loop() {
cleanup_esp_loop() {
sudo umount "$ESP_DIR"
+ sleep 1 # me belong cargo
adlr 2010/04/08 18:22:26 write a better comment?
Bill Richardson 2010/04/08 18:23:48 I *knew* you'd say something about this!
+ sudo losetup -d "$ESP_LOOP_DEV"
}
cleanup() {
@@ -141,7 +144,7 @@ cleanup() {
cleanup_rootfs_loop
fi
- if [[ -n "$ESP_DIR" ]]; then
+ if [[ -n "$ESP_LOOP_DEV" ]]; then
cleanup_esp_loop
fi
@@ -345,19 +348,30 @@ ESP_IMG=${OUTPUT_DIR}/esp.image
ESP_BLOCKS=16384
/usr/sbin/mkfs.vfat -C ${OUTPUT_DIR}/esp.image ${ESP_BLOCKS}
ESP_DIR=${OUTPUT_DIR}/esp
-mkdir -p ${ESP_DIR}
-sudo mount -o loop ${ESP_IMG} ${ESP_DIR}
-sudo mkdir -p ${ESP_DIR}/efi/boot
-sudo grub-mkimage -p /efi/boot -o ${ESP_DIR}/efi/boot/bootx64.efi \
+ESP_LOOP_DEV=$(sudo losetup -f)
+if [ -z "$ESP_LOOP_DEV" ] ; then
+ echo "No free loop device. Free up a loop device or reboot. exiting. "
+ exit 1
+fi
+mkdir -p "${ESP_DIR}"
+sudo losetup "${ESP_LOOP_DEV}" "${ESP_IMG}"
+sudo mount "${ESP_LOOP_DEV}" "${ESP_DIR}"
+sudo mkdir -p "${ESP_DIR}/efi/boot"
+sudo grub-mkimage -p /efi/boot -o "${ESP_DIR}/efi/boot/bootx64.efi" \
part_gpt fat ext2 normal boot sh chain configfile linux
-sudo cp ${ROOT_FS_DIR}/boot/vmlinuz ${ESP_DIR}/efi/boot/vmlinuz
-cat <<EOF | sudo dd of=${ESP_DIR}/efi/boot/grub.cfg
+sudo cp "${ROOT_FS_DIR}/boot/vmlinuz" "${ESP_DIR}/efi/boot/vmlinuz"
+cat <<EOF | sudo dd of="${ESP_DIR}/efi/boot/grub.cfg"
set timeout=2
set default=0
-menuentry "32-bit serial" {
+menuentry "serial debug" {
linux /efi/boot/vmlinuz earlyprintk=serial,ttyS0,115200 i915.modeset=0 console=ttyS0,115200 acpi=off init=/sbin/init boot=local rootwait root=/dev/sda3 ro noresume noswap loglevel=7
}
+
+menuentry "normal" {
+ linux /efi/boot/vmlinuz quiet console=tty2 init=/sbin/init boot=local rootwait root=/dev/sda3 ro noresume noswap i915.modeset=1 loglevel=1
+}
+
EOF
# Enable dev mode on the target system and re-run ldconfig
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698