Mercurial > hg > aboriginal
comparison system-image.sh @ 1728:b89324905ca2 draft
Giant redo to put simple-root-filesystem in initmpfs.
NO_NATIVE_COMPILER and NO_ROOTDIRS went away, kernel built moved back into
system-image.sh, old root-filesystem.sh and root-image.sh are no longer used,
I need to fix up several things (chroot-splice.sh, the lfs-bootstrap build
is breaking in mpfr, haven't tested this on all targets yet... but the basics
are in.
author | Rob Landley <rob@landley.net> |
---|---|
date | Fri, 06 Feb 2015 01:51:54 -0600 |
parents | 29109240fd6d |
children | 7f1b9fb1099e |
comparison
equal
deleted
inserted
replaced
1727:45c936d93711 | 1728:b89324905ca2 |
---|---|
1 #!/bin/bash | 1 #!/bin/bash |
2 | 2 |
3 # Combine a filesystem image and kernel with emulator launch scripts. | 3 # Combine a filesystem image and kernel with emulator launch scripts. |
4 | |
5 # Package a root filesystem directory into a filesystem image file | |
4 | 6 |
5 source sources/include.sh || exit 1 | 7 source sources/include.sh || exit 1 |
6 | 8 |
7 # Parse sources/targets/$1 | 9 # Parse sources/targets/$1 |
8 | 10 |
9 load_target "$1" | 11 load_target "$1" |
10 | 12 |
11 cd "$BUILD/linux-kernel-$ARCH_NAME" && | |
12 KERNEL="$(ls)" && | |
13 ln "$KERNEL" "$STAGE_DIR" && | |
14 cd "$BUILD/root-image-$ARCH" && | |
15 IMAGE="$(ls)" && | |
16 ln "$IMAGE" "$STAGE_DIR" || dienow | |
17 | |
18 # Provide qemu's common command line options between architectures. | 13 # Provide qemu's common command line options between architectures. |
19 | |
20 kernel_cmdline() | |
21 { | |
22 [ "$SYSIMAGE_TYPE" != "initramfs" ] && | |
23 echo -n "root=/dev/$ROOT rw init=/sbin/init.sh " | |
24 | |
25 echo -n "panic=1 PATH=\$DISTCC_PATH_PREFIX/bin:/sbin console=$CONSOLE" | |
26 echo -n " HOST=$ARCH ${KERNEL_EXTRA}\$KERNEL_EXTRA" | |
27 } | |
28 | 14 |
29 qemu_defaults() | 15 qemu_defaults() |
30 { | 16 { |
31 echo -n "-nographic -no-reboot -kernel $KERNEL" | 17 echo -n "-nographic -no-reboot -kernel linux" |
32 [ "$SYSIMAGE_TYPE" != "initramfs" ] && echo -n " -hda $IMAGE" | 18 [ "$SYSIMAGE_TYPE" != "rootfs" ] && echo -n " -initrd rootfs.cpio.gz" |
33 echo -n " -append \"$(kernel_cmdline)\" \$QEMU_EXTRA" | 19 echo -n " -append \"panic=1 console=$CONSOLE HOST=$ARCH $KERNEL_EXTRA\"" |
20 echo -n " \$QEMU_EXTRA" | |
34 } | 21 } |
35 | 22 |
36 # Write out a script to call the appropriate emulator. We split out the | 23 # Write out a script to call the appropriate emulator. We split out the |
37 # filesystem, kernel, and base kernel command line arguments in case you want | 24 # filesystem, kernel, and base kernel command line arguments in case you want |
38 # to use an emulator other than qemu, but put the default case in qemu_defaults | 25 # to use an emulator other than qemu, but put the default case in qemu_defaults |
56 EOF | 43 EOF |
57 chmod +x "$STAGE_DIR/run-emulator.sh" && | 44 chmod +x "$STAGE_DIR/run-emulator.sh" && |
58 | 45 |
59 # Write out development wrapper scripts, substituting INCLUDE lines. | 46 # Write out development wrapper scripts, substituting INCLUDE lines. |
60 | 47 |
61 [ -z "$NO_NATIVE_COMPILER" ] && for FILE in dev-environment.sh native-build.sh | 48 for FILE in dev-environment.sh native-build.sh |
62 do | 49 do |
63 (export IFS="$(echo -e "\n")" | 50 (export IFS="$(echo -e "\n")" |
64 cat "$SOURCES/toys/$FILE" | while read -r i | 51 cat "$SOURCES/toys/$FILE" | while read -r i |
65 do | 52 do |
66 if [ "${i:0:8}" == "INCLUDE " ] | 53 if [ "${i:0:8}" == "INCLUDE " ] |
74 ) > "$STAGE_DIR/$FILE" | 61 ) > "$STAGE_DIR/$FILE" |
75 | 62 |
76 chmod +x "$STAGE_DIR/$FILE" || dienow | 63 chmod +x "$STAGE_DIR/$FILE" || dienow |
77 done | 64 done |
78 | 65 |
66 # Package simple-root-filesystem into cpio file for initramfs | |
67 | |
68 SYSIMAGE_TYPE=cpio image_filesystem "$BUILD/simple-root-filesystem-$ARCH" \ | |
69 "$STAGE_DIR/rootfs" && | |
70 SYSIMAGE_TYPE=squashfs image_filesystem "$BUILD/native-compiler-$ARCH" \ | |
71 "$STAGE_DIR/toolchain" || dienow | |
72 | |
73 # Build linux kernel for the target | |
74 | |
75 setupfor linux | |
76 getconfig linux > mini.conf | |
77 [ "$SYSIMAGE_TYPE" == rootfs ] && | |
78 echo -e "CONFIG_INITRAMFS_SOURCE=\"$BUILD/simple-root-filesystem-$ARCH/rootfs.cpio.gz\"\n" \ | |
79 >> mini.conf | |
80 make ARCH=${BOOT_KARCH:-$KARCH} $LINUX_FLAGS KCONFIG_ALLCONFIG=mini.conf \ | |
81 allnoconfig >/dev/null && | |
82 make -j $CPUS ARCH=${BOOT_KARCH:-$KARCH} $DO_CROSS $LINUX_FLAGS $VERBOSITY && | |
83 cp "$KERNEL_PATH" "$STAGE_DIR/linux" | |
84 cleanup | |
85 | |
79 # Tar it up. | 86 # Tar it up. |
80 | 87 |
81 ARCH="$ARCH_NAME" create_stage_tarball | 88 ARCH="$ARCH_NAME" create_stage_tarball |
82 | 89 |
83 announce "Packaging complete" | 90 announce "Packaging complete" |