Skip to content

Commit fb03284

Browse files
committed
Update help and README
1 parent a037d25 commit fb03284

File tree

2 files changed

+78
-58
lines changed

2 files changed

+78
-58
lines changed

Makefile

Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -40,60 +40,70 @@ clean: linux_clean tools-vm_clean
4040
help:
4141
@echo '$(GREEN)General Environment Variables:$(NC)'
4242
@echo ' ARCH - Specify one of the supported architectures: x86_64, i386, arm64 (default: x86_64)'
43-
@echo ' ACK - Set to 1 if building ACK instead of the Linux kernel. Does not need to be set for `ack` and `run-ack` targets (default: 0)'
43+
@echo ' ACK - Set to 1 to build ACK instead of the Linux kernel. Does not need to be set for `ack` and `run-ack` targets (default: 0)'
4444
@echo ' VERBOSE - Set to 1 to enable verbose output (default: 0)'
4545
@echo ''
4646
@echo '$(GREEN)Build/Config:$(NC)'
4747
@echo ' Targets:'
48-
@echo ' linux (default) - Builds the Linux kernel'
49-
@echo ' linux_defconfig - Builds the Linux kernel'
50-
@echo ' linux_modules - Builds the Linux kernel modules'
48+
@echo ' linux (default) - Build the Linux kernel'
49+
@echo ' linux_defconfig - Run `make defconfig`'
50+
@echo ' linux_menuconfig - Run `make menuconfig`'
51+
@echo ' linux_modules - Build the Linux kernel modules'
5152
@echo ' linux_debpkg - Creates a Debian package for the kernel'
52-
@echo ' ack - Builds the Android Common Kernel'
53-
@echo ' tools-vm - Builds linux/tools/vm'
53+
@echo ' ack - Build the Android Common Kernel'
54+
@echo ' tools-vm - Build linux/tools/vm'
5455
@echo ''
5556
@echo ' Environment Variables:'
5657
@echo ' LINUX_DEFCONFIG - The defconfig to use when building the kernel (default: defconfig, ACK default: gki_defconfig)'
5758
@echo ' LINUX_SRC - The path to the kernel source directory (default: linux, ACK default: ack/common)'
5859
@echo ' LINUX_OUT - The path where the kernel build output should be stored (default: out/linux/$$ARCH, ACK default: out/ack/common/$$ARCH)'
59-
@echo ' LINUX_CONFIG_FRAGMENT - A kernel config fragment to merge with the defconfig (default: config/config.fragment, ACK default: config/config.fragment)'
60+
@echo ' LINUX_CONFIG_FRAGMENT - A kernel config fragment to merge with the defconfig (default: config/config.fragment)'
6061
@echo ''
6162
@echo '$(GREEN)Clean:$(NC)'
6263
@echo ' Targets:'
63-
@echo ' clean - Cleans output from default build targets'
64-
@echo ' <target>_clean - Cleans output for <target>'
64+
@echo ' clean - Clean output from default build targets'
65+
@echo ' <target>_clean - Clean output for <target>, where <target> is one of: ack, linux, tools-vm, rootfs'
6566
@echo ''
6667
@echo '$(GREEN)Run/Debug:$(NC)'
6768
@echo ' Targets:'
68-
@echo ' run - Run QEMU with the built kernel, bootloader, and rootfs image'
69+
@echo ' run - Run QEMU with the built kernel and rootfs image'
6970
@echo ' run-ack - Same as `run` but runs ACK instead'
7071
@echo ''
7172
@echo ' Environment Variables:'
7273
@echo ' GDB - Set to 1 to start a gdbserver and wait for GDB when running QEMU (default: 0)'
73-
@echo ' CPU - Specify the number of CPUs to use when running QEMU (default: 4)'
74-
@echo ' MEM - Specify the memory size in MB to use when running QEMU (default: 1024)'
75-
@echo ' QEMU_EXTRA_ARGS - Specify additional arguments to pass to QEMU (default: "")'
76-
@echo ' QEMU_EXTRA_KERNEL_CMDLINE - Specify additional arguments to pass to the kernel (default: "")'
77-
@echo ' QEMU_KERNEL_IMAGE - The path to the kernel image to run (x86_64 default: $$LINUX_OUT/arch/$$ARCH/boot/bzImage, arm64 default: $$LINUX_OUT/arch/$$ARCH/boot/Image)'
78-
@echo ' ROOTFS - The path to the rootfs image file (default: rootfs/rootfs-$$ARCH.img)'
79-
@echo ' ROOTFS_FORMAT - The format of the rootfs image file (default: qcow2)'
80-
@echo ' INITRD - The path to a gziped initramfs CPIO file to use instead of a rootfs image (default: "")'
81-
@echo ' RDINIT - The value of the `rdinit` kernel command line paramter (default: "", default if INITRD is set: /sbin/init)'
74+
@echo ' CPU - The number of CPUs to use when running QEMU (default: 4)'
75+
@echo ' MEM - The memory size in MB to use when running QEMU (default: 1024)'
76+
@echo ' QEMU_EXTRA_ARGS - Additional arguments to pass to QEMU (default: "")'
77+
@echo ' QEMU_EXTRA_KERNEL_CMDLINE - Additional arguments to pass to the kernel (default: "")'
78+
@echo ' QEMU_KERNEL_IMAGE - The path to the kernel image to run (x86_64/i386 default: $$LINUX_OUT/arch/$$ARCH/boot/bzImage, arm64 default: $$LINUX_OUT/arch/$$ARCH/boot/Image)'
79+
@echo ' ROOTFS - The path to the rootfs image file (default: rootfs/alpine-$$ARCH.img)'
80+
@echo ' ROOTFS_FORMAT - The format of the rootfs image file: raw, qcow2 (default: qcow2)'
81+
@echo ' INITRD - Set to 1 to use the $$CPIO_FILE initramfs instead of the $$ROOTFS image as the rootfs, or specify the path to an alternative CPIO file (default: "")'
82+
@echo ' RDINIT - The value of the `rdinit` kernel command line parameter (default: "", default if INITRD is set: /sbin/init)'
83+
@echo ' ECHR - The value of the QEMU `-echr` flag (default: 1)'
84+
@echo ' ROOT - The value of the `root` kernel command line parameter (default: /dev/vda)'
85+
@echo ' RW - Whether to mount the rootfs as read-write or read-only: ro, rw (default: rw)'
86+
@echo ' KASLR - Set to 1 to enable KASLR (default: 0)'
8287
@echo ''
8388
@echo '$(GREEN)rootfs:$(NC)'
8489
@echo ' Targets:'
85-
@echo ' rootfs-init - Extracts the Alpine Linux rootfs to rootfs/alpine-$$ARCH, makes arch-specific changes, and builds a rootfs image at rootfs/alpine-$$ARCH.img'
86-
@echo ' rootfs - An alias for the `ext4` target'
87-
@echo ' ext4 - Builds a QCOW2 rootfs image at rootfs/alpine-$$ARCH.img with an ext4 filesystem'
88-
@echo ' cpio - Builds a gziped initramfs CPIO file from the $$INITRAMFS_DIR directory'
89-
@echo ' rootfs-mount - Mount rootfs image at /tmp/rootfs'
90-
@echo ' rootfs-unmount - Unmount rootfs image'
90+
@echo ' rootfs-init - Extract the Alpine Linux rootfs to $$ROOTFS_DIR and then run the `rootfs-overlay` target'
91+
@echo ' rootfs-overlay - Apply arch-specific changes to $$ROOTFS_DIR and run the `rootfs` target'
92+
@echo ' rootfs - Run the `ext4` and `cpio` targets'
93+
@echo ' ext4 - Build a $$ROOTFS $$ROOTFS_FORMAT (default qcow2) image with an ext4 filesystem from $$ROOTFS_DIR'
94+
@echo ' cpio - Build a $$CPIO_FILE gzipped initramfs CPIO file from $$ROOTFS_DIR'
95+
@echo ' initramfs - An alias for the `cpio` target'
96+
@echo ' uncpio - Extract $$CPIO_FILE to $$ROOTFS_DIR'
97+
@echo ' rootfs-mount - Mount $$ROOTFS image at /tmp/rootfs'
98+
@echo ' rootfs-unmount - Unmount rootfs image from /tmp/rootfs'
99+
@echo ' chroot - chroot into $$ROOTFS_DIR'
91100
@echo ''
92101
@echo ' Environment Variables:'
93102
@echo ' EXT4_SIZE - The disk size of the rootfs image to build'
94103
@echo ' ROOTFS_DIR - The directory to create the ext4 rootfs image and initramfs CPIO from (default: rootfs/alpine-$$ARCH)'
95-
@echo ' ROOTFS - The path to the rootfs image file (default: rootfs/rootfs-$$ARCH.img)'
96-
@echo ' ROOTFS_FORMAT - The format of the rootfs image file (default: qcow2)'
104+
@echo ' ROOTFS - The path to the rootfs image file (default: rootfs/alpine-$$ARCH.img)'
105+
@echo ' ROOTFS_FORMAT - The format of the rootfs image file: raw, qcow2 (default: qcow2)'
106+
@echo ' CPIO_FILE - The path to the CPIO file to create (default: rootfs/alpine-$$ARCH.cpio.gz)'
97107
@echo ''
98108
@echo '$(GREEN)Miscellaneous:$(NC)'
99109
@echo ' Targets:'

README.md

Lines changed: 41 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -52,69 +52,79 @@ ARCH=arm64 make run
5252
```
5353
$ make help
5454
General Environment Variables:
55-
ARCH - Specify one of the supported architectures: x86_64, arm64 (default: x86_64)
56-
ACK - Set to 1 if building ACK instead of the Linux kernel. Does not need to be set for `ack` and `run-ack` targets (default: 0)
55+
ARCH - Specify one of the supported architectures: x86_64, i386, arm64 (default: x86_64)
56+
ACK - Set to 1 to build ACK instead of the Linux kernel. Does not need to be set for `ack` and `run-ack` targets (default: 0)
5757
VERBOSE - Set to 1 to enable verbose output (default: 0)
5858
5959
Build/Config:
6060
Targets:
61-
linux (default) - Builds the Linux kernel
62-
linux_defconfig - Builds the Linux kernel
63-
linux_modules - Builds the Linux kernel modules
64-
ack - Builds the Android Common Kernel
65-
tools-vm - Builds linux/tools/vm
61+
linux (default) - Build the Linux kernel
62+
linux_defconfig - Run `make defconfig`
63+
linux_menuconfig - Run `make menuconfig`
64+
linux_modules - Build the Linux kernel modules
65+
linux_debpkg - Creates a Debian package for the kernel
66+
ack - Build the Android Common Kernel
67+
tools-vm - Build linux/tools/vm
6668
6769
Environment Variables:
6870
LINUX_DEFCONFIG - The defconfig to use when building the kernel (default: defconfig, ACK default: gki_defconfig)
6971
LINUX_SRC - The path to the kernel source directory (default: linux, ACK default: ack/common)
7072
LINUX_OUT - The path where the kernel build output should be stored (default: out/linux/$ARCH, ACK default: out/ack/common/$ARCH)
71-
LINUX_CONFIG_FRAGMENT - A kernel config fragment to merge with the defconfig (default: config/config.fragment, ACK default: config/config.fragment)
73+
LINUX_CONFIG_FRAGMENT - A kernel config fragment to merge with the defconfig (default: config/config.fragment)
7274
7375
Clean:
7476
Targets:
75-
clean - Cleans output from default build targets
76-
<target>_clean - Cleans output for <target>
77+
clean - Clean output from default build targets
78+
<target>_clean - Clean output for <target>, where <target> is one of: ack, linux, tools-vm, rootfs
7779
7880
Run/Debug:
7981
Targets:
80-
run - Run QEMU with the built kernel, bootloader, and rootfs image
82+
run - Run QEMU with the built kernel and rootfs image
8183
run-ack - Same as `run` but runs ACK instead
8284
8385
Environment Variables:
8486
GDB - Set to 1 to start a gdbserver and wait for GDB when running QEMU (default: 0)
85-
CPU - Specify the number of CPUs to use when running QEMU (default: 4)
86-
MEM - Specify the memory size in MB to use when running QEMU (default: 1024)
87-
QEMU_EXTRA_ARGS - Specify additional arguments to pass to QEMU (default: "")
88-
QEMU_EXTRA_KERNEL_CMDLINE - Specify additional arguments to pass to the kernel (default: "")
89-
KERNEL_IMAGE - The path to the kernel image to run (x86_64 default: $LINUX_OUT/arch/$ARCH/boot/bzImage, arm64 default: $LINUX_OUT/arch/$ARCH/boot/Image)
90-
ROOTFS - The path to the rootfs image file (default: rootfs/rootfs-$ARCH.img)
91-
ROOTFS_FORMAT - The format of the rootfs image file (default: qcow2)
92-
INITRD - The path to a gziped initramfs CPIO file to use instead of a rootfs image (default: "")
93-
RDINIT - The value of the `rdinit` kernel command line paramter (default: "", default if INITRD is set: /sbin/init)
87+
CPU - The number of CPUs to use when running QEMU (default: 4)
88+
MEM - The memory size in MB to use when running QEMU (default: 1024)
89+
QEMU_EXTRA_ARGS - Additional arguments to pass to QEMU (default: "")
90+
QEMU_EXTRA_KERNEL_CMDLINE - Additional arguments to pass to the kernel (default: "")
91+
QEMU_KERNEL_IMAGE - The path to the kernel image to run (x86_64/i386 default: $LINUX_OUT/arch/$ARCH/boot/bzImage, arm64 default: $LINUX_OUT/arch/$ARCH/boot/Image)
92+
ROOTFS - The path to the rootfs image file (default: rootfs/alpine-$ARCH.img)
93+
ROOTFS_FORMAT - The format of the rootfs image file: raw, qcow2 (default: qcow2)
94+
INITRD - Set to 1 to use the $CPIO_FILE initramfs instead of the $ROOTFS image as the rootfs, or specify the path to an alternative CPIO file (default: "")
95+
RDINIT - The value of the `rdinit` kernel command line parameter (default: "", default if INITRD is set: /sbin/init)
96+
ECHR - The value of the QEMU `-echr` flag (default: 1)
97+
ROOT - The value of the `root` kernel command line parameter (default: /dev/vda)
98+
RW - Whether to mount the rootfs as read-write or read-only: ro, rw (default: rw)
99+
KASLR - Set to 1 to enable KASLR (default: 0)
94100
95101
rootfs:
96102
Targets:
97-
rootfs-init - Extracts the Alpine Linux rootfs to rootfs/alpine-$ARCH, makes arch-specific changes, and builds a rootfs image at rootfs/alpine-$ARCH.img
98-
rootfs - An alias for the `ext4` target
99-
ext4 - Builds a QCOW2 rootfs image at rootfs/alpine-$ARCH.img with an ext4 filesystem
100-
cpio - Builds a gziped initramfs CPIO file from the $INITRAMFS_DIR directory
101-
rootfs-mount - Mount rootfs image at /tmp/rootfs
102-
rootfs-unmount - Unmount rootfs image
103+
rootfs-init - Extract the Alpine Linux rootfs to $ROOTFS_DIR and then run the `rootfs-overlay` target
104+
rootfs-overlay - Apply arch-specific changes to $ROOTFS_DIR and run the `rootfs` target
105+
rootfs - Run the `ext4` and `cpio` targets
106+
ext4 - Build a $ROOTFS $ROOTFS_FORMAT (default qcow2) image with an ext4 filesystem from $ROOTFS_DIR
107+
cpio - Build a $CPIO_FILE gzipped initramfs CPIO file from $ROOTFS_DIR
108+
initramfs - An alias for the `cpio` target
109+
uncpio - Extract $CPIO_FILE to $ROOTFS_DIR
110+
rootfs-mount - Mount $ROOTFS image at /tmp/rootfs
111+
rootfs-unmount - Unmount rootfs image from /tmp/rootfs
112+
chroot - chroot into $ROOTFS_DIR
103113
104114
Environment Variables:
105115
EXT4_SIZE - The disk size of the rootfs image to build
106-
INITRAMFS_DIR - The directory to create the initramfs from (default: rootfs/alpine-$ARCH)
107-
ROOTFS_DIR - The directory to create the ext4/rootfs image from (default: rootfs/alpine-$ARCH)
108-
ROOTFS - The path to the rootfs image file (default: rootfs/rootfs-$ARCH.img)
109-
ROOTFS_FORMAT - The format of the rootfs image file (default: qcow2)
116+
ROOTFS_DIR - The directory to create the ext4 rootfs image and initramfs CPIO from (default: rootfs/alpine-$ARCH)
117+
ROOTFS - The path to the rootfs image file (default: rootfs/alpine-$ARCH.img)
118+
ROOTFS_FORMAT - The format of the rootfs image file: raw, qcow2 (default: qcow2)
119+
CPIO_FILE - The path to the CPIO file to create (default: rootfs/alpine-$ARCH.cpio.gz)
110120
111121
Miscellaneous:
112122
Targets:
113123
linux_download - Downloads an archive of the Linux kernel source for the version specified in $VERSION
114124
linux_checkout - Checks out the version specified by $VERSION of the linux kernel in $LINUX_SRC
115125
116126
Environment Variables:
117-
VERSION - The version to download or checkout. If the patch version is a 'y', the latest version of the kernel with that major and minor version is used. Examples: 5.10, 5.10.107, v5.10, 5.10.y, linux-5.10.y, android13-5.10
127+
VERSION - The version to download or checkout. For checkout only, if the third number in the version string is a 'y', the latest version of the kernel with that major and minor version is used. Examples: 5.10, 5.10.107, v5.10, 5.10.y, linux-5.10.y
118128
```
119129

120130
## Building

0 commit comments

Comments
 (0)