Hi all, ( i just had too much time on my hands , and nothing to do)
For those interested, even just for fun or anything, i've shared an AMI on EC2 with latest trunk as of today.
It's id is ami-e4c8c790 and it's in the EU-WEST region
Remember to add the port 23 to your security group in order to telnet the instance for the first time.
How to make your own:
Step 1) Download OpenWRT Sources
Step 2) make menuconfig, select x86, and subtarget as Xen ParavirtGuest
Step 3) go to base-files source /etc/config/network, and change proto from static to DHCP, else you won't be able to access it from the interwebs
Step 4) Go to target images, select tar.gz only (you won't need the other options for nothing), you can now save and exit, and make your build.
Create a 32mb (depending on what you built of course) file using dd:
dd if=/dev/zero of=/tmp/sf-01 bs=1M count=32
mkfs.ext4 that file
mount that file somewhere
After this is done (and assuming you already have your ec2 api and ami tools instaled and configured), untargz the root-fs to some the mountpoint of that file
Inside the extracted rootfs:
Step 1) mkdir -f boot/grub
Step 2) vi/nano/whatever boot/grub/menu.lst
Insert these contents
default 0
timeout 1
title OpenWRT
root (hd0)
kernel /boot/vmlinuz root=/dev/xvda1 rootfstype=ext4 rootwait xencons=hvc console=tty0 console=hvc0,38400n8 noinitrd
Step 3) copy the kernel to boot/grub/vmlinuz (note the filename MUST be vmlinuz)
Step 4) umount the filesystem.
Now for the EC2 commands and stuff (again assuming you already have the EC2 cmd line utils etc installed and running, you can find lots of tutorials around
Run these commands:
ec2-bundle-image --cert $EC2_CERTIFICATE -k $EC2_PRIVATE_KEY --user $AWS_UID -i imagefile
now using the output of the previous command
ec2-upload-bundle --access-key $EC2_ACCESS_KEY --secret-key $EC2_SECRET_KEY --bucket yourbucketname --manifest /tmp/something.manifest.xml
That will upload the AMi to your S3 Bucket.
Now that uploaded a non-ebs backed AMi (by this i mean, that if you stop/terminate the instance, you will loose all data)
Go to your AWS Console , go to EC2, AMI, Register AMi, and put the location to the manifest xml file there, and it'll register.
Launch the AMI (remember the telnet port on the security group before telling it won't work)
IMPORTANT: Please select kernel ID aki-75665e01 or IT WON'T BOOT
If it telnets, it's all OK, if not... welll welcome to my last 5 hours, terminate the instance, get system log and analyze
If everything is OK you can continue reading.
In order to create an EBS backed AMi do this:
Step 1) Create a 1gb EBS volume (i guess its more than enough, and it's the minimum size ) , on the same availability zone as another linux (NOT OPENWRT )instance you already have running.
Step 2) Attach that volume to the "another linux instance", after it's attached, just mkfs.ext4 that volume (DO NOT CREATE PARTITIONS)
Step 3) Detach from that volume, and attach it to your OpenWRT instance
Step 4) Go to the OpenWRT Instance and do this:
mkdir /mnt/rootfs
mkdir /mnt/clone
mount -o bind / /mnt/rootfs
mount /dev/attachedvolumename /mnt/clone
cp -a /mnt/rootfs /mnt/clone
umount /mnt/rootfs
rm /mnt/clone/mnt/clone (or just leave it there)
umount /mnt/clone
Detach volume
Now go to your AWS Console again, and create a snapshot of this volume, after the snapshot is completed. Go to the Snapshots tab, right click on this volume snapshot, Create Image, and do the same for the kernel ID (aki-75665e01) , continue until the end (also remember the security groups again) and you're all set, you created your own EC2 EBS Backed OpenWRT AMi
Best Regards
Tiago
(Last edited by kadettgte on 5 Feb 2013, 20:38)