Mercurial > hg > aboriginal
annotate system-image.sh @ 581:9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
The $BASE_ARCH approach didn't work because targets need to override things
like KERNEL_PATH, so they need to source the relevant details file themselves.
Shuffle things around so they can do that: move $CROSS into cross-compiler.sh,
add cross compiler to $PATH independently of that, remove $ARCH from CONFIG_DIR
and change users to add it, have getconfig check $ARCH_NAME directory first,
redo qemu_defaults to chop out initramfs options less uncleanly...
author | Rob Landley <rob@landley.net> |
---|---|
date | Mon, 12 Jan 2009 02:47:32 -0600 |
parents | 90bea985c98e |
children | c9c7420e952b |
rev | line source |
---|---|
177 | 1 #!/bin/bash |
109
d9dae1196ea7
Package ext2 filesystem image using UML.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
2 |
576
036dbe218036
Add BASE_ARCH support, so a hardware architecture can specify a base architecture and just provide a different kernel.
Rob Landley <rob@landley.net>
parents:
573
diff
changeset
|
3 # Create a bootable system image from mini-native |
109
d9dae1196ea7
Package ext2 filesystem image using UML.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
4 |
576
036dbe218036
Add BASE_ARCH support, so a hardware architecture can specify a base architecture and just provide a different kernel.
Rob Landley <rob@landley.net>
parents:
573
diff
changeset
|
5 NO_BASE_ARCH=1 |
503
e98ed40c55ef
Move include.sh to sources/include.sh. End user doesn't call it directly, shouldn't be at top level.
Rob Landley <rob@landley.net>
parents:
499
diff
changeset
|
6 source sources/include.sh |
109
d9dae1196ea7
Package ext2 filesystem image using UML.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
7 |
485
b0438691e9e1
Move color selection into ./config. (The default colors don't look great on a white background.)
Rob Landley <rob@landley.net>
parents:
483
diff
changeset
|
8 echo -e "$PACKAGE_COLOR" |
b0438691e9e1
Move color selection into ./config. (The default colors don't look great on a white background.)
Rob Landley <rob@landley.net>
parents:
483
diff
changeset
|
9 echo "=== Packaging system image from mini-native" |
b0438691e9e1
Move color selection into ./config. (The default colors don't look great on a white background.)
Rob Landley <rob@landley.net>
parents:
483
diff
changeset
|
10 |
581
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
11 [ -z "$SYSIMAGE_TYPE" ] && SYSIMAGE_TYPE=ext2 |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
12 |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
13 SYSIMAGE="${BUILD}/system-image-${ARCH_NAME}" |
462
3f3283fb5e1e
Running ./package-mini-native.sh as root can just loopback mount itself, without User Mode Linux.
Rob Landley <rob@landley.net>
parents:
451
diff
changeset
|
14 |
572
1277d5ae4507
Move bin/qemu-setup.sh to sbin/init.sh and do more work on initramfs packaging. (Doesn't work yet.)
Rob Landley <rob@landley.net>
parents:
553
diff
changeset
|
15 TOOLSDIR=tools |
1277d5ae4507
Move bin/qemu-setup.sh to sbin/init.sh and do more work on initramfs packaging. (Doesn't work yet.)
Rob Landley <rob@landley.net>
parents:
553
diff
changeset
|
16 [ -z "$NATIVE_TOOLSDIR" ] && TOOLSDIR=usr |
1277d5ae4507
Move bin/qemu-setup.sh to sbin/init.sh and do more work on initramfs packaging. (Doesn't work yet.)
Rob Landley <rob@landley.net>
parents:
553
diff
changeset
|
17 |
490
004f9509349b
Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents:
486
diff
changeset
|
18 # Flush old system-image directory |
468
3d2996abb6ea
Moving the temp dir broke non-root packaging: fix it.
Rob Landley <rob@landley.net>
parents:
467
diff
changeset
|
19 |
490
004f9509349b
Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents:
486
diff
changeset
|
20 rm -rf "${SYSIMAGE}" |
553
80f3356577fc
Move kernel building from mini-native to package-mini-native in preparation for initramfs packaging option.
Rob Landley <rob@landley.net>
parents:
537
diff
changeset
|
21 mkdir -p "${SYSIMAGE}" || dienow |
80f3356577fc
Move kernel building from mini-native to package-mini-native in preparation for initramfs packaging option.
Rob Landley <rob@landley.net>
parents:
537
diff
changeset
|
22 |
581
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
23 # This next bit is a little complicated; we generate the root filesystem image |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
24 # in the middle of building a kernel. This is necessary to embed an |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
25 # initramfs in the kernel, and allows us to parallelize the kernel build with |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
26 # the image generation. Having the other image types in the same if/else |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
27 # staircase with initramfs lets us detect unknown image types (probably typos) |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
28 # without repeating any. |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
29 |
553
80f3356577fc
Move kernel building from mini-native to package-mini-native in preparation for initramfs packaging option.
Rob Landley <rob@landley.net>
parents:
537
diff
changeset
|
30 # Build a linux kernel for the target |
80f3356577fc
Move kernel building from mini-native to package-mini-native in preparation for initramfs packaging option.
Rob Landley <rob@landley.net>
parents:
537
diff
changeset
|
31 |
80f3356577fc
Move kernel building from mini-native to package-mini-native in preparation for initramfs packaging option.
Rob Landley <rob@landley.net>
parents:
537
diff
changeset
|
32 setupfor linux |
572
1277d5ae4507
Move bin/qemu-setup.sh to sbin/init.sh and do more work on initramfs packaging. (Doesn't work yet.)
Rob Landley <rob@landley.net>
parents:
553
diff
changeset
|
33 make ARCH="${KARCH}" KCONFIG_ALLCONFIG="$(getconfig linux)" \ |
1277d5ae4507
Move bin/qemu-setup.sh to sbin/init.sh and do more work on initramfs packaging. (Doesn't work yet.)
Rob Landley <rob@landley.net>
parents:
553
diff
changeset
|
34 allnoconfig > /dev/null || dienow |
553
80f3356577fc
Move kernel building from mini-native to package-mini-native in preparation for initramfs packaging option.
Rob Landley <rob@landley.net>
parents:
537
diff
changeset
|
35 |
581
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
36 # Build kernel in parallel with initramfs |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
37 |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
38 ( make -j $CPUS ARCH="${KARCH}" CROSS_COMPILE="${ARCH}-" || dienow ) & |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
39 |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
40 # If we exit before removing this handler, kill everything in the current |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
41 # process group, which should take out backgrounded kernel make. |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
42 trap "kill 0" EXIT |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
43 |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
44 # Embed an initramfs image in the kernel? |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
45 |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
46 if [ "$SYSIMAGE_TYPE" == "initramfs" ] |
553
80f3356577fc
Move kernel building from mini-native to package-mini-native in preparation for initramfs packaging option.
Rob Landley <rob@landley.net>
parents:
537
diff
changeset
|
47 then |
572
1277d5ae4507
Move bin/qemu-setup.sh to sbin/init.sh and do more work on initramfs packaging. (Doesn't work yet.)
Rob Landley <rob@landley.net>
parents:
553
diff
changeset
|
48 echo "Generating initramfs (in background)" |
1277d5ae4507
Move bin/qemu-setup.sh to sbin/init.sh and do more work on initramfs packaging. (Doesn't work yet.)
Rob Landley <rob@landley.net>
parents:
553
diff
changeset
|
49 ( |
1277d5ae4507
Move bin/qemu-setup.sh to sbin/init.sh and do more work on initramfs packaging. (Doesn't work yet.)
Rob Landley <rob@landley.net>
parents:
553
diff
changeset
|
50 $CC usr/gen_init_cpio.c -o my_gen_init_cpio || dienow |
1277d5ae4507
Move bin/qemu-setup.sh to sbin/init.sh and do more work on initramfs packaging. (Doesn't work yet.)
Rob Landley <rob@landley.net>
parents:
553
diff
changeset
|
51 (./my_gen_init_cpio <( |
1277d5ae4507
Move bin/qemu-setup.sh to sbin/init.sh and do more work on initramfs packaging. (Doesn't work yet.)
Rob Landley <rob@landley.net>
parents:
553
diff
changeset
|
52 [ ! -d "$NATIVE"/dev ] && echo "dir /dev 755 0 0" |
1277d5ae4507
Move bin/qemu-setup.sh to sbin/init.sh and do more work on initramfs packaging. (Doesn't work yet.)
Rob Landley <rob@landley.net>
parents:
553
diff
changeset
|
53 [ ! -e "$NATIVE"/init ] && |
1277d5ae4507
Move bin/qemu-setup.sh to sbin/init.sh and do more work on initramfs packaging. (Doesn't work yet.)
Rob Landley <rob@landley.net>
parents:
553
diff
changeset
|
54 echo "slink /init $NATIVE/$TOOLSDIR/sbin/init.sh 755 0 0" |
1277d5ae4507
Move bin/qemu-setup.sh to sbin/init.sh and do more work on initramfs packaging. (Doesn't work yet.)
Rob Landley <rob@landley.net>
parents:
553
diff
changeset
|
55 |
1277d5ae4507
Move bin/qemu-setup.sh to sbin/init.sh and do more work on initramfs packaging. (Doesn't work yet.)
Rob Landley <rob@landley.net>
parents:
553
diff
changeset
|
56 "$SOURCES"/toys/gen_initramfs_list.sh "$NATIVE" && |
1277d5ae4507
Move bin/qemu-setup.sh to sbin/init.sh and do more work on initramfs packaging. (Doesn't work yet.)
Rob Landley <rob@landley.net>
parents:
553
diff
changeset
|
57 echo "nod /dev/console 640 0 0 c 5 1" >> initramfs.txt || dienow |
1277d5ae4507
Move bin/qemu-setup.sh to sbin/init.sh and do more work on initramfs packaging. (Doesn't work yet.)
Rob Landley <rob@landley.net>
parents:
553
diff
changeset
|
58 ) || dienow |
1277d5ae4507
Move bin/qemu-setup.sh to sbin/init.sh and do more work on initramfs packaging. (Doesn't work yet.)
Rob Landley <rob@landley.net>
parents:
553
diff
changeset
|
59 ) | gzip -9 > initramfs_data.cpio.gz || dienow |
1277d5ae4507
Move bin/qemu-setup.sh to sbin/init.sh and do more work on initramfs packaging. (Doesn't work yet.)
Rob Landley <rob@landley.net>
parents:
553
diff
changeset
|
60 echo Initramfs generated. |
1277d5ae4507
Move bin/qemu-setup.sh to sbin/init.sh and do more work on initramfs packaging. (Doesn't work yet.)
Rob Landley <rob@landley.net>
parents:
553
diff
changeset
|
61 ) & |
354
d96741481221
User Mode Linux found a new way to break: now when it panics, it sends a kill
Rob Landley <rob@landley.net>
parents:
353
diff
changeset
|
62 |
581
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
63 # Wait for initial kernel build to finish. |
572
1277d5ae4507
Move bin/qemu-setup.sh to sbin/init.sh and do more work on initramfs packaging. (Doesn't work yet.)
Rob Landley <rob@landley.net>
parents:
553
diff
changeset
|
64 |
581
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
65 wait4background 0 |
572
1277d5ae4507
Move bin/qemu-setup.sh to sbin/init.sh and do more work on initramfs packaging. (Doesn't work yet.)
Rob Landley <rob@landley.net>
parents:
553
diff
changeset
|
66 |
1277d5ae4507
Move bin/qemu-setup.sh to sbin/init.sh and do more work on initramfs packaging. (Doesn't work yet.)
Rob Landley <rob@landley.net>
parents:
553
diff
changeset
|
67 # This is a repeat of an earlier make invocation, but if we try to |
1277d5ae4507
Move bin/qemu-setup.sh to sbin/init.sh and do more work on initramfs packaging. (Doesn't work yet.)
Rob Landley <rob@landley.net>
parents:
553
diff
changeset
|
68 # consolidate them the dependencies build unnecessary prereqisites |
1277d5ae4507
Move bin/qemu-setup.sh to sbin/init.sh and do more work on initramfs packaging. (Doesn't work yet.)
Rob Landley <rob@landley.net>
parents:
553
diff
changeset
|
69 # and then decide that they're newer than the cpio.gz we supplied, |
1277d5ae4507
Move bin/qemu-setup.sh to sbin/init.sh and do more work on initramfs packaging. (Doesn't work yet.)
Rob Landley <rob@landley.net>
parents:
553
diff
changeset
|
70 # and thus overwrite it with a default (emptyish) one. |
1277d5ae4507
Move bin/qemu-setup.sh to sbin/init.sh and do more work on initramfs packaging. (Doesn't work yet.)
Rob Landley <rob@landley.net>
parents:
553
diff
changeset
|
71 |
573
de6725a2fdad
Fix an "it doesn't boot" bug dating back to commit 553. Sigh.
Rob Landley <rob@landley.net>
parents:
572
diff
changeset
|
72 echo "Building kernel with initramfs." |
572
1277d5ae4507
Move bin/qemu-setup.sh to sbin/init.sh and do more work on initramfs packaging. (Doesn't work yet.)
Rob Landley <rob@landley.net>
parents:
553
diff
changeset
|
73 [ -f initramfs_data.cpio.gz ] && |
1277d5ae4507
Move bin/qemu-setup.sh to sbin/init.sh and do more work on initramfs packaging. (Doesn't work yet.)
Rob Landley <rob@landley.net>
parents:
553
diff
changeset
|
74 touch initramfs_data.cpio.gz && |
1277d5ae4507
Move bin/qemu-setup.sh to sbin/init.sh and do more work on initramfs packaging. (Doesn't work yet.)
Rob Landley <rob@landley.net>
parents:
553
diff
changeset
|
75 mv initramfs_data.cpio.gz usr && |
1277d5ae4507
Move bin/qemu-setup.sh to sbin/init.sh and do more work on initramfs packaging. (Doesn't work yet.)
Rob Landley <rob@landley.net>
parents:
553
diff
changeset
|
76 make -j $CPUS ARCH="${KARCH}" CROSS_COMPILE="${ARCH}-" || dienow |
581
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
77 |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
78 # No need to supply an hda image to emulator. |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
79 |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
80 IMAGE= |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
81 elif [ "$SYSIMAGE_TYPE" == "ext2" ] |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
82 then |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
83 # Generate a 64 megabyte ext2 filesystem image from the $NATIVE directory, |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
84 # with a temporary file defining the /dev nodes for the new filesystem. |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
85 |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
86 echo "Generating ext2 image (in background)" |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
87 |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
88 IMAGE="image-${ARCH}.ext2" |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
89 DEVLIST="$WORK"/devlist |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
90 |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
91 echo "/dev d 755 0 0 - - - - -" > "$DEVLIST" && |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
92 echo "/dev/console c 640 0 0 5 1 0 0 -" >> "$DEVLIST" && |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
93 |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
94 genext2fs -z -D "$DEVLIST" -d "${NATIVE}" -i 1024 -b $[64*1024] \ |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
95 "${SYSIMAGE}/${IMAGE}" && |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
96 rm "$DEVLIST" || dienow |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
97 |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
98 #elif [ "$SYSIMAGE_TYPE" == "squashfs" ] |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
99 #then |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
100 # We used to do this, but updating the squashfs patch for each new kernel |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
101 # was just too much work. If it gets merged someday, we may care again... |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
102 |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
103 # IMAGE="image-${ARCH}.sqf" |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
104 # echo -n "Creating squashfs image (in background)" |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
105 # "${WORK}/mksquashfs" "${NATIVE}" "${SYSIMAGE}/$IMAGE" \ |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
106 # -noappend -all-root -info || dienow |
553
80f3356577fc
Move kernel building from mini-native to package-mini-native in preparation for initramfs packaging option.
Rob Landley <rob@landley.net>
parents:
537
diff
changeset
|
107 fi |
80f3356577fc
Move kernel building from mini-native to package-mini-native in preparation for initramfs packaging option.
Rob Landley <rob@landley.net>
parents:
537
diff
changeset
|
108 |
581
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
109 # Wait for kernel build to finish (may be a NOP) |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
110 |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
111 echo Image generation complete. |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
112 wait4background 0 |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
113 trap "" EXIT |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
114 |
553
80f3356577fc
Move kernel building from mini-native to package-mini-native in preparation for initramfs packaging option.
Rob Landley <rob@landley.net>
parents:
537
diff
changeset
|
115 # Install kernel |
109
d9dae1196ea7
Package ext2 filesystem image using UML.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
116 |
553
80f3356577fc
Move kernel building from mini-native to package-mini-native in preparation for initramfs packaging option.
Rob Landley <rob@landley.net>
parents:
537
diff
changeset
|
117 [ -d "${TOOLS}/src" ] && cp .config "${TOOLS}"/src/config-linux |
80f3356577fc
Move kernel building from mini-native to package-mini-native in preparation for initramfs packaging option.
Rob Landley <rob@landley.net>
parents:
537
diff
changeset
|
118 cp "${KERNEL_PATH}" "${SYSIMAGE}/zImage-${ARCH}" && |
80f3356577fc
Move kernel building from mini-native to package-mini-native in preparation for initramfs packaging option.
Rob Landley <rob@landley.net>
parents:
537
diff
changeset
|
119 cd .. |
80f3356577fc
Move kernel building from mini-native to package-mini-native in preparation for initramfs packaging option.
Rob Landley <rob@landley.net>
parents:
537
diff
changeset
|
120 |
80f3356577fc
Move kernel building from mini-native to package-mini-native in preparation for initramfs packaging option.
Rob Landley <rob@landley.net>
parents:
537
diff
changeset
|
121 cleanup linux |
80f3356577fc
Move kernel building from mini-native to package-mini-native in preparation for initramfs packaging option.
Rob Landley <rob@landley.net>
parents:
537
diff
changeset
|
122 |
330
f9ff71c71f9e
Tweak run-with-home.sh to have a chance of actually working.
Rob Landley <rob@landley.net>
parents:
325
diff
changeset
|
123 # Provide qemu's common command line options between architectures. The lack |
f9ff71c71f9e
Tweak run-with-home.sh to have a chance of actually working.
Rob Landley <rob@landley.net>
parents:
325
diff
changeset
|
124 # of ending quotes on -append is intentional, callers append more kernel |
f9ff71c71f9e
Tweak run-with-home.sh to have a chance of actually working.
Rob Landley <rob@landley.net>
parents:
325
diff
changeset
|
125 # command line arguments and provide their own ending quote. |
325
51bcd6de223d
Redo plumbing that constructs run-emulator.sh. Group common qemu command
Rob Landley <rob@landley.net>
parents:
317
diff
changeset
|
126 function qemu_defaults() |
51bcd6de223d
Redo plumbing that constructs run-emulator.sh. Group common qemu command
Rob Landley <rob@landley.net>
parents:
317
diff
changeset
|
127 { |
581
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
128 if [ "$SYSIMAGE_TYPE" != "initramfs" ] |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
129 then |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
130 HDA="-hda \"$1\" " |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
131 APPEND="root=/dev/$ROOT console=$CONSOLE rw init=/$TOOLSDIR/sbin/init.sh " |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
132 fi |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
133 |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
134 echo "-nographic -no-reboot -kernel \"$2\" \$WITH_HDB $HDA" \ |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
135 "-append \"${APPEND}panic=1 PATH=\$DISTCC_PATH_PREFIX/\$TOOLSDIR/bin" \ |
9dffdd74c186
More changes for initramfs and hw- targets with a base architecture.
Rob Landley <rob@landley.net>
parents:
580
diff
changeset
|
136 '$KERNEL_EXTRA"' |
325
51bcd6de223d
Redo plumbing that constructs run-emulator.sh. Group common qemu command
Rob Landley <rob@landley.net>
parents:
317
diff
changeset
|
137 } |
51bcd6de223d
Redo plumbing that constructs run-emulator.sh. Group common qemu command
Rob Landley <rob@landley.net>
parents:
317
diff
changeset
|
138 |
490
004f9509349b
Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents:
486
diff
changeset
|
139 # Write out a script to call the appropriate emulator. We split out the |
004f9509349b
Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents:
486
diff
changeset
|
140 # filesystem, kernel, and base kernel command line arguments in case you want |
004f9509349b
Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents:
486
diff
changeset
|
141 # to use an emulator other than qemu, but put the default case in qemu_defaults |
004f9509349b
Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents:
486
diff
changeset
|
142 |
499
9d5fd8e1467b
Merge run-*.sh so run-emulator.sh takes command line arguments. Rename emulator-build.sh to be more clear what it does.
Rob Landley <rob@landley.net>
parents:
496
diff
changeset
|
143 cp "$SOURCES/toys/run-emulator.sh" "$SYSIMAGE/run-emulator.sh" && |
537
15af90157a19
Move the kernel image file from the temp dir into the mini-native dir, and teach packaging not to put it in the ext2 image. (Don't keep important files in the temp directory.)
Rob Landley <rob@landley.net>
parents:
508
diff
changeset
|
144 emulator_command image-$ARCH.ext2 zImage-$ARCH >> "$SYSIMAGE/run-emulator.sh" |
306
358ef8a27085
Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents:
300
diff
changeset
|
145 |
490
004f9509349b
Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents:
486
diff
changeset
|
146 [ $? -ne 0 ] && dienow |
004f9509349b
Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents:
486
diff
changeset
|
147 |
004f9509349b
Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents:
486
diff
changeset
|
148 if [ "$ARCH" == powerpc ] |
004f9509349b
Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents:
486
diff
changeset
|
149 then |
004f9509349b
Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents:
486
diff
changeset
|
150 cp "$SOURCES"/toys/ppc_rom.bin "$SYSIMAGE" || dienow |
004f9509349b
Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents:
486
diff
changeset
|
151 fi |
109
d9dae1196ea7
Package ext2 filesystem image using UML.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
152 |
490
004f9509349b
Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents:
486
diff
changeset
|
153 # Tar it up. |
004f9509349b
Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents:
486
diff
changeset
|
154 |
004f9509349b
Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents:
486
diff
changeset
|
155 tar -cvj -f "$BUILD"/system-image-$ARCH.tar.bz2 \ |
004f9509349b
Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents:
486
diff
changeset
|
156 -C "$BUILD" system-image-$ARCH || dienow |
267
98c1a2136322
Update package-mini-native.sh to create qemu-image-$ARCH.tar.bz2
Rob Landley <rob@landley.net>
parents:
264
diff
changeset
|
157 |
490
004f9509349b
Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents:
486
diff
changeset
|
158 echo -e "=== Packaging complete\e[0m" |